From 97a34ded56e0d9598700c1eebfcf073e58d7578e Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 12 Nov 2025 23:12:33 -0800 Subject: [PATCH 01/44] Start rewrite, add vcpkg --- .gitmodules | 3 + CMakeLists.txt | 490 ++--------------------------------------------- submodules/vcpkg | 1 + 3 files changed, 15 insertions(+), 479 deletions(-) create mode 160000 submodules/vcpkg diff --git a/.gitmodules b/.gitmodules index c9c3988cb..e032eabac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "submodules/recastnavigation"] path = submodules/recastnavigation url = https://github.com/EQEmu/recastnavigation.git +[submodule "submodules/vcpkg"] + path = submodules/vcpkg + url = https://github.com/microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 59279caa8..13d5fae12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,490 +1,22 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) -SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH}) - -IF(POLICY CMP0074) - CMAKE_POLICY(SET CMP0074 NEW) +IF(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) + MESSAGE(STATUS "Using vcpkg env variable") + SET(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") +ELSEIF(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + MESSAGE(STATUS "Using vcpkg submodule") + SET(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") ENDIF() +SET(CMAKE_CXX_STANDARD 20) +SET(CMAKE_CXX_STANDARD_REQUIRED ON) +SET(CMAKE_CXX_EXTENSIONS OFF) + PROJECT(EQEmu) IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) -SET(CMAKE_CXX_STANDARD 20) -SET(CMAKE_CXX_STANDARD_REQUIRED ON) -SET(CMAKE_CXX_EXTENSIONS OFF) -OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF) -OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) -IF (EQEMU_BUILD_STATIC) - SET(BUILD_SHARED_LIBS OFF) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") - MESSAGE(STATUS "Building with static linking") - SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") - IF (UNIX) - SET(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so") - SET(PERL_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/") - SET(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl") - ENDIF () -ENDIF (EQEMU_BUILD_STATIC) - - -# Requires libgoogle-perftools-dev google-perftools packages for linux (debian) -IF(EQEMU_ADD_PROFILER) - SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") -ENDIF(EQEMU_ADD_PROFILER) - -IF(USE_MAP_MMFS) - ADD_DEFINITIONS(-DUSE_MAP_MMFS) -ENDIF (USE_MAP_MMFS) - -IF(MSVC) - add_compile_options(/bigobj) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) - ADD_DEFINITIONS(-DNOMINMAX) - ADD_DEFINITIONS(-DCRASH_LOGGING) - ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17 - - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - - OPTION(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON) - IF(EQEMU_DISABLE_MSVC_WARNINGS) - ADD_DEFINITIONS( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os") - ENDIF(EQEMU_DISABLE_MSVC_WARNINGS) -ELSE(MSVC) - ADD_DEFINITIONS(-DHAS_UNION_SEMUN) -ENDIF(MSVC) - -#FreeBSD support -IF(UNIX) - IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - ADD_DEFINITIONS(-DFREEBSD) - ADD_DEFINITIONS(-D_GLIBCXX_USE_C99) - SET(FREEBSD TRUE) - ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") - ADD_DEFINITIONS(-DDARWIN) - SET(DARWIN TRUE) - ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") -ENDIF(UNIX) - -ADD_DEFINITIONS(-DGLM_FORCE_RADIANS) -ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT) -ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL) - -#MSVC can fetch dependencies automatically. -IF(MSVC) - INCLUDE("${CMAKE_SOURCE_DIR}/cmake/DependencyHelperMSVC.cmake") -ENDIF() - -#Find everything we need -FIND_PACKAGE(Boost REQUIRED) -FIND_PACKAGE(MySQL) -FIND_PACKAGE(MariaDB) -FIND_PACKAGE(ZLIB) -FIND_PACKAGE(OpenSSL) -FIND_PACKAGE(Lua51) -FIND_PACKAGE(LuaJit) -FIND_PACKAGE(PerlLibs) -FIND_PACKAGE(Sodium) -FIND_PACKAGE(mbedTLS) - -MESSAGE(STATUS "**************************************************") -MESSAGE(STATUS "* Library Detection *") -MESSAGE(STATUS "**************************************************") - -IF(MYSQL_FOUND) - MESSAGE(STATUS "* MySQL: FOUND *") -ELSE() - MESSAGE(STATUS "* MySQL: MISSING *") -ENDIF() - -IF(MARIADB_FOUND) - MESSAGE(STATUS "* MariaDB: FOUND *") -ELSE() - MESSAGE(STATUS "* MariaDB: MISSING *") -ENDIF() - -IF(ZLIB_FOUND) - MESSAGE(STATUS "* ZLIB: FOUND *") -ELSE() - MESSAGE(STATUS "* ZLIB: MISSING *") -ENDIF() - -IF(Lua51_FOUND) - MESSAGE(STATUS "* Lua: FOUND *") -ELSE() - MESSAGE(STATUS "* Lua: MISSING *") -ENDIF() - -IF(LuaJit_FOUND) - MESSAGE(STATUS "* LuaJIT: FOUND *") -ELSE() - MESSAGE(STATUS "* LuaJIT: MISSING *") -ENDIF() - -IF(PerlLibs_FOUND) - MESSAGE(STATUS "* Perl: FOUND *") -ELSE() - MESSAGE(STATUS "* Perl: MISSING *") -ENDIF() - -IF(SODIUM_FOUND) - MESSAGE(STATUS "* libsodium: FOUND *") -ELSE() - MESSAGE(STATUS "* libsodium: MISSING *") -ENDIF() - -IF(OpenSSL_FOUND) - MESSAGE(STATUS "* OpenSSL: FOUND *") -ELSE() - MESSAGE(STATUS "* OpenSSL: MISSING *") -ENDIF() - -IF(MBEDTLS_FOUND) - MESSAGE(STATUS "* mbedTLS: FOUND *") -ELSE() - MESSAGE(STATUS "* mbedTLS: MISSING *") -ENDIF() - -MESSAGE(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}") -MESSAGE(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}") -MESSAGE(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}") -MESSAGE(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}") -MESSAGE(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") -MESSAGE(STATUS "PERL_VERSION: ${PERL_VERSION}") - -MESSAGE(STATUS "**************************************************") - -#options -OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) -OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) -OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON) -OPTION(EQEMU_BUILD_HC "Build the headless client." OFF) -OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF) -OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) -OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF) - -#PRNG options -OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF) -MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG) -OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF) -MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST) -SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)") -MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE) - -IF(CMAKE_COMPILER_IS_GNUCXX) - OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF) - MARK_AS_ADVANCED(EQEMU_SFMT19937) -ENDIF() - -IF(EQEMU_ADDITIVE_LFIB_PRNG) - ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG) - IF(EQEMU_SFMT19937) - MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.") - SET(EQEMU_SFMT19937 OFF) - ENDIF() - IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.") - SET(EQEMU_CUSTOM_PRNG_ENGINE "") - ENDIF() -ENDIF() - -IF(EQEMU_SFMT19937) - ADD_DEFINITIONS(-DUSE_SFMT19937) - IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.") - SET(EQEMU_CUSTOM_PRNG_ENGINE "") - ENDIF() -ENDIF() - -IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE}) -ENDIF() - -IF(EQEMU_BIASED_INT_DIST) - ADD_DEFINITIONS(-DBIASED_INT_DIST) -ENDIF() - -IF(EQEMU_COMMANDS_LOGGING) - ADD_DEFINITIONS(-DCOMMANDS_LOGGING) -ENDIF(EQEMU_COMMANDS_LOGGING) - -#database -IF(MySQL_FOUND AND MariaDB_FOUND) - SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use: - MySQL - MariaDB" - ) - - IF(DATABASE_LIBRARY_SELECTION STREQUAL "MySQL") - SET(DATABASE_LIBRARY_TYPE " MySQL") - SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES}) - SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR}) - ELSEIF(DATABASE_LIBRARY_SELECTION STREQUAL "MariaDB") - SET(DATABASE_LIBRARY_TYPE "MariaDB") - SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES}) - SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR}) - ELSE() - MESSAGE(FATAL_ERROR "Unknown database library set, should be one of: MySQL, MariaDB") - ENDIF() -ELSEIF(MariaDB_FOUND) - SET(DATABASE_LIBRARY_TYPE "MariaDB") - SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES}) - SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR}) -ELSEIF(MySQL_FOUND) - SET(DATABASE_LIBRARY_TYPE " MySQL") - SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES}) - SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR}) -ELSE() - MESSAGE(FATAL_ERROR "One of MySQL or MariaDB is a required dependency.") -ENDIF() - -#security -#prefer openssl to mbedtls (arbitrary) -IF(OpenSSL_FOUND AND MBEDTLS_FOUND) - SET(TLS_LIBRARY_SELECTION OpenSSL CACHE STRING "TLS library to use: - OpenSSL - mbedTLS" - ) - - IF(TLS_LIBRARY_SELECTION STREQUAL "OpenSSL") - SET(TLS_LIBRARY_TYPE " OpenSSL") - SET(TLS_LIBRARY_ENABLED ON) - SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES}) - SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR}) - ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL) - IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") - ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT) - ENDIF() - ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS") - SET(TLS_LIBRARY_TYPE " mbedTLS") - SET(TLS_LIBRARY_ENABLED ON) - SET(TLS_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY}) - SET(TLS_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR}) - ADD_DEFINITIONS(-DEQEMU_USE_MBEDTLS) - ELSE() - MESSAGE(FATAL_ERROR "Unknown TLS library set, should be one of: OpenSSL, mbedTLS") - ENDIF() -ELSEIF(OpenSSL_FOUND) - SET(TLS_LIBRARY_TYPE " OpenSSL") - SET(TLS_LIBRARY_ENABLED ON) - SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES}) - SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR}) - ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL) - IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") - ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT) - ENDIF() -ELSEIF(MBEDTLS_FOUND) - SET(TLS_LIBRARY_TYPE " mbedTLS") - SET(TLS_LIBRARY_ENABLED ON) - SET(TLS_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY}) - SET(TLS_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR}) - ADD_DEFINITIONS(-DEQEMU_USE_MBEDTLS) -ELSE() - SET(TLS_LIBRARY_TYPE "Disabled") - SET(TLS_LIBRARY_ENABLED OFF) -ENDIF() - -IF(SODIUM_FOUND) - SET(SODIUM_LIBRARY_TYPE "Libsodium") - SET(SODIUM_LIBRARY_ENABLED ON) - SET(SODIUM_LIBRARY_LIBS ${SODIUM_LIBRARIES}) - SET(SODIUM_LIBRARY_INCLUDE ${SODIUM_INCLUDE_DIRS}) - ADD_DEFINITIONS(-DENABLE_SECURITY) -ELSE() - SET(SODIUM_LIBRARY_TYPE " Disabled") - SET(SODIUM_LIBRARY_ENABLED OFF) -ENDIF() - -IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND)) - SET(LUA_LIBRARY_TYPE " LuaJIT") - SET(LUA_LIBRARY_ENABLED ON) - SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind) - SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") -ELSEIF(Lua51_FOUND ) - SET(LUA_LIBRARY_TYPE " Lua 5.1") - SET(LUA_LIBRARY_ENABLED ON) - SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind) - SET(LUA_LIBRARY_INCLUDE ${LUA_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") -ELSE() - SET(LUA_LIBRARY_TYPE "Disabled") - SET(LUA_LIBRARY_ENABLED OFF) -ENDIF() - -IF(PerlLibs_FOUND) - SET(PERL_LIBRARY_TYPE " Perl") - SET(PERL_LIBRARY_ENABLED ON) - SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY}) - SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH}) -ELSE() - SET(PERL_LIBRARY_TYPE "Disabled") - SET(PERL_LIBRARY_ENABLED OFF) -ENDIF() - -#use zlib if exists -IF(ZLIB_FOUND) - OPTION(EQEMU_BUILD_ZLIB "Build internal version of zlib." ON) - IF(EQEMU_BUILD_ZLIB) - SET(ZLIB_LIBRARY_TYPE "zlib-ng") - SET(ZLIB_LIBRARY_LIBS "zlibstatic") - SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng") - INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng") - ELSE() - SET(ZLIB_LIBRARY_TYPE " zlib") - SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY}) - SET(ZLIB_LIBRARY_INCLUDE ${ZLIB_INCLUDE_DIRS}) - ENDIF() -ELSE() - SET(ZLIB_LIBRARY_TYPE "zlib-ng") - SET(ZLIB_LIBRARY_LIBS "zlibstatic") - SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng") -ENDIF() - -IF (EQEMU_BUILD_STATIC) - SET(ZLIB_LIBRARY_LIBS libz.a) -ENDIF(EQEMU_BUILD_STATIC) - -MESSAGE(STATUS "") -MESSAGE(STATUS "**************************************************") -MESSAGE(STATUS "* Library Usage *") -MESSAGE(STATUS "**************************************************") -MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *") -MESSAGE(STATUS "* TLS: ${TLS_LIBRARY_TYPE} *") -MESSAGE(STATUS "* Sodium: ${SODIUM_LIBRARY_TYPE} *") -MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *") -MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *") -MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *") -MESSAGE(STATUS "**************************************************") - -#setup server libs and headers -SET(SERVER_LIBS common ${DATABASE_LIBRARY_LIBS} ${ZLIB_LIBRARY_LIBS} ${Boost_LIBRARIES} uv_a fmt RecastNavigation::Detour) - -set(FMT_HEADER_ONLY OFF) - -INCLUDE_DIRECTORIES(SYSTEM "${DATABASE_LIBRARY_INCLUDE}") -INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_LIBRARY_INCLUDE}") -INCLUDE_DIRECTORIES(SYSTEM "${Boost_INCLUDE_DIRS}") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/libuv/include" ) -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DebugUtils/Include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Detour/Include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourCrowd/Include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourTileCache/Include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp") - -# silence obnoxious deprecation message -ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) - -IF(TLS_LIBRARY_ENABLED) - SET(SERVER_LIBS ${SERVER_LIBS} ${TLS_LIBRARY_LIBS}) - INCLUDE_DIRECTORIES(SYSTEM "${TLS_LIBRARY_INCLUDE}") -ENDIF() - -IF(SODIUM_LIBRARY_ENABLED) - SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARY_LIBS}) - INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_LIBRARY_INCLUDE}") -ENDIF() - -IF(LUA_LIBRARY_ENABLED) - OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON) - - IF(EQEMU_BUILD_LUA) - ADD_DEFINITIONS(-DLUA_EQEMU) - SET(ZONE_LIBS ${LUA_LIBRARY_LIBS}) - INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}") - - OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) - IF(EQEMU_SANITIZE_LUA_LIBS) - ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS) - ENDIF() - ENDIF() -ENDIF() - -IF(PERL_LIBRARY_ENABLED) - OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON) - IF(EQEMU_BUILD_PERL) - SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) - INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}") - ADD_DEFINITIONS(-DEMBPERL) - ADD_DEFINITIONS(-DEMBPERL_PLUGIN) - ADD_DEFINITIONS(-DPERLBIND_NO_STRICT_SCALAR_TYPES) - IF (UNIX AND EQEMU_BUILD_STATIC) - SET(SERVER_LIBS ${SERVER_LIBS} libcrypt.a) - ENDIF () - ENDIF() -ENDIF() - -IF(WIN32) - SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv") -ENDIF() - -IF(UNIX) - SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread") - IF(NOT DARWIN) - SET(SERVER_LIBS ${SERVER_LIBS} "rt") - ENDIF() - # Freebsd provides uuids in the C library - IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") - SET(SERVER_LIBS ${SERVER_LIBS} "uuid") - ENDIF() -ENDIF() - -SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS}) - -IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED) - MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.") -ENDIF() - -IF(EQEMU_BUILD_HC AND NOT TLS_LIBRARY_ENABLED) - MESSAGE(FATAL_ERROR "Headless client requires a TLS Library to build.") -ENDIF() - -IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) - ADD_SUBDIRECTORY(common) - ADD_SUBDIRECTORY(libs) - ADD_SUBDIRECTORY(submodules/fmt) - ADD_SUBDIRECTORY(submodules/libuv) - - IF(EQEMU_BUILD_ZLIB) - SET(ZLIB_COMPAT ON CACHE BOOL "Compile with zlib compatible API") - SET(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Build test binaries") - ADD_SUBDIRECTORY(libs/zlibng) - ENDIF() - - SET(RECASTNAVIGATION_DEMO OFF CACHE BOOL "Build demo") - SET(RECASTNAVIGATION_TESTS OFF CACHE BOOL "Build tests") - SET(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "Build examples") - ADD_SUBDIRECTORY(submodules/recastnavigation) -ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) - -IF(EQEMU_BUILD_SERVER) - ADD_SUBDIRECTORY(shared_memory) - ADD_SUBDIRECTORY(world) - ADD_SUBDIRECTORY(zone) - ADD_SUBDIRECTORY(ucs) - ADD_SUBDIRECTORY(queryserv) - ADD_SUBDIRECTORY(eqlaunch) -ENDIF(EQEMU_BUILD_SERVER) - -IF(EQEMU_BUILD_LOGIN) - ADD_SUBDIRECTORY(loginserver) -ENDIF(EQEMU_BUILD_LOGIN) - -IF(EQEMU_BUILD_HC) - ADD_SUBDIRECTORY(hc) -ENDIF(EQEMU_BUILD_HC) - -IF(EQEMU_BUILD_TESTS) - ADD_SUBDIRECTORY(tests) -ENDIF(EQEMU_BUILD_TESTS) - -IF(EQEMU_BUILD_CLIENT_FILES) - ADD_SUBDIRECTORY(client_files) -ENDIF(EQEMU_BUILD_CLIENT_FILES) diff --git a/submodules/vcpkg b/submodules/vcpkg new file mode 160000 index 000000000..163fe7bd3 --- /dev/null +++ b/submodules/vcpkg @@ -0,0 +1 @@ +Subproject commit 163fe7bd3d67c41200617caaa245b5ba2ba854e6 From 792bd3be96aff0c3e47eea7264247bf08ab6cde3 Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 12 Nov 2025 23:26:57 -0800 Subject: [PATCH 02/44] Simple vcpkg manifest, will almost certainly need tweaking --- vcpkg.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 vcpkg.json diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..f5b39ddf8 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "eqemu", + "version-string": "24.10.3", + "dependencies": [ + "boost-dynamic-bitset", + "boost-foreach", + "boost-tuple", + "libmariadb", + "zlib-ng", + "openssl", + "luajit", + "cereal", + "fmt", + "glm", + "libuv", + "recastnavigation" + ] +} From 2faa3ec47858200fe2561e9e4200761fdc73dba3 Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 12 Nov 2025 23:32:03 -0800 Subject: [PATCH 03/44] Remove cmake ext we wont be using anymore --- cmake/DependencyHelperMSVC.cmake | 94 -------------------------------- cmake/FindLua51.cmake | 91 ------------------------------- cmake/FindLuaJit.cmake | 91 ------------------------------- cmake/FindMariaDB.cmake | 87 ----------------------------- cmake/FindMySQL.cmake | 87 ----------------------------- cmake/FindSodium.cmake | 30 ---------- cmake/FindmbedTLS.cmake | 93 ------------------------------- 7 files changed, 573 deletions(-) delete mode 100644 cmake/DependencyHelperMSVC.cmake delete mode 100644 cmake/FindLua51.cmake delete mode 100644 cmake/FindLuaJit.cmake delete mode 100644 cmake/FindMariaDB.cmake delete mode 100644 cmake/FindMySQL.cmake delete mode 100644 cmake/FindSodium.cmake delete mode 100644 cmake/FindmbedTLS.cmake diff --git a/cmake/DependencyHelperMSVC.cmake b/cmake/DependencyHelperMSVC.cmake deleted file mode 100644 index 33f92e41b..000000000 --- a/cmake/DependencyHelperMSVC.cmake +++ /dev/null @@ -1,94 +0,0 @@ -OPTION(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG "Automatically fetch vcpkg dependencies for MSCV" ON) -OPTION(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL "Automatically fetch perl dependencies for MSCV" ON) - -MARK_AS_ADVANCED(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG) -MARK_AS_ADVANCED(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL) - -SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86 "https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x86.zip") -SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64 "https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x64.zip") -SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86 "http://strawberryperl.com/download/5.24.4.1/strawberry-perl-5.24.4.1-32bit-portable.zip") -SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64 "http://strawberryperl.com/download/5.24.4.1/strawberry-perl-5.24.4.1-64bit-portable.zip") -SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_ZIP "vcpkg-export-x86.zip") -SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_ZIP "vcpkg-export-x64.zip") -SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_DIR "vcpkg-export-x86") -SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_DIR "vcpkg-export-x64") -SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86_ZIP "strawberry-perl-5.24.4.1-32bit-portable.zip") -SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64_ZIP "strawberry-perl-5.24.4.1-64bit-portable.zip") -SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86_DIR "x86") -SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64_DIR "x64") - -IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(EQEMU_VCPKG_URL ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64}) - SET(EQEMU_PERL_URL ${EQEMU_MSVC_DEPENDENCIES_PERL_X64}) - SET(EQEMU_VCPKG_ZIP ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_ZIP}) - SET(EQEMU_VCPKG_DIR ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_DIR}) - SET(EQEMU_PERL_ZIP ${EQEMU_MSVC_DEPENDENCIES_PERL_X64_ZIP}) - SET(EQEMU_PERL_DIR ${EQEMU_MSVC_DEPENDENCIES_PERL_X64_DIR}) -ELSE() - SET(EQEMU_VCPKG_URL ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86}) - SET(EQEMU_PERL_URL ${EQEMU_MSVC_DEPENDENCIES_PERL_X86}) - SET(EQEMU_VCPKG_ZIP ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_ZIP}) - SET(EQEMU_VCPKG_DIR ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_DIR}) - SET(EQEMU_PERL_ZIP ${EQEMU_MSVC_DEPENDENCIES_PERL_X86_ZIP}) - SET(EQEMU_PERL_DIR ${EQEMU_MSVC_DEPENDENCIES_PERL_X86_DIR}) -ENDIF() - -IF(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG) - MESSAGE(STATUS "Resolving vcpkg dependencies...") - - IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP}) - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/vcpkg) - - MESSAGE(STATUS "Downloading existing vcpkg dependencies from releases...") - FILE(DOWNLOAD ${EQEMU_VCPKG_URL} ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP} - SHOW_PROGRESS - STATUS DOWNLOAD_STATUS) - - LIST(GET DOWNLOAD_STATUS 0 STATUS_CODE) - IF(NOT STATUS_CODE EQUAL 0) - MESSAGE(FATAL_ERROR "Was unable to download dependencies from ${EQEMU_VCPKG_URL}") - ENDIF() - - MESSAGE(STATUS "Extracting files...") - EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/vcpkg - ) - ENDIF() - - INCLUDE(${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake) -ENDIF() - -IF(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL) - #Try to find perl first, (so you can use your active install first) - FIND_PACKAGE(PerlLibs) - - IF(NOT PerlLibs_FOUND) - MESSAGE(STATUS "Resolving perl dependencies...") - - IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP}) - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/perl) - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}) - - MESSAGE(STATUS "Downloading portable perl...") - FILE(DOWNLOAD ${EQEMU_PERL_URL} ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP} - SHOW_PROGRESS - STATUS DOWNLOAD_STATUS) - - LIST(GET DOWNLOAD_STATUS 0 STATUS_CODE) - IF(NOT STATUS_CODE EQUAL 0) - MESSAGE(FATAL_ERROR "Was unable to download dependencies from ${EQEMU_PERL_URL}") - ENDIF() - - MESSAGE(STATUS "Extracting files...") - EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP} - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR} - ) - ENDIF() - - SET(PERL_EXECUTABLE ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/bin/perl.exe CACHE FILEPATH "Path to perl program" FORCE) - SET(PERL_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/lib/CORE CACHE PATH "Path to perl include files" FORCE) - SET(PERL_LIBRARY ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/lib/CORE/libperl524.a CACHE FILEPATH "Path to perl library" FORCE) - ENDIF() -ENDIF() \ No newline at end of file diff --git a/cmake/FindLua51.cmake b/cmake/FindLua51.cmake deleted file mode 100644 index 0aab2bb82..000000000 --- a/cmake/FindLua51.cmake +++ /dev/null @@ -1,91 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. -# Modified from the FindLua51 that comes with CMake - -#[=======================================================================[.rst: -FindLua51 ---------- - - - -Locate Lua51 library This module defines - -:: - - LUA51_FOUND, if false, do not try to link to Lua - LUA_LIBRARIES - LUA_INCLUDE_DIR, where to find lua.h - LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) - - - -Note that the expected include convention is - -:: - - #include "lua.h" - -and not - -:: - - #include - -This is because, the lua location is not standardized and may exist in -locations other than lua/ -#]=======================================================================] - -find_path(LUA_INCLUDE_DIR lua.h - HINTS - ENV LUA_DIR - PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -find_library(LUA_LIBRARY - NAMES lua51 lua5.1 lua-5.1 lua - HINTS - ENV LUA_DIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt -) - -if(LUA_LIBRARY) - # include the math library for Unix - if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) - find_library(LUA_MATH_LIBRARY m) - set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") - # For Windows and Mac, don't need to explicitly include the math library - else() - set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") - endif() -endif() - -if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") - - string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") - unset(lua_version_str) -endif() - -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -# handle the QUIETLY and REQUIRED arguments and set LUA51_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 - REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR - VERSION_VAR LUA_VERSION_STRING) - -mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) - diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake deleted file mode 100644 index a7376dee1..000000000 --- a/cmake/FindLuaJit.cmake +++ /dev/null @@ -1,91 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. -# Modified from the FindLua51 that comes with CMake - -#[=======================================================================[.rst: -FindLuaJit ---------- - - - -Locate LuaJit library This module defines - -:: - - LUAJIT_FOUND, if false, do not try to link to Lua - LUAJIT_LIBRARIES - LUAJIT_INCLUDE_DIR, where to find lua.h - LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8) - - - -Note that the expected include convention is - -:: - - #include "lua.h" - -and not - -:: - - #include - -This is because, the lua location is not standardized and may exist in -locations other than lua/ -#]=======================================================================] - -find_path(LUAJIT_INCLUDE_DIR lua.h - HINTS - ENV LUA_DIR - PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt -) - -find_library(LUAJIT_LIBRARY - NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51 - HINTS - ENV LUA_DIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt -) - -if(LUAJIT_LIBRARY) - # include the math library for Unix - if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) - find_library(LUAJIT_MATH_LIBRARY m) - set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries") - # For Windows and Mac, don't need to explicitly include the math library - else() - set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries") - endif() -endif() - -if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h") - file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") - - string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}") - unset(lua_version_str) -endif() - -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit - REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR - VERSION_VAR LUAJIT_VERSION_STRING) - -mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY) - diff --git a/cmake/FindMariaDB.cmake b/cmake/FindMariaDB.cmake deleted file mode 100644 index 14f54734d..000000000 --- a/cmake/FindMariaDB.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# - Find mariadbclient -# -# -*- cmake -*- -# -# Find the native MariaDB includes and library -# -# MariaDB_INCLUDE_DIR - where to find mysql.h, etc. -# MariaDB_LIBRARIES - List of libraries when using MariaDB. -# MariaDB_FOUND - True if MariaDB found. -# The following can be used as a hint as to where to search: -# MARIADB_ROOT - -IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES) - # Already in cache, be silent - SET(MariaDB_FIND_QUIETLY TRUE) -ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES) - -# Include dir -IF(MARIADB_ROOT) - FIND_PATH(MariaDB_INCLUDE_DIR - NAMES mariadb_version.h - PATHS ${MARIADB_ROOT}/include - PATH_SUFFIXES mysql mariadb - NO_DEFAULT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - ) - FIND_PATH(MariaDB_INCLUDE_DIR - NAMES mariadb_version.h - PATH_SUFFIXES mysql mariadb - ) -ELSE(MARIADB_ROOT) - FIND_PATH(MariaDB_INCLUDE_DIR - NAMES mariadb_version.h - PATH_SUFFIXES mysql mariadb - ) -ENDIF(MARIADB_ROOT) - -# Library -SET(MariaDB_NAMES libmariadb) -IF(MARIADB_ROOT) - FIND_LIBRARY(MariaDB_LIBRARY - NAMES ${MariaDB_NAMES} - PATHS ${MARIADB_ROOT}/lib - PATH_SUFFIXES mysql mariadb - NO_DEFAULT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - ) - - FIND_LIBRARY(MariaDB_LIBRARY - NAMES ${MariaDB_NAMES} - PATH_SUFFIXES mysql mariadb - ) -ELSE(MARIADB_ROOT) - FIND_LIBRARY(MariaDB_LIBRARY - NAMES ${MariaDB_NAMES} mariadbclient_r mariadbclient - PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 - PATH_SUFFIXES mysql mariadb - ) -ENDIF(MARIADB_ROOT) - -IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY) - SET(MariaDB_FOUND TRUE) - SET(MariaDB_LIBRARIES ${MariaDB_LIBRARY}) -ELSE (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY) - SET(MariaDB_FOUND FALSE) - SET(MariaDB_LIBRARIES) -ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY) - - -# handle the QUIETLY and REQUIRED arguments and set MariaDB_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MariaDB DEFAULT_MSG MariaDB_LIBRARY MariaDB_INCLUDE_DIR) - -IF(MariaDB_FOUND) - SET( MariaDB_LIBRARY_RELEASE ${MariaDB_LIBRARY} ) - SET( MariaDB_LIBRARY_DEBUG ${MariaDB_LIBRARY} ) - SET( MariaDB_LIBRARIES ${MariaDB_LIBRARY_RELEASE} ${MariaDB_LIBRARY_DEBUG} ) -ELSE(MariaDB_FOUND) - SET( MariaDB_LIBRARIES ) -ENDIF(MariaDB_FOUND) - -MARK_AS_ADVANCED( - MariaDB_LIBRARY_DEBUG - MariaDB_LIBRARY_RELEASE - MariaDB_INCLUDE_DIR - ) diff --git a/cmake/FindMySQL.cmake b/cmake/FindMySQL.cmake deleted file mode 100644 index 5a7927552..000000000 --- a/cmake/FindMySQL.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# - Find mysqlclient -# -# -*- cmake -*- -# -# Find the native MySQL includes and library -# -# MySQL_INCLUDE_DIR - where to find mysql.h, etc. -# MySQL_LIBRARIES - List of libraries when using MySQL. -# MySQL_FOUND - True if MySQL found. -# The following can be used as a hint as to where to search: -# MYSQL_ROOT - -IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES) - # Already in cache, be silent - SET(MySQL_FIND_QUIETLY TRUE) -ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES) - -# Include dir -IF(MYSQL_ROOT) - FIND_PATH(MySQL_INCLUDE_DIR - NAMES mysql.h - PATHS ${MYSQL_ROOT}/include - PATH_SUFFIXES mysql - NO_DEFAULT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - ) - FIND_PATH(MySQL_INCLUDE_DIR - NAMES mysql.h - PATH_SUFFIXES mysql - ) -ELSE(MYSQL_ROOT) - FIND_PATH(MySQL_INCLUDE_DIR - NAMES mysql.h - PATH_SUFFIXES mysql - ) -ENDIF(MYSQL_ROOT) - -# Library -SET(MySQL_NAMES libmysql) -IF(MYSQL_ROOT) - FIND_LIBRARY(MySQL_LIBRARY - NAMES ${MySQL_NAMES} - PATHS ${MYSQL_ROOT}/lib - PATH_SUFFIXES mysql - NO_DEFAULT_PATH - NO_SYSTEM_ENVIRONMENT_PATH - ) - - FIND_LIBRARY(MySQL_LIBRARY - NAMES ${MySQL_NAMES} - PATH_SUFFIXES mysql - ) -ELSE(MYSQL_ROOT) - FIND_LIBRARY(MySQL_LIBRARY - NAMES ${MySQL_NAMES} mysqlclient_r mysqlclient - PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 - PATH_SUFFIXES mysql - ) -ENDIF(MYSQL_ROOT) - -IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY) - SET(MySQL_FOUND TRUE) - SET( MySQL_LIBRARIES ${MySQL_LIBRARY} ) -ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY) - SET(MySQL_FOUND FALSE) - SET( MySQL_LIBRARIES ) -ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY) - - -# handle the QUIETLY and REQUIRED arguments and set MySQL_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY MySQL_INCLUDE_DIR) - -IF(MySQL_FOUND) - SET( MySQL_LIBRARY_RELEASE ${MySQL_LIBRARY} ) - SET( MySQL_LIBRARY_DEBUG ${MySQL_LIBRARY} ) - SET( MySQL_LIBRARIES ${MySQL_LIBRARY_RELEASE} ${MySQL_LIBRARY_DEBUG} ) -ELSE(MySQL_FOUND) - SET( MySQL_LIBRARIES ) -ENDIF(MySQL_FOUND) - -MARK_AS_ADVANCED( - MySQL_LIBRARY_DEBUG - MySQL_LIBRARY_RELEASE - MySQL_INCLUDE_DIR - ) diff --git a/cmake/FindSodium.cmake b/cmake/FindSodium.cmake deleted file mode 100644 index 3c5ae3467..000000000 --- a/cmake/FindSodium.cmake +++ /dev/null @@ -1,30 +0,0 @@ -if (NOT MSVC) -include(FindPkgConfig) -pkg_check_modules(PC_SODIUM "libsodium") -if (NOT PC_SODIUM_FOUND) - pkg_check_modules(PC_SODIUM "sodium") -endif (NOT PC_SODIUM_FOUND) -if (PC_SODIUM_FOUND) - set(SODIUM_INCLUDE_HINTS ${PC_SODIUM_INCLUDE_DIRS} ${PC_SODIUM_INCLUDE_DIRS}/*) - set(SODIUM_LIBRARY_HINTS ${PC_SODIUM_LIBRARY_DIRS} ${PC_SODIUM_LIBRARY_DIRS}/*) -endif() -endif (NOT MSVC) - -# some libraries install the headers is a subdirectory of the include dir -# returned by pkg-config, so use a wildcard match to improve chances of finding -# headers and libraries. -find_path( - SODIUM_INCLUDE_DIRS - NAMES sodium.h - HINTS ${SODIUM_INCLUDE_HINTS} -) - -find_library( - SODIUM_LIBRARIES - NAMES libsodium sodium - HINTS ${SODIUM_LIBRARY_HINTS} -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS) -mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS) diff --git a/cmake/FindmbedTLS.cmake b/cmake/FindmbedTLS.cmake deleted file mode 100644 index d2a3ce3b9..000000000 --- a/cmake/FindmbedTLS.cmake +++ /dev/null @@ -1,93 +0,0 @@ -# - Try to find mbedTLS -# Once done this will define -# -# Read-Only variables -# MBEDTLS_FOUND - system has mbedTLS -# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory -# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory -# MBEDTLS_LIBRARIES - Link these to use mbedTLS -# MBEDTLS_LIBRARY - path to mbedTLS library -# MBEDX509_LIBRARY - path to mbedTLS X.509 library -# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library -# -# Hint -# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation. - -SET(_MBEDTLS_ROOT_HINTS - ${MBEDTLS_ROOT_DIR} - ENV MBEDTLS_ROOT_DIR -) - -SET(_MBEDTLS_ROOT_HINTS_AND_PATHS - HINTS ${_MBEDTLS_ROOT_HINTS} - PATHS ${_MBEDTLS_ROOT_PATHS} -) - -FIND_PATH(MBEDTLS_INCLUDE_DIR - NAMES mbedtls/version.h - ${_MBEDTLS_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES include -) - -IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES) - # Already in cache, be silent - SET(MBEDTLS_FIND_QUIETLY TRUE) -ENDIF() - -FIND_LIBRARY(MBEDTLS_LIBRARY - NAMES mbedtls libmbedtls - ${_MBEDTLS_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES library -) -FIND_LIBRARY(MBEDX509_LIBRARY - NAMES mbedx509 libmbedx509 - ${_MBEDTLS_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES library -) -FIND_LIBRARY(MBEDCRYPTO_LIBRARY - NAMES mbedcrypto libmbedcrypto - ${_MBEDTLS_ROOT_HINTS_AND_PATHS} - PATH_SUFFIXES library -) - -IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY) - SET(MBEDTLS_FOUND TRUE) -ENDIF() - -IF(MBEDTLS_FOUND) - # split mbedTLS into -L and -l linker options, so we can set them for pkg-config - GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH) - GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE) - GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE) - GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE) - STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE}) - STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE}) - STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE}) - SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}") - - IF(NOT MBEDTLS_FIND_QUIETLY) - MESSAGE(STATUS "Found mbedTLS:") - FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT) - STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT}) - IF (MBEDTLSMATCH) - STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH}) - MESSAGE(STATUS " version ${MBEDTLS_VERSION}") - ENDIF(MBEDTLSMATCH) - MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}") - MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}") - MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}") - ENDIF(NOT MBEDTLS_FIND_QUIETLY) -ELSE(MBEDTLS_FOUND) - IF(MBEDTLS_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find mbedTLS") - ENDIF(MBEDTLS_FIND_REQUIRED) -ENDIF(MBEDTLS_FOUND) - -MARK_AS_ADVANCED( - MBEDTLS_INCLUDE_DIR - MBEDTLS_LIBRARY_DIR - MBEDTLS_LIBRARIES - MBEDTLS_LIBRARY - MBEDX509_LIBRARY - MBEDCRYPTO_LIBRARY -) From 0f7abb8c2577aff8ba9deca87c35d3fbd6611363 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 13 Nov 2025 21:11:03 -0800 Subject: [PATCH 04/44] Update vcpkg to no longer be from 2022, update cmake lists (wip) --- CMakeLists.txt | 160 +++++++++++++++++++++++++++++++++++++++++++++++ submodules/vcpkg | 2 +- 2 files changed, 161 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13d5fae12..5e2b74c41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,5 +18,165 @@ IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) +OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) +# Requires libgoogle-perftools-dev google-perftools packages for linux (debian) +IF(EQEMU_ADD_PROFILER) + SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") +ENDIF(EQEMU_ADD_PROFILER) +IF(USE_MAP_MMFS) + ADD_DEFINITIONS(-DUSE_MAP_MMFS) +ENDIF (USE_MAP_MMFS) + +IF(MSVC) + add_compile_options(/bigobj) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) + ADD_DEFINITIONS(-DNOMINMAX) + ADD_DEFINITIONS(-DCRASH_LOGGING) + ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17 + + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + + OPTION(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON) + IF(EQEMU_DISABLE_MSVC_WARNINGS) + ADD_DEFINITIONS( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os") + ENDIF(EQEMU_DISABLE_MSVC_WARNINGS) +ELSE(MSVC) + ADD_DEFINITIONS(-DHAS_UNION_SEMUN) +ENDIF(MSVC) + +#FreeBSD support +IF(UNIX) + IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + ADD_DEFINITIONS(-DFREEBSD) + ADD_DEFINITIONS(-D_GLIBCXX_USE_C99) + SET(FREEBSD TRUE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") + ADD_DEFINITIONS(-DDARWIN) + SET(DARWIN TRUE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") +ENDIF(UNIX) + +#insert vcpkg libs here +FIND_PACKAGE(PerlLibs) + +MESSAGE(STATUS "**************************************************") +MESSAGE(STATUS "* Library Detection *") +MESSAGE(STATUS "**************************************************") +MESSAGE(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}") +MESSAGE(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}") +MESSAGE(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}") +MESSAGE(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}") +MESSAGE(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") +MESSAGE(STATUS "PERL_VERSION: ${PERL_VERSION}") +MESSAGE(STATUS "**************************************************") + +SET(EQEMU_LOG_LEVEL 0) +IF(EQEMU_ENABLE_LOG_TRACE) + MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 1") +ENDIF(EQEMU_ENABLE_LOG_TRACE) + +IF(EQEMU_ENABLE_LOG_DEBUG) + MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 2") +ENDIF(EQEMU_ENABLE_LOG_DEBUG) + +IF(EQEMU_ENABLE_LOG_INFO) + MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 4") +ENDIF(EQEMU_ENABLE_LOG_INFO) + +IF(EQEMU_ENABLE_LOG_WARN) + MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 8") +ENDIF(EQEMU_ENABLE_LOG_WARN) + +IF(EQEMU_ENABLE_LOG_ERROR) + MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 16") +ENDIF(EQEMU_ENABLE_LOG_ERROR) + +IF(EQEMU_ENABLE_LOG_FATAL) + MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 32") +ENDIF(EQEMU_ENABLE_LOG_FATAL) +ADD_DEFINITIONS(-DEQEMU_LOG_LEVEL=${EQEMU_LOG_LEVEL}) + +ADD_DEFINITIONS(-DGLM_FORCE_RADIANS) +ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT) +ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL) + +#options +OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) +OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) +OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON) +OPTION(EQEMU_BUILD_HC "Build the headless client." OFF) +OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF) +OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) +OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF) + +#PRNG options +OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF) +MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG) +OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF) +MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST) +SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)") +MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE) + +IF(CMAKE_COMPILER_IS_GNUCXX) + OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF) + MARK_AS_ADVANCED(EQEMU_SFMT19937) +ENDIF() + +IF(EQEMU_ADDITIVE_LFIB_PRNG) + ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG) + IF(EQEMU_SFMT19937) + MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.") + SET(EQEMU_SFMT19937 OFF) + ENDIF() + IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.") + SET(EQEMU_CUSTOM_PRNG_ENGINE "") + ENDIF() +ENDIF() + +IF(EQEMU_SFMT19937) + ADD_DEFINITIONS(-DUSE_SFMT19937) + IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.") + SET(EQEMU_CUSTOM_PRNG_ENGINE "") + ENDIF() +ENDIF() + +IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE}) +ENDIF() + +IF(EQEMU_BIASED_INT_DIST) + ADD_DEFINITIONS(-DBIASED_INT_DIST) +ENDIF() + +IF(EQEMU_COMMANDS_LOGGING) + ADD_DEFINITIONS(-DCOMMANDS_LOGGING) +ENDIF(EQEMU_COMMANDS_LOGGING) + +IF(PerlLibs_FOUND) + SET(PERL_LIBRARY_TYPE " Perl") + SET(PERL_LIBRARY_ENABLED ON) + SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY}) + SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH}) +ELSE() + SET(PERL_LIBRARY_TYPE "Disabled") + SET(PERL_LIBRARY_ENABLED OFF) +ENDIF() + +MESSAGE(STATUS "") +MESSAGE(STATUS "**************************************************") +MESSAGE(STATUS "* Library Usage *") +MESSAGE(STATUS "**************************************************") +MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *") +MESSAGE(STATUS "**************************************************") + +# silence obnoxious deprecation message +ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) + +IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) + ADD_SUBDIRECTORY(common) +ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) diff --git a/submodules/vcpkg b/submodules/vcpkg index 163fe7bd3..d1ff36c65 160000 --- a/submodules/vcpkg +++ b/submodules/vcpkg @@ -1 +1 @@ -Subproject commit 163fe7bd3d67c41200617caaa245b5ba2ba854e6 +Subproject commit d1ff36c6520ee43f1a656c03cd6425c2974a449e From d61effbb8f22c2e561dd62ec1865dd7f2429b543 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 13 Nov 2025 21:34:14 -0800 Subject: [PATCH 05/44] Add finds to the toplevel cmakelists --- CMakeLists.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e2b74c41..d1fe524ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,8 +59,18 @@ IF(UNIX) ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") ENDIF(UNIX) -#insert vcpkg libs here -FIND_PACKAGE(PerlLibs) +find_package(PkgConfig) +find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple) +find_package(cereal CONFIG REQUIRED) +find_package(fmt CONFIG REQUIRED) +find_package(glm CONFIG REQUIRED) +find_package(unofficial-libmariadb CONFIG REQUIRED) +find_package(libuv CONFIG REQUIRED) +find_package(OpenSSL REQUIRED) +find_package(recastnavigation CONFIG REQUIRED) +find_package(zlib-ng CONFIG REQUIRED) +pkg_check_modules(luajit REQUIRED luajit) +find_package(PerlLibs) MESSAGE(STATUS "**************************************************") MESSAGE(STATUS "* Library Detection *") From 2f78b6c2f335a2aad504d1a0c1f8c97488dc988c Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 15 Nov 2025 22:30:54 -0800 Subject: [PATCH 06/44] WIP, luabind and perlbind build. Common only partially builds. --- CMakeLists.txt | 197 +++++++++++++++++++++++++++++------- libs/luabind/CMakeLists.txt | 4 +- 2 files changed, 165 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1fe524ff..490475b0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,18 +8,32 @@ ELSEIF(NOT DEFINED CMAKE_TOOLCHAIN_FILE) SET(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") ENDIF() -SET(CMAKE_CXX_STANDARD 20) -SET(CMAKE_CXX_STANDARD_REQUIRED ON) -SET(CMAKE_CXX_EXTENSIONS OFF) - PROJECT(EQEmu) IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) +SET(CMAKE_CXX_STANDARD 20) +SET(CMAKE_CXX_STANDARD_REQUIRED ON) +SET(CMAKE_CXX_EXTENSIONS OFF) + +OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF) OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) +IF (EQEMU_BUILD_STATIC) + SET(BUILD_SHARED_LIBS OFF) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") + MESSAGE(STATUS "Building with static linking") + SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") + IF (UNIX) + SET(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so") + SET(PERL_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/") + SET(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl") + ENDIF () +ENDIF (EQEMU_BUILD_STATIC) + + # Requires libgoogle-perftools-dev google-perftools packages for linux (debian) IF(EQEMU_ADD_PROFILER) SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") @@ -59,6 +73,10 @@ IF(UNIX) ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") ENDIF(UNIX) +ADD_DEFINITIONS(-DGLM_FORCE_RADIANS) +ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT) +ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL) + find_package(PkgConfig) find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple) find_package(cereal CONFIG REQUIRED) @@ -72,47 +90,51 @@ find_package(zlib-ng CONFIG REQUIRED) pkg_check_modules(luajit REQUIRED luajit) find_package(PerlLibs) +include_directories(SYSTEM "${Boost_INCLUDE_DIR}") + MESSAGE(STATUS "**************************************************") MESSAGE(STATUS "* Library Detection *") MESSAGE(STATUS "**************************************************") + +IF(MARIADB_FOUND) + MESSAGE(STATUS "* MariaDB: FOUND *") +ELSE() + MESSAGE(STATUS "* MariaDB: MISSING *") +ENDIF() + +IF(ZLIB_FOUND) + MESSAGE(STATUS "* ZLIB: FOUND *") +ELSE() + MESSAGE(STATUS "* ZLIB: MISSING *") +ENDIF() + +IF(LuaJit_FOUND) + MESSAGE(STATUS "* LuaJIT: FOUND *") +ELSE() + MESSAGE(STATUS "* LuaJIT: MISSING *") +ENDIF() + +IF(PerlLibs_FOUND) + MESSAGE(STATUS "* Perl: FOUND *") +ELSE() + MESSAGE(STATUS "* Perl: MISSING *") +ENDIF() + +IF(OpenSSL_FOUND) + MESSAGE(STATUS "* OpenSSL: FOUND *") +ELSE() + MESSAGE(STATUS "* OpenSSL: MISSING *") +ENDIF() + MESSAGE(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}") MESSAGE(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}") MESSAGE(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}") MESSAGE(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}") MESSAGE(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") MESSAGE(STATUS "PERL_VERSION: ${PERL_VERSION}") + MESSAGE(STATUS "**************************************************") -SET(EQEMU_LOG_LEVEL 0) -IF(EQEMU_ENABLE_LOG_TRACE) - MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 1") -ENDIF(EQEMU_ENABLE_LOG_TRACE) - -IF(EQEMU_ENABLE_LOG_DEBUG) - MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 2") -ENDIF(EQEMU_ENABLE_LOG_DEBUG) - -IF(EQEMU_ENABLE_LOG_INFO) - MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 4") -ENDIF(EQEMU_ENABLE_LOG_INFO) - -IF(EQEMU_ENABLE_LOG_WARN) - MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 8") -ENDIF(EQEMU_ENABLE_LOG_WARN) - -IF(EQEMU_ENABLE_LOG_ERROR) - MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 16") -ENDIF(EQEMU_ENABLE_LOG_ERROR) - -IF(EQEMU_ENABLE_LOG_FATAL) - MATH(EXPR EQEMU_LOG_LEVEL "${EQEMU_LOG_LEVEL} + 32") -ENDIF(EQEMU_ENABLE_LOG_FATAL) -ADD_DEFINITIONS(-DEQEMU_LOG_LEVEL=${EQEMU_LOG_LEVEL}) - -ADD_DEFINITIONS(-DGLM_FORCE_RADIANS) -ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT) -ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL) - #options OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) @@ -167,6 +189,21 @@ IF(EQEMU_COMMANDS_LOGGING) ADD_DEFINITIONS(-DCOMMANDS_LOGGING) ENDIF(EQEMU_COMMANDS_LOGGING) +SET(DATABASE_LIBRARY_TYPE "MariaDB") +SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES}) +SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR}) +SET(TLS_LIBRARY_TYPE " OpenSSL") +SET(TLS_LIBRARY_ENABLED ON) +SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES}) +SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR}) +ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL) +IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") + ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT) +ENDIF() + +SET(LUA_LIBRARY_TYPE " LuaJIT") +SET(LUA_LIBRARY_ENABLED ON) + IF(PerlLibs_FOUND) SET(PERL_LIBRARY_TYPE " Perl") SET(PERL_LIBRARY_ENABLED ON) @@ -177,16 +214,108 @@ ELSE() SET(PERL_LIBRARY_ENABLED OFF) ENDIF() +SET(ZLIB_LIBRARY_TYPE "zlib-ng") +SET(ZLIB_LIBRARY_LIBS "zlibstatic") +SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng") +IF (EQEMU_BUILD_STATIC) + SET(ZLIB_LIBRARY_LIBS libz.a) +ENDIF(EQEMU_BUILD_STATIC) MESSAGE(STATUS "") MESSAGE(STATUS "**************************************************") MESSAGE(STATUS "* Library Usage *") MESSAGE(STATUS "**************************************************") +MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *") +MESSAGE(STATUS "* TLS: ${TLS_LIBRARY_TYPE} *") +MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *") MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *") +MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *") MESSAGE(STATUS "**************************************************") + +SET(SERVER_LIBS common) # silence obnoxious deprecation message ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) +IF(LUA_LIBRARY_ENABLED) + OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON) + + IF(EQEMU_BUILD_LUA) + ADD_DEFINITIONS(-DLUA_EQEMU) + SET(ZONE_LIBS ${pkgcfg_lib_luajit_lua51}) + include_directories(SYSTEM "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/luajit" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") + + OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) + IF(EQEMU_SANITIZE_LUA_LIBS) + ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS) + ENDIF() + ENDIF() +ENDIF() + +IF(PERL_LIBRARY_ENABLED) + OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON) + IF(EQEMU_BUILD_PERL) + SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) + INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}") + ADD_DEFINITIONS(-DEMBPERL) + ADD_DEFINITIONS(-DEMBPERL_PLUGIN) + ADD_DEFINITIONS(-DPERLBIND_NO_STRICT_SCALAR_TYPES) + IF (UNIX AND EQEMU_BUILD_STATIC) + SET(SERVER_LIBS ${SERVER_LIBS} libcrypt.a) + ENDIF () + ENDIF() +ENDIF() + +IF(WIN32) + SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv") +ENDIF() + +IF(UNIX) + SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread") + IF(NOT DARWIN) + SET(SERVER_LIBS ${SERVER_LIBS} "rt") + ENDIF() + # Freebsd provides uuids in the C library + IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + SET(SERVER_LIBS ${SERVER_LIBS} "uuid") + ENDIF() +ENDIF() + +SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS}) + +IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED) + MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.") +ENDIF() + +IF(EQEMU_BUILD_HC AND NOT TLS_LIBRARY_ENABLED) + MESSAGE(FATAL_ERROR "Headless client requires a TLS Library to build.") +ENDIF() + IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) ADD_SUBDIRECTORY(common) + ADD_SUBDIRECTORY(libs) ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) + +#IF(EQEMU_BUILD_SERVER) +# ADD_SUBDIRECTORY(shared_memory) +# ADD_SUBDIRECTORY(world) +# ADD_SUBDIRECTORY(zone) +# ADD_SUBDIRECTORY(ucs) +# ADD_SUBDIRECTORY(queryserv) +# ADD_SUBDIRECTORY(eqlaunch) +#ENDIF(EQEMU_BUILD_SERVER) +# +#IF(EQEMU_BUILD_LOGIN) +# ADD_SUBDIRECTORY(loginserver) +#ENDIF(EQEMU_BUILD_LOGIN) +# +#IF(EQEMU_BUILD_HC) +# ADD_SUBDIRECTORY(hc) +#ENDIF(EQEMU_BUILD_HC) +# +#IF(EQEMU_BUILD_TESTS) +# ADD_SUBDIRECTORY(tests) +#ENDIF(EQEMU_BUILD_TESTS) +# +#IF(EQEMU_BUILD_CLIENT_FILES) +# ADD_SUBDIRECTORY(client_files) +#ENDIF(EQEMU_BUILD_CLIENT_FILES) \ No newline at end of file diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index 74d95ee70..ac9e1224e 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -24,8 +24,8 @@ SET(lb_headers ) -ADD_LIBRARY(luabind ${lb_sources} ${lb_headers}) - +add_library(luabind ${lb_sources} ${lb_headers}) +target_link_libraries(luabind PRIVATE luajit) IF(UNIX) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) From af0fd14a387d77eb678a14b6c2f8865f992ba9b4 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 16:53:20 -0800 Subject: [PATCH 07/44] Fix common build. --- CMakeLists.txt | 7 ++++--- common/CMakeLists.txt | 2 ++ common/classes.cpp | 1 + common/cli/eqemu_command_handler.cpp | 1 + common/dynamic_zone_lockout.cpp | 1 + common/eqemu_config.h | 1 + common/eqemu_logsys.h | 1 + common/events/player_event_discord_formatter.cpp | 1 + common/file.cpp | 1 + common/ip_util.cpp | 1 + common/net/console_server.cpp | 1 + common/net/console_server_connection.cpp | 1 + common/net/packet.cpp | 1 + common/net/reliable_stream_connection.cpp | 1 + common/net/websocket_server.cpp | 1 + common/net/websocket_server_connection.cpp | 1 + common/process/process.cpp | 1 + common/profanity_manager.h | 2 +- common/rulesys.cpp | 1 + common/shareddb.cpp | 1 + common/strings.cpp | 1 + common/util/uuid.cpp | 1 + libs/luabind/CMakeLists.txt | 2 +- 23 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 490475b0b..22bcbe6c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,8 +90,6 @@ find_package(zlib-ng CONFIG REQUIRED) pkg_check_modules(luajit REQUIRED luajit) find_package(PerlLibs) -include_directories(SYSTEM "${Boost_INCLUDE_DIR}") - MESSAGE(STATUS "**************************************************") MESSAGE(STATUS "* Library Detection *") MESSAGE(STATUS "**************************************************") @@ -132,9 +130,12 @@ MESSAGE(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}") MESSAGE(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}") MESSAGE(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") MESSAGE(STATUS "PERL_VERSION: ${PERL_VERSION}") - MESSAGE(STATUS "**************************************************") +INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp") + +ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) + #options OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 45af7b94d..d2eb1fca0 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -835,6 +835,8 @@ INCLUDE_DIRECTORIES(Patches SocketLib StackWalker) ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories}) +target_link_libraries(common PRIVATE cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> zlib-ng::zlib) + IF (UNIX) SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0) diff --git a/common/classes.cpp b/common/classes.cpp index f849a5bfd..df1350004 100644 --- a/common/classes.cpp +++ b/common/classes.cpp @@ -16,6 +16,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include "../common/global_define.h" #include "../common/classes.h" #include "data_verification.h" diff --git a/common/cli/eqemu_command_handler.cpp b/common/cli/eqemu_command_handler.cpp index 9017adbb3..bf796b42b 100644 --- a/common/cli/eqemu_command_handler.cpp +++ b/common/cli/eqemu_command_handler.cpp @@ -19,6 +19,7 @@ */ #include +#include #include "eqemu_command_handler.h" #include "terminal_color.hpp" #include "../platform.h" diff --git a/common/dynamic_zone_lockout.cpp b/common/dynamic_zone_lockout.cpp index a47a9e205..a714dc101 100644 --- a/common/dynamic_zone_lockout.cpp +++ b/common/dynamic_zone_lockout.cpp @@ -3,6 +3,7 @@ #include "rulesys.h" #include "util/uuid.h" #include +#include #include DzLockout::DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration) diff --git a/common/eqemu_config.h b/common/eqemu_config.h index 57a0543c8..94b0fea52 100644 --- a/common/eqemu_config.h +++ b/common/eqemu_config.h @@ -23,6 +23,7 @@ #include "path_manager.h" #include #include +#include struct LoginConfig { std::string LoginHost; diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 0757b3e98..210d784f8 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -34,6 +34,7 @@ #endif #include +#include #include "types.h" namespace Logs { diff --git a/common/events/player_event_discord_formatter.cpp b/common/events/player_event_discord_formatter.cpp index 5b068f507..b25680902 100644 --- a/common/events/player_event_discord_formatter.cpp +++ b/common/events/player_event_discord_formatter.cpp @@ -3,6 +3,7 @@ #include "../json/json_archive_single_line.h" #include #include +#include #include #include diff --git a/common/file.cpp b/common/file.cpp index 97eec9051..df15255af 100644 --- a/common/file.cpp +++ b/common/file.cpp @@ -36,6 +36,7 @@ #endif #include +#include #include #include #include diff --git a/common/ip_util.cpp b/common/ip_util.cpp index df4abcfc0..c0316ea10 100644 --- a/common/ip_util.cpp +++ b/common/ip_util.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include "ip_util.h" diff --git a/common/net/console_server.cpp b/common/net/console_server.cpp index a5276f4cf..4cc2b2126 100644 --- a/common/net/console_server.cpp +++ b/common/net/console_server.cpp @@ -1,6 +1,7 @@ #include "console_server.h" #include "../strings.h" #include +#include EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port) { diff --git a/common/net/console_server_connection.cpp b/common/net/console_server_connection.cpp index e53058f67..47e321b80 100644 --- a/common/net/console_server_connection.cpp +++ b/common/net/console_server_connection.cpp @@ -5,6 +5,7 @@ #include "../servertalk.h" #include "../rulesys.h" #include +#include EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent, std::shared_ptr connection) { diff --git a/common/net/packet.cpp b/common/net/packet.cpp index 1ae959e62..a4ec4b498 100644 --- a/common/net/packet.cpp +++ b/common/net/packet.cpp @@ -2,6 +2,7 @@ #include "endian.h" #include #include +#include void EQ::Net::Packet::PutInt8(size_t offset, int8_t value) { diff --git a/common/net/reliable_stream_connection.cpp b/common/net/reliable_stream_connection.cpp index e1101f452..c75bfe77a 100644 --- a/common/net/reliable_stream_connection.cpp +++ b/common/net/reliable_stream_connection.cpp @@ -4,6 +4,7 @@ #include "crc32.h" #include #include +#include // observed client receive window is 300 packets, 140KB constexpr size_t MAX_CLIENT_RECV_PACKETS_PER_WINDOW = 300; diff --git a/common/net/websocket_server.cpp b/common/net/websocket_server.cpp index f74f437ba..1e8b80b64 100644 --- a/common/net/websocket_server.cpp +++ b/common/net/websocket_server.cpp @@ -2,6 +2,7 @@ #include "../event/event_loop.h" #include "../event/timer.h" #include +#include #include #include #include diff --git a/common/net/websocket_server_connection.cpp b/common/net/websocket_server_connection.cpp index 3c1271518..36e85eb74 100644 --- a/common/net/websocket_server_connection.cpp +++ b/common/net/websocket_server_connection.cpp @@ -4,6 +4,7 @@ #include "../util/uuid.h" #include #include +#include struct EQ::Net::WebsocketServerConnection::Impl { WebsocketServer *parent; diff --git a/common/process/process.cpp b/common/process/process.cpp index 56bbeff2b..92bf757f4 100644 --- a/common/process/process.cpp +++ b/common/process/process.cpp @@ -2,6 +2,7 @@ #include #include "process.h" #include +#include std::string Process::execute(const std::string &cmd) { diff --git a/common/profanity_manager.h b/common/profanity_manager.h index 311ca19e0..165b6516e 100644 --- a/common/profanity_manager.h +++ b/common/profanity_manager.h @@ -23,7 +23,7 @@ #include #include #include - +#include class DBcore; diff --git a/common/rulesys.cpp b/common/rulesys.cpp index f73112b1b..3e6f833a8 100644 --- a/common/rulesys.cpp +++ b/common/rulesys.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "../common/repositories/rule_sets_repository.h" #include "../common/repositories/rule_values_repository.h" diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 0ef0cbe4e..89da73410 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #if defined(_MSC_VER) && _MSC_VER >= 1800 #include diff --git a/common/strings.cpp b/common/strings.cpp index eb56ab2f5..cdb754cad 100644 --- a/common/strings.cpp +++ b/common/strings.cpp @@ -36,6 +36,7 @@ #include "strings.h" #include #include +#include #include #include diff --git a/common/util/uuid.cpp b/common/util/uuid.cpp index 7acd1517f..1e221b5b9 100644 --- a/common/util/uuid.cpp +++ b/common/util/uuid.cpp @@ -2,6 +2,7 @@ #include #include +#include #ifdef _WIN32 #include diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index ac9e1224e..b261f4c60 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -25,7 +25,7 @@ SET(lb_headers ) add_library(luabind ${lb_sources} ${lb_headers}) -target_link_libraries(luabind PRIVATE luajit) +target_link_libraries(luabind PRIVATE luajit Boost::dynamic_bitset Boost::tuple Boost::foreach) IF(UNIX) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) From f72474216f71c1d8d4b5a0021662ed981553dbdb Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:21:10 -0800 Subject: [PATCH 08/44] shared_memory compiles --- CMakeLists.txt | 8 ++++---- common/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22bcbe6c5..6466753eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -296,15 +296,15 @@ IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_H ADD_SUBDIRECTORY(libs) ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) -#IF(EQEMU_BUILD_SERVER) -# ADD_SUBDIRECTORY(shared_memory) +IF(EQEMU_BUILD_SERVER) + ADD_SUBDIRECTORY(shared_memory) # ADD_SUBDIRECTORY(world) # ADD_SUBDIRECTORY(zone) # ADD_SUBDIRECTORY(ucs) # ADD_SUBDIRECTORY(queryserv) # ADD_SUBDIRECTORY(eqlaunch) -#ENDIF(EQEMU_BUILD_SERVER) -# +ENDIF(EQEMU_BUILD_SERVER) + #IF(EQEMU_BUILD_LOGIN) # ADD_SUBDIRECTORY(loginserver) #ENDIF(EQEMU_BUILD_LOGIN) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d2eb1fca0..5835a874b 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -835,7 +835,7 @@ INCLUDE_DIRECTORIES(Patches SocketLib StackWalker) ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories}) -target_link_libraries(common PRIVATE cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> zlib-ng::zlib) +target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> zlib-ng::zlib OpenSSL::SSL OpenSSL::Crypto) IF (UNIX) SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) From 625cfdb17984fac2b91d62de0854e63867477d06 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:22:00 -0800 Subject: [PATCH 09/44] client files compile --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6466753eb..e4a14346e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,7 +316,7 @@ ENDIF(EQEMU_BUILD_SERVER) #IF(EQEMU_BUILD_TESTS) # ADD_SUBDIRECTORY(tests) #ENDIF(EQEMU_BUILD_TESTS) -# -#IF(EQEMU_BUILD_CLIENT_FILES) -# ADD_SUBDIRECTORY(client_files) -#ENDIF(EQEMU_BUILD_CLIENT_FILES) \ No newline at end of file + +IF(EQEMU_BUILD_CLIENT_FILES) + ADD_SUBDIRECTORY(client_files) +ENDIF(EQEMU_BUILD_CLIENT_FILES) \ No newline at end of file From b9f8d7c3b17da3cf9b7566eff4b8275551ce7c89 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:26:34 -0800 Subject: [PATCH 10/44] Tests and more cmake version updates --- CMakeLists.txt | 8 ++++---- client_files/export/CMakeLists.txt | 2 +- client_files/import/CMakeLists.txt | 2 +- common/CMakeLists.txt | 2 +- libs/luabind/CMakeLists.txt | 2 +- libs/perlbind/CMakeLists.txt | 2 +- shared_memory/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 4 ++-- tests/cppunit/CMakeLists.txt | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4a14346e..a62656aad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,10 +312,10 @@ ENDIF(EQEMU_BUILD_SERVER) #IF(EQEMU_BUILD_HC) # ADD_SUBDIRECTORY(hc) #ENDIF(EQEMU_BUILD_HC) -# -#IF(EQEMU_BUILD_TESTS) -# ADD_SUBDIRECTORY(tests) -#ENDIF(EQEMU_BUILD_TESTS) + +IF(EQEMU_BUILD_TESTS) + ADD_SUBDIRECTORY(tests) +ENDIF(EQEMU_BUILD_TESTS) IF(EQEMU_BUILD_CLIENT_FILES) ADD_SUBDIRECTORY(client_files) diff --git a/client_files/export/CMakeLists.txt b/client_files/export/CMakeLists.txt index b7f15dddb..985a18b79 100644 --- a/client_files/export/CMakeLists.txt +++ b/client_files/export/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) SET(export_sources main.cpp diff --git a/client_files/import/CMakeLists.txt b/client_files/import/CMakeLists.txt index da08cda6e..673f6ec7f 100644 --- a/client_files/import/CMakeLists.txt +++ b/client_files/import/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) SET(import_sources main.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5835a874b..81bff171d 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) SET(common_sources base_packet.cpp diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index b261f4c60..7410cf506 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) SET(lb_sources src/class.cpp diff --git a/libs/perlbind/CMakeLists.txt b/libs/perlbind/CMakeLists.txt index c03dd8e3a..7facb84fe 100644 --- a/libs/perlbind/CMakeLists.txt +++ b/libs/perlbind/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.7) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) project(perlbind LANGUAGES CXX) diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index c192e6540..7c62403bd 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) SET(shared_memory_sources items.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6ed82f5b8..2310d765a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.2) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) ADD_SUBDIRECTORY(cppunit) @@ -21,7 +21,7 @@ SET(tests_headers ADD_EXECUTABLE(tests ${tests_sources} ${tests_headers}) -TARGET_LINK_LIBRARIES(tests common cppunit fmt ${SERVER_LIBS}) +TARGET_LINK_LIBRARIES(tests common cppunit ${SERVER_LIBS}) INSTALL(TARGETS tests RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) diff --git a/tests/cppunit/CMakeLists.txt b/tests/cppunit/CMakeLists.txt index 7b7e4c749..e8f602d82 100644 --- a/tests/cppunit/CMakeLists.txt +++ b/tests/cppunit/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.2) +CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) SET(cppunit_sources collectoroutput.cpp From 897512a43eb6338be8505929ad6259dd1813ec92 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:43:58 -0800 Subject: [PATCH 11/44] World, had to swap out zlib-ng for now because it wasn't playing nicely along side the zlib install. May revisit. --- CMakeLists.txt | 4 ++-- common/CMakeLists.txt | 2 +- vcpkg.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a62656aad..678ad292b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ find_package(unofficial-libmariadb CONFIG REQUIRED) find_package(libuv CONFIG REQUIRED) find_package(OpenSSL REQUIRED) find_package(recastnavigation CONFIG REQUIRED) -find_package(zlib-ng CONFIG REQUIRED) +find_package(ZLIB REQUIRED) pkg_check_modules(luajit REQUIRED luajit) find_package(PerlLibs) @@ -298,7 +298,7 @@ ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUIL IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(shared_memory) -# ADD_SUBDIRECTORY(world) + ADD_SUBDIRECTORY(world) # ADD_SUBDIRECTORY(zone) # ADD_SUBDIRECTORY(ucs) # ADD_SUBDIRECTORY(queryserv) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 81bff171d..5abd18607 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -835,7 +835,7 @@ INCLUDE_DIRECTORIES(Patches SocketLib StackWalker) ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories}) -target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> zlib-ng::zlib OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) IF (UNIX) SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) diff --git a/vcpkg.json b/vcpkg.json index f5b39ddf8..bdcf7d247 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -6,7 +6,7 @@ "boost-foreach", "boost-tuple", "libmariadb", - "zlib-ng", + "zlib", "openssl", "luajit", "cereal", From 2d30df179c18f5f84335fdc08c02d3625215d24d Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:47:54 -0800 Subject: [PATCH 12/44] UCS compiles now too! --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 678ad292b..e546eab95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,7 +300,7 @@ IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(shared_memory) ADD_SUBDIRECTORY(world) # ADD_SUBDIRECTORY(zone) -# ADD_SUBDIRECTORY(ucs) + ADD_SUBDIRECTORY(ucs) # ADD_SUBDIRECTORY(queryserv) # ADD_SUBDIRECTORY(eqlaunch) ENDIF(EQEMU_BUILD_SERVER) From 95b91431dd2ac10d2690ae48983d0ed60f22bbe8 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:48:55 -0800 Subject: [PATCH 13/44] queryserv and eqlaunch --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e546eab95..c098f34b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,8 +301,8 @@ IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(world) # ADD_SUBDIRECTORY(zone) ADD_SUBDIRECTORY(ucs) -# ADD_SUBDIRECTORY(queryserv) -# ADD_SUBDIRECTORY(eqlaunch) + ADD_SUBDIRECTORY(queryserv) + ADD_SUBDIRECTORY(eqlaunch) ENDIF(EQEMU_BUILD_SERVER) #IF(EQEMU_BUILD_LOGIN) From 87076e8487ce52d7de61c9a3652a43783eb9134a Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 22:52:45 -0800 Subject: [PATCH 14/44] loginserver works --- CMakeLists.txt | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c098f34b6..8583b0463 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,6 @@ ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON) -OPTION(EQEMU_BUILD_HC "Build the headless client." OFF) OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF) OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF) @@ -287,14 +286,10 @@ IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED) MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.") ENDIF() -IF(EQEMU_BUILD_HC AND NOT TLS_LIBRARY_ENABLED) - MESSAGE(FATAL_ERROR "Headless client requires a TLS Library to build.") -ENDIF() - -IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) +IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(libs) -ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC) +ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(shared_memory) @@ -305,13 +300,9 @@ IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(eqlaunch) ENDIF(EQEMU_BUILD_SERVER) -#IF(EQEMU_BUILD_LOGIN) -# ADD_SUBDIRECTORY(loginserver) -#ENDIF(EQEMU_BUILD_LOGIN) -# -#IF(EQEMU_BUILD_HC) -# ADD_SUBDIRECTORY(hc) -#ENDIF(EQEMU_BUILD_HC) +IF(EQEMU_BUILD_LOGIN) + ADD_SUBDIRECTORY(loginserver) +ENDIF(EQEMU_BUILD_LOGIN) IF(EQEMU_BUILD_TESTS) ADD_SUBDIRECTORY(tests) From 2239bba2c5359549ce26d3a68f22d9c4c17f401c Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 16 Nov 2025 23:20:03 -0800 Subject: [PATCH 15/44] Zone works but is messy, tomorrow futher cleanup! --- CMakeLists.txt | 6 +++--- libs/luabind/CMakeLists.txt | 2 +- zone/CMakeLists.txt | 11 ++++++++--- zone/pathfinder_nav_mesh.cpp | 4 ++-- zone/pathfinder_nav_mesh.h | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8583b0463..38ff72e0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ find_package(libuv CONFIG REQUIRED) find_package(OpenSSL REQUIRED) find_package(recastnavigation CONFIG REQUIRED) find_package(ZLIB REQUIRED) -pkg_check_modules(luajit REQUIRED luajit) +pkg_check_modules(luajit REQUIRED IMPORTED_TARGET luajit) find_package(PerlLibs) MESSAGE(STATUS "**************************************************") @@ -241,7 +241,7 @@ IF(LUA_LIBRARY_ENABLED) IF(EQEMU_BUILD_LUA) ADD_DEFINITIONS(-DLUA_EQEMU) - SET(ZONE_LIBS ${pkgcfg_lib_luajit_lua51}) + #SET(ZONE_LIBS ${pkgcfg_lib_luajit_lua51}) include_directories(SYSTEM "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/luajit" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) @@ -294,7 +294,7 @@ ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) IF(EQEMU_BUILD_SERVER) ADD_SUBDIRECTORY(shared_memory) ADD_SUBDIRECTORY(world) -# ADD_SUBDIRECTORY(zone) + ADD_SUBDIRECTORY(zone) ADD_SUBDIRECTORY(ucs) ADD_SUBDIRECTORY(queryserv) ADD_SUBDIRECTORY(eqlaunch) diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index 7410cf506..f891185a7 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -25,7 +25,7 @@ SET(lb_headers ) add_library(luabind ${lb_sources} ${lb_headers}) -target_link_libraries(luabind PRIVATE luajit Boost::dynamic_bitset Boost::tuple Boost::foreach) +target_link_libraries(luabind PRIVATE PkgConfig::luajit Boost::dynamic_bitset Boost::tuple Boost::foreach) IF(UNIX) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index ffea99f78..6e1cb4743 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -472,6 +472,7 @@ set(gm_command_sources ) add_library(gm_commands_zone STATIC ${gm_command_sources}) +target_link_libraries(gm_commands_zone PRIVATE cereal::cereal fmt::fmt $,libuv::uv_a,libuv::uv> unofficial::libmariadb) set_target_properties(gm_commands_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 32) # zone combine sources and headers @@ -490,19 +491,23 @@ ENDIF() ADD_DEFINITIONS(-DZONE) # link lua_zone unity build against luabind -target_link_libraries(lua_zone PRIVATE luabind) +IF(MSVC) + target_compile_options(lua_zone PRIVATE /utf-8) +ENDIF(MSVC) + +target_link_libraries(lua_zone PRIVATE luabind Boost::dynamic_bitset Boost::tuple Boost::foreach unofficial::libmariadb) if (EQEMU_BUILD_STATIC AND LUA_LIBRARY) target_link_libraries(zone PRIVATE ${LUA_LIBRARY}) endif() # perl unity build links against perl_zone -target_link_libraries(perl_zone PRIVATE perlbind) +target_link_libraries(perl_zone PRIVATE perlbind fmt::fmt unofficial::libmariadb) if (EQEMU_BUILD_STATIC AND PERL_LIBRARY) target_link_libraries(zone PRIVATE ${PERL_LIBRARY}) endif() # link zone against common libraries -target_link_libraries(zone PRIVATE lua_zone perl_zone gm_commands_zone ${ZONE_LIBS}) +target_link_libraries(zone PRIVATE lua_zone perl_zone gm_commands_zone ${ZONE_LIBS} RecastNavigation::Detour) SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/zone/pathfinder_nav_mesh.cpp b/zone/pathfinder_nav_mesh.cpp index 22dd12249..5cf89f091 100644 --- a/zone/pathfinder_nav_mesh.cpp +++ b/zone/pathfinder_nav_mesh.cpp @@ -2,8 +2,8 @@ #include #include #include "pathfinder_nav_mesh.h" -#include -#include +#include +#include #include "zone.h" #include "water_map.h" diff --git a/zone/pathfinder_nav_mesh.h b/zone/pathfinder_nav_mesh.h index 9f7bf4120..3b10cc23c 100644 --- a/zone/pathfinder_nav_mesh.h +++ b/zone/pathfinder_nav_mesh.h @@ -2,7 +2,7 @@ #include "pathfinder_interface.h" #include -#include +#include class PathfinderNavmesh : public IPathfinder { From e81f36c0a6f20776f26a4eda934e0b1a96a2e7d7 Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 20 Nov 2025 22:41:35 -0800 Subject: [PATCH 16/44] Cleanup main file --- CMakeLists.txt | 470 +++++++++++++++++++++++-------------------------- 1 file changed, 223 insertions(+), 247 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38ff72e0c..2fd5ee965 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,81 +1,81 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -IF(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) - MESSAGE(STATUS "Using vcpkg env variable") - SET(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") -ELSEIF(NOT DEFINED CMAKE_TOOLCHAIN_FILE) - MESSAGE(STATUS "Using vcpkg submodule") - SET(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") -ENDIF() +if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) + message(STATUS "Using vcpkg env variable") + set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") +elseif(NOT DEFINED CMAKE_TOOLCHAIN_FILE) + message(STATUS "Using vcpkg submodule") + set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") +endif() -PROJECT(EQEmu) +project(EQEmu) -IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) -ENDIF(NOT CMAKE_BUILD_TYPE) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) +endif() -SET(CMAKE_CXX_STANDARD 20) -SET(CMAKE_CXX_STANDARD_REQUIRED ON) -SET(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) -OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF) -OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) +option(EQEMU_BUILD_STATIC "Build with static linking" OFF) +option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) -IF (EQEMU_BUILD_STATIC) - SET(BUILD_SHARED_LIBS OFF) - SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") - MESSAGE(STATUS "Building with static linking") - SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") - IF (UNIX) - SET(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so") - SET(PERL_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/") - SET(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl") - ENDIF () -ENDIF (EQEMU_BUILD_STATIC) +if(EQEMU_BUILD_STATIC) + set(BUILD_SHARED_LIBS OFF) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") + message(STATUS "Building with static linking") + set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") + if(UNIX) + set(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so") + set(PERL_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/") + set(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl") + endif() +endif() # Requires libgoogle-perftools-dev google-perftools packages for linux (debian) -IF(EQEMU_ADD_PROFILER) - SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") -ENDIF(EQEMU_ADD_PROFILER) +if(EQEMU_ADD_PROFILER) + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") +endif() -IF(USE_MAP_MMFS) - ADD_DEFINITIONS(-DUSE_MAP_MMFS) -ENDIF (USE_MAP_MMFS) +if(USE_MAP_MMFS) + add_definitions(-DUSE_MAP_MMFS) +endif() -IF(MSVC) +if(MSVC) add_compile_options(/bigobj) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) - ADD_DEFINITIONS(-DNOMINMAX) - ADD_DEFINITIONS(-DCRASH_LOGGING) - ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17 + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DNOMINMAX) + add_definitions(-DCRASH_LOGGING) + add_definitions(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17 - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - OPTION(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON) - IF(EQEMU_DISABLE_MSVC_WARNINGS) - ADD_DEFINITIONS( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os") - ENDIF(EQEMU_DISABLE_MSVC_WARNINGS) -ELSE(MSVC) - ADD_DEFINITIONS(-DHAS_UNION_SEMUN) -ENDIF(MSVC) + option(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON) + if(EQEMU_DISABLE_MSVC_WARNINGS) + add_definitions( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os") + endif() +else(MSVC) + add_definitions(-DHAS_UNION_SEMUN) +endif() #FreeBSD support -IF(UNIX) - IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - ADD_DEFINITIONS(-DFREEBSD) - ADD_DEFINITIONS(-D_GLIBCXX_USE_C99) - SET(FREEBSD TRUE) - ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") - ADD_DEFINITIONS(-DDARWIN) - SET(DARWIN TRUE) - ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") -ENDIF(UNIX) +if(UNIX) + if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + add_definitions(-DFREEBSD) + add_definitions(-D_GLIBCXX_USE_C99) + set(FREEBSD TRUE) + endif() + if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + add_definitions(-DDARWIN) + set(DARWIN TRUE) + endif() +endif() -ADD_DEFINITIONS(-DGLM_FORCE_RADIANS) -ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT) -ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL) +add_definitions(-DGLM_FORCE_RADIANS) +add_definitions(-DGLM_FORCE_CTOR_INIT) +add_definitions(-DGLM_ENABLE_EXPERIMENTAL) find_package(PkgConfig) find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple) @@ -90,224 +90,200 @@ find_package(ZLIB REQUIRED) pkg_check_modules(luajit REQUIRED IMPORTED_TARGET luajit) find_package(PerlLibs) -MESSAGE(STATUS "**************************************************") -MESSAGE(STATUS "* Library Detection *") -MESSAGE(STATUS "**************************************************") +message(STATUS "**************************************************") +message(STATUS "* Library Detection *") +message(STATUS "**************************************************") -IF(MARIADB_FOUND) - MESSAGE(STATUS "* MariaDB: FOUND *") -ELSE() - MESSAGE(STATUS "* MariaDB: MISSING *") -ENDIF() +if(MARIADB_FOUND) + message(STATUS "* MariaDB: FOUND *") +else() + message(STATUS "* MariaDB: MISSING *") +endif() -IF(ZLIB_FOUND) - MESSAGE(STATUS "* ZLIB: FOUND *") -ELSE() - MESSAGE(STATUS "* ZLIB: MISSING *") -ENDIF() +if(ZLIB_FOUND) + message(STATUS "* ZLIB: FOUND *") +else() + message(STATUS "* ZLIB: MISSING *") +endif() -IF(LuaJit_FOUND) - MESSAGE(STATUS "* LuaJIT: FOUND *") -ELSE() - MESSAGE(STATUS "* LuaJIT: MISSING *") -ENDIF() +if(LuaJit_FOUND) + message(STATUS "* LuaJIT: FOUND *") +else() + message(STATUS "* LuaJIT: MISSING *") +endif() -IF(PerlLibs_FOUND) - MESSAGE(STATUS "* Perl: FOUND *") -ELSE() - MESSAGE(STATUS "* Perl: MISSING *") -ENDIF() +if(PerlLibs_FOUND) + message(STATUS "* Perl: FOUND *") +else() + message(STATUS "* Perl: MISSING *") +endif() -IF(OpenSSL_FOUND) - MESSAGE(STATUS "* OpenSSL: FOUND *") -ELSE() - MESSAGE(STATUS "* OpenSSL: MISSING *") -ENDIF() +if(OpenSSL_FOUND) + message(STATUS "* OpenSSL: FOUND *") +else() + message(STATUS "* OpenSSL: MISSING *") +endif() -MESSAGE(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}") -MESSAGE(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}") -MESSAGE(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}") -MESSAGE(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}") -MESSAGE(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") -MESSAGE(STATUS "PERL_VERSION: ${PERL_VERSION}") -MESSAGE(STATUS "**************************************************") +message(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}") +message(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}") +message(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}") +message(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}") +message(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") +message(STATUS "PERL_VERSION: ${PERL_VERSION}") +message(STATUS "**************************************************") -INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp") +include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp") -ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) +add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) #options -OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) -OPTION(EQEMU_BUILD_SERVER "Build the game server." ON) -OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON) -OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF) -OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) -OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF) +option(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) +option(EQEMU_BUILD_SERVER "Build the game server." ON) +option(EQEMU_BUILD_LOGIN "Build the login server." ON) +option(EQEMU_BUILD_TESTS "Build utility tests." OFF) +option(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) +option(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF) #PRNG options -OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF) -MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG) -OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF) -MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST) -SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)") -MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE) +option(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF) +mark_as_advanced(EQEMU_ADDITIVE_LFIB_PRNG) +option(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF) +mark_as_advanced(EQEMU_BIASED_INT_DIST) +set(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)") +mark_as_advanced(EQEMU_CUSTOM_PRNG_ENGINE) -IF(CMAKE_COMPILER_IS_GNUCXX) - OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF) - MARK_AS_ADVANCED(EQEMU_SFMT19937) -ENDIF() +if(CMAKE_COMPILER_IS_GNUCXX) + option(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF) + mark_as_advanced(EQEMU_SFMT19937) +endif() -IF(EQEMU_ADDITIVE_LFIB_PRNG) - ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG) - IF(EQEMU_SFMT19937) - MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.") - SET(EQEMU_SFMT19937 OFF) - ENDIF() - IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.") - SET(EQEMU_CUSTOM_PRNG_ENGINE "") - ENDIF() -ENDIF() +if(EQEMU_ADDITIVE_LFIB_PRNG) + add_definitions(-DUSE_ADDITIVE_LFIB_PRNG) + if(EQEMU_SFMT19937) + message(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.") + set(EQEMU_SFMT19937 OFF) + endif() + if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + message(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.") + set(EQEMU_CUSTOM_PRNG_ENGINE "") + endif() +endif() -IF(EQEMU_SFMT19937) - ADD_DEFINITIONS(-DUSE_SFMT19937) - IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.") - SET(EQEMU_CUSTOM_PRNG_ENGINE "") - ENDIF() -ENDIF() +if(EQEMU_SFMT19937) + add_definitions(-DUSE_SFMT19937) + if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + message(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.") + set(EQEMU_CUSTOM_PRNG_ENGINE "") + endif() +endif() -IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE}) -ENDIF() +if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + add_definitions(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE}) +endif() -IF(EQEMU_BIASED_INT_DIST) - ADD_DEFINITIONS(-DBIASED_INT_DIST) -ENDIF() +if(EQEMU_BIASED_INT_DIST) + add_definitions(-DBIASED_INT_DIST) +endif() -IF(EQEMU_COMMANDS_LOGGING) - ADD_DEFINITIONS(-DCOMMANDS_LOGGING) -ENDIF(EQEMU_COMMANDS_LOGGING) +if(EQEMU_COMMANDS_LOGGING) + add_definitions(-DCOMMANDS_LOGGING) +endif() -SET(DATABASE_LIBRARY_TYPE "MariaDB") -SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES}) -SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR}) -SET(TLS_LIBRARY_TYPE " OpenSSL") -SET(TLS_LIBRARY_ENABLED ON) -SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES}) -SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR}) -ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL) -IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") - ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT) -ENDIF() +if(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") + add_definitions(-DCPPHTTPLIB_OPENSSL_SUPPORT) +endif() -SET(LUA_LIBRARY_TYPE " LuaJIT") -SET(LUA_LIBRARY_ENABLED ON) +if(PerlLibs_FOUND) + set(PERL_LIBRARY_TYPE " Perl") + set(PERL_LIBRARY_ENABLED ON) + set(PERL_LIBRARY_LIBS ${PERL_LIBRARY}) + set(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH}) +else() + set(PERL_LIBRARY_TYPE "Disabled") + set(PERL_LIBRARY_ENABLED OFF) +endif() -IF(PerlLibs_FOUND) - SET(PERL_LIBRARY_TYPE " Perl") - SET(PERL_LIBRARY_ENABLED ON) - SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY}) - SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH}) -ELSE() - SET(PERL_LIBRARY_TYPE "Disabled") - SET(PERL_LIBRARY_ENABLED OFF) -ENDIF() +message(STATUS "") +message(STATUS "**************************************************") +message(STATUS "* Library Usage *") +message(STATUS "**************************************************") +message(STATUS "* Database: MariaDB *") +message(STATUS "* TLS: OpenSSL *") +message(STATUS "* Lua: LuaJIT *") +message(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *") +message(STATUS "* zlib: ZLIB *") +message(STATUS "**************************************************") -SET(ZLIB_LIBRARY_TYPE "zlib-ng") -SET(ZLIB_LIBRARY_LIBS "zlibstatic") -SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng") -IF (EQEMU_BUILD_STATIC) - SET(ZLIB_LIBRARY_LIBS libz.a) -ENDIF(EQEMU_BUILD_STATIC) -MESSAGE(STATUS "") -MESSAGE(STATUS "**************************************************") -MESSAGE(STATUS "* Library Usage *") -MESSAGE(STATUS "**************************************************") -MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *") -MESSAGE(STATUS "* TLS: ${TLS_LIBRARY_TYPE} *") -MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *") -MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *") -MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *") -MESSAGE(STATUS "**************************************************") +option(EQEMU_BUILD_LUA "Build Lua parser." ON) +if(EQEMU_BUILD_LUA) + add_definitions(-DLUA_EQEMU) + #set(ZONE_LIBS ${pkgcfg_lib_luajit_lua51}) + include_directories(SYSTEM "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/luajit" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") -SET(SERVER_LIBS common) -# silence obnoxious deprecation message -ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) + option(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) + if(EQEMU_SANITIZE_LUA_LIBS) + add_definitions(-DSANITIZE_LUA_LIBS) + endif() +endif() -IF(LUA_LIBRARY_ENABLED) - OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON) - - IF(EQEMU_BUILD_LUA) - ADD_DEFINITIONS(-DLUA_EQEMU) - #SET(ZONE_LIBS ${pkgcfg_lib_luajit_lua51}) - include_directories(SYSTEM "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/luajit" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") - - OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) - IF(EQEMU_SANITIZE_LUA_LIBS) - ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS) - ENDIF() - ENDIF() -ENDIF() - -IF(PERL_LIBRARY_ENABLED) - OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON) - IF(EQEMU_BUILD_PERL) - SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) +if(PERL_LIBRARY_ENABLED) + option(EQEMU_BUILD_PERL "Build Perl parser." ON) + if(EQEMU_BUILD_PERL) + set(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}") - ADD_DEFINITIONS(-DEMBPERL) - ADD_DEFINITIONS(-DEMBPERL_PLUGIN) - ADD_DEFINITIONS(-DPERLBIND_NO_STRICT_SCALAR_TYPES) - IF (UNIX AND EQEMU_BUILD_STATIC) - SET(SERVER_LIBS ${SERVER_LIBS} libcrypt.a) - ENDIF () - ENDIF() -ENDIF() + add_definitions(-DEMBPERL) + add_definitions(-DEMBPERL_PLUGIN) + add_definitions(-DPERLBIND_NO_STRICT_SCALAR_TYPES) + if(UNIX AND EQEMU_BUILD_STATIC) + set(SERVER_LIBS ${SERVER_LIBS} libcrypt.a) + endif() + endif() +endif() -IF(WIN32) - SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv") -ENDIF() +set(SERVER_LIBS common) +# silence obnoxious deprecation message +add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) -IF(UNIX) - SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread") - IF(NOT DARWIN) - SET(SERVER_LIBS ${SERVER_LIBS} "rt") - ENDIF() +if(WIN32) + set(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv") +endif() + +if(UNIX) + set(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread") + if(NOT DARWIN) + set(SERVER_LIBS ${SERVER_LIBS} "rt") + endif() # Freebsd provides uuids in the C library - IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") - SET(SERVER_LIBS ${SERVER_LIBS} "uuid") - ENDIF() -ENDIF() + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(SERVER_LIBS ${SERVER_LIBS} "uuid") + endif() +endif() -SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS}) +set(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS}) -IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED) - MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.") -ENDIF() +if(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) + add_subdirectory(common) + add_subdirectory(libs) +endif() -IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) - ADD_SUBDIRECTORY(common) - ADD_SUBDIRECTORY(libs) -ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) +if(EQEMU_BUILD_SERVER) + add_subdirectory(shared_memory) + add_subdirectory(world) + add_subdirectory(zone) + add_subdirectory(ucs) + add_subdirectory(queryserv) + add_subdirectory(eqlaunch) +endif() -IF(EQEMU_BUILD_SERVER) - ADD_SUBDIRECTORY(shared_memory) - ADD_SUBDIRECTORY(world) - ADD_SUBDIRECTORY(zone) - ADD_SUBDIRECTORY(ucs) - ADD_SUBDIRECTORY(queryserv) - ADD_SUBDIRECTORY(eqlaunch) -ENDIF(EQEMU_BUILD_SERVER) +if(EQEMU_BUILD_LOGIN) + add_subdirectory(loginserver) +endif() -IF(EQEMU_BUILD_LOGIN) - ADD_SUBDIRECTORY(loginserver) -ENDIF(EQEMU_BUILD_LOGIN) +if(EQEMU_BUILD_TESTS) + add_subdirectory(tests) +endif() -IF(EQEMU_BUILD_TESTS) - ADD_SUBDIRECTORY(tests) -ENDIF(EQEMU_BUILD_TESTS) - -IF(EQEMU_BUILD_CLIENT_FILES) - ADD_SUBDIRECTORY(client_files) -ENDIF(EQEMU_BUILD_CLIENT_FILES) \ No newline at end of file +if(EQEMU_BUILD_CLIENT_FILES) + add_subdirectory(client_files) +endif() From 1168d3bc373f7f38804da6e8f020dee260c80c80 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 22 Nov 2025 17:41:19 -0800 Subject: [PATCH 17/44] remove old zlibng, remove perlwrap, remove hc --- common/CMakeLists.txt | 41 +- hc/CMakeLists.txt | 22 - hc/eq.cpp | 350 - hc/eq.h | 74 - hc/login.cpp | 255 - hc/login.h | 56 - hc/main.cpp | 51 - hc/world.cpp | 78 - hc/world.h | 31 - hc/zone.cpp | 0 hc/zone.h | 0 libs/CMakeLists.txt | 12 +- libs/luabind/CMakeLists.txt | 16 +- libs/perlbind/CMakeLists.txt | 2 +- libs/zlibng/.gitattributes | 4 - libs/zlibng/.github/workflows/analyze.yml | 39 - libs/zlibng/.github/workflows/cmake.yml | 381 - libs/zlibng/.github/workflows/configure.yml | 185 - libs/zlibng/.github/workflows/fuzz.yml | 23 - libs/zlibng/.github/workflows/libpng.yml | 46 - libs/zlibng/.github/workflows/nmake.yml | 48 - libs/zlibng/.github/workflows/pkgcheck.yml | 121 - libs/zlibng/.github/workflows/release.yml | 73 - libs/zlibng/.gitignore | 86 - libs/zlibng/.shellcheckrc | 1 - libs/zlibng/CMakeLists.txt | 1285 --- libs/zlibng/FAQ.zlib | 374 - libs/zlibng/INDEX.md | 37 - libs/zlibng/LICENSE.md | 19 - libs/zlibng/Makefile.in | 441 - libs/zlibng/README.md | 206 - libs/zlibng/adler32.c | 139 - libs/zlibng/adler32_p.h | 53 - libs/zlibng/arch/.gitignore | 2 - libs/zlibng/arch/arm/Makefile.in | 68 - libs/zlibng/arch/arm/adler32_neon.c | 126 - libs/zlibng/arch/arm/arm.h | 13 - libs/zlibng/arch/arm/armfeature.c | 69 - libs/zlibng/arch/arm/chunkset_neon.c | 54 - libs/zlibng/arch/arm/crc32_acle.c | 110 - libs/zlibng/arch/arm/ctzl.h | 12 - libs/zlibng/arch/arm/insert_string_acle.c | 22 - libs/zlibng/arch/arm/slide_neon.c | 52 - libs/zlibng/arch/generic/Makefile.in | 21 - libs/zlibng/arch/power/Makefile.in | 49 - libs/zlibng/arch/power/adler32_power8.c | 154 - libs/zlibng/arch/power/power.c | 19 - libs/zlibng/arch/power/power.h | 13 - libs/zlibng/arch/power/slide_hash_power8.c | 60 - libs/zlibng/arch/s390/Makefile.in | 40 - libs/zlibng/arch/s390/README.md | 216 - libs/zlibng/arch/s390/dfltcc_common.c | 89 - libs/zlibng/arch/s390/dfltcc_common.h | 29 - libs/zlibng/arch/s390/dfltcc_deflate.c | 406 - libs/zlibng/arch/s390/dfltcc_deflate.h | 56 - libs/zlibng/arch/s390/dfltcc_detail.h | 199 - libs/zlibng/arch/s390/dfltcc_inflate.c | 137 - libs/zlibng/arch/s390/dfltcc_inflate.h | 49 - libs/zlibng/arch/x86/INDEX.md | 8 - libs/zlibng/arch/x86/Makefile.in | 107 - libs/zlibng/arch/x86/adler32_avx.c | 117 - libs/zlibng/arch/x86/adler32_ssse3.c | 118 - libs/zlibng/arch/x86/chunkset_avx.c | 50 - libs/zlibng/arch/x86/chunkset_sse.c | 51 - libs/zlibng/arch/x86/compare258_avx.c | 67 - libs/zlibng/arch/x86/compare258_sse.c | 74 - libs/zlibng/arch/x86/crc_folding.c | 457 - libs/zlibng/arch/x86/crc_folding.h | 19 - libs/zlibng/arch/x86/insert_string_sse.c | 46 - libs/zlibng/arch/x86/slide_avx.c | 47 - libs/zlibng/arch/x86/slide_sse.c | 46 - libs/zlibng/arch/x86/x86.c | 80 - libs/zlibng/arch/x86/x86.h | 18 - libs/zlibng/chunkset.c | 81 - libs/zlibng/chunkset_tpl.h | 172 - libs/zlibng/cmake/detect-arch.c | 99 - libs/zlibng/cmake/detect-arch.cmake | 93 - libs/zlibng/cmake/detect-sanitizer.cmake | 123 - libs/zlibng/cmake/run-and-compare.cmake | 48 - libs/zlibng/cmake/run-and-redirect.cmake | 38 - libs/zlibng/cmake/test-compress.cmake | 188 - libs/zlibng/cmake/toolchain-aarch64.cmake | 26 - libs/zlibng/cmake/toolchain-arm.cmake | 24 - libs/zlibng/cmake/toolchain-mingw-i686.cmake | 16 - .../zlibng/cmake/toolchain-mingw-x86_64.cmake | 16 - libs/zlibng/cmake/toolchain-powerpc.cmake | 25 - libs/zlibng/cmake/toolchain-powerpc64.cmake | 25 - libs/zlibng/cmake/toolchain-powerpc64le.cmake | 25 - libs/zlibng/cmake/toolchain-s390x.cmake | 25 - libs/zlibng/cmake/toolchain-sparc64.cmake | 25 - libs/zlibng/compare258.c | 186 - libs/zlibng/compress.c | 83 - libs/zlibng/configure | 1725 ---- libs/zlibng/crc32.c | 202 - libs/zlibng/crc32_comb.c | 108 - libs/zlibng/crc32_comb_tbl.h | 300 - libs/zlibng/crc32_p.h | 19 - libs/zlibng/crc32_tbl.h | 444 - libs/zlibng/deflate.c | 1782 ---- libs/zlibng/deflate.h | 411 - libs/zlibng/deflate_fast.c | 106 - libs/zlibng/deflate_medium.c | 293 - libs/zlibng/deflate_p.h | 82 - libs/zlibng/deflate_quick.c | 121 - libs/zlibng/deflate_slow.c | 137 - libs/zlibng/doc/algorithm.txt | 209 - libs/zlibng/doc/rfc1950.txt | 619 -- libs/zlibng/doc/rfc1951.txt | 955 --- libs/zlibng/doc/rfc1952.txt | 675 -- libs/zlibng/doc/txtvsbin.txt | 107 - libs/zlibng/fallback_builtins.h | 44 - libs/zlibng/functable.c | 466 - libs/zlibng/functable.h | 29 - libs/zlibng/gzguts.h | 154 - libs/zlibng/gzlib.c | 543 -- libs/zlibng/gzread.c | 602 -- libs/zlibng/gzwrite.c | 526 -- libs/zlibng/infback.c | 510 -- libs/zlibng/inffast.c | 325 - libs/zlibng/inffast.h | 18 - libs/zlibng/inffixed_tbl.h | 94 - libs/zlibng/inflate.c | 1329 --- libs/zlibng/inflate.h | 134 - libs/zlibng/inflate_p.h | 101 - libs/zlibng/inftrees.c | 297 - libs/zlibng/inftrees.h | 66 - libs/zlibng/insert_string.c | 25 - libs/zlibng/insert_string_tpl.h | 89 - libs/zlibng/match_tpl.h | 180 - libs/zlibng/test/.gitignore | 5 - libs/zlibng/test/CVE-2002-0059/test.gz | Bin 4610 -> 0 bytes libs/zlibng/test/CVE-2003-0107.c | 22 - libs/zlibng/test/CVE-2004-0797/test.gz | Bin 52 -> 0 bytes libs/zlibng/test/CVE-2005-1849/test.gz | Bin 52 -> 0 bytes libs/zlibng/test/CVE-2005-2096/test.gz | Bin 52 -> 0 bytes libs/zlibng/test/GH-361/test.txt | 4 - libs/zlibng/test/GH-364/test.bin | Bin 8 -> 0 bytes libs/zlibng/test/GH-382/defneg3.dat | 1 - libs/zlibng/test/GH-751/test.txt | 1 - libs/zlibng/test/Makefile.in | 116 - libs/zlibng/test/README.md | 36 - libs/zlibng/test/abi/ignore | 12 - .../abi/zlib-v1.2.11-arm-linux-gnueabihf.abi | 119 - .../abi/zlib-v1.2.11-x86_64-linux-gnu.abi | 1037 --- libs/zlibng/test/abicheck.md | 59 - libs/zlibng/test/abicheck.sh | 164 - libs/zlibng/test/adler32_test.c | 365 - libs/zlibng/test/data/fireworks.jpg | Bin 123093 -> 0 bytes libs/zlibng/test/data/lcet10.txt | 7519 ----------------- libs/zlibng/test/data/paper-100k.pdf | 598 -- libs/zlibng/test/example.c | 1067 --- libs/zlibng/test/fuzz/checksum_fuzzer.c | 86 - libs/zlibng/test/fuzz/compress_fuzzer.c | 87 - libs/zlibng/test/fuzz/example_dict_fuzzer.c | 169 - libs/zlibng/test/fuzz/example_flush_fuzzer.c | 124 - libs/zlibng/test/fuzz/example_large_fuzzer.c | 141 - libs/zlibng/test/fuzz/example_small_fuzzer.c | 123 - libs/zlibng/test/fuzz/minigzip_fuzzer.c | 321 - .../test/fuzz/standalone_fuzz_target_runner.c | 36 - libs/zlibng/test/infcover.c | 682 -- libs/zlibng/test/minideflate.c | 307 - libs/zlibng/test/minigzip.c | 376 - libs/zlibng/test/pkgcheck.sh | 176 - libs/zlibng/test/switchlevels.c | 169 - libs/zlibng/test/testCVEinputs.sh | 30 - libs/zlibng/tools/codecov-upload.sh | 9 - libs/zlibng/tools/config.sub | 17 - libs/zlibng/tools/makecrct.c | 177 - libs/zlibng/tools/makefixed.c | 89 - libs/zlibng/tools/maketrees.c | 147 - libs/zlibng/trees.c | 822 -- libs/zlibng/trees.h | 40 - libs/zlibng/trees_emit.h | 228 - libs/zlibng/trees_tbl.h | 132 - libs/zlibng/uncompr.c | 85 - libs/zlibng/win32/DLL_FAQ.txt | 397 - libs/zlibng/win32/Makefile.a64 | 208 - libs/zlibng/win32/Makefile.arm | 220 - libs/zlibng/win32/Makefile.msc | 215 - libs/zlibng/win32/README-WIN32.txt | 103 - libs/zlibng/win32/zlib-ng.def | 60 - libs/zlibng/win32/zlib-ng1.rc | 40 - libs/zlibng/win32/zlib.def | 61 - libs/zlibng/win32/zlib1.rc | 40 - libs/zlibng/win32/zlibcompat.def | 94 - libs/zlibng/zbuild.h | 29 - libs/zlibng/zconf-ng.h.in | 177 - libs/zlibng/zconf.h.in | 185 - libs/zlibng/zendian.h | 60 - libs/zlibng/zlib-ng.h | 1888 ----- libs/zlibng/zlib-ng.map | 107 - libs/zlibng/zlib.3 | 149 - libs/zlibng/zlib.h | 1831 ---- libs/zlibng/zlib.map | 100 - libs/zlibng/zlib.pc.cmakein | 13 - libs/zlibng/zlib.pc.in | 13 - libs/zlibng/zutil.c | 111 - libs/zlibng/zutil.h | 254 - libs/zlibng/zutil_p.h | 34 - 199 files changed, 35 insertions(+), 45116 deletions(-) delete mode 100644 hc/CMakeLists.txt delete mode 100644 hc/eq.cpp delete mode 100644 hc/eq.h delete mode 100644 hc/login.cpp delete mode 100644 hc/login.h delete mode 100644 hc/main.cpp delete mode 100644 hc/world.cpp delete mode 100644 hc/world.h delete mode 100644 hc/zone.cpp delete mode 100644 hc/zone.h delete mode 100644 libs/zlibng/.gitattributes delete mode 100644 libs/zlibng/.github/workflows/analyze.yml delete mode 100644 libs/zlibng/.github/workflows/cmake.yml delete mode 100644 libs/zlibng/.github/workflows/configure.yml delete mode 100644 libs/zlibng/.github/workflows/fuzz.yml delete mode 100644 libs/zlibng/.github/workflows/libpng.yml delete mode 100644 libs/zlibng/.github/workflows/nmake.yml delete mode 100644 libs/zlibng/.github/workflows/pkgcheck.yml delete mode 100644 libs/zlibng/.github/workflows/release.yml delete mode 100644 libs/zlibng/.gitignore delete mode 100644 libs/zlibng/.shellcheckrc delete mode 100644 libs/zlibng/CMakeLists.txt delete mode 100644 libs/zlibng/FAQ.zlib delete mode 100644 libs/zlibng/INDEX.md delete mode 100644 libs/zlibng/LICENSE.md delete mode 100644 libs/zlibng/Makefile.in delete mode 100644 libs/zlibng/README.md delete mode 100644 libs/zlibng/adler32.c delete mode 100644 libs/zlibng/adler32_p.h delete mode 100644 libs/zlibng/arch/.gitignore delete mode 100644 libs/zlibng/arch/arm/Makefile.in delete mode 100644 libs/zlibng/arch/arm/adler32_neon.c delete mode 100644 libs/zlibng/arch/arm/arm.h delete mode 100644 libs/zlibng/arch/arm/armfeature.c delete mode 100644 libs/zlibng/arch/arm/chunkset_neon.c delete mode 100644 libs/zlibng/arch/arm/crc32_acle.c delete mode 100644 libs/zlibng/arch/arm/ctzl.h delete mode 100644 libs/zlibng/arch/arm/insert_string_acle.c delete mode 100644 libs/zlibng/arch/arm/slide_neon.c delete mode 100644 libs/zlibng/arch/generic/Makefile.in delete mode 100644 libs/zlibng/arch/power/Makefile.in delete mode 100644 libs/zlibng/arch/power/adler32_power8.c delete mode 100644 libs/zlibng/arch/power/power.c delete mode 100644 libs/zlibng/arch/power/power.h delete mode 100644 libs/zlibng/arch/power/slide_hash_power8.c delete mode 100644 libs/zlibng/arch/s390/Makefile.in delete mode 100644 libs/zlibng/arch/s390/README.md delete mode 100644 libs/zlibng/arch/s390/dfltcc_common.c delete mode 100644 libs/zlibng/arch/s390/dfltcc_common.h delete mode 100644 libs/zlibng/arch/s390/dfltcc_deflate.c delete mode 100644 libs/zlibng/arch/s390/dfltcc_deflate.h delete mode 100644 libs/zlibng/arch/s390/dfltcc_detail.h delete mode 100644 libs/zlibng/arch/s390/dfltcc_inflate.c delete mode 100644 libs/zlibng/arch/s390/dfltcc_inflate.h delete mode 100644 libs/zlibng/arch/x86/INDEX.md delete mode 100644 libs/zlibng/arch/x86/Makefile.in delete mode 100644 libs/zlibng/arch/x86/adler32_avx.c delete mode 100644 libs/zlibng/arch/x86/adler32_ssse3.c delete mode 100644 libs/zlibng/arch/x86/chunkset_avx.c delete mode 100644 libs/zlibng/arch/x86/chunkset_sse.c delete mode 100644 libs/zlibng/arch/x86/compare258_avx.c delete mode 100644 libs/zlibng/arch/x86/compare258_sse.c delete mode 100644 libs/zlibng/arch/x86/crc_folding.c delete mode 100644 libs/zlibng/arch/x86/crc_folding.h delete mode 100644 libs/zlibng/arch/x86/insert_string_sse.c delete mode 100644 libs/zlibng/arch/x86/slide_avx.c delete mode 100644 libs/zlibng/arch/x86/slide_sse.c delete mode 100644 libs/zlibng/arch/x86/x86.c delete mode 100644 libs/zlibng/arch/x86/x86.h delete mode 100644 libs/zlibng/chunkset.c delete mode 100644 libs/zlibng/chunkset_tpl.h delete mode 100644 libs/zlibng/cmake/detect-arch.c delete mode 100644 libs/zlibng/cmake/detect-arch.cmake delete mode 100644 libs/zlibng/cmake/detect-sanitizer.cmake delete mode 100644 libs/zlibng/cmake/run-and-compare.cmake delete mode 100644 libs/zlibng/cmake/run-and-redirect.cmake delete mode 100644 libs/zlibng/cmake/test-compress.cmake delete mode 100644 libs/zlibng/cmake/toolchain-aarch64.cmake delete mode 100644 libs/zlibng/cmake/toolchain-arm.cmake delete mode 100644 libs/zlibng/cmake/toolchain-mingw-i686.cmake delete mode 100644 libs/zlibng/cmake/toolchain-mingw-x86_64.cmake delete mode 100644 libs/zlibng/cmake/toolchain-powerpc.cmake delete mode 100644 libs/zlibng/cmake/toolchain-powerpc64.cmake delete mode 100644 libs/zlibng/cmake/toolchain-powerpc64le.cmake delete mode 100644 libs/zlibng/cmake/toolchain-s390x.cmake delete mode 100644 libs/zlibng/cmake/toolchain-sparc64.cmake delete mode 100644 libs/zlibng/compare258.c delete mode 100644 libs/zlibng/compress.c delete mode 100644 libs/zlibng/configure delete mode 100644 libs/zlibng/crc32.c delete mode 100644 libs/zlibng/crc32_comb.c delete mode 100644 libs/zlibng/crc32_comb_tbl.h delete mode 100644 libs/zlibng/crc32_p.h delete mode 100644 libs/zlibng/crc32_tbl.h delete mode 100644 libs/zlibng/deflate.c delete mode 100644 libs/zlibng/deflate.h delete mode 100644 libs/zlibng/deflate_fast.c delete mode 100644 libs/zlibng/deflate_medium.c delete mode 100644 libs/zlibng/deflate_p.h delete mode 100644 libs/zlibng/deflate_quick.c delete mode 100644 libs/zlibng/deflate_slow.c delete mode 100644 libs/zlibng/doc/algorithm.txt delete mode 100644 libs/zlibng/doc/rfc1950.txt delete mode 100644 libs/zlibng/doc/rfc1951.txt delete mode 100644 libs/zlibng/doc/rfc1952.txt delete mode 100644 libs/zlibng/doc/txtvsbin.txt delete mode 100644 libs/zlibng/fallback_builtins.h delete mode 100644 libs/zlibng/functable.c delete mode 100644 libs/zlibng/functable.h delete mode 100644 libs/zlibng/gzguts.h delete mode 100644 libs/zlibng/gzlib.c delete mode 100644 libs/zlibng/gzread.c delete mode 100644 libs/zlibng/gzwrite.c delete mode 100644 libs/zlibng/infback.c delete mode 100644 libs/zlibng/inffast.c delete mode 100644 libs/zlibng/inffast.h delete mode 100644 libs/zlibng/inffixed_tbl.h delete mode 100644 libs/zlibng/inflate.c delete mode 100644 libs/zlibng/inflate.h delete mode 100644 libs/zlibng/inflate_p.h delete mode 100644 libs/zlibng/inftrees.c delete mode 100644 libs/zlibng/inftrees.h delete mode 100644 libs/zlibng/insert_string.c delete mode 100644 libs/zlibng/insert_string_tpl.h delete mode 100644 libs/zlibng/match_tpl.h delete mode 100644 libs/zlibng/test/.gitignore delete mode 100644 libs/zlibng/test/CVE-2002-0059/test.gz delete mode 100644 libs/zlibng/test/CVE-2003-0107.c delete mode 100644 libs/zlibng/test/CVE-2004-0797/test.gz delete mode 100644 libs/zlibng/test/CVE-2005-1849/test.gz delete mode 100644 libs/zlibng/test/CVE-2005-2096/test.gz delete mode 100644 libs/zlibng/test/GH-361/test.txt delete mode 100644 libs/zlibng/test/GH-364/test.bin delete mode 100644 libs/zlibng/test/GH-382/defneg3.dat delete mode 100644 libs/zlibng/test/GH-751/test.txt delete mode 100644 libs/zlibng/test/Makefile.in delete mode 100644 libs/zlibng/test/README.md delete mode 100644 libs/zlibng/test/abi/ignore delete mode 100644 libs/zlibng/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi delete mode 100644 libs/zlibng/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi delete mode 100644 libs/zlibng/test/abicheck.md delete mode 100644 libs/zlibng/test/abicheck.sh delete mode 100644 libs/zlibng/test/adler32_test.c delete mode 100644 libs/zlibng/test/data/fireworks.jpg delete mode 100644 libs/zlibng/test/data/lcet10.txt delete mode 100644 libs/zlibng/test/data/paper-100k.pdf delete mode 100644 libs/zlibng/test/example.c delete mode 100644 libs/zlibng/test/fuzz/checksum_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/compress_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/example_dict_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/example_flush_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/example_large_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/example_small_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/minigzip_fuzzer.c delete mode 100644 libs/zlibng/test/fuzz/standalone_fuzz_target_runner.c delete mode 100644 libs/zlibng/test/infcover.c delete mode 100644 libs/zlibng/test/minideflate.c delete mode 100644 libs/zlibng/test/minigzip.c delete mode 100644 libs/zlibng/test/pkgcheck.sh delete mode 100644 libs/zlibng/test/switchlevels.c delete mode 100644 libs/zlibng/test/testCVEinputs.sh delete mode 100644 libs/zlibng/tools/codecov-upload.sh delete mode 100644 libs/zlibng/tools/config.sub delete mode 100644 libs/zlibng/tools/makecrct.c delete mode 100644 libs/zlibng/tools/makefixed.c delete mode 100644 libs/zlibng/tools/maketrees.c delete mode 100644 libs/zlibng/trees.c delete mode 100644 libs/zlibng/trees.h delete mode 100644 libs/zlibng/trees_emit.h delete mode 100644 libs/zlibng/trees_tbl.h delete mode 100644 libs/zlibng/uncompr.c delete mode 100644 libs/zlibng/win32/DLL_FAQ.txt delete mode 100644 libs/zlibng/win32/Makefile.a64 delete mode 100644 libs/zlibng/win32/Makefile.arm delete mode 100644 libs/zlibng/win32/Makefile.msc delete mode 100644 libs/zlibng/win32/README-WIN32.txt delete mode 100644 libs/zlibng/win32/zlib-ng.def delete mode 100644 libs/zlibng/win32/zlib-ng1.rc delete mode 100644 libs/zlibng/win32/zlib.def delete mode 100644 libs/zlibng/win32/zlib1.rc delete mode 100644 libs/zlibng/win32/zlibcompat.def delete mode 100644 libs/zlibng/zbuild.h delete mode 100644 libs/zlibng/zconf-ng.h.in delete mode 100644 libs/zlibng/zconf.h.in delete mode 100644 libs/zlibng/zendian.h delete mode 100644 libs/zlibng/zlib-ng.h delete mode 100644 libs/zlibng/zlib-ng.map delete mode 100644 libs/zlibng/zlib.3 delete mode 100644 libs/zlibng/zlib.h delete mode 100644 libs/zlibng/zlib.map delete mode 100644 libs/zlibng/zlib.pc.cmakein delete mode 100644 libs/zlibng/zlib.pc.in delete mode 100644 libs/zlibng/zutil.c delete mode 100644 libs/zlibng/zutil.h delete mode 100644 libs/zlibng/zutil_p.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5abd18607..b0d9c0b46 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -SET(common_sources +set(common_sources base_packet.cpp bazaar.cpp bodytypes.cpp @@ -132,7 +132,7 @@ SET(common_sources util/directory.cpp util/uuid.cpp) -SET(repositories +set(repositories # Criteria repositories/criteria/content_filter_criteria.h @@ -531,10 +531,9 @@ SET(repositories repositories/veteran_reward_templates_repository.h repositories/zone_repository.h repositories/zone_points_repository.h - ) -SET(common_headers +set(common_headers additive_lagged_fibonacci_engine.h bazaar.h base_packet.h @@ -723,19 +722,19 @@ SET(common_headers util/uuid.h ) -SOURCE_GROUP(Event FILES +source_group(Event FILES event/event_loop.h event/timer.h event/task.h ) -SOURCE_GROUP(Json FILES +source_group(Json FILES json/json.h json/jsoncpp.cpp json/json-forwards.h ) -SOURCE_GROUP(Net FILES +source_group(Net FILES net/console_server.cpp net/console_server.h net/console_server_connection.cpp @@ -774,7 +773,7 @@ SOURCE_GROUP(Net FILES net/websocket_server_connection.h ) -SOURCE_GROUP(Patches FILES +source_group(Patches FILES patches/patches.h patches/sod.h patches/sod_limits.h @@ -818,12 +817,12 @@ SOURCE_GROUP(Patches FILES patches/uf_limits.cpp ) -SOURCE_GROUP(StackWalker FILES +source_group(StackWalker FILES StackWalker/StackWalker.h StackWalker/StackWalker.cpp ) -SOURCE_GROUP(Util FILES +source_group(Util FILES util/memory_stream.h util/directory.cpp util/directory.h @@ -831,24 +830,24 @@ SOURCE_GROUP(Util FILES util/uuid.h ) -INCLUDE_DIRECTORIES(Patches SocketLib StackWalker) +include_directories(Patches SocketLib StackWalker) -ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories}) +add_library(common ${common_sources} ${common_headers} ${repositories}) target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) -IF (UNIX) - SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) - SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0) -ENDIF (UNIX) +if(UNIX) + set_source_files_properties("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) + set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0) +endif() -IF (EQEMU_BUILD_PCH) +if(EQEMU_BUILD_PCH) TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h) # Avoid PCH/__OPTIMIZE__ mismatch when compiling certain patch sources with -O0 # These files are compiled with -O0 on UNIX (see COMPILE_FLAGS above), which # disables the __OPTIMIZE__ predefined macro. Disabling PCH for them prevents # Clang from erroring due to macro state differences between the PCH and TU. - SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS ON) -ENDIF () + set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS ON) +endif() -SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/hc/CMakeLists.txt b/hc/CMakeLists.txt deleted file mode 100644 index 9f2c78298..000000000 --- a/hc/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.2) - -SET(hc_sources - eq.cpp - main.cpp - login.cpp - world.cpp -) - -SET(hc_headers - eq.h - login.h - world.h -) - -ADD_EXECUTABLE(hc ${hc_sources} ${hc_headers}) - -INSTALL(TARGETS hc RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - -TARGET_LINK_LIBRARIES(hc ${SERVER_LIBS}) - -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/hc/eq.cpp b/hc/eq.cpp deleted file mode 100644 index d8f2877d8..000000000 --- a/hc/eq.cpp +++ /dev/null @@ -1,350 +0,0 @@ -#include "eq.h" -#include "../common/net/dns.h" - -const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) { - DES_key_schedule k; - DES_cblock v; - - memset(&k, 0, sizeof(DES_key_schedule)); - memset(&v, 0, sizeof(DES_cblock)); - - if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) { - return nullptr; - } - - DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc); - return buffer_out; -} - -EverQuest::EverQuest(const std::string &host, int port, const std::string &user, const std::string &pass, const std::string &server, const std::string &character) -{ - m_host = host; - m_port = port; - m_user = user; - m_pass = pass; - m_server = server; - m_character = character; - m_dbid = 0; - - EQ::Net::DNSLookup(m_host, port, false, [&](const std::string &addr) { - if (addr.empty()) { - Log.OutF(Logs::General, Logs::Headless_Client, "Could not resolve address: {0}", m_host); - return; - } - else { - m_host = addr; - m_login_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager()); - - m_login_connection_manager->OnNewConnection(std::bind(&EverQuest::LoginOnNewConnection, this, std::placeholders::_1)); - m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_login_connection_manager->OnPacketRecv(std::bind(&EverQuest::LoginOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2)); - - m_login_connection_manager->Connect(m_host, m_port); - } - }); -} - -EverQuest::~EverQuest() -{ -} - -void EverQuest::LoginOnNewConnection(std::shared_ptr connection) -{ - m_login_connection = connection; - Log.OutF(Logs::General, Logs::Headless_Client, "Connecting..."); -} - -void EverQuest::LoginOnStatusChangeReconnectEnabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusConnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "Login connected."); - LoginSendSessionReady(); - } - - if (to == EQ::Net::StatusDisconnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "Login connection lost before we got to world, reconnecting."); - m_key.clear(); - m_dbid = 0; - m_login_connection.reset(); - m_login_connection_manager->Connect(m_host, m_port); - } -} - -void EverQuest::LoginOnStatusChangeReconnectDisabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusDisconnected) { - m_login_connection.reset(); - } -} - -void EverQuest::LoginOnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet & p) -{ - auto opcode = p.GetUInt16(0); - switch (opcode) { - case 0x0017: //OP_ChatMessage - LoginSendLogin(); - break; - case 0x0018: - LoginProcessLoginResponse(p); - break; - case 0x0019: - LoginProcessServerPacketList(p); - break; - case 0x0022: - LoginProcessServerPlayResponse(p); - break; - } -} - -void EverQuest::LoginSendSessionReady() -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 1); //OP_SessionReady - p.PutUInt32(2, 2); - - m_login_connection->QueuePacket(p); -} - -void EverQuest::LoginSendLogin() -{ - size_t buffer_len = m_user.length() + m_pass.length() + 2; - std::unique_ptr buffer(new char[buffer_len]); - - strcpy(&buffer[0], m_user.c_str()); - strcpy(&buffer[m_user.length() + 1], m_pass.c_str()); - - size_t encrypted_len = buffer_len; - - if (encrypted_len % 8 > 0) { - encrypted_len = ((encrypted_len / 8) + 1) * 8; - } - - EQ::Net::DynamicPacket p; - p.Resize(12 + encrypted_len); - p.PutUInt16(0, 2); //OP_Login - p.PutUInt32(2, 3); - - eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true); - - m_login_connection->QueuePacket(p); -} - -void EverQuest::LoginSendServerRequest() -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 4); //OP_ServerListRequest - p.PutUInt32(2, 4); - - m_login_connection->QueuePacket(p); -} - -void EverQuest::LoginSendPlayRequest(uint32_t id) -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 0x000d); - p.PutUInt16(2, 5); - p.PutUInt32(4, 0); - p.PutUInt32(8, 0); - p.PutUInt32(12, id); - - m_login_connection->QueuePacket(p); -} - -void EverQuest::LoginProcessLoginResponse(const EQ::Net::Packet & p) -{ - auto encrypt_size = p.Length() - 12; - if (encrypt_size % 8 > 0) { - encrypt_size = (encrypt_size / 8) * 8; - } - - std::unique_ptr decrypted(new char[encrypt_size]); - - eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false); - - EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size); - auto response_error = sp.GetUInt16(1); - - if (response_error > 101) { - Log.OutF(Logs::General, Logs::Headless_Client, "Error logging in response code: {0}", response_error); - LoginDisableReconnect(); - } - else { - m_key = sp.GetCString(12); - m_dbid = sp.GetUInt32(8); - - Log.OutF(Logs::General, Logs::Headless_Client, "Logged in successfully with dbid {0} and key {1}", m_dbid, m_key); - LoginSendServerRequest(); - } -} - -void EverQuest::LoginProcessServerPacketList(const EQ::Net::Packet & p) -{ - m_world_servers.clear(); - auto number_of_servers = p.GetUInt32(18); - size_t idx = 22; - - for (auto i = 0U; i < number_of_servers; ++i) { - WorldServer ws; - ws.address = p.GetCString(idx); - idx += (ws.address.length() + 1); - - ws.type = p.GetInt32(idx); - idx += 4; - - auto id = p.GetUInt32(idx); - idx += 4; - - ws.long_name = p.GetCString(idx); - idx += (ws.long_name.length() + 1); - - ws.lang = p.GetCString(idx); - idx += (ws.lang.length() + 1); - - ws.region = p.GetCString(idx); - idx += (ws.region.length() + 1); - - ws.status = p.GetInt32(idx); - idx += 4; - - ws.players = p.GetInt32(idx); - idx += 4; - - m_world_servers[id] = ws; - } - - for (auto server : m_world_servers) { - if (server.second.long_name.compare(m_server) == 0) { - Log.OutF(Logs::General, Logs::Headless_Client, "Found world server {0}, attempting to login.", m_server); - LoginSendPlayRequest(server.first); - return; - } - } - - Log.OutF(Logs::General, Logs::Headless_Client, "Got response from login server but could not find world server {0} disconnecting.", m_server); - LoginDisableReconnect(); -} - -void EverQuest::LoginProcessServerPlayResponse(const EQ::Net::Packet &p) -{ - auto allowed = p.GetUInt8(12); - - if (allowed) { - auto server = p.GetUInt32(18); - auto ws = m_world_servers.find(server); - if (ws != m_world_servers.end()) { - ConnectToWorld(); - LoginDisableReconnect(); - } - } - else { - auto message = p.GetUInt16(13); - Log.OutF(Logs::General, Logs::Headless_Client, "Failed to login to server with message {0}"); - LoginDisableReconnect(); - } -} - -void EverQuest::LoginDisableReconnect() -{ - m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectDisabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_login_connection->Close(); -} - -void EverQuest::ConnectToWorld() -{ - m_world_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager()); - m_world_connection_manager->OnNewConnection(std::bind(&EverQuest::WorldOnNewConnection, this, std::placeholders::_1)); - m_world_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::WorldOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_world_connection_manager->OnPacketRecv(std::bind(&EverQuest::WorldOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2)); - m_world_connection_manager->Connect(m_host, 9000); -} - -void EverQuest::WorldOnNewConnection(std::shared_ptr connection) -{ - m_world_connection = connection; - Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world..."); -} - -void EverQuest::WorldOnStatusChangeReconnectEnabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusConnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "World connected."); - WorldSendClientAuth(); - } - - if (to == EQ::Net::StatusDisconnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "World connection lost, reconnecting."); - m_world_connection.reset(); - m_world_connection_manager->Connect(m_host, 9000); - } -} - -void EverQuest::WorldOnStatusChangeReconnectDisabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusDisconnected) { - m_world_connection.reset(); - } -} - -void EverQuest::WorldOnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet & p) -{ - auto opcode = p.GetUInt16(0); - switch (opcode) { - case 0x00d2: - WorldProcessCharacterSelect(p); - break; - default: - Log.OutF(Logs::General, Logs::Headless_Client, "Unhandled opcode: {0:#x}", opcode); - break; - } -} - -void EverQuest::WorldSendClientAuth() -{ - EQ::Net::DynamicPacket p; - p.Resize(2 + 464); - - p.PutUInt16(0, 0x7a09U); - std::string dbid_str = std::to_string(m_dbid); - - p.PutCString(2, dbid_str.c_str()); - p.PutCString(2 + dbid_str.length() + 1, m_key.c_str()); - - m_world_connection->QueuePacket(p); -} - -void EverQuest::WorldSendEnterWorld(const std::string &character) -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 0x578f); - p.PutString(2, character); - p.PutUInt32(66, 0); - p.PutUInt32(70, 0); - - m_world_connection->QueuePacket(p); -} - -void EverQuest::WorldProcessCharacterSelect(const EQ::Net::Packet &p) -{ - auto char_count = p.GetUInt32(2); - size_t idx = 6; - - //Log.OutF(Logs::General, Logs::Headless_Client, "{0} characters", char_count); - for (uint32_t i = 0; i < char_count; ++i) { - auto name = p.GetCString(idx); - idx += name.length() + 1; - - auto pclass = p.GetUInt8(idx); - auto prace = p.GetUInt32(idx + 1); - auto plevel = p.GetUInt8(idx + 5); - - idx += 274; - if (m_character.compare(name) == 0) { - Log.OutF(Logs::General, Logs::Headless_Client, "Found {0}, would attempt to login here.", m_character); - WorldSendEnterWorld(m_character); - return; - } - } - - Log.OutF(Logs::General, Logs::Headless_Client, "Could not find {0}, cannot continue to login.", m_character); -} - \ No newline at end of file diff --git a/hc/eq.h b/hc/eq.h deleted file mode 100644 index 63467b318..000000000 --- a/hc/eq.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include "../common/eqemu_logsys.h" -#include "../common/net/reliable_stream_connection.h" -#include "../common/event/timer.h" -#include -#include -#include - -struct WorldServer -{ - std::string long_name; - std::string address; - int type; - std::string lang; - std::string region; - int status; - int players; -}; - -class EverQuest -{ -public: - EverQuest(const std::string &host, int port, const std::string &user, const std::string &pass, const std::string &server, const std::string &character); - ~EverQuest(); - -private: - //Login - void LoginOnNewConnection(std::shared_ptr connection); - void LoginOnStatusChangeReconnectEnabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void LoginOnStatusChangeReconnectDisabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void LoginOnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p); - - void LoginSendSessionReady(); - void LoginSendLogin(); - void LoginSendServerRequest(); - void LoginSendPlayRequest(uint32_t id); - void LoginProcessLoginResponse(const EQ::Net::Packet &p); - void LoginProcessServerPacketList(const EQ::Net::Packet &p); - void LoginProcessServerPlayResponse(const EQ::Net::Packet &p); - - void LoginDisableReconnect(); - - std::unique_ptr m_login_connection_manager; - std::shared_ptr m_login_connection; - std::map m_world_servers; - - //World - void ConnectToWorld(); - - void WorldOnNewConnection(std::shared_ptr connection); - void WorldOnStatusChangeReconnectEnabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void WorldOnStatusChangeReconnectDisabled(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void WorldOnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p); - - void WorldSendClientAuth(); - void WorldSendEnterWorld(const std::string &character); - - void WorldProcessCharacterSelect(const EQ::Net::Packet &p); - - std::unique_ptr m_world_connection_manager; - std::shared_ptr m_world_connection; - - //Variables - std::string m_host; - int m_port; - std::string m_user; - std::string m_pass; - std::string m_server; - std::string m_character; - - std::string m_key; - uint32_t m_dbid; -}; \ No newline at end of file diff --git a/hc/login.cpp b/hc/login.cpp deleted file mode 100644 index f6dca7c78..000000000 --- a/hc/login.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/*#include "login.h" -#include "../common/eqemu_logsys.h" -#include - -const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) { - DES_key_schedule k; - DES_cblock v; - - memset(&k, 0, sizeof(DES_key_schedule)); - memset(&v, 0, sizeof(DES_cblock)); - - if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) { - return nullptr; - } - - DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc); - return buffer_out; -} - -LoginConnection::LoginConnection(const std::string &username, const std::string &password, const std::string &host, int host_port, const std::string &server) -{ - m_connecting = false; - m_username = username; - m_password = password; - m_host = host; - m_host_port = host_port; - m_server = server; - - m_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager()); - - m_connection_manager->OnNewConnection(std::bind(&LoginConnection::OnNewConnection, this, std::placeholders::_1)); - m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_connection_manager->OnPacketRecv(std::bind(&LoginConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2)); - - m_connection_manager->Connect(host, host_port); -} - -LoginConnection::~LoginConnection() -{ -} - -void LoginConnection::OnNewConnection(std::shared_ptr connection) -{ - m_connection = connection; - Log.OutF(Logs::General, Logs::Headless_Client, "Connecting..."); -} - -void LoginConnection::OnStatusChangeActive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusConnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "Login connected."); - SendSessionReady(); - } - - if (to == EQ::Net::StatusDisconnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "Login connection lost, reconnecting."); - m_key.clear(); - m_dbid = 0; - m_connection.reset(); - m_connection_manager->Connect(m_host, m_host_port); - } -} - -void LoginConnection::OnStatusChangeInactive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusDisconnected) { - m_key.clear(); - m_dbid = 0; - m_connection.reset(); - } -} - -void LoginConnection::OnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p) -{ - auto opcode = p.GetUInt16(0); - switch (opcode) { - case 0x0017: //OP_ChatMessage - SendLogin(); - break; - case 0x0018: - ProcessLoginResponse(p); - break; - case 0x0019: - ProcessServerPacketList(p); - break; - case 0x0022: - ProcessServerPlayResponse(p); - break; - } -} - -void LoginConnection::Kill() -{ - m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeInactive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_key.clear(); - m_dbid = 0; - m_connection->Close(); -} - -void LoginConnection::Start() -{ - m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_connection_manager->Connect(m_host, m_host_port); -} - -void LoginConnection::SendSessionReady() -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 1); //OP_SessionReady - p.PutUInt32(2, 2); - - m_connection->QueuePacket(p); -} - -void LoginConnection::SendLogin() -{ - size_t buffer_len = m_username.length() + m_password.length() + 2; - std::unique_ptr buffer(new char[buffer_len]); - - strcpy(&buffer[0], m_username.c_str()); - strcpy(&buffer[m_username.length() + 1], m_password.c_str()); - - size_t encrypted_len = buffer_len; - - if (encrypted_len % 8 > 0) { - encrypted_len = ((encrypted_len / 8) + 1) * 8; - } - - EQ::Net::DynamicPacket p; - p.Resize(12 + encrypted_len); - p.PutUInt16(0, 2); //OP_Login - p.PutUInt32(2, 3); - - eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true); - - m_connection->QueuePacket(p); -} - -void LoginConnection::SendServerRequest() -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 4); //OP_ServerListRequest - p.PutUInt32(2, 4); - - m_connection->QueuePacket(p); -} - -void LoginConnection::SendPlayRequest(uint32_t id) -{ - EQ::Net::DynamicPacket p; - p.PutUInt16(0, 0x000d); - p.PutUInt16(2, 5); - p.PutUInt32(4, 0); - p.PutUInt32(8, 0); - p.PutUInt32(12, id); - - m_connection->QueuePacket(p); -} - -void LoginConnection::ProcessLoginResponse(const EQ::Net::Packet &p) -{ - auto encrypt_size = p.Length() - 12; - if (encrypt_size % 8 > 0) { - encrypt_size = (encrypt_size / 8) * 8; - } - - std::unique_ptr decrypted(new char[encrypt_size]); - - eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false); - - EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size); - auto response_error = sp.GetUInt16(1); - - if (response_error > 101) { - Log.OutF(Logs::General, Logs::Headless_Client, "Error logging in response code: {0}", response_error); - Kill(); - } - else { - m_key = sp.GetCString(12); - m_dbid = sp.GetUInt32(8); - - Log.OutF(Logs::General, Logs::Headless_Client, "Logged in successfully with dbid {0} and key {1}", m_dbid, m_key); - SendServerRequest(); - } -} - -void LoginConnection::ProcessServerPacketList(const EQ::Net::Packet &p) -{ - m_world_servers.clear(); - auto number_of_servers = p.GetUInt32(18); - size_t idx = 22; - - for (auto i = 0U; i < number_of_servers; ++i) { - WorldServer ws; - ws.address = p.GetCString(idx); - idx += (ws.address.length() + 1); - - ws.type = p.GetInt32(idx); - idx += 4; - - auto id = p.GetUInt32(idx); - idx += 4; - - ws.long_name = p.GetCString(idx); - idx += (ws.long_name.length() + 1); - - ws.lang = p.GetCString(idx); - idx += (ws.lang.length() + 1); - - ws.region = p.GetCString(idx); - idx += (ws.region.length() + 1); - - ws.status = p.GetInt32(idx); - idx += 4; - - ws.players = p.GetInt32(idx); - idx += 4; - - m_world_servers[id] = ws; - } - - for (auto server : m_world_servers) { - if (server.second.long_name.compare(m_server) == 0) { - Log.OutF(Logs::General, Logs::Headless_Client, "Found world server {0}, attempting to login.", m_server); - SendPlayRequest(server.first); - return; - } - } - - Log.OutF(Logs::General, Logs::Headless_Client, "Got response from login server but could not find world server {0} disconnecting.", m_server); - Kill(); -} - -void LoginConnection::ProcessServerPlayResponse(const EQ::Net::Packet &p) -{ - auto allowed = p.GetUInt8(12); - - if (allowed) { - auto server = p.GetUInt32(18); - auto ws = m_world_servers.find(server); - if (ws != m_world_servers.end()) { - if (m_on_can_login_world) { - m_on_can_login_world(ws->second, m_key, m_dbid); - } - - Kill(); - } - } - else { - auto message = p.GetUInt16(13); - Log.OutF(Logs::General, Logs::Headless_Client, "Failed to login to server with message {0}"); - Kill(); - } -} -*/ \ No newline at end of file diff --git a/hc/login.h b/hc/login.h deleted file mode 100644 index bec7c3cdd..000000000 --- a/hc/login.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include "../common/net/reliable_stream_connection.h" -#include "../common/event/timer.h" -#include - -struct WorldServer -{ - std::string long_name; - std::string address; - int type; - std::string lang; - std::string region; - int status; - int players; -}; - -class LoginConnection -{ -public: - LoginConnection(const std::string &username, const std::string &password, const std::string &host, int host_port, const std::string &server); - void OnCanLoginToWorld(std::function cb) { m_on_can_login_world = cb; } - - ~LoginConnection(); -private: - void OnNewConnection(std::shared_ptr connection); - void OnStatusChangeActive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void OnStatusChangeInactive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void OnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p); - void Kill(); - void Start(); - - void SendSessionReady(); - void SendLogin(); - void SendServerRequest(); - void SendPlayRequest(uint32_t id); - void ProcessLoginResponse(const EQ::Net::Packet &p); - void ProcessServerPacketList(const EQ::Net::Packet &p); - void ProcessServerPlayResponse(const EQ::Net::Packet &p); - - std::unique_ptr m_connection_manager; - std::shared_ptr m_connection; - bool m_connecting; - std::unique_ptr m_connect_timer; - - std::string m_username; - std::string m_password; - std::string m_host; - int m_host_port; - std::string m_server; - - std::string m_key; - uint32_t m_dbid; - std::map m_world_servers; - std::function m_on_can_login_world; -}; \ No newline at end of file diff --git a/hc/main.cpp b/hc/main.cpp deleted file mode 100644 index f461aa666..000000000 --- a/hc/main.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "../common/event/event_loop.h" -#include "../common/eqemu_logsys.h" -#include "../common/crash.h" -#include "../common/platform.h" -#include "../common/json_config.h" -#include - -#include "eq.h" - -EQEmuLogSys Log; - -int main() { - RegisterExecutablePlatform(ExePlatformHC); - Log.LoadLogSettingsDefaults(); - set_exception_handler(); - - Log.OutF(Logs::General, Logs::Headless_Client, "Starting EQEmu Headless Client."); - - auto config = EQ::JsonConfigFile::Load("hc.json"); - auto config_handle = config.RawHandle(); - - std::vector> eq_list; - - try { - for (int i = 0; i < config_handle.size(); ++i) { - auto c = config_handle[i]; - - auto host = c["host"].asString(); - auto port = c["port"].asInt(); - auto user = c["user"].asString(); - auto pass = c["pass"].asString(); - auto server = c["server"].asString(); - auto character = c["character"].asString(); - - Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to {0}:{1} as Account '{2}' to Server '{3}' under Character '{4}'", host, port, user, server, character); - - eq_list.push_back(std::unique_ptr(new EverQuest(host, port, user, pass, server, character))); - } - } - catch (std::exception &ex) { - Log.OutF(Logs::General, Logs::Headless_Client, "Error parsing config file: {0}", ex.what()); - return 0; - } - - for (;;) { - EQ::EventLoop::Get().Process(); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - - return 0; -} diff --git a/hc/world.cpp b/hc/world.cpp deleted file mode 100644 index c9d690f62..000000000 --- a/hc/world.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "world.h" -#include "../common/eqemu_logsys.h" - -WorldConnection::WorldConnection(const std::string &key, uint32_t dbid, const std::string &host) -{ - m_connecting = false; - m_host = host; - m_key = key; - m_dbid = dbid; - - m_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager()); - m_connection_manager->OnNewConnection(std::bind(&WorldConnection::OnNewConnection, this, std::placeholders::_1)); - m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_connection_manager->OnPacketRecv(std::bind(&WorldConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2)); - m_connection_manager->Connect(host, 9000); -} - -WorldConnection::~WorldConnection() { -} - -void WorldConnection::OnNewConnection(std::shared_ptr connection) -{ - m_connection = connection; - Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world..."); -} - -void WorldConnection::OnStatusChangeActive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusConnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "World connected."); - SendClientAuth(); - } - - if (to == EQ::Net::StatusDisconnected) { - Log.OutF(Logs::General, Logs::Headless_Client, "World connection lost, reconnecting."); - m_connection.reset(); - m_connection_manager->Connect(m_host, 9000); - } -} - -void WorldConnection::OnStatusChangeInactive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to) -{ - if (to == EQ::Net::StatusDisconnected) { - m_connection.reset(); - } -} - -void WorldConnection::OnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p) -{ - auto opcode = p.GetUInt16(0); - Log.OutF(Logs::General, Logs::Headless_Client, "Packet in:\n{0}", p.ToString()); -} - -void WorldConnection::Kill() -{ - m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeInactive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_connection->Close(); -} - -void WorldConnection::Start() -{ - m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - m_connection_manager->Connect(m_host, 9000); -} - -void WorldConnection::SendClientAuth() -{ - EQ::Net::DynamicPacket p; - p.Resize(2 + 464); - - p.PutUInt16(0, 0x7a09U); - std::string dbid_str = std::to_string(m_dbid); - - p.PutCString(2, dbid_str.c_str()); - p.PutCString(2 + dbid_str.length() + 1, m_key.c_str()); - - m_connection->QueuePacket(p); -} diff --git a/hc/world.h b/hc/world.h deleted file mode 100644 index b1df83894..000000000 --- a/hc/world.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "../common/net/reliable_stream_connection.h" -#include "../common/event/timer.h" -#include - -class WorldConnection -{ -public: - WorldConnection(const std::string &key, uint32_t dbid, const std::string &host); - ~WorldConnection(); -private: - void OnNewConnection(std::shared_ptr connection); - void OnStatusChangeActive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void OnStatusChangeInactive(std::shared_ptr conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to); - void OnPacketRecv(std::shared_ptr conn, const EQ::Net::Packet &p); - void Kill(); - void Start(); - - void SendClientAuth(); - - std::unique_ptr m_connection_manager; - std::shared_ptr m_connection; - bool m_connecting; - std::unique_ptr m_connect_timer; - - std::string m_host; - - std::string m_key; - uint32_t m_dbid; -}; \ No newline at end of file diff --git a/hc/zone.cpp b/hc/zone.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/hc/zone.h b/hc/zone.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index d5b325aec..802a6327d 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -1,7 +1,7 @@ -IF(EQEMU_BUILD_LUA) - ADD_SUBDIRECTORY(luabind) -ENDIF(EQEMU_BUILD_LUA) +if(EQEMU_BUILD_LUA) + add_subdirectory(luabind) +endif() -IF(EQEMU_BUILD_PERL) - ADD_SUBDIRECTORY(perlbind) -ENDIF(EQEMU_BUILD_PERL) +if(EQEMU_BUILD_PERL) + add_subdirectory(perlbind) +endif() diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index f891185a7..3cbac5341 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -SET(lb_sources +set(lb_sources src/class.cpp src/class_info.cpp src/class_registry.cpp @@ -20,19 +20,19 @@ SET(lb_sources src/wrapper_base.cpp ) -SET(lb_headers +set(lb_headers ) add_library(luabind ${lb_sources} ${lb_headers}) target_link_libraries(luabind PRIVATE PkgConfig::luajit Boost::dynamic_bitset Boost::tuple Boost::foreach) -IF(UNIX) +if(UNIX) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) -ENDIF(UNIX) +endif() -IF(MSVC) +if(MSVC) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " ) -ENDIF(MSVC) +endif() -SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/libs/perlbind/CMakeLists.txt b/libs/perlbind/CMakeLists.txt index 7facb84fe..01d30a61b 100644 --- a/libs/perlbind/CMakeLists.txt +++ b/libs/perlbind/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) project(perlbind LANGUAGES CXX) diff --git a/libs/zlibng/.gitattributes b/libs/zlibng/.gitattributes deleted file mode 100644 index 68ec3a174..000000000 --- a/libs/zlibng/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -* text=auto -*.c text -*.h text -Makefile text diff --git a/libs/zlibng/.github/workflows/analyze.yml b/libs/zlibng/.github/workflows/analyze.yml deleted file mode 100644 index 7c848ef02..000000000 --- a/libs/zlibng/.github/workflows/analyze.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: CI Static Analysis -on: [push, pull_request] -jobs: - GCC-10: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Install packages (Ubuntu) - run: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt-get update - sudo apt-get install -y gcc-10 - - name: Generate project files - run: | - cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF - env: - CC: gcc-10 - CFLAGS: "-fanalyzer -Werror -Wanalyzer-double-fclose -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak -Wanalyzer-null-argument -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument -Wanalyzer-possible-null-dereference -Wanalyzer-stale-setjmp-buffer -Wanalyzer-tainted-array-index -Wanalyzer-unsafe-call-within-signal-handler -Wanalyzer-use-after-free -Wanalyzer-use-of-pointer-in-stale-stack-frame" - CI: true - - name: Compile source code - run: | - cmake --build . --config Release > /dev/null - Clang-12: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Install packages (Ubuntu) - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" -y - sudo apt install clang-tools-12 -y - - name: Generate project files - run: | - scan-build-12 --status-bugs cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF - env: - CI: true - - name: Compile source code - run: | - scan-build-12 --status-bugs cmake --build . --config Release > /dev/null diff --git a/libs/zlibng/.github/workflows/cmake.yml b/libs/zlibng/.github/workflows/cmake.yml deleted file mode 100644 index 4eaec6c4b..000000000 --- a/libs/zlibng/.github/workflows/cmake.yml +++ /dev/null @@ -1,381 +0,0 @@ -name: CI CMake -on: [push, pull_request] -jobs: - ci-cmake: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_SANITIZER=Address - codecov: ubuntu_gcc - - - name: Ubuntu GCC OSB -O1 No Unaligned64 - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_UNALIGNED=ON -DUNALIGNED64_OK=OFF -DWITH_SANITIZER=Undefined - build-dir: ../build - build-src-dir: ../zlib-ng - codecov: ubuntu_gcc_osb - cflags: -O1 -g3 - - - name: Ubuntu GCC -O3 No Unaligned - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_UNALIGNED=OFF - codecov: ubuntu_gcc_o3 - cflags: -O3 - - - name: Ubuntu GCC Link Zlib - os: ubuntu-latest - compiler: gcc - cmake-args: -DZLIB_DUAL_LINK=ON - - - name: Ubuntu GCC No AVX2 - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_AVX2=OFF -DWITH_SANITIZER=Undefined - codecov: ubuntu_gcc_no_avx2 - - - name: Ubuntu GCC No SSE2 - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_SSE2=OFF -DWITH_SANITIZER=Undefined - codecov: ubuntu_gcc_no_sse2 - - - name: Ubuntu GCC No SSE4 - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_SSE4=OFF -DWITH_SANITIZER=Undefined - codecov: ubuntu_gcc_no_sse4 - - - name: Ubuntu GCC No PCLMULQDQ - os: ubuntu-latest - compiler: gcc - cmake-args: -DWITH_PCLMULQDQ=OFF -DWITH_SANITIZER=Undefined - codecov: ubuntu_gcc_no_pclmulqdq - - - name: Ubuntu GCC Compat No Opt - os: ubuntu-latest - compiler: gcc - cmake-args: -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Address - codecov: ubuntu_gcc_compat_no_opt - cflags: -DNOT_TWEAK_COMPILER - - - name: Ubuntu GCC ARM SF - os: ubuntu-latest - compiler: arm-linux-gnueabi-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DWITH_SANITIZER=Address - packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross - codecov: ubuntu_gcc_armsf - - - name: Ubuntu GCC ARM SF Compat No Opt - os: ubuntu-latest - compiler: arm-linux-gnueabi-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined - packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross - codecov: ubuntu_gcc_armsf_compat_no_opt - - - name: Ubuntu GCC ARM HF - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_SANITIZER=Address - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - codecov: ubuntu_gcc_armhf - - - name: Ubuntu GCC ARM HF No ACLE - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_ACLE=OFF -DWITH_SANITIZER=Address - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - codecov: ubuntu_gcc_armhf_no_acle - - - name: Ubuntu GCC ARM HF No NEON - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_NEON=OFF -DWITH_SANITIZER=Address - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - codecov: ubuntu_gcc_armhf_no_neon - - - name: Ubuntu GCC ARM HF Compat No Opt - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - codecov: ubuntu_gcc_armhf_compat_no_opt - - - name: Ubuntu GCC AARCH64 - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_SANITIZER=Address - asan-options: detect_leaks=0 - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - codecov: ubuntu_gcc_aarch64 - - - name: Ubuntu GCC AARCH64 No ACLE - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_ACLE=OFF -DWITH_SANITIZER=Undefined - asan-options: detect_leaks=0 - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - codecov: ubuntu_gcc_aarch64_no_acle - - - name: Ubuntu GCC AARCH64 No NEON - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_NEON=OFF -DWITH_SANITIZER=Undefined - asan-options: detect_leaks=0 - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - codecov: ubuntu_gcc_aarch64_no_neon - - - name: Ubuntu GCC AARCH64 Compat No Opt - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined - asan-options: detect_leaks=0 - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - codecov: ubuntu_gcc_aarch64_compat_no_opt - - - name: Ubuntu GCC PPC - os: ubuntu-latest - compiler: powerpc-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake - packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross - ldflags: -static - codecov: ubuntu_gcc_ppc - - - name: Ubuntu GCC PPC64 - os: ubuntu-latest - compiler: powerpc64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64.cmake - packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross - ldflags: -static - codecov: ubuntu_gcc_ppc64 - - - name: Ubuntu GCC PPC64LE - os: ubuntu-latest - compiler: powerpc64le-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake - packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross - codecov: ubuntu_gcc_ppc64le - - - name: Ubuntu GCC SPARC64 - os: ubuntu-latest - compiler: sparc64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sparc64.cmake - packages: qemu gcc-sparc64-linux-gnu libc-dev-sparc64-cross - ldflags: -static - codecov: ubuntu_gcc_sparc64 - - - name: Ubuntu GCC S390X - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_SANITIZER=Address - packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross - ldflags: -static - codecov: ubuntu_gcc_s390x - - - name: Ubuntu GCC S390X DFLTCC - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Address - packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross - ldflags: -static - codecov: ubuntu_gcc_s390x - - - name: Ubuntu GCC S390X DFLTCC Compat - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DZLIB_COMPAT=ON -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Undefined - packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross - ldflags: -static - codecov: ubuntu_gcc_s390x - - - name: Ubuntu MinGW i686 - os: ubuntu-latest - compiler: i686-w64-mingw32-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-i686.cmake - packages: wine32 gcc-mingw-w64 - # Codecov disabled due to gcov locking issue error - - - name: Ubuntu MinGW x86_64 - os: ubuntu-latest - compiler: x86_64-w64-mingw32-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-x86_64.cmake - packages: wine-stable gcc-mingw-w64 - codecov: ubuntu_gcc_mingw_x86_64 - - - name: Ubuntu Clang - os: ubuntu-latest - compiler: clang - packages: llvm-6.0 - gcov-exec: llvm-cov-6.0 gcov - codecov: ubuntu_clang - - - name: Ubuntu Clang Inflate Strict - os: ubuntu-latest - compiler: clang - cmake-args: -DWITH_INFLATE_STRICT=ON - packages: llvm-6.0 - gcov-exec: llvm-cov-6.0 gcov - codecov: ubuntu_clang_inflate_strict - - - name: Ubuntu Clang Inflate Allow Invalid Dist - os: ubuntu-latest - compiler: clang - cmake-args: -DWITH_INFLATE_ALLOW_INVALID_DIST=ON - packages: llvm-6.0 - gcov-exec: llvm-cov-6.0 gcov - codecov: ubuntu_clang_inflate_allow_invalid_dist - - - name: Ubuntu Clang Memory Map - os: ubuntu-latest - compiler: clang - cflags: -DUSE_MMAP - packages: llvm-6.0 - gcov-exec: llvm-cov-6.0 gcov - codecov: ubuntu_clang_mmap - - - name: Ubuntu Clang Debug - os: ubuntu-latest - compiler: clang - packages: llvm-6.0 - gcov-exec: llvm-cov-6.0 gcov - codecov: ubuntu_clang_debug - build-config: Debug - - - name: Ubuntu Clang MSAN - os: ubuntu-latest - compiler: clang - cmake-args: -GNinja -DWITH_SANITIZER=Memory - packages: ninja-build llvm-6.0 - gcov-exec: llvm-cov-6.0 gcov - cflags: -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize-memory-track-origins - codecov: ubuntu_clang_msan - - - name: Windows MSVC Win32 - os: windows-latest - compiler: cl - cmake-args: -A Win32 - - - name: Windows MSVC Win64 - os: windows-latest - compiler: cl - cmake-args: -A x64 - - - name: Windows MSVC ARM No Test - os: windows-latest - compiler: cl - cmake-args: -A ARM - - - name: Windows MSVC ARM64 No Test - os: windows-latest - compiler: cl - cmake-args: -A ARM64 - - - name: Windows GCC - os: windows-latest - compiler: gcc - cmake-args: -G Ninja - codecov: win64_gcc - - - name: Windows GCC Compat No Opt - os: windows-latest - compiler: gcc - cmake-args: -G Ninja -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF - codecov: win64_gcc_compat_no_opt - - - name: macOS Clang - os: macos-latest - compiler: clang - cmake-args: -DWITH_SANITIZER=Address - codecov: macos_clang - - - name: macOS GCC - os: macos-latest - compiler: gcc-10 - cmake-args: -DWITH_SANITIZER=Undefined - packages: gcc@10 - gcov-exec: gcov-10 - codecov: macos_gcc - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Checkout test corpora - uses: actions/checkout@v2 - with: - repository: nmoinvaz/corpora - path: test/data/corpora - - - name: Install packages (Ubuntu) - if: runner.os == 'Linux' && matrix.packages - run: | - sudo dpkg --add-architecture i386 # Required for wine32 - sudo apt-get update - sudo apt-get install -y ${{ matrix.packages }} - - - name: Install packages (Windows) - if: runner.os == 'Windows' - run: | - choco install ninja ${{ matrix.packages }} --no-progress - - - name: Install packages (macOS) - if: runner.os == 'macOS' - run: | - brew install ninja ${{ matrix.packages }} - env: - HOMEBREW_NO_INSTALL_CLEANUP: 1 - - - name: Install codecov.io tools - if: matrix.codecov - run: | - python -u -m pip install codecov - - - name: Generate project files - # Shared libaries turned off for qemu ppc* and sparc & reduce code coverage sources - run: | - mkdir ${{ matrix.build-dir || '.not-used' }} - cd ${{ matrix.build-dir || '.' }} - cmake ${{ matrix.build-src-dir || '.' }} ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=ON -DWITH_CODE_COVERAGE=ON -DWITH_MAINTAINER_WARNINGS=ON - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - LDFLAGS: ${{ matrix.ldflags }} - CI: true - - - name: Compile source code - run: | - cd ${{ matrix.build-dir || '.' }} - cmake --build . --config ${{ matrix.build-config || 'Release' }} - - - name: Run test cases - # Don't run tests on Windows ARM - if: runner.os != 'Windows' || contains(matrix.name, 'ARM') == false - run: | - cd ${{ matrix.build-dir || '.' }} - ctest --verbose -C Release --output-on-failure --max-width 120 -j 6 - env: - ASAN_OPTIONS: ${{ matrix.asan-options || 'verbosity=0' }}:abort_on_error=1 - MSAN_OPTIONS: ${{ matrix.msan-options || 'verbosity=0' }}:abort_on_error=1 - TSAN_OPTIONS: ${{ matrix.tsan-options || 'verbosity=0' }}:abort_on_error=1 - LSAN_OPTIONS: ${{ matrix.lsan-options || 'verbosity=0' }}:abort_on_error=1 - - - name: Upload coverage report - if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' ) - shell: bash - run: | - bash tools/codecov-upload.sh - env: - # Codecov does not yet support GitHub Actions - CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}" - CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}" - CODECOV_FLAGS: "${{ matrix.codecov }}" - CODECOV_NAME: "${{ matrix.name }}" - CODECOV_EXEC: "${{ matrix.gcov-exec || 'gcov' }}" - CODECOV_DIR: "${{ matrix.build-dir || '.' }}" diff --git a/libs/zlibng/.github/workflows/configure.yml b/libs/zlibng/.github/workflows/configure.yml deleted file mode 100644 index 750f30d71..000000000 --- a/libs/zlibng/.github/workflows/configure.yml +++ /dev/null @@ -1,185 +0,0 @@ -name: CI Configure -on: [push, pull_request] -jobs: - ci-configure: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - configure-args: --warn - - - name: Ubuntu GCC OSB - os: ubuntu-latest - compiler: gcc - configure-args: --warn - build-dir: ../build - build-src-dir: ../zlib-ng - - - name: Ubuntu GCC Compat No Opt - os: ubuntu-latest - compiler: gcc - configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies - - - name: Ubuntu GCC ARM SF - os: ubuntu-latest - compiler: arm-linux-gnueabi-gcc - configure-args: --warn - chost: arm-linux-gnueabi - packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross - - - name: Ubuntu GCC ARM SF Compat No Opt - os: ubuntu-latest - compiler: arm-linux-gnueabi-gcc - configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies - chost: arm-linux-gnueabi - packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross - - - name: Ubuntu GCC ARM HF - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - configure-args: --warn - chost: arm-linux-gnueabihf - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - - - name: Ubuntu GCC ARM HF No ACLE - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - configure-args: --warn --without-acle - chost: arm-linux-gnueabihf - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - - - name: Ubuntu GCC ARM HF No NEON - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - configure-args: --warn --without-neon - chost: arm-linux-gnueabihf - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - - - name: Ubuntu GCC ARM HF Compat No Opt - os: ubuntu-latest - compiler: arm-linux-gnueabihf-gcc - configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies - chost: arm-linux-gnueabihf - packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross - - - name: Ubuntu GCC AARCH64 - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - configure-args: --warn - chost: aarch64-linux-gnu - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - - - name: Ubuntu GCC AARCH64 No ACLE - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - configure-args: --warn --without-acle - chost: aarch64-linux-gnu - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - - - name: Ubuntu GCC AARCH64 No NEON - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - configure-args: --warn --without-neon - chost: aarch64-linux-gnu - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - - - name: Ubuntu GCC AARCH64 Compat No Opt - os: ubuntu-latest - compiler: aarch64-linux-gnu-gcc - configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies - chost: aarch64-linux-gnu - packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross - - - name: Ubuntu GCC PPC - os: ubuntu-latest - compiler: powerpc-linux-gnu-gcc - configure-args: --warn --static - chost: powerpc-linux-gnu - packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross - cflags: -static - ldflags: -static - - - name: Ubuntu GCC PPC64 - os: ubuntu-latest - compiler: powerpc64-linux-gnu-gcc - configure-args: --warn --static - chost: powerpc-linux-gnu - packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross - cflags: -static - ldflags: -static - - - name: Ubuntu GCC PPC64LE - os: ubuntu-latest - compiler: powerpc64le-linux-gnu-gcc - configure-args: --warn - chost: powerpc64le-linux-gnu - packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross - - - name: Ubuntu GCC S390X - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - configure-args: --warn --static - chost: s390x-linux-gnu - packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross - cflags: -static - ldflags: -static - - - name: Ubuntu GCC S390X DFLTCC - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - configure-args: --warn --static --with-dfltcc-deflate --with-dfltcc-inflate - chost: s390x-linux-gnu - packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross - cflags: -static - ldflags: -static - - - name: Ubuntu GCC S390X DFLTCC Compat - os: ubuntu-latest - compiler: s390x-linux-gnu-gcc - configure-args: --warn --zlib-compat --static --with-dfltcc-deflate --with-dfltcc-inflate - chost: s390x-linux-gnu - packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross - cflags: -static - ldflags: -static - - - name: macOS GCC - os: macOS-latest - compiler: gcc - configure-args: --warn - - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - - name: Install packages (Ubuntu) - if: runner.os == 'Linux' && matrix.packages - run: | - sudo apt-get update - sudo apt-get install -y ${{ matrix.packages }} - - - name: Generate project files - run: | - mkdir ${{ matrix.build-dir || '.not-used' }} - cd ${{ matrix.build-dir || '.' }} - ${{ matrix.build-src-dir || '.' }}/configure ${{ matrix.configure-args }} - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - LDFLAGS: ${{ matrix.ldflags }} - CHOST: ${{ matrix.chost }} - CI: true - - - name: Compile source code - run: | - cd ${{ matrix.build-dir || '.' }} - make -j2 - - - name: Run test cases - run: | - cd ${{ matrix.build-dir || '.' }} - make test diff --git a/libs/zlibng/.github/workflows/fuzz.yml b/libs/zlibng/.github/workflows/fuzz.yml deleted file mode 100644 index e7ddaea5b..000000000 --- a/libs/zlibng/.github/workflows/fuzz.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: CI Fuzz -on: [pull_request] -jobs: - Fuzzing: - runs-on: ubuntu-latest - steps: - - name: Build Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'zlib-ng' - dry-run: false - - name: Run Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'zlib-ng' - fuzz-seconds: 600 - dry-run: false - - name: Upload Crash - uses: actions/upload-artifact@v1 - if: failure() - with: - name: artifacts - path: ./out/artifacts diff --git a/libs/zlibng/.github/workflows/libpng.yml b/libs/zlibng/.github/workflows/libpng.yml deleted file mode 100644 index fe970dd15..000000000 --- a/libs/zlibng/.github/workflows/libpng.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CI Libpng -on: [pull_request] -jobs: - pngtest: - name: Ubuntu Clang - runs-on: ubuntu-latest - - steps: - - name: Checkout repository (zlib-ng) - uses: actions/checkout@v1 - - - name: Generate project files (zlib-ng) - run: | - cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF - env: - CC: clang - CFLAGS: -fPIC - CI: true - - - name: Compile source code (zlib-ng) - run: | - cmake --build . --config Release - - - name: Checkout repository (libpng) - uses: actions/checkout@v2 - with: - repository: glennrp/libpng - path: libpng - - - name: Generate project files (libpng) - run: | - cd libpng - cmake . -DCMAKE_BUILD_TYPE=Release -DPNG_TESTS=ON -DPNG_STATIC=OFF -DZLIB_INCLUDE_DIR=.. -DZLIB_LIBRARY=$PWD/../libz.a - env: - CC: clang - CI: true - - - name: Compile source code (libpng) - run: | - cd libpng - cmake --build . --config Release - - - name: Run test cases (libpng) - run: | - cd libpng - ctest -C Release --output-on-failure --max-width 120 diff --git a/libs/zlibng/.github/workflows/nmake.yml b/libs/zlibng/.github/workflows/nmake.yml deleted file mode 100644 index 38c0b42eb..000000000 --- a/libs/zlibng/.github/workflows/nmake.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: CI NMake -on: [push, pull_request] -jobs: - ci-cmake: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Windows NMake x86 - os: windows-latest - makefile: win32/Makefile.msc - vc-vars: x86 - - - name: Windows NMake x64 - os: windows-latest - makefile: win32/Makefile.msc - vc-vars: x86_amd64 - - - name: Windows NMake ARM No Test - os: windows-latest - makefile: win32/Makefile.arm - vc-vars: x86_arm - - - name: Windows NMake ARM64 No Test - os: windows-latest - makefile: win32/Makefile.a64 - vc-vars: x86_arm64 - - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - - name: Compile source code - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }} - nmake -f ${{ matrix.makefile }} - - - name: Run test cases - shell: cmd - # Don't run tests on Windows ARM - if: contains(matrix.vc-vars, 'arm') == false - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }} - nmake -f ${{ matrix.makefile }} test - nmake -f ${{ matrix.makefile }} testdll diff --git a/libs/zlibng/.github/workflows/pkgcheck.yml b/libs/zlibng/.github/workflows/pkgcheck.yml deleted file mode 100644 index a34ad94f3..000000000 --- a/libs/zlibng/.github/workflows/pkgcheck.yml +++ /dev/null @@ -1,121 +0,0 @@ -name: CI Pkgcheck -on: [push, pull_request] -jobs: - ci-pkgcheck: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Ubuntu GCC - os: ubuntu-latest - compiler: gcc - - - name: Ubuntu GCC -m32 - os: ubuntu-latest - compiler: gcc - packages: gcc-multilib - cmake-args: -DCMAKE_C_FLAGS=-m32 - cflags: -m32 - ldflags: -m32 - - - name: Ubuntu GCC ARM HF - os: ubuntu-latest - chost: arm-linux-gnueabihf - compiler: arm-linux-gnueabihf-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf - packages: qemu gcc-arm-linux-gnueabihf libc6-dev-armhf-cross - - - name: Ubuntu GCC AARCH64 - os: ubuntu-latest - chost: aarch64-linux-gnu - compiler: aarch64-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake - packages: qemu gcc-aarch64-linux-gnu libc6-dev-arm64-cross - - - name: Ubuntu GCC PPC - os: ubuntu-latest - chost: powerpc-linux-gnu - compiler: powerpc-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake - packages: qemu gcc-powerpc-linux-gnu libc6-dev-powerpc-cross - - - name: Ubuntu GCC PPC64LE - os: ubuntu-latest - chost: powerpc64le-linux-gnu - compiler: powerpc64le-linux-gnu-gcc - cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake - packages: qemu gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross - - - name: macOS Clang - os: macOS-latest - compiler: clang - - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - - name: Install packages (Ubuntu) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y --no-install-recommends abigail-tools ninja-build diffoscope ${{ matrix.packages }} - - - name: Install packages (macOS) - if: runner.os == 'macOS' - run: | - brew install ninja diffoscope ${{ matrix.packages }} - env: - HOMEBREW_NO_INSTALL_CLEANUP: 1 - - - name: Select Xcode version (macOS) - # Use a version of Xcode that supports ZERO_AR_DATE until CMake supports - # AppleClang linking with libtool using -D argument - # https://gitlab.kitware.com/cmake/cmake/-/issues/19852 - if: runner.os == 'macOS' - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '12.1.1' - - - name: Compare builds - run: | - sh test/pkgcheck.sh - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - CHOST: ${{ matrix.chost }} - CMAKE_ARGS: ${{ matrix.cmake-args }} - LDFLAGS: ${{ matrix.ldflags }} - - - name: Compare builds (compat) - run: | - sh test/pkgcheck.sh --zlib-compat - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - CHOST: ${{ matrix.chost }} - CMAKE_ARGS: ${{ matrix.cmake-args }} - LDFLAGS: ${{ matrix.ldflags }} - - - name: Check ABI - # macOS runner does not contain abigail - if: runner.os != 'macOS' - run: | - sh test/abicheck.sh --refresh_if - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - CHOST: ${{ matrix.chost }} - LDFLAGS: ${{ matrix.ldflags }} - - - name: Check ABI (compat) - # macOS runner does not contain abigail - if: runner.os != 'macOS' - run: | - sh test/abicheck.sh --zlib-compat --refresh_if - env: - CC: ${{ matrix.compiler }} - CFLAGS: ${{ matrix.cflags }} - CHOST: ${{ matrix.chost }} - LDFLAGS: ${{ matrix.ldflags }} diff --git a/libs/zlibng/.github/workflows/release.yml b/libs/zlibng/.github/workflows/release.yml deleted file mode 100644 index c2a306172..000000000 --- a/libs/zlibng/.github/workflows/release.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: CI Release -on: - push: - tags: - - '*' -jobs: - ci-cmake: - name: ${{ matrix.name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - name: Windows MSVC Win32 - os: windows-latest - compiler: cl - cmake-args: -A Win32 - deploy-name: win32 - - - name: Windows MSVC Win32 Compat - os: windows-latest - compiler: cl - cmake-args: -A Win32 -DZLIB_COMPAT=ON - deploy-name: win32-compat - - - name: Windows MSVC Win64 - os: windows-latest - compiler: cl - cmake-args: -A x64 - deploy-name: win64 - - - name: Windows MSVC Win64 Compat - os: windows-latest - compiler: cl - cmake-args: -A x64 -DZLIB_COMPAT=ON - deploy-name: win64-compat - - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - - name: Set environment variables - shell: bash - run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - - name: Generate project files - run: | - cmake . ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -DZLIB_ENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX=out -DINSTALL_UTILS=ON - env: - CC: ${{ matrix.compiler }} - CI: true - - - name: Compile source code - run: | - cmake --build . --config Release --target install - - - name: Package release (Windows) - if: runner.os == 'Windows' - run: | - cd out - 7z a -tzip ../zlib-ng-${{ matrix.deploy-name }}.zip bin include lib ../LICENSE.md ../README.md - - - name: Upload release (Windows) - uses: svenstaro/upload-release-action@v1-release - if: runner.os == 'Windows' - with: - asset_name: zlib-ng-${{ matrix.deploy-name }}.zip - file: zlib-ng-${{ matrix.deploy-name }}.zip - tag: ${{env.tag}} - repo_token: ${{ secrets.GITHUB_TOKEN }} - overwrite: true - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/libs/zlibng/.gitignore b/libs/zlibng/.gitignore deleted file mode 100644 index 23f9fd159..000000000 --- a/libs/zlibng/.gitignore +++ /dev/null @@ -1,86 +0,0 @@ -*.diff -*.patch -*.orig -*.rej - -*~ -*.a -*.lo -*.o -*.dylib - -*.gcda -*.gcno -*.gcov - -/adler32_test -/adler32_testsh -/example -/example64 -/examplesh -/libz.so* -/libz-ng.so* -/makefixed -/minigzip -/minigzip64 -/minigzipsh -/switchlevels -/zlib.pc -/zlib-ng.pc -/CVE-2003-0107 - -.DS_Store -*_fuzzer -*.obj -*.exe -*.pdb -*.exp -*.lib -*.dll -*.res -foo.gz -*.manifest -*.opensdf -*.sln -*.sdf -*.vcxproj -*.vcxproj.filters -.vs - -CMakeCache.txt -CMakeFiles -Testing -/*.cmake -*.stackdump -*._h -zconf.h -zconf.h.cmakein -zconf.h.included -zconf-ng.h -zconf-ng.h.cmakein -ztest* - -configure.log -a.out - -/Makefile -/arch/arm/Makefile -/arch/generic/Makefile -/arch/power/Makefile -/arch/x86/Makefile -.kdev4 -*.kdev4 - -/Debug -/example.dir -/minigzip.dir -/zlib.dir -/zlibstatic.dir -/win32/Debug -/build/ -/build[.-]*/ -/btmp[12]/ -/pkgtmp[12]/ - -/.idea -/cmake-build-debug diff --git a/libs/zlibng/.shellcheckrc b/libs/zlibng/.shellcheckrc deleted file mode 100644 index 89a1625ff..000000000 --- a/libs/zlibng/.shellcheckrc +++ /dev/null @@ -1 +0,0 @@ -disable=SC2140,SC2086,SC2046,SC2015,SC1097,SC1035,SC1036,SC1007,SC2154,SC2155,SC2000,SC2034,SC2016,SC1091,SC1090,SC2212,SC2143,SC2129,SC2102,SC2069,SC1041,SC1042,SC1044,SC1046,SC1119,SC1110,SC1111,SC1112,SC1102,SC1105,SC1101,SC1004,SC1003,SC1012,SC2068,SC2065,SC2064,SC2063,SC2059,SC2053,SC2048,SC2044,SC2032,SC2031,SC2030,SC2029,SC2025,SC2024,SC2022,SC2018,SC2019,SC2017,SC2014,SC2013,SC2012,SC2009,SC2001,SC2098,SC2096,SC2094,SC2091,SC2092,SC2088,SC2087,SC2076,SC2072,SC2071,SC2223,SC2221,SC2222,SC2217,SC2207,SC2206,SC2205,SC2190,SC2188,SC2187,SC2185,SC2179,SC2178,SC2174,SC2168,SC2167,SC2163,SC2161,SC2160,SC2153,SC2150,SC2148,SC2147,SC2146,SC2142,SC2139,SC2126,SC2123,SC2120,SC2119,SC2117,SC2114,SC1117,SC2164,SC1083,SC2004,SC2125,SC2128,SC2011,SC1008,SC1019,SC2093,SC1132,SC1129,SC2236,SC2237,SC2231,SC2230,SC2229,SC2106,SC2102,SC2243,SC2244,SC2245,SC2247,SC2248,SC2249,SC2250,SC2251,SC2252,SC2181 diff --git a/libs/zlibng/CMakeLists.txt b/libs/zlibng/CMakeLists.txt deleted file mode 100644 index 05087781e..000000000 --- a/libs/zlibng/CMakeLists.txt +++ /dev/null @@ -1,1285 +0,0 @@ -cmake_minimum_required(VERSION 3.5.1) -if(CMAKE_VERSION VERSION_LESS 3.12) - cmake_policy(VERSION ${CMAKE_VERSION}) -else() - cmake_policy(VERSION 3.5.1...3.13.2) -endif() -message(STATUS "Using CMake version ${CMAKE_VERSION}") - -set(CMAKE_MACOSX_RPATH 1) - -# If not specified on the command line, enable C99 as the default -# Configuration items that affect the global compiler envirionment standards -# should be issued before the "project" command. -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 99) # The C standard whose features are requested to build this target -endif() -if(NOT CMAKE_C_STANDARD_REQUIRED) - set(CMAKE_C_STANDARD_REQUIRED ON) # Boolean describing whether the value of C_STANDARD is a requirement -endif() -if(NOT CMAKE_C_EXTENSIONS) - set(CMAKE_C_EXTENSIONS OFF) # Boolean specifying whether compiler specific extensions are requested -endif() -set(VALID_C_STANDARDS "99" "11") -if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS) - MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in know standards list\n ${VALID_C_STANDARDS}") -endif() - -# Parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9]+.[0-9]+.[0-9]+).*\".*" - "\\1" ZLIB_HEADER_VERSION ${_zlib_h_contents}) -string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIBNG_HEADER_VERSION ${_zlib_h_contents}) -message(STATUS "ZLIB_HEADER_VERSION: ${ZLIB_HEADER_VERSION}") -message(STATUS "ZLIBNG_HEADER_VERSION: ${ZLIBNG_HEADER_VERSION}") - -project(zlib VERSION ${ZLIB_HEADER_VERSION} LANGUAGES C) - -set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -set(INC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -set(MAN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -set(PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") - -include(CheckTypeSize) -include(CheckSymbolExists) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) -include(CheckCSourceRuns) -include(CMakeDependentOption) -include(FeatureSummary) - -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect-arch.cmake) -include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect-sanitizer.cmake) - -if(CMAKE_TOOLCHAIN_FILE) - message(STATUS "Using CMake toolchain: ${CMAKE_TOOLCHAIN_FILE}") -endif() - -# Make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact -# this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Choose the type of build, standard options are: Debug Release RelWithDebInfo MinSizeRel." - FORCE) - add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (default)") -else() - add_feature_info(CMAKE_BUILD_TYPE 1 "Build type: ${CMAKE_BUILD_TYPE} (selected)") -endif() - -# -# Options parsing -# -macro(add_option name description value) - option(${name} ${description} ${value}) - add_feature_info(${name} ${name} ${description}) -endmacro() - -add_option(WITH_GZFILEOP "Compile with support for gzFile related functions" ON) -add_option(ZLIB_COMPAT "Compile with zlib compatible API" OFF) -add_option(ZLIB_ENABLE_TESTS "Build test binaries" ON) -add_option(ZLIB_DUAL_LINK "Dual link tests against system zlib" OFF) -add_option(WITH_SANITIZER "Build with sanitizer (Memory, Address, Undefined)" OFF) -add_option(WITH_FUZZERS "Build test/fuzz" OFF) -add_option(WITH_OPTIM "Build with optimisation" ON) -add_option(WITH_NEW_STRATEGIES "Use new strategies" ON) -add_option(WITH_NATIVE_INSTRUCTIONS - "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF) -add_option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF) -add_option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF) -add_option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF) -add_option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF) -add_option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON) - -if(BASEARCH_ARM_FOUND) - add_option(WITH_ACLE "Build with ACLE" ON) - add_option(WITH_NEON "Build with NEON intrinsics" ON) -elseif(BASEARCH_PPC_FOUND) - add_option(WITH_POWER8 "Build with optimisations for POWER8" ON) -elseif(BASEARCH_S360_FOUND) - add_option(WITH_DFLTCC_DEFLATE "Use DEFLATE CONVERSION CALL instruction for compression on IBM Z" OFF) - add_option(WITH_DFLTCC_INFLATE "Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z" OFF) -elseif(BASEARCH_X86_FOUND) - add_option(WITH_AVX2 "Build with AVX2" ON) - add_option(WITH_SSE2 "Build with SSE2" ON) - add_option(WITH_SSSE3 "Build with SSSE3" ON) - add_option(WITH_SSE4 "Build with SSE4" ON) - add_option(WITH_PCLMULQDQ "Build with PCLMULQDQ" ON) -endif() -add_option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF) - -mark_as_advanced(FORCE - ZLIB_DUAL_LINK - WITH_ACLE WITH_NEON - WITH_DFLTCC_DEFLATE - WITH_DFLTCC_INFLATE - WITH_AVX2 WITH_SSE2 - WITH_SSSE3 WITH_SSE4 - WITH_PCLMULQDQ - WITH_POWER8 - WITH_INFLATE_STRICT - WITH_INFLATE_ALLOW_INVALID_DIST - WITH_UNALIGNED - INSTALL_UTILS - ) - -if(ZLIB_COMPAT) - add_definitions(-DZLIB_COMPAT) - set(WITH_GZFILEOP ON) - set(SUFFIX "-ng") -else() - set(SUFFIX "-ng") -endif() - -if(WITH_GZFILEOP) - add_definitions(-DWITH_GZFILEOP) -endif() - -if("${CMAKE_C_COMPILER}" MATCHES "icc" OR "${CMAKE_C_COMPILER}" MATCHES "icpc" OR "${CMAKE_C_COMPILER}" MATCHES "icl") - if(CMAKE_HOST_UNIX OR APPLE) - set(WARNFLAGS "-w3") - set(WARNFLAGS_MAINTAINER "-w3 -Wcheck -Wremarks") - set(WARNFLAGS_DISABLE "") - if(BASEARCH_X86_FOUND) - set(AVX2FLAG "-mavx2") - set(SSE2FLAG "-msse2") - set(SSSE3FLAG "-mssse3") - set(SSE4FLAG "-msse4.2") - endif() - else() - set(WARNFLAGS "/W3") - set(WARNFLAGS_MAINTAINER "/W5") - set(WARNFLAGS_DISABLE "") - if(BASEARCH_X86_FOUND) - set(AVX2FLAG "/arch:AVX2") - set(SSE2FLAG "/arch:SSE2") - set(SSSE3FLAG "/arch:SSSE3") - set(SSE4FLAG "/arch:SSE4.2") - endif() - endif() - if(WITH_NATIVE_INSTRUCTIONS) - message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration") - endif() -elseif(MSVC) - # TODO. ICC can be used through MSVC. I'm not sure if we'd ever see that combination - # (who'd use cmake from an IDE...) but checking for ICC before checking for MSVC should - # avoid mistakes. - # /Oi ? - set(WARNFLAGS "/W3") - set(WARNFLAGS_MAINTAINER "/W4") - set(WARNFLAGS_DISABLE "") - if(BASEARCH_ARM_FOUND) - add_definitions(-D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE) - if(NOT "${ARCH}" MATCHES "aarch64") - set(NEONFLAG "/arch:VFPv4") - endif() - elseif(BASEARCH_X86_FOUND) - if(NOT "${ARCH}" MATCHES "x86_64") - set(SSE2FLAG "/arch:SSE2") - endif() - endif() - if(WITH_NATIVE_INSTRUCTIONS) - message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not supported on this configuration") - endif() -else() - # catch all GNU C compilers as well as Clang and AppleClang - if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang") - set(__GNUC__ ON) - endif() - # Enable warnings in GCC and Clang - if(__GNUC__) - set(WARNFLAGS "-Wall") - set(WARNFLAGS_MAINTAINER "-Wextra -Wpedantic") - set(WARNFLAGS_DISABLE "-Wno-implicit-fallthrough") - endif() - if(WITH_NATIVE_INSTRUCTIONS) - if(__GNUC__) - if(BASEARCH_PPC_FOUND) - set(NATIVEFLAG "-mcpu=native") - else() - set(NATIVEFLAG "-march=native") - endif() - else() - message(STATUS "Ignoring WITH_NATIVE_INSTRUCTIONS; not implemented yet on this configuration") - endif() - endif() - if(NOT NATIVEFLAG) - if(__GNUC__) - if(BASEARCH_ARM_FOUND) - if(NOT CMAKE_C_FLAGS MATCHES "-mfloat-abi") - # Check support for ARM floating point - execute_process(COMMAND ${CMAKE_C_COMPILER} "-dumpmachine" - OUTPUT_VARIABLE GCC_MACHINE) - if("${GCC_MACHINE}" MATCHES "gnueabihf") - set(FLOATABI "-mfloat-abi=hard") - elseif("${GCC_MACHINE}" MATCHES ".*gnueabi") - set(FLOATABI "-mfloat-abi=softfp") - endif() - message(STATUS "ARM floating point arch: ${FLOATABI}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLOATABI}") - endif() - # NEON - if("${ARCH}" MATCHES "aarch64") - set(NEONFLAG "-march=armv8-a+simd") - else() - # Check whether -mfpu=neon is available - set(CMAKE_REQUIRED_FLAGS "-mfpu=neon") - check_c_source_compiles( - "int main() { return 0; }" - MFPU_NEON_AVAILABLE FAIL_REGEX "not supported") - set(CMAKE_REQUIRED_FLAGS) - if(MFPU_NEON_AVAILABLE) - set(NEONFLAG "-mfpu=neon") - endif() - endif() - # ACLE - set(ACLEFLAG "-march=armv8-a+crc") - elseif(BASEARCH_PPC_FOUND) - set(POWER8FLAG "-mcpu=power8") - elseif(BASEARCH_X86_FOUND) - set(AVX2FLAG "-mavx2") - set(SSE2FLAG "-msse2") - set(SSSE3FLAG "-mssse3") - set(SSE4FLAG "-msse4") - set(PCLMULFLAG "-mpclmul") - endif() - endif() - endif() -endif() - -# Replace optimization level 3 added by default with level 2 -if(NOT MSVC AND NOT CMAKE_C_FLAGS MATCHES "([\\/\\-]O)3") - string(REGEX REPLACE "([\\/\\-]O)3" "\\12" - CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) -endif() - -# Set architecture alignment requirements -if(WITH_UNALIGNED) - if(BASEARCH_ARM_FOUND OR (BASEARCH_PPC_FOUND AND "${ARCH}" MATCHES "powerpc64le") OR BASEARCH_X86_FOUND) - if(NOT DEFINED UNALIGNED_OK) - set(UNALIGNED_OK TRUE) - endif() - endif() - if(UNALIGNED_OK) - add_definitions(-DUNALIGNED_OK) - message(STATUS "Architecture supports unaligned reads") - endif() - if(BASEARCH_ARM_FOUND) - if(NOT DEFINED UNALIGNED64_OK) - if("${ARCH}" MATCHES "(arm(v[8-9])?|aarch64)") - set(UNALIGNED64_OK TRUE) - endif() - endif() - endif() - if(BASEARCH_PPC_FOUND) - if(NOT DEFINED UNALIGNED64_OK) - if("${ARCH}" MATCHES "powerpc64le") - set(UNALIGNED64_OK TRUE) - endif() - endif() - endif() - if(BASEARCH_X86_FOUND) - if(NOT DEFINED UNALIGNED64_OK) - set(UNALIGNED64_OK TRUE) - endif() - endif() - if(UNALIGNED64_OK) - add_definitions(-DUNALIGNED64_OK) - message(STATUS "Architecture supports unaligned reads of > 4 bytes") - endif() -else() - message(STATUS "Unaligned reads manually disabled") -endif() - -# Apply warning compiler flags -if(WITH_MAINTAINER_WARNINGS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNFLAGS} ${WARNFLAGS_MAINTAINER} ${WARNFLAGS_DISABLE}") -else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNFLAGS} ${WARNFLAGS_DISABLE}") -endif() - -# Set code coverage compiler flags -if(WITH_CODE_COVERAGE) - if(CMAKE_C_COMPILER_ID MATCHES "Clang") - set(CMAKE_C_FLAGS "-O0 ${CMAKE_C_FLAGS} -coverage") - elseif(__GNUC__) - # Some versions of GCC don't support -coverage shorthand - set(CMAKE_C_FLAGS "-O0 ${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs -fprofile-values") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -fprofile-arcs") - endif() -endif() - -# Set native instruction set compiler flag -if(WITH_NATIVE_INSTRUCTIONS AND DEFINED NATIVEFLAG) - # Apply flag to all source files and compilation checks - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NATIVEFLAG}") -endif() - -# -# Check for stndard/system includes -# -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdarg.h HAVE_STDARG_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) -check_include_file(sys/sdt.h HAVE_SYS_SDT_H) -check_include_file(unistd.h HAVE_UNISTD_H) - -# -# Check to see if we have large file support -# -set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) -check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) -else() - check_type_size(_off64_t _OFF64_T) - if(HAVE__OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1 -D__USE_LARGEFILE64) - else() - check_type_size(__off64_t __OFF64_T) - endif() -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable - -# -# Check for fseeko and other optional functions -# -check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() -check_function_exists(strerror HAVE_STRERROR) -if(NOT HAVE_STRERROR) - add_definitions(-DNO_STRERROR) -endif() - -if(WITH_SANITIZER STREQUAL "Address") - add_address_sanitizer() -elseif(WITH_SANITIZER STREQUAL "Memory") - add_memory_sanitizer() -elseif(WITH_SANITIZER STREQUAL "Undefined") - add_undefined_sanitizer() -endif() - -# -# Check whether compiler supports -fno-semantic-interposition parameter -# -set(CMAKE_REQUIRED_FLAGS "-fno-semantic-interposition") -check_c_source_compiles( - "int main() { return 0; }" - HAVE_NO_INTERPOSITION -) -set(CMAKE_REQUIRED_FLAGS) - -# -# Check if we can hide zlib internal symbols that are linked between separate source files using hidden -# -check_c_source_compiles( - "#define Z_INTERNAL __attribute__((visibility (\"hidden\"))) - int Z_INTERNAL foo; - int main() { - return 0; - }" - HAVE_ATTRIBUTE_VISIBILITY_HIDDEN FAIL_REGEX "not supported") -if(HAVE_ATTRIBUTE_VISIBILITY_HIDDEN) - add_definitions(-DHAVE_VISIBILITY_HIDDEN) -endif() - -# -# Check if we can hide zlib internal symbols that are linked between separate source files using internal -# -check_c_source_compiles( - "#define Z_INTERNAL __attribute__((visibility (\"internal\"))) - int Z_INTERNAL foo; - int main() { - return 0; - }" - HAVE_ATTRIBUTE_VISIBILITY_INTERNAL FAIL_REGEX "not supported") -if(HAVE_ATTRIBUTE_VISIBILITY_INTERNAL) - add_definitions(-DHAVE_VISIBILITY_INTERNAL) -endif() - -# -# check for __builtin_ctz() support in the compiler -# -check_c_source_compiles( - "int main(void) { - unsigned int zero = 0; - long test = __builtin_ctz(zero); - (void)test; - return 0; - }" - HAVE_BUILTIN_CTZ -) -if(HAVE_BUILTIN_CTZ) - add_definitions(-DHAVE_BUILTIN_CTZ) -endif() -# -# check for __builtin_ctzll() support in the compiler -# -check_c_source_compiles( - "int main(void) { - unsigned int zero = 0; - long test = __builtin_ctzll(zero); - (void)test; - return 0; - }" - HAVE_BUILTIN_CTZLL -) -if(HAVE_BUILTIN_CTZLL) - add_definitions(-DHAVE_BUILTIN_CTZLL) -endif() - -# -# check for ptrdiff_t support -# -check_c_source_compiles( - "#include - int main() { - ptrdiff_t *a; - (void)a; - return 0; - }" - HAVE_PTRDIFF_T -) -if(NOT HAVE_PTRDIFF_T) - set(NEED_PTRDIFF_T 1) - - check_type_size("void *" SIZEOF_DATA_PTR) - message(STATUS "sizeof(void *) is ${SIZEOF_DATA_PTR} bytes") - - if(${SIZEOF_DATA_PTR} MATCHES "4") - set(PTRDIFF_TYPE "uint32_t") - elseif(${SIZEOF_DATA_PTR} MATCHES "8") - set(PTRDIFF_TYPE "uint64_t") - else() - message(FATAL_ERROR "sizeof(void *) is neither 32 nor 64 bit") - endif() -endif() - -# Macro to check if source compiles -# (and, when compiling very natively, also runs). -macro(check_c_source_compile_or_run source flag) - if(CMAKE_CROSSCOMPILING OR NOT WITH_NATIVE_INSTRUCTIONS) - check_c_source_compiles("${source}" ${flag}) - else() - check_c_source_runs("${source}" ${flag}) - endif() -endmacro() - -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DZLIB_DEBUG") - -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) -endif() - -if(BASEARCH_PPC_FOUND) - # Check if we have what we need for POWER8 optimizations - set(CMAKE_REQUIRED_FLAGS "${POWER8FLAG}") - check_c_source_compiles( - "#include - int main() { - return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); - }" - HAVE_POWER8 - ) - set(CMAKE_REQUIRED_FLAGS) -elseif(BASEARCH_X86_FOUND) - # Check whether compiler supports SSE2 instrinics - set(CMAKE_REQUIRED_FLAGS "${SSE2FLAG}") - check_c_source_compile_or_run( - "#include - int main(void) { - __m128i zero = _mm_setzero_si128(); - (void)zero; - return 0; - }" - HAVE_SSE2_INTRIN - ) - # Check whether compiler supports SSSE3 intrinsics - set(CMAKE_REQUIRED_FLAGS "${SSSE3FLAG}") - check_c_source_compile_or_run( - "#include - int main(void) { - __m128i u, v, w; - u = _mm_set1_epi32(1); - v = _mm_set1_epi32(2); - w = _mm_hadd_epi32(u, v); - (void)w; - return 0; - }" - HAVE_SSSE3_INTRIN - ) - # Check whether compiler supports SSE4 CRC inline asm - set(CMAKE_REQUIRED_FLAGS "${SSE4FLAG}") - check_c_source_compile_or_run( - "int main(void) { - unsigned val = 0, h = 0; - #if defined(_MSC_VER) - { __asm mov edx, h __asm mov eax, val __asm crc32 eax, edx __asm mov val, eax } - #else - __asm__ __volatile__ ( \"crc32 %1,%0\" : \"+r\" (h) : \"r\" (val) ); - #endif - return (int)h; - }" - HAVE_SSE42CRC_INLINE_ASM - ) - # Check whether compiler supports SSE4 CRC intrinsics - check_c_source_compile_or_run( - "#include - int main(void) { - unsigned crc = 0; - char c = 'c'; - #if defined(_MSC_VER) - crc = _mm_crc32_u32(crc, c); - #else - crc = __builtin_ia32_crc32qi(crc, c); - #endif - (void)crc; - return 0; - }" - HAVE_SSE42CRC_INTRIN - ) - # Check whether compiler supports SSE4.2 compare string instrinics - check_c_source_compile_or_run( - "#include - int main(void) { - unsigned char a[64] = { 0 }; - unsigned char b[64] = { 0 }; - __m128i xmm_src0, xmm_src1; - xmm_src0 = _mm_loadu_si128((__m128i *)(char *)a); - xmm_src1 = _mm_loadu_si128((__m128i *)(char *)b); - return _mm_cmpestri(xmm_src0, 16, xmm_src1, 16, 0); - }" - HAVE_SSE42CMPSTR_INTRIN - ) - # Check whether compiler supports PCLMULQDQ intrinsics - set(CMAKE_REQUIRED_FLAGS "${PCLMULFLAG}") - if(NOT (APPLE AND "${ARCH}" MATCHES "i386")) - # The pclmul code currently crashes on Mac in 32bit mode. Avoid for now. - check_c_source_compile_or_run( - "#include - int main(void) { - __m128i a = _mm_setzero_si128(); - __m128i b = _mm_setzero_si128(); - __m128i c = _mm_clmulepi64_si128(a, b, 0x10); - (void)c; - return 0; - }" - HAVE_PCLMULQDQ_INTRIN - ) - else() - set(HAVE_PCLMULQDQ_INTRIN NO) - endif() - # Check whether compiler supports AVX2 intrinics - set(CMAKE_REQUIRED_FLAGS "${AVX2FLAG}") - check_c_source_compile_or_run( - "#include - int main(void) { - __m256i x = _mm256_set1_epi16(2); - const __m256i y = _mm256_set1_epi16(1); - x = _mm256_subs_epu16(x, y); - (void)x; - return 0; - }" - HAVE_AVX2_INTRIN - ) - set(CMAKE_REQUIRED_FLAGS) - - # FORCE_SSE2 option will only be shown if HAVE_SSE2_INTRIN is true - if("${ARCH}" MATCHES "i[3-6]86") - cmake_dependent_option(FORCE_SSE2 "Always assume CPU is SSE2 capable" OFF "HAVE_SSE2_INTRIN" OFF) - endif() -endif() - -# -# Enable deflate_quick at level 1 -# -if(NOT WITH_NEW_STRATEGIES) - add_definitions(-DNO_QUICK_STRATEGY) -endif() -# -# Enable deflate_medium at level 4-6 -# -if(NOT WITH_NEW_STRATEGIES) - add_definitions(-DNO_MEDIUM_STRATEGY) -endif() -# -# Enable inflate compilation options -# -if(WITH_INFLATE_STRICT) - add_definitions(-DINFLATE_STRICT) - message(STATUS "Inflate strict distance checking enabled") -endif() -if(WITH_INFLATE_ALLOW_INVALID_DIST) - add_definitions(-DINFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR) - message(STATUS "Inflate zero data for invalid distances enabled") -endif() - - -set(ZLIB_ARCH_SRCS) -set(ZLIB_ARCH_HDRS) -set(ARCHDIR "arch/generic") -if(BASEARCH_ARM_FOUND) - set(ARCHDIR "arch/arm") -elseif(BASEARCH_PPC_FOUND) - set(ARCHDIR "arch/power") -elseif(BASEARCH_S360_FOUND) - set(ARCHDIR "arch/s390") -elseif(BASEARCH_X86_FOUND) - set(ARCHDIR "arch/x86") - if(NOT ${ARCH} MATCHES "x86_64") - add_feature_info(SSE2 1 "Support the SSE2 instruction set, using \"${SSE2FLAG}\"") - endif() -else() - message(STATUS "No optimized architecture: using ${ARCHDIR}") -endif() - -if(WITH_OPTIM) - if(BASEARCH_ARM_FOUND) - add_definitions(-DARM_FEATURES) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/arm.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/armfeature.c) - if(WITH_ACLE AND NOT MSVC) - add_definitions(-DARM_ACLE_CRC_HASH) - set(ACLE_SRCS ${ARCHDIR}/crc32_acle.c ${ARCHDIR}/insert_string_acle.c) - set_property(SOURCE ${ACLE_SRCS} PROPERTY COMPILE_FLAGS "${ACLEFLAG}") - list(APPEND ZLIB_ARCH_SRCS ${ACLE_SRCS}) - add_feature_info(ACLE_CRC 1 "Support ACLE optimized CRC hash generation, using \"${ACLEFLAG}\"") - endif() - if(WITH_NEON) - add_definitions(-DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH) - set(NEON_SRCS ${ARCHDIR}/adler32_neon.c ${ARCHDIR}/chunkset_neon.c ${ARCHDIR}/slide_neon.c) - list(APPEND ZLIB_ARCH_SRCS ${NEON_SRCS}) - set_property(SOURCE ${NEON_SRCS} PROPERTY COMPILE_FLAGS "${NEONFLAG}") - if(MSVC) - add_definitions(-D__ARM_NEON__) - endif() - add_feature_info(NEON_ADLER32 1 "Support NEON instructions in adler32, using \"${NEONFLAG}\"") - add_feature_info(NEON_SLIDEHASH 1 "Support NEON instructions in slide_hash, using \"${NEONFLAG}\"") - endif() - elseif(BASEARCH_PPC_FOUND) - if(WITH_POWER8 AND HAVE_POWER8) - add_definitions(-DPOWER8) - add_definitions(-DPOWER_FEATURES) - add_definitions(-DPOWER8_VSX_ADLER32) - add_definitions(-DPOWER8_VSX_SLIDEHASH) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power.c) - set(POWER8_SRCS ${ARCHDIR}/adler32_power8.c ${ARCHDIR}/slide_hash_power8.c) - list(APPEND ZLIB_ARCH_SRCS ${POWER8_SRCS}) - set_property(SOURCE ${POWER8_SRCS} PROPERTY COMPILE_FLAGS "${POWER8FLAG}") - endif() - elseif(BASEARCH_S360_FOUND) - if(WITH_DFLTCC_DEFLATE OR WITH_DFLTCC_INFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_common.c) - add_definitions(-DGZBUFSIZE=262144) - endif() - if(WITH_DFLTCC_DEFLATE) - add_definitions(-DS390_DFLTCC_DEFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_deflate.c) - endif() - if(WITH_DFLTCC_INFLATE) - add_definitions(-DS390_DFLTCC_INFLATE) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/dfltcc_inflate.c) - endif() - elseif(BASEARCH_X86_FOUND) - add_definitions(-DX86_FEATURES) - list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/x86.h) - list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/x86.c) - if(MSVC) - list(APPEND ZLIB_ARCH_HDRS fallback_builtins.h) - endif() - if(WITH_AVX2 AND HAVE_AVX2_INTRIN) - add_definitions(-DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET) - set(AVX2_SRCS ${ARCHDIR}/slide_avx.c) - add_feature_info(AVX2_SLIDEHASH 1 "Support AVX2 optimized slide_hash, using \"${AVX2FLAG}\"") - list(APPEND AVX2_SRCS ${ARCHDIR}/chunkset_avx.c) - add_feature_info(AVX_CHUNKSET 1 "Support AVX optimized chunkset, using \"${AVX2FLAG}\"") - list(APPEND AVX2_SRCS ${ARCHDIR}/compare258_avx.c) - add_feature_info(AVX2_COMPARE258 1 "Support AVX2 optimized compare258, using \"${AVX2FLAG}\"") - list(APPEND AVX2_SRCS ${ARCHDIR}/adler32_avx.c) - add_feature_info(AVX2_ADLER32 1 "Support AVX2-accelerated adler32, using \"${AVX2FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${AVX2_SRCS}) - set_property(SOURCE ${AVX2_SRCS} PROPERTY COMPILE_FLAGS "${AVX2FLAG}") - endif() - if(WITH_SSE4 AND (HAVE_SSE42CRC_INLINE_ASM OR HAVE_SSE42CRC_INTRIN)) - add_definitions(-DX86_SSE42_CRC_HASH) - set(SSE42_SRCS ${ARCHDIR}/insert_string_sse.c) - add_feature_info(SSE42_CRC 1 "Support SSE4.2 optimized CRC hash generation, using \"${SSE4FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) - set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG}") - if(HAVE_SSE42CRC_INTRIN) - add_definitions(-DX86_SSE42_CRC_INTRIN) - endif() - endif() - if(HAVE_SSE42CMPSTR_INTRIN) - add_definitions(-DX86_SSE42_CMP_STR) - set(SSE42_SRCS ${ARCHDIR}/compare258_sse.c) - add_feature_info(SSE42_COMPARE258 1 "Support SSE4.2 optimized compare258, using \"${SSE4FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSE42_SRCS}) - set_property(SOURCE ${SSE42_SRCS} PROPERTY COMPILE_FLAGS "${SSE4FLAG}") - endif() - if(WITH_SSE2 AND HAVE_SSE2_INTRIN) - add_definitions(-DX86_SSE2 -DX86_SSE2_CHUNKSET -DX86_SSE2_SLIDEHASH) - set(SSE2_SRCS ${ARCHDIR}/chunkset_sse.c ${ARCHDIR}/slide_sse.c) - list(APPEND ZLIB_ARCH_SRCS ${SSE2_SRCS}) - if(NOT ${ARCH} MATCHES "x86_64") - set_property(SOURCE ${SSE2_SRCS} PROPERTY COMPILE_FLAGS "${SSE2FLAG}") - add_feature_info(FORCE_SSE2 FORCE_SSE2 "Assume CPU is SSE2 capable") - if(FORCE_SSE2) - add_definitions(-DX86_NOCHECK_SSE2) - endif() - endif() - endif() - if(WITH_SSSE3 AND HAVE_SSSE3_INTRIN) - add_definitions(-DX86_SSSE3 -DX86_SSSE3_ADLER32) - set(SSSE3_SRCS ${ARCHDIR}/adler32_ssse3.c) - add_feature_info(SSSE3_ADLER32 1 "Support SSSE3-accelerated adler32, using \"${SSSE3FLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${SSSE3_SRCS}) - set_property(SOURCE ${SSSE3_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG}") - endif() - if(WITH_PCLMULQDQ AND HAVE_PCLMULQDQ_INTRIN AND WITH_SSSE3 AND WITH_SSE4) - add_definitions(-DX86_PCLMULQDQ_CRC) - set(PCLMULQDQ_SRCS ${ARCHDIR}/crc_folding.c) - add_feature_info(PCLMUL_CRC 1 "Support CRC hash generation using PCLMULQDQ, using \"${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG}\"") - list(APPEND ZLIB_ARCH_SRCS ${PCLMULQDQ_SRCS}) - set_property(SOURCE ${PCLMULQDQ_SRCS} PROPERTY COMPILE_FLAGS "${SSSE3FLAG} ${SSE4FLAG} ${PCLMULFLAG}") - endif() - endif() -endif() -message(STATUS "Architecture-specific source files: ${ZLIB_ARCH_SRCS}") - -#============================================================================ -# zconf.h -#============================================================================ - -macro(generate_cmakein input output) - file(REMOVE ${output}) - file(STRINGS ${input} _lines) - foreach(_line IN LISTS _lines) - string(REGEX REPLACE "#ifdef HAVE_UNISTD_H.*" "@ZCONF_UNISTD_LINE@" _line "${_line}") - string(REGEX REPLACE "#ifdef HAVE_STDARG_H.*" "@ZCONF_STDARG_LINE@" _line "${_line}") - string(REGEX REPLACE "#ifdef NEED_PTRDIFF_T.*" "@ZCONF_PTRDIFF_LINE@" _line "${_line}") - if(NEED_PTRDIFF_T) - string(REGEX REPLACE "typedef PTRDIFF_TYPE" "typedef @PTRDIFF_TYPE@" _line "${_line}") - endif() - file(APPEND ${output} "${_line}\n") - endforeach() -endmacro(generate_cmakein) - -generate_cmakein( ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.in ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein ) - -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h") - message(STATUS "to 'zconf${SUFFIX}.h.included' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.included) - endif() - - # If we're doing an out of source build and the user has a zconf.h.cmakein - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein") - message(STATUS "to 'zconf${SUFFIX}.h.cmakeincluded' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakein ${CMAKE_CURRENT_SOURCE_DIR}/zconf${SUFFIX}.h.cmakeincluded) - endif() -endif() - -# Refer to prefix symbolically to ease relocation by end user, -# as Makefile-generated .pc file does. -if(INC_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/include") - set(PC_INC_INSTALL_DIR "\${prefix}/include") -else() - set(PC_INC_INSTALL_DIR "${INSTALL_INC_DIR}") -endif() -if(LIB_INSTALL_DIR STREQUAL "${CMAKE_INSTALL_PREFIX}/lib") - set(PC_LIB_INSTALL_DIR "\${exec_prefix}/lib") -else() - set(PC_LIB_INSTALL_DIR "${INSTALL_LIB_DIR}") -endif() - -#============================================================================ -# zlib -#============================================================================ - -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h - zlib${SUFFIX}.h -) -set(ZLIB_PRIVATE_HDRS - adler32_p.h - chunkset_tpl.h - crc32_p.h - crc32_tbl.h - crc32_comb_tbl.h - deflate.h - deflate_p.h - functable.h - inffast.h - inffixed_tbl.h - inflate.h - inflate_p.h - inftrees.h - insert_string_tpl.h - match_tpl.h - trees.h - trees_emit.h - trees_tbl.h - zbuild.h - zendian.h - zutil.h -) -set(ZLIB_SRCS - adler32.c - chunkset.c - compare258.c - compress.c - crc32.c - crc32_comb.c - deflate.c - deflate_fast.c - deflate_medium.c - deflate_quick.c - deflate_slow.c - functable.c - infback.c - inffast.c - inflate.c - inftrees.c - insert_string.c - trees.c - uncompr.c - zutil.c -) - -set(ZLIB_GZFILE_PRIVATE_HDRS - gzguts.h -) -set(ZLIB_GZFILE_SRCS - gzlib.c - gzread.c - gzwrite.c -) - -if(NOT MINGW AND NOT MSYS) - set(ZLIB_DLL_SRCS - win32/zlib${SUFFIX}1.rc # If present will override custom build rule below. - ) -endif() - -if(MINGW OR MSYS) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) - endif() - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} - -D GCC_WINDRES - -I ${CMAKE_CURRENT_SOURCE_DIR} - -I ${CMAKE_CURRENT_BINARY_DIR} - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib${SUFFIX}1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -endif() - -set(ZLIB_ALL_SRCS ${ZLIB_SRCS} ${ZLIB_ARCH_HDRS} ${ZLIB_ARCH_SRCS} ${ZLIB_DLL_SRCS} - ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -if(WITH_GZFILEOP) - list(APPEND ZLIB_ALL_SRCS ${ZLIB_GZFILE_PRIVATE_HDRS} ${ZLIB_GZFILE_SRCS}) -endif() - -if(NOT DEFINED BUILD_SHARED_LIBS) - add_library(zlib SHARED ${ZLIB_ALL_SRCS}) - add_library(zlibstatic STATIC ${ZLIB_ALL_SRCS}) - - set(ZLIB_INSTALL_LIBRARIES zlib zlibstatic) -else() - add_library(zlib ${ZLIB_ALL_SRCS}) - - set(ZLIB_INSTALL_LIBRARIES zlib) -endif() - -foreach(ZLIB_INSTALL_LIBRARY ${ZLIB_INSTALL_LIBRARIES}) - target_include_directories(${ZLIB_INSTALL_LIBRARY} PUBLIC - ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -endforeach() - -if(WIN32) - set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME zlib${SUFFIX}) -else() - # On unix-like platforms the library is almost always called libz - set_target_properties(${ZLIB_INSTALL_LIBRARIES} PROPERTIES OUTPUT_NAME z${SUFFIX}) -endif() - -if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) - set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) - - if(ZLIB_COMPAT) - set(ZLIB_FULL_VERSION ${ZLIB_HEADER_VERSION}.zlib-ng) - set_target_properties(zlib PROPERTIES SOVERSION 1) - else() - set(ZLIB_FULL_VERSION ${ZLIBNG_HEADER_VERSION}) - set_target_properties(zlib PROPERTIES SOVERSION 2) - endif() - - if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # 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}) - endif() - - if(UNIX) - if(HAVE_NO_INTERPOSITION) - set_target_properties(zlib PROPERTIES COMPILE_FLAGS "-fno-semantic-interposition") - endif() - if(NOT APPLE) - set_target_properties(zlib PROPERTIES LINK_FLAGS - "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.map\"") - else() - # Match configure/make's behavior (i.e. don't use @rpath on mac). - set_target_properties(zlib PROPERTIES INSTALL_NAME_DIR "${LIB_INSTALL_DIR}") - endif() - elseif(MSYS) - # Suppress version number from shared library name - set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0) - elseif(WIN32) - # Creates zlib1.dll when building shared library version - if(ZLIB_COMPAT) - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") - else() - set_target_properties(zlib PROPERTIES SUFFIX "2.dll") - endif() - endif() -endif() - -if(HAVE_STDARG_H) - SET(ZCONF_STDARG_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") -else() - SET(ZCONF_STDARG_LINE "#ifdef HAVE_STDARG_H /* may be set to #if 1 by configure/cmake/etc */") -endif() -if(HAVE_UNISTD_H) - SET(ZCONF_UNISTD_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") -else() - SET(ZCONF_UNISTD_LINE "#ifdef HAVE_UNISTD_H /* may be set to #if 1 by configure/cmake/etc */") -endif() -if(NEED_PTRDIFF_T) - SET(ZCONF_PTRDIFF_LINE "#if 1 /* was set to #if 1 by configure/cmake/etc */") -else() - SET(ZCONF_PTRDIFF_LINE "#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */") -endif() - -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.pc) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file(${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h @ONLY) - -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS ${ZLIB_INSTALL_LIBRARIES} - RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}") -endif() -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(FILES zlib${SUFFIX}.h - DESTINATION "${INC_INSTALL_DIR}" RENAME zlib${SUFFIX}.h) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h - DESTINATION "${INC_INSTALL_DIR}" RENAME zconf${SUFFIX}.h) -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) - install(FILES zlib.3 DESTINATION "${MAN_INSTALL_DIR}/man3" RENAME zlib${SUFFIX}.3) -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL) - install(FILES ${ZLIB_PC} DESTINATION "${PKGCONFIG_INSTALL_DIR}") -endif() - -#============================================================================ -# Example binaries -#============================================================================ - -option(ZLIB_ENABLE_TESTS "Build test binaries" ON) -if(ZLIB_ENABLE_TESTS) - enable_testing() - macro(configure_test_executable target) - target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - if(NOT WITH_GZFILEOP) - target_compile_definitions(${target} PUBLIC -DWITH_GZFILEOP) - target_sources(${target} PRIVATE ${ZLIB_GZFILE_PRIVATE_HDRS} ${ZLIB_GZFILE_SRCS}) - endif() - if(ZLIB_DUAL_LINK) - find_package(ZLIB) - if(ZLIB_FOUND) - target_link_libraries(${target} ${ZLIB_LIBRARIES}) - endif() - endif() - endmacro() - - add_executable(adler32_test test/adler32_test.c) - configure_test_executable(adler32_test) - target_link_libraries(adler32_test zlib) - - set(ADLER32TEST_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME adler32_test COMMAND ${ADLER32TEST_COMMAND}) - - add_executable(example test/example.c) - configure_test_executable(example) - target_link_libraries(example zlib) - - set(EXAMPLE_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME example COMMAND ${EXAMPLE_COMMAND}) - - set(MINIGZIP_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_executable(minigzip test/minigzip.c) - configure_test_executable(minigzip) - if(NOT DEFINED BUILD_SHARED_LIBS) - target_link_libraries(minigzip zlibstatic) - else() - target_link_libraries(minigzip zlib) - endif() - if(BASEARCH_S360_FOUND) - if(WITH_DFLTCC_DEFLATE OR WITH_DFLTCC_INFLATE) - set_source_files_properties(test/minigzip.c PROPERTIES COMPILE_DEFINITIONS BUFLEN=262144) - endif() - endif() - - set(MINIDEFLATE_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_executable(minideflate test/minideflate.c) - configure_test_executable(minideflate) - target_link_libraries(minideflate zlib) - - if(INSTALL_UTILS) - install(TARGETS minigzip minideflate - RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}") - endif() - - set(SWITCHLEVELS_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_executable(switchlevels test/switchlevels.c) - configure_test_executable(switchlevels) - target_link_libraries(switchlevels zlib) - - add_executable(infcover test/infcover.c inftrees.c) - configure_test_executable(infcover) - target_link_libraries(infcover zlib) - - add_executable(makefixed tools/makefixed.c inftrees.c) - target_include_directories(makefixed PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - set(MAKEFIXED_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME makefixed - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKEFIXED_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/inffixed_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/inffixed_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - add_executable(maketrees tools/maketrees.c trees.c zutil.c) - target_include_directories(maketrees PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - set(MAKETREES_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME maketrees - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKETREES_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/trees_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/trees_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - add_executable(makecrct tools/makecrct.c) - target_include_directories(makecrct PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - set(MAKECRCT_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME makecrct-crc32 - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKECRCT_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/crc32_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/crc32_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - set(MAKECRCT_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -c) - add_test(NAME makecrct-crc32-combine - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${MAKECRCT_COMMAND}" - -DOUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/crc32_comb_tbl._h - -DCOMPARE=${CMAKE_CURRENT_SOURCE_DIR}/crc32_comb_tbl.h - -DIGNORE_LINE_ENDINGS=ON - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-compare.cmake) - - if(WITH_FUZZERS) - set(FUZZERS checksum compress example_small example_large example_flush example_dict minigzip) - file(GLOB ALL_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*") - foreach(FUZZER ${FUZZERS}) - add_executable(${FUZZER}_fuzzer test/fuzz/${FUZZER}_fuzzer.c test/fuzz/standalone_fuzz_target_runner.c) - configure_test_executable(${FUZZER}_fuzzer) - target_link_libraries(${FUZZER}_fuzzer zlib) - set(FUZZER_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ALL_SRC_FILES}) - add_test(NAME ${FUZZER}_fuzzer COMMAND ${FUZZER_COMMAND}) - endforeach() - endif() - - macro(test_minigzip name path) - # Construct compression arguments for minigzip - set(compress_args -k -c) - foreach(extra_arg IN ITEMS "${ARGN}") - list(APPEND compress_args ${extra_arg}) - endforeach() - - # Create unique friendly string for test - string(REPLACE ";" "" arg_list "${ARGN}") - string(REPLACE " " "" arg_list "${arg_list}") - string(REPLACE "-" "" arg_list "${arg_list}") - - set(test_id minigzip-${name}-${arg_list}) - - if(NOT TEST ${test_id}) - add_test(NAME ${test_id} - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIGZIP_COMMAND}" - "-DCOMPRESS_ARGS=${compress_args}" - "-DDECOMPRESS_ARGS=-d;-c" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/${path} - -DOUTPUT=${CMAKE_CURRENT_SOURCE_DIR}/${path}-${test_id}.gz - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - endif() - endmacro() - - set(TEST_CONFIGS - -R # Z_RLE - -h # Z_HUFFMAN_ONLY - -T # Direct store - -0 # No compression - -1 # Deflate quick - -4 # Deflate medium (lazy matches) - "-5;-F" # Deflate medium (Z_FIXED) - -6 # Deflate medium - -9 # Deflate slow - "-9;-f" # Deflate slow (Z_FILTERED) - ) - - file(GLOB_RECURSE TEST_FILE_PATHS - LIST_DIRECTORIES false - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/test/data/*) - - foreach(TEST_FILE_PATH ${TEST_FILE_PATHS}) - if("${TEST_FILE_PATH}" MATCHES ".gz$" OR "${TEST_FILE_PATH}" MATCHES ".out$" OR - "${TEST_FILE_PATH}" MATCHES "/.git/" OR "${TEST_FILE_PATH}" MATCHES ".md$") - continue() - endif() - foreach(TEST_CONFIG ${TEST_CONFIGS}) - get_filename_component(TEST_NAME ${TEST_FILE_PATH} NAME_WE) - if (TEST_NAME STREQUAL "") - continue() - endif() - test_minigzip(${TEST_NAME} ${TEST_FILE_PATH} ${TEST_CONFIG}) - endforeach() - endforeach() - - test_minigzip("detect-text" "test/data/lcet10.txt" -A) - test_minigzip("detect-binary" "test/data/paper-100k.pdf" -A) - - set(CVES CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096) - foreach(CVE ${CVES}) - set(CVE_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -d) - add_test(NAME ${CVE} - COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${CVE_COMMAND}" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/${CVE}/test.gz - "-DSUCCESS_EXIT=0;1" - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/run-and-redirect.cmake) - endforeach() - - if(NOT WIN32 AND ZLIB_COMPAT) - add_executable(CVE-2003-0107 test/CVE-2003-0107.c) - target_link_libraries(CVE-2003-0107 zlib) - set(CVE20030107_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME CVE-2003-0107 COMMAND ${CVE20030107_COMMAND}) - endif() - - set(INFCOVER_COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - add_test(NAME infcover COMMAND ${INFCOVER_COMMAND}) - - add_test(NAME GH-361 - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIGZIP_COMMAND}" - "-DCOMPRESS_ARGS=-c;-k;-4" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-361/test.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-364 - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=1;5;9;3" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-364/test.bin - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-382 - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIDEFLATE_COMMAND}" - "-DCOMPRESS_ARGS=-c;-m;1;-w;-15;-1;-s;4" - "-DDECOMPRESS_ARGS=-c;-d;-m;1;-w;-15" - -DGZIP_VERIFY=OFF - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-382/defneg3.dat - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-536-segfault - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=6;9744;1;91207" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DCOMPARE=OFF - -DGZIP_VERIFY=OFF - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/data/lcet10.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-536-incomplete-read - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=6;88933;1;195840;2;45761" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DCOMPARE=OFF - -DGZIP_VERIFY=OFF - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/data/lcet10.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-536-zero-stored-block - COMMAND ${CMAKE_COMMAND} - "-DCOMPRESS_TARGET=${SWITCHLEVELS_COMMAND}" - "-DCOMPRESS_ARGS=6;15248;1;1050;2;25217" - "-DDECOMPRESS_TARGET=${MINIGZIP_COMMAND}" - -DCOMPARE=OFF - -DGZIP_VERIFY=OFF - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/data/lcet10.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) - - add_test(NAME GH-751 - COMMAND ${CMAKE_COMMAND} - "-DTARGET=${MINIGZIP_COMMAND}" - -DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/test/GH-751/test.txt - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-compress.cmake) -endif() - -FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES) diff --git a/libs/zlibng/FAQ.zlib b/libs/zlibng/FAQ.zlib deleted file mode 100644 index f234f3e59..000000000 --- a/libs/zlibng/FAQ.zlib +++ /dev/null @@ -1,374 +0,0 @@ -## -# THIS IS AN UNMAINTAINED COPY OF THE ORIGINAL FILE DISTRIBUTED WITH ZLIB 1.2.11 -## - - - - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://zlib.net/ which may have more recent information. -The lastest zlib FAQ is at http://zlib.net/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://marknelson.us/1997/01/01/zlib-engine/ - * win32/DLL_FAQ.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR. - - Make sure that before the call of compress(), the length of the compressed - buffer is equal to the available size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR. - - Before making the call, make sure that avail_in and avail_out are not zero. - When setting the parameter flush equal to Z_FINISH, also make sure that - avail_out is big enough to allow processing all pending input. Note that a - Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be - made with more input or output space. A Z_BUF_ERROR may in fact be - unavoidable depending on how the functions are used, since it is not - possible to tell whether or not there is more output pending when - strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a - heavily annotated example. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h . Examples of zlib usage are in the files test/example.c - and test/minigzip.c, with more in examples/ . - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple package. - zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of zlib. - Please try to reproduce the problem with a small program and send the - corresponding source to us at zlib@gzip.org . Do not send multi-megabyte - data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - Not by itself, no. See the directory contrib/minizip in the zlib - distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - By default a shared (and a static) library is built for Unix. So: - - make distclean - ./configure - make - -14. How do I install a shared zlib library on Unix? - - After the above, then: - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to - it. You can check the version at the top of zlib.h or with the - ZLIB_VERSION symbol defined in zlib.h . - -15. I have a question about OttoPDF. - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site: Joel Hainley, jhainley@myndkryme.com. - -16. Can zlib decode Flate data in an Adobe PDF file? - - Yes. See http://www.pdflib.com/ . To modify PDF forms, see - http://sourceforge.net/projects/acroformtool/ . - -17. Why am I getting this "register_frame_info not found" error on Solaris? - - After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib - generates an error such as: - - ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: - symbol __register_frame_info: referenced symbol not found - - The symbol __register_frame_info is not part of zlib, it is generated by - the C compiler (cc or gcc). You must recompile applications using zlib - which have this problem. This problem is specific to Solaris. See - http://www.sunfreeware.com for Solaris versions of zlib and applications - using zlib. - -18. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip formats - use the same compressed data format internally, but have different headers - and trailers around the compressed data. - -19. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about a - single file, such as the name and last modification date. The zlib format - on the other hand was designed for in-memory and communication channel - applications, and has a much more compact header and trailer and uses a - faster integrity check than gzip. - -20. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode the - gzip format using inflateInit2(). Read zlib.h for more details. - -21. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's *Init* functions - allow for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -22. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -23. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -24. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -25. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -26. Will zlib work on a 64-bit machine? - - Yes. It has been tested on 64-bit machines, and has no dependence on any - data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -27. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format than - does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -28. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically use - Z_FULL_FLUSH, carefully write all the pending data at those points, and - keep an index of those locations, then you can start decompression at those - points. You have to be careful to not use Z_FULL_FLUSH too often, since it - can significantly degrade compression. Alternatively, you can scan a - deflate stream once to generate an index, and then use that index for - random access. See examples/zran.c . - -29. Does zlib work on MVS, OS/390, CICS, etc.? - - It has in the past, but we have not heard of any recent evidence. There - were working ports of zlib 1.1.4 to MVS, but those links no longer work. - If you know of recent, successful applications of zlib on these operating - systems, please let us know. Thanks. - -30. Is there some simpler, easier to read version of inflate I can look at to - understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -31. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -32. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit only - if the compiler's "long" type is 32 bits. If the compiler's "long" type is - 64 bits, then the limit is 16 exabytes. - -33. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib is - compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of an 8K string space (or other value as set by - gzbuffer()), other than the caller of gzprintf() assuring that the output - will not exceed 8K. On the other hand, if zlib is compiled to use - snprintf() or vsnprintf(), which should normally be the case, then there is - no vulnerability. The ./configure script will display warnings if an - insecure variation of sprintf() will be used by gzprintf(). Also the - zlibCompileFlags() function will return information on what variant of - sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability, and versions - 1.2.1 and 1.2.2 were subject to an access exception when decompressing - invalid compressed data. - -34. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://zlib.net/ . - -35. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pedantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly as well as contradicted each other. So now, we simply - make sure that the code always works. - -36. Valgrind (or some similar memory access checker) says that deflate is - performing a conditional jump that depends on an uninitialized value. - Isn't that a bug? - - No. That is intentional for performance reasons, and the output of deflate - is not affected. This only started showing up recently since zlib 1.2.x - uses malloc() by default for allocations, whereas earlier versions used - calloc(), which zeros out the allocated memory. Even though the code was - correct, versions 1.2.4 and later was changed to not stimulate these - checkers. - -37. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -38. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very - weak and can be broken with freely available programs. To get strong - encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib - compression. For PKZIP compatible "encryption", look at - http://www.info-zip.org/ - -39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion with - the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specification in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -40. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. In - any case, the compression improvements are so modest compared to other more - modern approaches, that it's not worth the effort to implement. - -41. I'm having a problem with the zip functions in zlib, can you help? - - There are no zip functions in zlib. You are probably using minizip by - Giles Vollant, which is found in the contrib directory of zlib. It is not - part of zlib. In fact none of the stuff in contrib is part of zlib. The - files in there are not supported by the zlib authors. You need to contact - the authors of the respective contribution for help. - -42. The match.asm code in contrib is under the GNU General Public License. - Since it's part of zlib, doesn't that mean that all of zlib falls under the - GNU GPL? - - No. The files in contrib are not part of zlib. They were contributed by - other authors and are provided as a convenience to the user within the zlib - distribution. Each item in contrib has its own license. - -43. Is zlib subject to export controls? What is its ECCN? - - zlib is not subject to export controls, and so is classified as EAR99. - -44. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/libs/zlibng/INDEX.md b/libs/zlibng/INDEX.md deleted file mode 100644 index 5be081c4e..000000000 --- a/libs/zlibng/INDEX.md +++ /dev/null @@ -1,37 +0,0 @@ -Contents --------- - -| Name | Description | -|:-----------------|:---------------------------------------------------------------| -| arch/ | Architecture-specific code | -| doc/ | Documentation for formats and algorithms | -| test/example.c | Zlib usages examples for build testing | -| test/minigzip.c | Minimal gzip-like functionality for build testing | -| test/infcover.c | Inflate code coverage for build testing | -| win32/ | Shared library version resources for Windows | -| CMakeLists.txt | Cmake build script | -| configure | Bash configure/build script | -| adler32.c | Compute the Adler-32 checksum of a data stream | -| chunkset.* | Inline functions to copy small data chunks | -| compress.c | Compress a memory buffer | -| deflate.* | Compress data using the deflate algorithm | -| deflate_fast.c | Compress data using the deflate algorithm with fast strategy | -| deflate_medium.c | Compress data using the deflate algorithm with medium strategy | -| deflate_slow.c | Compress data using the deflate algorithm with slow strategy | -| functable.* | Struct containing function pointers to optimized functions | -| gzguts.h | Internal definitions for gzip operations | -| gzlib.c | Functions common to reading and writing gzip files | -| gzread.c | Read gzip files | -| gzwrite.c | Write gzip files | -| infback.* | Inflate using a callback interface | -| inflate.* | Decompress data | -| inffast.* | Decompress data with speed optimizations | -| inffixed_tbl.h | Table for decoding fixed codes | -| inftrees.h | Generate Huffman trees for efficient decoding | -| trees.* | Output deflated data using Huffman coding | -| uncompr.c | Decompress a memory buffer | -| zconf.h.cmakein | zconf.h template for cmake | -| zendian.h | BYTE_ORDER for endian tests | -| zlib.3 | Man page for zlib | -| zlib.map | Linux symbol information | -| zlib.pc.in | Pkg-config template | diff --git a/libs/zlibng/LICENSE.md b/libs/zlibng/LICENSE.md deleted file mode 100644 index adb48d472..000000000 --- a/libs/zlibng/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -(C) 1995-2013 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. diff --git a/libs/zlibng/Makefile.in b/libs/zlibng/Makefile.in deleted file mode 100644 index 8de3192c9..000000000 --- a/libs/zlibng/Makefile.in +++ /dev/null @@ -1,441 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# ./configure; make test -# Normally configure builds both a static and a shared library. -# If you want to build just a static library, use: ./configure --static - -# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: -# make install -# To install in $HOME instead of /usr/local, use: -# make install prefix=$HOME - -CC=cc - -CFLAGS=-O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DZLIB_DEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -SFLAGS=-O -LDFLAGS=-L. -LIBNAME1=libz-ng -LIBNAME2=zlib-ng -SUFFIX=-ng -TEST_LIBS=$(LIBNAME1).a -LDSHARED=$(CC) -LDSHAREDFLAGS=-shared - -VER=2.0.0-RC2 -VER1=2 - -STATICLIB=$(LIBNAME1).a -SHAREDLIB=$(LIBNAME1).so -SHAREDLIBV=$(LIBNAME1).so.$(VER) -SHAREDLIBM=$(LIBNAME1).so.$(VER1) -IMPORTLIB= -SHAREDTARGET=$(LIBNAME1).so.$(VER) -PKGFILE=$(LIBNAME2).pc - -LIBS=$(STATICLIB) $(SHAREDTARGET) - -AR=ar -ARFLAGS=rc -DEFFILE= -RC= -RCFLAGS= -RCOBJS= -STRIP= -RANLIB=ranlib -LDCONFIG=ldconfig -LDSHAREDLIBC= -EXE= - -SRCDIR=. -INCLUDES=-I$(SRCDIR) - -ARCHDIR=arch/generic -ARCH_STATIC_OBJS= -ARCH_SHARED_OBJS= - -prefix = /usr/local -exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin -libdir = ${exec_prefix}/lib -sharedlibdir = ${libdir} -includedir = ${prefix}/include -mandir = ${prefix}/share/man -man3dir = ${mandir}/man3 -pkgconfigdir = ${libdir}/pkgconfig - -OBJZ = \ - adler32.o \ - chunkset.o \ - compare258.o \ - compress.o \ - crc32.o \ - crc32_comb.o \ - deflate.o \ - deflate_fast.o \ - deflate_medium.o \ - deflate_quick.o \ - deflate_slow.o \ - functable.o \ - infback.o \ - inffast.o \ - inflate.o \ - inftrees.o \ - insert_string.o \ - trees.o \ - uncompr.o \ - zutil.o \ - $(ARCH_STATIC_OBJS) - -OBJG = \ - gzlib.o \ - gzread.o \ - gzwrite.o - -OBJC = $(OBJZ) $(OBJG) - -PIC_OBJZ = \ - adler32.lo \ - chunkset.lo \ - compare258.lo \ - compress.lo \ - crc32.lo \ - crc32_comb.lo \ - deflate.lo \ - deflate_fast.lo \ - deflate_medium.lo \ - deflate_quick.lo \ - deflate_slow.lo \ - functable.lo \ - infback.lo \ - inffast.lo \ - inflate.lo \ - inftrees.lo \ - insert_string.lo \ - trees.lo \ - uncompr.lo \ - zutil.lo \ - $(ARCH_SHARED_OBJS) - -PIC_OBJG = \ - gzlib.lo \ - gzread.lo \ - gzwrite.lo - -PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) - -OBJS = $(OBJC) - -PIC_OBJS = $(PIC_OBJC) - -all: static shared - -static: adler32_test$(EXE) example$(EXE) minigzip$(EXE) fuzzers makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) - -shared: adler32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) - -check: test - -.SECONDARY: - -$(ARCHDIR)/%.o: $(SRCDIR)/$(ARCHDIR)/%.c - $(MAKE) -C $(ARCHDIR) $(notdir $@) - -$(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c - $(MAKE) -C $(ARCHDIR) $(notdir $@) - -%.o: $(ARCHDIR)/%.o - -cp $< $@ - -%.lo: $(ARCHDIR)/%.lo - -cp $< $@ - -test: all - $(MAKE) -C test - -# This variable is set by configure. -WITH_FUZZERS= - -# By default, use our own standalone_fuzz_target_runner. -# This runner does no fuzzing, but simply executes the inputs -# provided via parameters. -# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a" -# to link the fuzzer(s) against a real fuzzing engine. -ifeq (,$(LIB_FUZZING_ENGINE)) - LIB_FUZZING_ENGINE = standalone_fuzz_target_runner.o -else - # OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE. - WITH_FUZZERS=1 -endif - -ifeq (1,$(WITH_FUZZERS)) -fuzzers: checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) -else -fuzzers: -endif - -# The standalone fuzz target runner. -standalone_fuzz_target_runner.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -checksum_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -compress_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_small_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_large_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_flush_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -example_dict_fuzzer.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< -minigzip_fuzzer.o: - $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< -checksum_fuzzer$(EXE): checksum_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) checksum_fuzzer.o $(STATICLIB) -lpthread -compress_fuzzer$(EXE): compress_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) compress_fuzzer.o $(STATICLIB) -lpthread -example_small_fuzzer$(EXE): example_small_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_small_fuzzer.o $(STATICLIB) -lpthread -example_large_fuzzer$(EXE): example_large_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_large_fuzzer.o $(STATICLIB) -lpthread -example_flush_fuzzer$(EXE): example_flush_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_flush_fuzzer.o $(STATICLIB) -lpthread -example_dict_fuzzer$(EXE): example_dict_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_dict_fuzzer.o $(STATICLIB) -lpthread -minigzip_fuzzer$(EXE): minigzip_fuzzer.o standalone_fuzz_target_runner.o $(OBJG) $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) minigzip_fuzzer.o $(OBJG) $(STATICLIB) -lpthread - -infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c - -infcover$(EXE): infcover.o $(STATICLIB) - $(CC) $(LDFLAGS) -o $@ infcover.o $(STATICLIB) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -cover: infcover$(EXE) - rm -f *.gcda - ./infcover - gcov inf*.c - -$(STATICLIB): $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -adler32_test.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/adler32_test.c - -example.o: - $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c - -minigzip.o: - $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c - -makefixed.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makefixed.c - -maketrees.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/maketrees.c - -makecrct.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makecrct.c - -zlibrc.o: win32/zlib$(SUFFIX)1.rc - $(RC) $(RCFLAGS) -o $@ win32/zlib$(SUFFIX)1.rc - -.SUFFIXES: .lo - -%.o: $(SRCDIR)/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< - -%.lo: $(SRCDIR)/%.c - $(CC) $(SFLAGS) -DPIC $(INCLUDES) -c -o $@ $< - -$(OBJG): %.o: $(SRCDIR)/%.c - $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $< - -$(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS) -ifneq ($(SHAREDTARGET),) - $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif -ifneq ($(SHAREDLIB),$(SHAREDTARGET)) - rm -f $(SHAREDLIB) $(SHAREDLIBM) - ln -s $@ $(SHAREDLIB) - ln -s $@ $(SHAREDLIBM) -endif -endif - -adler32_test$(EXE): adler32_test.o $(OBJG) $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -example$(EXE): example.o $(OBJG) $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -minigzip$(EXE): minigzip.o $(OBJG) $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -adler32_testsh$(EXE): adler32_test.o $(OBJG) $(SHAREDTARGET) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -examplesh$(EXE): example.o $(OBJG) $(SHAREDTARGET) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -minigzipsh$(EXE): minigzip.o $(OBJG) $(SHAREDTARGET) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -makefixed$(EXE): makefixed.o $(OBJG) $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ makefixed.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -maketrees$(EXE): maketrees.o $(OBJG) $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ maketrees.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -makecrct$(EXE): makecrct.o $(OBJG) $(STATICLIB) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ makecrct.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC) -ifneq ($(STRIP),) - $(STRIP) $@ -endif - -install-shared: $(SHAREDTARGET) -ifneq ($(SHAREDTARGET),) - -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi - rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET) - cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir) - chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET) -ifneq ($(SHAREDLIB),$(SHAREDTARGET)) - rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM) - ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) - ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM) - ($(LDCONFIG) || true) >/dev/null 2>&1 -# ldconfig is for Linux -endif -ifneq ($(IMPORTLIB),) - cp $(IMPORTLIB) $(DESTDIR)$(sharedlibdir) - chmod 644 $(DESTDIR)$(sharedlibdir)/$(IMPORTLIB) -endif -endif - -install-static: $(STATICLIB) - -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi - rm -f $(DESTDIR)$(libdir)/$(STATICLIB) - cp $(STATICLIB) $(DESTDIR)$(libdir) - chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB) - -@($(RANLIB) $(DESTDIR)$(libdir)/$(STATICLIB) || true) >/dev/null 2>&1 -# The ranlib in install-static is needed on NeXTSTEP which checks file times - -install-libs: install-shared install-static - -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi - -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi - rm -f $(DESTDIR)$(man3dir)/zlib$(SUFFIX).3 - cp $(SRCDIR)/zlib.3 $(DESTDIR)$(man3dir)/zlib$(SUFFIX).3 - chmod 644 $(DESTDIR)$(man3dir)/zlib$(SUFFIX).3 - rm -f $(DESTDIR)$(pkgconfigdir)/$(PKGFILE) - cp $(PKGFILE) $(DESTDIR)$(pkgconfigdir) - chmod 644 $(DESTDIR)$(pkgconfigdir)/$(PKGFILE) - -install: install-libs - -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi - rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h - cp $(SRCDIR)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h - cp zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h - chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h - -uninstall-static: - cd $(DESTDIR)$(libdir) && rm -f $(STATICLIB) - -uninstall-shared: -ifneq ($(SHAREDLIB),) - cd $(DESTDIR)$(sharedlibdir) && rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM) -endif -ifneq ($(IMPORTLIB),) - cd $(DESTDIR)$(sharedlibdir) && rm -f $(IMPORTLIB) -endif - -uninstall: uninstall-static uninstall-shared - cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h - cd $(DESTDIR)$(man3dir) && rm -f zlib$(SUFFIX).3 - cd $(DESTDIR)$(pkgconfigdir) && rm -f $(PKGFILE) - -docs: zlib.3.pdf - -zlib.3.pdf: $(SRCDIR)/zlib.3 - groff -mandoc -f H -T ps $(SRCDIR)/zlib.3 | ps2pdf - zlib.3.pdf - -mostlyclean: clean -clean: - @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi - @if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi - rm -f *.o *.lo *~ \ - adler32_test$(EXE) example$(EXE) minigzip$(EXE) \ - adler32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ - checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) \ - example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) \ - infcover makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) \ - $(STATICLIB) $(IMPORTLIB) $(SHAREDLIB) $(SHAREDLIBV) $(SHAREDLIBM) \ - foo.gz so_locations \ - _match.s maketree - rm -rf objs - rm -f *.gcda *.gcno *.gcov - rm -f a.out a.exe - rm -f *.pc - rm -f *._h - rm -rf btmp1 btmp2 pkgtmp1 pkgtmp2 - -maintainer-clean: distclean -distclean: clean - @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) distclean; fi - @if [ -f test/Makefile ]; then $(MAKE) -C test distclean; fi - rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein - -@rm -f .DS_Store -# Reset Makefile if building inside source tree - @if [ -f Makefile.in ]; then \ - printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ - printf '\ndistclean:\n\t$(MAKE) -f Makefile.in distclean\n' >> Makefile ; \ - touch -r $(SRCDIR)/Makefile.in Makefile ; fi -# Reset zconf.h and zconf.h.cmakein if building inside source tree - @if [ -f zconf.h.in ]; then \ - cp -p $(SRCDIR)/zconf.h.in zconf.h ; \ - grep -v '^#cmakedefine' $(SRCDIR)/zconf.h.in > zconf.h.cmakein &&\ - touch -r $(SRCDIR)/zconf.h.in zconf.h.cmakein ; fi -# Cleanup these files if building outside source tree - @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf Makefile; fi -# Remove arch and test directory if building outside source tree - @if [ ! -f $(ARCHDIR)/Makefile.in ]; then rm -rf arch; fi - @if [ ! -f test/Makefile.in ]; then rm -rf test; fi - -tags: - etags $(SRCDIR)/*.[ch] diff --git a/libs/zlibng/README.md b/libs/zlibng/README.md deleted file mode 100644 index ad14c3ff4..000000000 --- a/libs/zlibng/README.md +++ /dev/null @@ -1,206 +0,0 @@ -## zlib-ng -*zlib data compression library for the next generation systems* - -Maintained by Hans Kristian Rosbach - aka Dead2 (zlib-ng àt circlestorm dót org) - -|CI|Status| -|:-|-| -|GitHub Actions|[![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20CMake/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions) [![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20Configure/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions) [![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20NMake/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions)| -|Buildkite|[![Build status](https://badge.buildkite.com/7bb1ef84356d3baee26202706cc053ee1de871c0c712b65d26.svg?branch=develop)](https://buildkite.com/circlestorm-productions/zlib-ng)| -|CodeFactor|[![CodeFactor](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/badge)](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng)| -|OSS-Fuzz|[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/zlib-ng.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zlib-ng) -|Codecov|[![codecov.io](https://codecov.io/github/zlib-ng/zlib-ng/coverage.svg?branch=develop)](https://codecov.io/github/zlib-ng/zlib-ng/)| - -Features --------- - -* Zlib compatible API with support for dual-linking -* Modernized native API based on zlib API for ease of porting -* Modern C99 syntax and a clean code layout -* Deflate medium and quick algorithms based on Intels zlib fork -* Support for CPU intrinsics when available - * Adler32 implementation using SSSE3, AVX2, Neon & VSX - * CRC32-B implementation using PCLMULQDQ & ACLE - * Hash table implementation using CRC32-C intrinsics on x86 and ARM - * Slide hash implementations using SSE2, AVX2, Neon & VSX - * Compare256/258 implementations using SSE4.2 & AVX2 - * Inflate chunk copying using SSE2, AVX2 & Neon - * Support for hardware-accelerated deflate using IBM Z DFLTCC -* Unaligned memory read/writes and large bit buffer improvements -* Includes improvements from Cloudflare and Intel forks -* Configure, CMake, and NMake build system support -* Comprehensive set of CMake unit tests -* Code sanitizers, fuzzing, and coverage -* GitHub Actions continuous integration on Windows, macOS, and Linux - * Emulated CI for ARM, AARCH64, PPC, PPC64, SPARC64, S390x using qemu - -Fork Motivation ---------------------------- - -The motivation for this fork was due to seeing several 3rd party -contributions containing new optimizations not getting implemented -into the official zlib repository. - -Mark Adler has been maintaining zlib for a very long time, and he has -done a great job and hopefully he will continue for a long time yet. -The idea of zlib-ng is not to replace zlib, but to co-exist as a -drop-in replacement with a lower threshold for code change. - -zlib has a long history and is incredibly portable, even supporting -lots of systems that predate the Internet. This is great, but it does -complicate further development and maintainability. -The zlib code has numerous workarounds for old compilers that do not -understand ANSI-C or to accommodate systems with limitations such as -operating in a 16-bit environment. - -Many of these workarounds are only maintenance burdens, some of them -are pretty huge code-wise. For example, the [v]s[n]printf workaround -code has a whopping 8 different implementations just to cater to -various old compilers. With this many workarounds cluttered throughout -the code, new programmers with an idea/interest for zlib will need -to take some time to figure out why all of these seemingly strange -things are used, and how to work within those confines. - -So I decided to make a fork, merge all the Intel optimizations, merge -the Cloudflare optimizations that did not conflict, plus a couple -of other smaller patches. Then I started cleaning out workarounds, -various dead code, all contrib and example code as there is little -point in having those in this fork for various reasons. - -A lot of improvements have gone into zlib-ng since its start, and -numerous people and companies have contributed both small and big -improvements, or valuable testing. - -Please read LICENSE.md, it is very simple and very liberal. - -Build ------ - -There are two ways to build zlib-ng: - -### Cmake - -To build zlib-ng using the cross-platform makefile generator cmake. - -``` -cmake . -cmake --build . --config Release -ctest --verbose -C Release -``` - -Alternatively, you can use the cmake configuration GUI tool ccmake: - -``` -ccmake . -``` - -### Configure - -To build zlib-ng using the bash configure script: - -``` -./configure -make -make test -``` - -Build Options -------------- -| CMake | configure | Description | Default | -|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------| -| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF | -| ZLIB_ENABLE_TESTS | | Build test binaries | ON | -| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON | -| WITH_OPTIM | --without-optimizations | Build with optimisations | ON | -| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON | -| WITH_NATIVE_INSTRUCTIONS | --native | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF | -| WITH_SANITIZER | --with-sanitizer | Build with sanitizer (memory, address, undefined) | OFF | -| WITH_FUZZERS | --with-fuzzers | Build test/fuzz | OFF | -| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF | -| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF | - -Install -------- - -WARNING: We do not recommend manually installing unless you really -know what you are doing, because this can potentially override the system -default zlib library, and any incompatibility or wrong configuration of -zlib-ng can make the whole system unusable, requiring recovery or reinstall. -If you still want a manual install, we recommend using the /opt/ path prefix. - -For Linux distros, an alternative way to use zlib-ng (if compiled in -zlib-compat mode) instead of zlib, is through the use of the -_LD_PRELOAD_ environment variable. If the program is dynamically linked -with zlib, then zlib-ng will temporarily be used instead by the program, -without risking system-wide instability. - -``` -LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.11.zlib-ng /usr/bin/program -``` - -### Cmake - -To install zlib-ng system-wide using cmake: - -``` -cmake --build . --target install -``` - -### Configure - -To install zlib-ng system-wide using the configure script: - -``` -make install -``` - -Contributing ------------- - -Zlib-ng is a aiming to be open to contributions, and we would be -delighted to receive pull requests on github. -Just remember that any code you submit must be your own and it must -be zlib licensed. -Help with testing and reviewing of pull requests etc is also very -much appreciated. - -If you are interested in contributing, please consider joining our -IRC channel #zlib-ng on the Freenode IRC network. - - -Acknowledgments ----------------- - -Thanks to Servebolt.com for sponsoring my maintainership of zlib-ng. - -Thanks go out to all the people and companies who have taken the time -to contribute code reviews, testing and/or patches. Zlib-ng would not -have been nearly as good without you. - -The deflate format used by zlib was defined by Phil Katz. -The deflate and zlib specifications were written by L. Peter Deutsch. - -zlib was originally created by Jean-loup Gailly (compression) -and Mark Adler (decompression). - -Advanced Build Options ----------------------- - -| CMake | configure | Description | Default | -|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------| -| ZLIB_DUAL_LINK | | Dual link tests with system zlib | OFF | -| | --force-sse2 | Assume SSE2 instructions are always available | ON (x86), OFF (x86_64) | -| WITH_AVX2 | | Build with AVX2 intrinsics | ON | -| WITH_SSE2 | | Build with SSE2 intrinsics | ON | -| WITH_SSE4 | | Build with SSE4 intrinsics | ON | -| WITH_PCLMULQDQ | | Build with PCLMULQDQ intrinsics | ON | -| WITH_ACLE | --without-acle | Build with ACLE intrinsics | ON | -| WITH_NEON | --without-neon | Build with NEON intrinsics | ON | -| WITH_POWER8 | | Build with POWER8 optimisations | ON | -| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Use DEFLATE COMPRESSION CALL instruction for compression on IBM Z | OFF | -| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Use DEFLATE COMPRESSION CALL instruction for decompression on IBM Z | OFF | -| WITH_UNALIGNED | | Allow optimizations that use unaligned reads if safe on current arch| ON | -| WITH_INFLATE_STRICT | | Build with strict inflate distance checking | OFF | -| WITH_INFLATE_ALLOW_INVALID_DIST | | Build with zero fill for inflate invalid distances | OFF | -| INSTALL_UTILS | | Copy minigzip and minideflate during install | OFF | diff --git a/libs/zlibng/adler32.c b/libs/zlibng/adler32.c deleted file mode 100644 index 7b245fc84..000000000 --- a/libs/zlibng/adler32.c +++ /dev/null @@ -1,139 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" -#include "functable.h" -#include "adler32_p.h" - -/* ========================================================================= */ -Z_INTERNAL uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len) { - uint32_t sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; -#ifdef UNROLL_MORE - n = NMAX / 16; /* NMAX is divisible by 16 */ -#else - n = NMAX / 8; /* NMAX is divisible by 8 */ -#endif - do { -#ifdef UNROLL_MORE - DO16(adler, sum2, buf); /* 16 sums unrolled */ - buf += 16; -#else - DO8(adler, sum2, buf, 0); /* 8 sums unrolled */ - buf += 8; -#endif - } while (--n); - adler %= BASE; - sum2 %= BASE; - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ -#ifdef UNROLL_MORE - while (len >= 16) { - len -= 16; - DO16(adler, sum2, buf); - buf += 16; -#else - while (len >= 8) { - len -= 8; - DO8(adler, sum2, buf, 0); - buf += 8; -#endif - } - while (len) { - --len; - adler += *buf++; - sum2 += adler; - } - adler %= BASE; - sum2 %= BASE; - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(adler32_z)(unsigned long adler, const unsigned char *buf, size_t len) { - return (unsigned long)functable.adler32((uint32_t)adler, buf, len); -} -#else -uint32_t Z_EXPORT PREFIX(adler32_z)(uint32_t adler, const unsigned char *buf, size_t len) { - return functable.adler32(adler, buf, len); -} -#endif - -/* ========================================================================= */ -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(adler32)(unsigned long adler, const unsigned char *buf, unsigned int len) { - return (unsigned long)functable.adler32((uint32_t)adler, buf, len); -} -#else -uint32_t Z_EXPORT PREFIX(adler32)(uint32_t adler, const unsigned char *buf, uint32_t len) { - return functable.adler32(adler, buf, len); -} -#endif - -/* ========================================================================= */ -static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len2) { - uint32_t sum1; - uint32_t sum2; - unsigned rem; - - /* for negative len, return invalid adler32 as a clue for debugging */ - if (len2 < 0) - return 0xffffffff; - - /* the derivation of this formula is left as an exercise for the reader */ - len2 %= BASE; /* assumes len2 >= 0 */ - rem = (unsigned)len2; - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - sum2 %= BASE; - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 >= BASE) sum1 -= BASE; - if (sum1 >= BASE) sum1 -= BASE; - if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1); - if (sum2 >= BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} - -/* ========================================================================= */ -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(adler32_combine)(unsigned long adler1, unsigned long adler2, z_off_t len2) { - return (unsigned long)adler32_combine_((uint32_t)adler1, (uint32_t)adler2, len2); -} - -unsigned long Z_EXPORT PREFIX4(adler32_combine)(unsigned long adler1, unsigned long adler2, z_off64_t len2) { - return (unsigned long)adler32_combine_((uint32_t)adler1, (uint32_t)adler2, len2); -} -#else -uint32_t Z_EXPORT PREFIX4(adler32_combine)(uint32_t adler1, uint32_t adler2, z_off64_t len2) { - return adler32_combine_(adler1, adler2, len2); -} -#endif diff --git a/libs/zlibng/adler32_p.h b/libs/zlibng/adler32_p.h deleted file mode 100644 index 7f75c71e2..000000000 --- a/libs/zlibng/adler32_p.h +++ /dev/null @@ -1,53 +0,0 @@ -/* adler32_p.h -- Private inline functions and macros shared with - * different computation of the Adler-32 checksum - * of a data stream. - * Copyright (C) 1995-2011, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ADLER32_P_H -#define ADLER32_P_H - -#define BASE 65521U /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(sum1, sum2, buf, i) {(sum1) += buf[(i)]; (sum2) += (sum1);} -#define DO2(sum1, sum2, buf, i) {DO1(sum1, sum2, buf, i); DO1(sum1, sum2, buf, i+1);} -#define DO4(sum1, sum2, buf, i) {DO2(sum1, sum2, buf, i); DO2(sum1, sum2, buf, i+2);} -#define DO8(sum1, sum2, buf, i) {DO4(sum1, sum2, buf, i); DO4(sum1, sum2, buf, i+4);} -#define DO16(sum1, sum2, buf) {DO8(sum1, sum2, buf, 0); DO8(sum1, sum2, buf, 8);} - -static inline uint32_t adler32_len_1(uint32_t adler, const unsigned char *buf, uint32_t sum2) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); -} - -static inline uint32_t adler32_len_16(uint32_t adler, const unsigned char *buf, size_t len, uint32_t sum2) { - while (len) { - --len; - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - sum2 %= BASE; /* only added so many BASE's */ - return adler | (sum2 << 16); -} - -static inline uint32_t adler32_len_64(uint32_t adler, const unsigned char *buf, size_t len, uint32_t sum2) { - while (len >= 16) { - len -= 16; - DO16(adler, sum2, buf); - buf += 16; - } - /* Process tail (len < 16). */ - return adler32_len_16(adler, buf, len, sum2); -} - -#endif /* ADLER32_P_H */ diff --git a/libs/zlibng/arch/.gitignore b/libs/zlibng/arch/.gitignore deleted file mode 100644 index 2c3af0a08..000000000 --- a/libs/zlibng/arch/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# ignore Makefiles; they're all automatically generated -Makefile diff --git a/libs/zlibng/arch/arm/Makefile.in b/libs/zlibng/arch/arm/Makefile.in deleted file mode 100644 index a728d5ab2..000000000 --- a/libs/zlibng/arch/arm/Makefile.in +++ /dev/null @@ -1,68 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= -ACLEFLAG= -NEONFLAG= -SUFFIX= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -all: \ - adler32_neon.o adler32_neon.lo \ - armfeature.o armfeature.lo \ - chunkset_neon.o chunkset_neon.lo \ - crc32_acle.o crc32_acle.lo \ - slide_neon.o slide_neon.lo \ - insert_string_acle.o insert_string_acle.lo - -adler32_neon.o: - $(CC) $(CFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c - -adler32_neon.lo: - $(CC) $(SFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c - -armfeature.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c - -armfeature.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c - -chunkset_neon.o: - $(CC) $(CFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_neon.c - -chunkset_neon.lo: - $(CC) $(SFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_neon.c - -crc32_acle.o: - $(CC) $(CFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c - -crc32_acle.lo: - $(CC) $(SFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c - -slide_neon.o: - $(CC) $(CFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_neon.c - -slide_neon.lo: - $(CC) $(SFLAGS) $(NEONFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_neon.c - -insert_string_acle.o: - $(CC) $(CFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c - -insert_string_acle.lo: - $(CC) $(SFLAGS) $(ACLEFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_acle.c - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ - rm -rf objs - rm -f *.gcda *.gcno *.gcov - -distclean: - rm -f Makefile diff --git a/libs/zlibng/arch/arm/adler32_neon.c b/libs/zlibng/arch/arm/adler32_neon.c deleted file mode 100644 index adda6f61d..000000000 --- a/libs/zlibng/arch/arm/adler32_neon.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (C) 1995-2011, 2016 Mark Adler - * Copyright (C) 2017 ARM Holdings Inc. - * Author: Adenilson Cavalcanti - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#ifdef ARM_NEON_ADLER32 -#ifdef _M_ARM64 -# include -#else -# include -#endif -#include "../../zutil.h" -#include "../../adler32_p.h" - -static void NEON_accum32(uint32_t *s, const unsigned char *buf, size_t len) { - static const uint8_t taps[32] = { - 32, 31, 30, 29, 28, 27, 26, 25, - 24, 23, 22, 21, 20, 19, 18, 17, - 16, 15, 14, 13, 12, 11, 10, 9, - 8, 7, 6, 5, 4, 3, 2, 1 }; - - uint32x2_t adacc2, s2acc2, as; - uint8x16_t t0 = vld1q_u8(taps), t1 = vld1q_u8(taps + 16); - - uint32x4_t adacc = vdupq_n_u32(0), s2acc = vdupq_n_u32(0); - adacc = vsetq_lane_u32(s[0], adacc, 0); - s2acc = vsetq_lane_u32(s[1], s2acc, 0); - - while (len >= 2) { - uint8x16_t d0 = vld1q_u8(buf), d1 = vld1q_u8(buf + 16); - uint16x8_t adler, sum2; - s2acc = vaddq_u32(s2acc, vshlq_n_u32(adacc, 5)); - adler = vpaddlq_u8( d0); - adler = vpadalq_u8(adler, d1); - sum2 = vmull_u8( vget_low_u8(t0), vget_low_u8(d0)); - sum2 = vmlal_u8(sum2, vget_high_u8(t0), vget_high_u8(d0)); - sum2 = vmlal_u8(sum2, vget_low_u8(t1), vget_low_u8(d1)); - sum2 = vmlal_u8(sum2, vget_high_u8(t1), vget_high_u8(d1)); - adacc = vpadalq_u16(adacc, adler); - s2acc = vpadalq_u16(s2acc, sum2); - len -= 2; - buf += 32; - } - - while (len > 0) { - uint8x16_t d0 = vld1q_u8(buf); - uint16x8_t adler, sum2; - s2acc = vaddq_u32(s2acc, vshlq_n_u32(adacc, 4)); - adler = vpaddlq_u8(d0); - sum2 = vmull_u8( vget_low_u8(t1), vget_low_u8(d0)); - sum2 = vmlal_u8(sum2, vget_high_u8(t1), vget_high_u8(d0)); - adacc = vpadalq_u16(adacc, adler); - s2acc = vpadalq_u16(s2acc, sum2); - buf += 16; - len--; - } - - adacc2 = vpadd_u32(vget_low_u32(adacc), vget_high_u32(adacc)); - s2acc2 = vpadd_u32(vget_low_u32(s2acc), vget_high_u32(s2acc)); - as = vpadd_u32(adacc2, s2acc2); - s[0] = vget_lane_u32(as, 0); - s[1] = vget_lane_u32(as, 1); -} - -static void NEON_handle_tail(uint32_t *pair, const unsigned char *buf, size_t len) { - unsigned int i; - for (i = 0; i < len; ++i) { - pair[0] += buf[i]; - pair[1] += pair[0]; - } -} - -uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t len) { - /* split Adler-32 into component sums */ - uint32_t sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) - return adler32_len_16(adler, buf, len, sum2); - - uint32_t pair[2]; - int n = NMAX; - unsigned int done = 0; - unsigned int i; - - /* Split Adler-32 into component sums, it can be supplied by - * the caller sites (e.g. in a PNG file). - */ - pair[0] = adler; - pair[1] = sum2; - - for (i = 0; i < len; i += n) { - if ((i + n) > len) - n = (int)(len - i); - - if (n < 16) - break; - - NEON_accum32(pair, buf + i, n / 16); - pair[0] %= BASE; - pair[1] %= BASE; - - done += (n / 16) * 16; - } - - /* Handle the tail elements. */ - if (done < len) { - NEON_handle_tail(pair, (buf + done), len - done); - pair[0] %= BASE; - pair[1] %= BASE; - } - - /* D = B * 65536 + A, see: https://en.wikipedia.org/wiki/Adler-32. */ - return (pair[1] << 16) | pair[0]; -} -#endif diff --git a/libs/zlibng/arch/arm/arm.h b/libs/zlibng/arch/arm/arm.h deleted file mode 100644 index 378006efb..000000000 --- a/libs/zlibng/arch/arm/arm.h +++ /dev/null @@ -1,13 +0,0 @@ -/* arm.h -- check for ARM features. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ARM_H_ -#define ARM_H_ - -extern int arm_cpu_has_neon; -extern int arm_cpu_has_crc32; - -void Z_INTERNAL arm_check_features(void); - -#endif /* ARM_H_ */ diff --git a/libs/zlibng/arch/arm/armfeature.c b/libs/zlibng/arch/arm/armfeature.c deleted file mode 100644 index cf31a48f0..000000000 --- a/libs/zlibng/arch/arm/armfeature.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "../../zutil.h" - -#if defined(__linux__) -# include -# include -#elif defined(__FreeBSD__) && defined(__aarch64__) -# include -# ifndef ID_AA64ISAR0_CRC32_VAL -# define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32 -# endif -#elif defined(__APPLE__) -# include -#elif defined(_WIN32) -# include -#endif - -static int arm_has_crc32() { -#if defined(__linux__) && defined(HWCAP2_CRC32) - return (getauxval(AT_HWCAP2) & HWCAP2_CRC32) != 0 ? 1 : 0; -#elif defined(__FreeBSD__) && defined(__aarch64__) - return getenv("QEMU_EMULATING") == NULL - && ID_AA64ISAR0_CRC32_VAL(READ_SPECIALREG(id_aa64isar0_el1)) >= ID_AA64ISAR0_CRC32_BASE; -#elif defined(__APPLE__) - int hascrc32; - size_t size = sizeof(hascrc32); - return sysctlbyname("hw.optional.armv8_crc32", &hascrc32, &size, NULL, 0) == 0 - && hascrc32 == 1; -#elif defined(ARM_NOCHECK_ACLE) - return 1; -#else - return 0; -#endif -} - -/* AArch64 has neon. */ -#if !defined(__aarch64__) && !defined(_M_ARM64) -static inline int arm_has_neon() { -#if defined(__linux__) && defined(HWCAP_NEON) - return (getauxval(AT_HWCAP) & HWCAP_NEON) != 0 ? 1 : 0; -#elif defined(__APPLE__) - int hasneon; - size_t size = sizeof(hasneon); - return sysctlbyname("hw.optional.neon", &hasneon, &size, NULL, 0) == 0 - && hasneon == 1; -#elif defined(_M_ARM) && defined(WINAPI_FAMILY_PARTITION) -# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) - return 1; /* Always supported */ -# endif -#endif - -#if defined(ARM_NOCHECK_NEON) - return 1; -#else - return 0; -#endif -} -#endif - -Z_INTERNAL int arm_cpu_has_neon; -Z_INTERNAL int arm_cpu_has_crc32; - -void Z_INTERNAL arm_check_features(void) { -#if defined(__aarch64__) || defined(_M_ARM64) - arm_cpu_has_neon = 1; /* always available */ -#else - arm_cpu_has_neon = arm_has_neon(); -#endif - arm_cpu_has_crc32 = arm_has_crc32(); -} diff --git a/libs/zlibng/arch/arm/chunkset_neon.c b/libs/zlibng/arch/arm/chunkset_neon.c deleted file mode 100644 index e9cbcb1ba..000000000 --- a/libs/zlibng/arch/arm/chunkset_neon.c +++ /dev/null @@ -1,54 +0,0 @@ -/* chunkset_neon.c -- NEON inline functions to copy small data chunks. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef ARM_NEON_CHUNKSET -#ifdef _M_ARM64 -# include -#else -# include -#endif -#include "../../zbuild.h" -#include "../../zutil.h" - -typedef uint8x16_t chunk_t; - -#define HAVE_CHUNKMEMSET_1 -#define HAVE_CHUNKMEMSET_2 -#define HAVE_CHUNKMEMSET_4 -#define HAVE_CHUNKMEMSET_8 - -static inline void chunkmemset_1(uint8_t *from, chunk_t *chunk) { - *chunk = vld1q_dup_u8(from); -} - -static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { - *chunk = vreinterpretq_u8_s16(vdupq_n_s16(*(int16_t *)from)); -} - -static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { - *chunk = vreinterpretq_u8_s32(vdupq_n_s32(*(int32_t *)from)); -} - -static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { - *chunk = vcombine_u8(vld1_u8(from), vld1_u8(from)); -} - -#define CHUNKSIZE chunksize_neon -#define CHUNKCOPY chunkcopy_neon -#define CHUNKCOPY_SAFE chunkcopy_safe_neon -#define CHUNKUNROLL chunkunroll_neon -#define CHUNKMEMSET chunkmemset_neon -#define CHUNKMEMSET_SAFE chunkmemset_safe_neon - -static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { - *chunk = vld1q_u8(s); -} - -static inline void storechunk(uint8_t *out, chunk_t *chunk) { - vst1q_u8(out, *chunk); -} - -#include "chunkset_tpl.h" - -#endif diff --git a/libs/zlibng/arch/arm/crc32_acle.c b/libs/zlibng/arch/arm/crc32_acle.c deleted file mode 100644 index 88ba6c38c..000000000 --- a/libs/zlibng/arch/arm/crc32_acle.c +++ /dev/null @@ -1,110 +0,0 @@ -/* crc32_acle.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler - * Copyright (C) 2016 Yang Zhang - * For conditions of distribution and use, see copyright notice in zlib.h - * -*/ - -#ifdef ARM_ACLE_CRC_HASH -#ifndef _MSC_VER -# include -#endif -#include "../../zutil.h" - -uint32_t crc32_acle(uint32_t crc, const unsigned char *buf, uint64_t len) { - Z_REGISTER uint32_t c; - Z_REGISTER const uint16_t *buf2; - Z_REGISTER const uint32_t *buf4; - - c = ~crc; - if (len && ((ptrdiff_t)buf & 1)) { - c = __crc32b(c, *buf++); - len--; - } - - if ((len > sizeof(uint16_t)) && ((ptrdiff_t)buf & sizeof(uint16_t))) { - buf2 = (const uint16_t *) buf; - c = __crc32h(c, *buf2++); - len -= sizeof(uint16_t); - buf4 = (const uint32_t *) buf2; - } else { - buf4 = (const uint32_t *) buf; - } - -#if defined(__aarch64__) - if ((len > sizeof(uint32_t)) && ((ptrdiff_t)buf & sizeof(uint32_t))) { - c = __crc32w(c, *buf4++); - len -= sizeof(uint32_t); - } - - const uint64_t *buf8 = (const uint64_t *) buf4; - -#ifdef UNROLL_MORE - while (len >= 4 * sizeof(uint64_t)) { - c = __crc32d(c, *buf8++); - c = __crc32d(c, *buf8++); - c = __crc32d(c, *buf8++); - c = __crc32d(c, *buf8++); - len -= 4 * sizeof(uint64_t); - } -#endif - - while (len >= sizeof(uint64_t)) { - c = __crc32d(c, *buf8++); - len -= sizeof(uint64_t); - } - - if (len >= sizeof(uint32_t)) { - buf4 = (const uint32_t *) buf8; - c = __crc32w(c, *buf4++); - len -= sizeof(uint32_t); - buf2 = (const uint16_t *) buf4; - } else { - buf2 = (const uint16_t *) buf8; - } - - if (len >= sizeof(uint16_t)) { - c = __crc32h(c, *buf2++); - len -= sizeof(uint16_t); - } - - buf = (const unsigned char *) buf2; -#else /* __aarch64__ */ - -# ifdef UNROLL_MORE - while (len >= 8 * sizeof(uint32_t)) { - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - c = __crc32w(c, *buf4++); - len -= 8 * sizeof(uint32_t); - } -# endif - - while (len >= sizeof(uint32_t)) { - c = __crc32w(c, *buf4++); - len -= sizeof(uint32_t); - } - - if (len >= sizeof(uint16_t)) { - buf2 = (const uint16_t *) buf4; - c = __crc32h(c, *buf2++); - len -= sizeof(uint16_t); - buf = (const unsigned char *) buf2; - } else { - buf = (const unsigned char *) buf4; - } -#endif /* __aarch64__ */ - - if (len) { - c = __crc32b(c, *buf); - } - - c = ~c; - return c; -} -#endif diff --git a/libs/zlibng/arch/arm/ctzl.h b/libs/zlibng/arch/arm/ctzl.h deleted file mode 100644 index 77218deec..000000000 --- a/libs/zlibng/arch/arm/ctzl.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ARM_CTZL_H -#define ARM_CTZL_H - -#include - -#if defined(_MSC_VER) && !defined(__clang__) -static __forceinline unsigned long __builtin_ctzl(unsigned long value) { - return _arm_clz(_arm_rbit(value)); -} -#endif - -#endif diff --git a/libs/zlibng/arch/arm/insert_string_acle.c b/libs/zlibng/arch/arm/insert_string_acle.c deleted file mode 100644 index 2daf9ba3e..000000000 --- a/libs/zlibng/arch/arm/insert_string_acle.c +++ /dev/null @@ -1,22 +0,0 @@ -/* insert_string_acle.c -- insert_string variant using ACLE's CRC instructions - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#ifdef ARM_ACLE_CRC_HASH -#ifndef _MSC_VER -# include -#endif -#include "../../zbuild.h" -#include "../../deflate.h" - -#define UPDATE_HASH(s, h, val) \ - h = __crc32w(0, val) - -#define INSERT_STRING insert_string_acle -#define QUICK_INSERT_STRING quick_insert_string_acle - -#include "../../insert_string_tpl.h" -#endif diff --git a/libs/zlibng/arch/arm/slide_neon.c b/libs/zlibng/arch/arm/slide_neon.c deleted file mode 100644 index f64fa5b5b..000000000 --- a/libs/zlibng/arch/arm/slide_neon.c +++ /dev/null @@ -1,52 +0,0 @@ -/* slide_neon.c -- Optimized hash table shifting for ARM with support for NEON instructions - * Copyright (C) 2017-2020 Mika T. Lindqvist - * - * Authors: - * Mika T. Lindqvist - * Jun He - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#if defined(ARM_NEON_SLIDEHASH) -#ifdef _M_ARM64 -# include -#else -# include -#endif -#include "../../zbuild.h" -#include "../../deflate.h" - -/* SIMD version of hash_chain rebase */ -static inline void slide_hash_chain(Pos *table, unsigned int entries, uint16_t window_size) { - Z_REGISTER uint16x8_t v, *p; - Z_REGISTER size_t n; - - size_t size = entries*sizeof(table[0]); - Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); - - Assert(sizeof(Pos) == 2, "Wrong Pos size"); - v = vdupq_n_u16(window_size); - - p = (uint16x8_t *)table; - n = size / (sizeof(uint16x8_t) * 8); - do { - p[0] = vqsubq_u16(p[0], v); - p[1] = vqsubq_u16(p[1], v); - p[2] = vqsubq_u16(p[2], v); - p[3] = vqsubq_u16(p[3], v); - p[4] = vqsubq_u16(p[4], v); - p[5] = vqsubq_u16(p[5], v); - p[6] = vqsubq_u16(p[6], v); - p[7] = vqsubq_u16(p[7], v); - p += 8; - } while (--n); -} - -Z_INTERNAL void slide_hash_neon(deflate_state *s) { - unsigned int wsize = s->w_size; - - slide_hash_chain(s->head, HASH_SIZE, wsize); - slide_hash_chain(s->prev, wsize, wsize); -} -#endif diff --git a/libs/zlibng/arch/generic/Makefile.in b/libs/zlibng/arch/generic/Makefile.in deleted file mode 100644 index be8c18545..000000000 --- a/libs/zlibng/arch/generic/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -all: - - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ \ - rm -rf objs - rm -f *.gcda *.gcno *.gcov diff --git a/libs/zlibng/arch/power/Makefile.in b/libs/zlibng/arch/power/Makefile.in deleted file mode 100644 index 25ebc9d1d..000000000 --- a/libs/zlibng/arch/power/Makefile.in +++ /dev/null @@ -1,49 +0,0 @@ -# Makefile for POWER-specific files -# Copyright (C) 2020 Matheus Castanho , IBM -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= -SUFFIX= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -P8FLAGS=-mcpu=power8 - -all: power.o \ - power.lo \ - adler32_power8.o \ - adler32_power8.lo \ - slide_hash_power8.o \ - slide_hash_power8.lo - -power.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power.c - -power.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/power.c - -adler32_power8.o: - $(CC) $(CFLAGS) $(P8FLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c - -adler32_power8.lo: - $(CC) $(SFLAGS) $(P8FLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_power8.c - -slide_hash_power8.o: - $(CC) $(CFLAGS) $(P8FLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c - -slide_hash_power8.lo: - $(CC) $(SFLAGS) $(P8FLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ - rm -rf objs - rm -f *.gcda *.gcno *.gcov - -distclean: - rm -f Makefile diff --git a/libs/zlibng/arch/power/adler32_power8.c b/libs/zlibng/arch/power/adler32_power8.c deleted file mode 100644 index cda51aa80..000000000 --- a/libs/zlibng/arch/power/adler32_power8.c +++ /dev/null @@ -1,154 +0,0 @@ -/* Adler32 for POWER8 using VSX instructions. - * Copyright (C) 2020 IBM Corporation - * Author: Rogerio Alves - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Calculate adler32 checksum for 16 bytes at once using POWER8+ VSX (vector) - * instructions. - * - * If adler32 do 1 byte at time on the first iteration s1 is s1_0 (_n means - * iteration n) is the initial value of adler - at start _0 is 1 unless - * adler initial value is different than 1. So s1_1 = s1_0 + c[0] after - * the first calculation. For the iteration s1_2 = s1_1 + c[1] and so on. - * Hence, for iteration N, s1_N = s1_(N-1) + c[N] is the value of s1 on - * after iteration N. - * - * Therefore, for s2 and iteration N, s2_N = s2_0 + N*s1_N + N*c[0] + - * N-1*c[1] + ... + c[N] - * - * In a more general way: - * - * s1_N = s1_0 + sum(i=1 to N)c[i] - * s2_N = s2_0 + N*s1 + sum (i=1 to N)(N-i+1)*c[i] - * - * Where s1_N, s2_N are the values for s1, s2 after N iterations. So if we - * can process N-bit at time we can do this at once. - * - * Since VSX can support 16-bit vector instructions, we can process - * 16-bit at time using N = 16 we have: - * - * s1 = s1_16 = s1_(16-1) + c[16] = s1_0 + sum(i=1 to 16)c[i] - * s2 = s2_16 = s2_0 + 16*s1 + sum(i=1 to 16)(16-i+1)*c[i] - * - * After the first iteration we calculate the adler32 checksum for 16 bytes. - * - * For more background about adler32 please check the RFC: - * https://www.ietf.org/rfc/rfc1950.txt - */ - -#ifdef POWER8_VSX_ADLER32 - -#include -#include "zbuild.h" -#include "zutil.h" -#include "adler32_p.h" - -/* Vector across sum unsigned int (saturate). */ -inline vector unsigned int vec_sumsu(vector unsigned int __a, vector unsigned int __b) { - __b = vec_sld(__a, __a, 8); - __b = vec_add(__b, __a); - __a = vec_sld(__b, __b, 4); - __a = vec_add(__a, __b); - - return __a; -} - -uint32_t adler32_power8(uint32_t adler, const unsigned char* buf, size_t len) { - uint32_t s1 = adler & 0xffff; - uint32_t s2 = (adler >> 16) & 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(s1, buf, s2); - - /* If buffer is empty or len=0 we need to return adler initial value. */ - if (UNLIKELY(buf == NULL)) - return 1; - - /* This is faster than VSX code for len < 64. */ - if (len < 64) - return adler32_len_64(s1, buf, len, s2); - - /* Use POWER VSX instructions for len >= 64. */ - const vector unsigned int v_zeros = { 0 }; - const vector unsigned char v_mul = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, - 6, 5, 4, 3, 2, 1}; - const vector unsigned char vsh = vec_splat_u8(4); - const vector unsigned int vmask = {0xffffffff, 0x0, 0x0, 0x0}; - vector unsigned int vs1 = { 0 }; - vector unsigned int vs2 = { 0 }; - vector unsigned int vs1_save = { 0 }; - vector unsigned int vsum1, vsum2; - vector unsigned char vbuf; - int n; - - vs1[0] = s1; - vs2[0] = s2; - - /* Do length bigger than NMAX in blocks of NMAX size. */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; - do { - vbuf = vec_xl(0, (unsigned char *) buf); - vsum1 = vec_sum4s(vbuf, v_zeros); /* sum(i=1 to 16) buf[i]. */ - /* sum(i=1 to 16) buf[i]*(16-i+1). */ - vsum2 = vec_msum(vbuf, v_mul, v_zeros); - /* Save vs1. */ - vs1_save = vec_add(vs1_save, vs1); - /* Accumulate the sums. */ - vs1 = vec_add(vsum1, vs1); - vs2 = vec_add(vsum2, vs2); - - buf += 16; - } while (--n); - /* Once each block of NMAX size. */ - vs1 = vec_sumsu(vs1, vsum1); - vs1_save = vec_sll(vs1_save, vsh); /* 16*vs1_save. */ - vs2 = vec_add(vs1_save, vs2); - vs2 = vec_sumsu(vs2, vsum2); - - /* vs1[0] = (s1_i + sum(i=1 to 16)buf[i]) mod 65521. */ - vs1[0] = vs1[0] % BASE; - /* vs2[0] = s2_i + 16*s1_save + - sum(i=1 to 16)(16-i+1)*buf[i] mod 65521. */ - vs2[0] = vs2[0] % BASE; - - vs1 = vec_and(vs1, vmask); - vs2 = vec_and(vs2, vmask); - vs1_save = v_zeros; - } - - /* len is less than NMAX one modulo is needed. */ - if (len >= 16) { - while (len >= 16) { - len -= 16; - - vbuf = vec_xl(0, (unsigned char *) buf); - - vsum1 = vec_sum4s(vbuf, v_zeros); /* sum(i=1 to 16) buf[i]. */ - /* sum(i=1 to 16) buf[i]*(16-i+1). */ - vsum2 = vec_msum(vbuf, v_mul, v_zeros); - /* Save vs1. */ - vs1_save = vec_add(vs1_save, vs1); - /* Accumulate the sums. */ - vs1 = vec_add(vsum1, vs1); - vs2 = vec_add(vsum2, vs2); - - buf += 16; - } - /* Since the size will be always less than NMAX we do this once. */ - vs1 = vec_sumsu(vs1, vsum1); - vs1_save = vec_sll(vs1_save, vsh); /* 16*vs1_save. */ - vs2 = vec_add(vs1_save, vs2); - vs2 = vec_sumsu(vs2, vsum2); - } - /* Copy result back to s1, s2 (mod 65521). */ - s1 = vs1[0] % BASE; - s2 = vs2[0] % BASE; - - /* Process tail (len < 16).and return */ - return adler32_len_16(s1, buf, len, s2); -} - -#endif /* POWER8_VSX_ADLER32 */ diff --git a/libs/zlibng/arch/power/power.c b/libs/zlibng/arch/power/power.c deleted file mode 100644 index f93b586d5..000000000 --- a/libs/zlibng/arch/power/power.c +++ /dev/null @@ -1,19 +0,0 @@ -/* POWER feature check - * Copyright (C) 2020 Matheus Castanho , IBM - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include "../../zutil.h" - -Z_INTERNAL int power_cpu_has_arch_2_07; - -void Z_INTERNAL power_check_features(void) { - unsigned long hwcap2; - hwcap2 = getauxval(AT_HWCAP2); - -#ifdef POWER8 - if (hwcap2 & PPC_FEATURE2_ARCH_2_07) - power_cpu_has_arch_2_07 = 1; -#endif -} diff --git a/libs/zlibng/arch/power/power.h b/libs/zlibng/arch/power/power.h deleted file mode 100644 index b36c26141..000000000 --- a/libs/zlibng/arch/power/power.h +++ /dev/null @@ -1,13 +0,0 @@ -/* power.h -- check for POWER CPU features - * Copyright (C) 2020 Matheus Castanho , IBM - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef POWER_H_ -#define POWER_H_ - -extern int power_cpu_has_arch_2_07; - -void Z_INTERNAL power_check_features(void); - -#endif /* POWER_H_ */ diff --git a/libs/zlibng/arch/power/slide_hash_power8.c b/libs/zlibng/arch/power/slide_hash_power8.c deleted file mode 100644 index b1e30cea0..000000000 --- a/libs/zlibng/arch/power/slide_hash_power8.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Optimized slide_hash for POWER processors - * Copyright (C) 2019-2020 IBM Corporation - * Author: Matheus Castanho - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef POWER8_VSX_SLIDEHASH - -#include -#include "zbuild.h" -#include "deflate.h" - -static inline void slide_hash_power8_loop(deflate_state *s, unsigned n_elems, Pos *table_end) { - vector unsigned short vw, vm, *vp; - unsigned chunks; - - /* Each vector register (chunk) corresponds to 128 bits == 8 Posf, - * so instead of processing each of the n_elems in the hash table - * individually, we can do it in chunks of 8 with vector instructions. - * - * This function is only called from slide_hash_power8(), and both calls - * pass n_elems as a power of 2 higher than 2^7, as defined by - * deflateInit2_(), so n_elems will always be a multiple of 8. */ - chunks = n_elems >> 3; - Assert(n_elems % 8 == 0, "Weird hash table size!"); - - /* This type casting is safe since s->w_size is always <= 64KB - * as defined by deflateInit2_() and Posf == unsigned short */ - vw[0] = (Pos) s->w_size; - vw = vec_splat(vw,0); - - vp = (vector unsigned short *) table_end; - - do { - /* Processing 8 elements at a time */ - vp--; - vm = *vp; - - /* This is equivalent to: m >= w_size ? m - w_size : 0 - * Since we are using a saturated unsigned subtraction, any - * values that are > w_size will be set to 0, while the others - * will be subtracted by w_size. */ - *vp = vec_subs(vm,vw); - } while (--chunks); -} - -void Z_INTERNAL slide_hash_power8(deflate_state *s) { - unsigned int n; - Pos *p; - - n = HASH_SIZE; - p = &s->head[n]; - slide_hash_power8_loop(s,n,p); - - n = s->w_size; - p = &s->prev[n]; - slide_hash_power8_loop(s,n,p); -} - -#endif /* POWER8_VSX_SLIDEHASH */ diff --git a/libs/zlibng/arch/s390/Makefile.in b/libs/zlibng/arch/s390/Makefile.in deleted file mode 100644 index 2652fe62d..000000000 --- a/libs/zlibng/arch/s390/Makefile.in +++ /dev/null @@ -1,40 +0,0 @@ -# Makefile for zlib-ng -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= -SUFFIX= - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -dfltcc_common.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c - -dfltcc_common.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_common.c - -dfltcc_deflate.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_deflate.c - -dfltcc_deflate.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_deflate.c - -dfltcc_inflate.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_inflate.c - -dfltcc_inflate.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/dfltcc_inflate.c - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ - rm -rf objs - rm -f *.gcda *.gcno *.gcov - -distclean: - rm -f Makefile diff --git a/libs/zlibng/arch/s390/README.md b/libs/zlibng/arch/s390/README.md deleted file mode 100644 index 641c63a83..000000000 --- a/libs/zlibng/arch/s390/README.md +++ /dev/null @@ -1,216 +0,0 @@ -# Introduction - -This directory contains SystemZ deflate hardware acceleration support. -It can be enabled using the following build commands: - - $ ./configure --with-dfltcc-deflate --with-dfltcc-inflate - $ make - -or - - $ cmake -DWITH_DFLTCC_DEFLATE=1 -DWITH_DFLTCC_INFLATE=1 . - $ make - -When built like this, zlib-ng would compress using hardware on level 1, -and using software on all other levels. Decompression will always happen -in hardware. In order to enable hardware compression for levels 1-6 -(i.e. to make it used by default) one could add -`-DDFLTCC_LEVEL_MASK=0x7e` to CFLAGS when building zlib-ng. - -SystemZ deflate hardware acceleration is available on [IBM z15]( -https://www.ibm.com/products/z15) and newer machines under the name [ -"Integrated Accelerator for zEnterprise Data Compression"]( -https://www.ibm.com/support/z-content-solutions/compression/). The -programming interface to it is a machine instruction called DEFLATE -CONVERSION CALL (DFLTCC). It is documented in Chapter 26 of [Principles -of Operation](http://publibfp.dhe.ibm.com/epubs/pdf/a227832c.pdf). Both -the code and the rest of this document refer to this feature simply as -"DFLTCC". - -# Performance - -Performance figures are published [here]( -https://github.com/iii-i/zlib-ng/wiki/Performance-with-dfltcc-patch-applied-and-dfltcc-support-built-on-dfltcc-enabled-machine -). The compression speed-up can be as high as 110x and the decompression -speed-up can be as high as 15x. - -# Limitations - -Two DFLTCC compression calls with identical inputs are not guaranteed to -produce identical outputs. Therefore care should be taken when using -hardware compression when reproducible results are desired. In -particular, zlib-ng-specific `zng_deflateSetParams` call allows setting -`Z_DEFLATE_REPRODUCIBLE` parameter, which disables DFLTCC support for a -particular stream. - -DFLTCC does not support every single zlib-ng feature, in particular: - -* `inflate(Z_BLOCK)` and `inflate(Z_TREES)` -* `inflateMark()` -* `inflatePrime()` -* `inflateSyncPoint()` - -When used, these functions will either switch to software, or, in case -this is not possible, gracefully fail. - -# Code structure - -All SystemZ-specific code lives in `arch/s390` directory and is -integrated with the rest of zlib-ng using hook macros. - -## Hook macros - -DFLTCC takes as arguments a parameter block, an input buffer, an output -buffer and a window. `ZALLOC_STATE()`, `ZFREE_STATE()`, `ZCOPY_STATE()`, -`ZALLOC_WINDOW()` and `TRY_FREE_WINDOW()` macros encapsulate allocation -details for the parameter block (which is allocated alongside zlib-ng -state) and the window (which must be page-aligned). - -While inflate software and hardware window formats match, this is not -the case for deflate. Therefore, `deflateSetDictionary()` and -`deflateGetDictionary()` need special handling, which is triggered using -`DEFLATE_SET_DICTIONARY_HOOK()` and `DEFLATE_GET_DICTIONARY_HOOK()` -macros. - -`deflateResetKeep()` and `inflateResetKeep()` update the DFLTCC -parameter block using `DEFLATE_RESET_KEEP_HOOK()` and -`INFLATE_RESET_KEEP_HOOK()` macros. - -`INFLATE_PRIME_HOOK()`, `INFLATE_MARK_HOOK()` and -`INFLATE_SYNC_POINT_HOOK()` macros make the respective unsupported -calls gracefully fail. - -`DEFLATE_PARAMS_HOOK()` implements switching between hardware and -software compression mid-stream using `deflateParams()`. Switching -normally entails flushing the current block, which might not be possible -in low memory situations. `deflateParams()` uses `DEFLATE_DONE()` hook -in order to detect and gracefully handle such situations. - -The algorithm implemented in hardware has different compression ratio -than the one implemented in software. `DEFLATE_BOUND_ADJUST_COMPLEN()` -and `DEFLATE_NEED_CONSERVATIVE_BOUND()` macros make `deflateBound()` -return the correct results for the hardware implementation. - -Actual compression and decompression are handled by `DEFLATE_HOOK()` and -`INFLATE_TYPEDO_HOOK()` macros. Since inflation with DFLTCC manages the -window on its own, calling `updatewindow()` is suppressed using -`INFLATE_NEED_UPDATEWINDOW()` macro. - -In addition to compression, DFLTCC computes CRC-32 and Adler-32 -checksums, therefore, whenever it's used, software checksumming is -suppressed using `DEFLATE_NEED_CHECKSUM()` and `INFLATE_NEED_CHECKSUM()` -macros. - -While software always produces reproducible compression results, this -is not the case for DFLTCC. Therefore, zlib-ng users are given the -ability to specify whether or not reproducible compression results -are required. While it is always possible to specify this setting -before the compression begins, it is not always possible to do so in -the middle of a deflate stream - the exact conditions for that are -determined by `DEFLATE_CAN_SET_REPRODUCIBLE()` macro. - -## SystemZ-specific code - -When zlib-ng is built with DFLTCC, the hooks described above are -converted to calls to functions, which are implemented in -`arch/s390/dfltcc_*` files. The functions can be grouped in three broad -categories: - -* Base DFLTCC support, e.g. wrapping the machine instruction - - `dfltcc()` and allocating aligned memory - `dfltcc_alloc_state()`. -* Translating between software and hardware data formats, e.g. - `dfltcc_deflate_set_dictionary()`. -* Translating between software and hardware state machines, e.g. - `dfltcc_deflate()` and `dfltcc_inflate()`. - -The functions from the first two categories are fairly simple, however, -various quirks in both software and hardware state machines make the -functions from the third category quite complicated. - -### `dfltcc_deflate()` function - -This function is called by `deflate()` and has the following -responsibilities: - -* Checking whether DFLTCC can be used with the current stream. If this - is not the case, then it returns `0`, making `deflate()` use some - other function in order to compress in software. Otherwise it returns - `1`. -* Block management and Huffman table generation. DFLTCC ends blocks only - when explicitly instructed to do so by the software. Furthermore, - whether to use fixed or dynamic Huffman tables must also be determined - by the software. Since looking at data in order to gather statistics - would negate performance benefits, the following approach is used: the - first `DFLTCC_FIRST_FHT_BLOCK_SIZE` bytes are placed into a fixed - block, and every next `DFLTCC_BLOCK_SIZE` bytes are placed into - dynamic blocks. -* Writing EOBS. Block Closing Control bit in the parameter block - instructs DFLTCC to write EOBS, however, certain conditions need to be - met: input data length must be non-zero or Continuation Flag must be - set. To put this in simpler terms, DFLTCC will silently refuse to - write EOBS if this is the only thing that it is asked to do. Since the - code has to be able to emit EOBS in software anyway, in order to avoid - tricky corner cases Block Closing Control is never used. Whether to - write EOBS is instead controlled by `soft_bcc` variable. -* Triggering block post-processing. Depending on flush mode, `deflate()` - must perform various additional actions when a block or a stream ends. - `dfltcc_deflate()` informs `deflate()` about this using - `block_state *result` parameter. -* Converting software state fields into hardware parameter block fields, - and vice versa. For example, `wrap` and Check Value Type or `bi_valid` - and Sub-Byte Boundary. Certain fields cannot be translated and must - persist untouched in the parameter block between calls, for example, - Continuation Flag or Continuation State Buffer. -* Handling flush modes and low-memory situations. These aspects are - quite intertwined and pervasive. The general idea here is that the - code must not do anything in software - whether explicitly by e.g. - calling `send_eobs()`, or implicitly - by returning to `deflate()` - with certain return and `*result` values, when Continuation Flag is - set. -* Ending streams. When a new block is started and flush mode is - `Z_FINISH`, Block Header Final parameter block bit is used to mark - this block as final. However, sometimes an empty final block is - needed, and, unfortunately, just like with EOBS, DFLTCC will silently - refuse to do this. The general idea of DFLTCC implementation is to - rely as much as possible on the existing code. Here in order to do - this, the code pretends that it does not support DFLTCC, which makes - `deflate()` call a software compression function, which writes an - empty final block. Whether this is required is controlled by - `need_empty_block` variable. -* Error handling. This is simply converting - Operation-Ending-Supplemental Code to string. Errors can only happen - due to things like memory corruption, and therefore they don't affect - the `deflate()` return code. - -### `dfltcc_inflate()` function - -This function is called by `inflate()` from the `TYPEDO` state (that is, -when all the metadata is parsed and the stream is positioned at the type -bits of deflate block header) and it's responsible for the following: - -* Falling back to software when flush mode is `Z_BLOCK` or `Z_TREES`. - Unfortunately, there is no way to ask DFLTCC to stop decompressing on - block or tree boundary. -* `inflate()` decompression loop management. This is controlled using - the return value, which can be either `DFLTCC_INFLATE_BREAK` or - `DFLTCC_INFLATE_CONTINUE`. -* Converting software state fields into hardware parameter block fields, - and vice versa. For example, `whave` and History Length or `wnext` and - History Offset. -* Ending streams. This instructs `inflate()` to return `Z_STREAM_END` - and is controlled by `last` state field. -* Error handling. Like deflate, error handling comprises - Operation-Ending-Supplemental Code to string conversion. Unlike - deflate, errors may happen due to bad inputs, therefore they are - propagated to `inflate()` by setting `mode` field to `MEM` or `BAD`. - -# Testing - -Given complexity of DFLTCC machine instruction, it is not clear whether -QEMU TCG will ever support it. At the time of writing, one has to have -access to an IBM z15+ VM or LPAR in order to test DFLTCC support. Since -DFLTCC is a non-privileged instruction, neither special VM/LPAR -configuration nor root are required. - -Still, zlib-ng CI has a few QEMU TCG-based configurations that check -whether fallback to software is working. diff --git a/libs/zlibng/arch/s390/dfltcc_common.c b/libs/zlibng/arch/s390/dfltcc_common.c deleted file mode 100644 index c82c3b220..000000000 --- a/libs/zlibng/arch/s390/dfltcc_common.c +++ /dev/null @@ -1,89 +0,0 @@ -/* dfltcc_deflate.c - IBM Z DEFLATE CONVERSION CALL general support. */ - -#include "../../zbuild.h" -#include "dfltcc_common.h" -#include "dfltcc_detail.h" - -/* - Memory management. - - DFLTCC requires parameter blocks and window to be aligned. zlib-ng allows - users to specify their own allocation functions, so using e.g. - `posix_memalign' is not an option. Thus, we overallocate and take the - aligned portion of the buffer. -*/ -static inline int is_dfltcc_enabled(void) { - uint64_t facilities[(DFLTCC_FACILITY / 64) + 1]; - Z_REGISTER uint8_t r0 __asm__("r0"); - - memset(facilities, 0, sizeof(facilities)); - r0 = sizeof(facilities) / sizeof(facilities[0]) - 1; - /* STFLE is supported since z9-109 and only in z/Architecture mode. When - * compiling with -m31, gcc defaults to ESA mode, however, since the kernel - * is 64-bit, it's always z/Architecture mode at runtime. - */ - __asm__ volatile( -#ifndef __clang__ - ".machinemode push\n" - ".machinemode zarch\n" -#endif - "stfle %[facilities]\n" -#ifndef __clang__ - ".machinemode pop\n" -#endif - : [facilities] "=Q" (facilities), [r0] "+r" (r0) :: "cc"); - return is_bit_set((const char *)facilities, DFLTCC_FACILITY); -} - -void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size) { - struct dfltcc_state *dfltcc_state = (struct dfltcc_state *)((char *)strm->state + ALIGN_UP(size, 8)); - struct dfltcc_qaf_param *param = (struct dfltcc_qaf_param *)&dfltcc_state->param; - - /* Initialize available functions */ - if (is_dfltcc_enabled()) { - dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL); - memmove(&dfltcc_state->af, param, sizeof(dfltcc_state->af)); - } else - memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af)); - - /* Initialize parameter block */ - memset(&dfltcc_state->param, 0, sizeof(dfltcc_state->param)); - dfltcc_state->param.nt = 1; - - /* Initialize tuning parameters */ - dfltcc_state->level_mask = DFLTCC_LEVEL_MASK; - dfltcc_state->block_size = DFLTCC_BLOCK_SIZE; - dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE; - dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE; - dfltcc_state->param.ribm = DFLTCC_RIBM; -} - -void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size) { - return ZALLOC(strm, ALIGN_UP(items * size, 8) + sizeof(struct dfltcc_state), sizeof(unsigned char)); -} - -void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size) { - memcpy(dst, src, ALIGN_UP(size, 8) + sizeof(struct dfltcc_state)); -} - -static const int PAGE_ALIGN = 0x1000; - -void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size) { - void *p; - void *w; - - /* To simplify freeing, we store the pointer to the allocated buffer right - * before the window. - */ - p = ZALLOC(strm, sizeof(void *) + items * size + PAGE_ALIGN, sizeof(unsigned char)); - if (p == NULL) - return NULL; - w = ALIGN_UP((char *)p + sizeof(void *), PAGE_ALIGN); - *(void **)((char *)w - sizeof(void *)) = p; - return w; -} - -void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w) { - if (w) - ZFREE(strm, *(void **)((unsigned char *)w - sizeof(void *))); -} diff --git a/libs/zlibng/arch/s390/dfltcc_common.h b/libs/zlibng/arch/s390/dfltcc_common.h deleted file mode 100644 index 5c3be91b9..000000000 --- a/libs/zlibng/arch/s390/dfltcc_common.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef DFLTCC_COMMON_H -#define DFLTCC_COMMON_H - -#ifdef ZLIB_COMPAT -#include "../../zlib.h" -#else -#include "../../zlib-ng.h" -#endif -#include "../../zutil.h" - -void Z_INTERNAL *dfltcc_alloc_state(PREFIX3(streamp) strm, uInt items, uInt size); -void Z_INTERNAL dfltcc_copy_state(void *dst, const void *src, uInt size); -void Z_INTERNAL dfltcc_reset(PREFIX3(streamp) strm, uInt size); -void Z_INTERNAL *dfltcc_alloc_window(PREFIX3(streamp) strm, uInt items, uInt size); -void Z_INTERNAL dfltcc_free_window(PREFIX3(streamp) strm, void *w); - -#define ZALLOC_STATE dfltcc_alloc_state - -#define ZFREE_STATE ZFREE - -#define ZCOPY_STATE dfltcc_copy_state - -#define ZALLOC_WINDOW dfltcc_alloc_window - -#define ZFREE_WINDOW dfltcc_free_window - -#define TRY_FREE_WINDOW dfltcc_free_window - -#endif diff --git a/libs/zlibng/arch/s390/dfltcc_deflate.c b/libs/zlibng/arch/s390/dfltcc_deflate.c deleted file mode 100644 index 187865667..000000000 --- a/libs/zlibng/arch/s390/dfltcc_deflate.c +++ /dev/null @@ -1,406 +0,0 @@ -/* dfltcc_deflate.c - IBM Z DEFLATE CONVERSION CALL compression support. */ - -/* - Use the following commands to build zlib-ng with DFLTCC compression support: - - $ ./configure --with-dfltcc-deflate - or - - $ cmake -DWITH_DFLTCC_DEFLATE=1 . - - and then - - $ make -*/ - -#include "../../zbuild.h" -#include "../../zutil.h" -#include "../../deflate.h" -#include "../../trees_emit.h" -#include "dfltcc_deflate.h" -#include "dfltcc_detail.h" - -static inline int dfltcc_can_deflate_with_params(PREFIX3(streamp) strm, int level, uInt window_bits, int strategy, - int reproducible) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - - /* Unsupported compression settings */ - if ((dfltcc_state->level_mask & (1 << level)) == 0) - return 0; - if (window_bits != HB_BITS) - return 0; - if (strategy != Z_FIXED && strategy != Z_DEFAULT_STRATEGY) - return 0; - if (reproducible) - return 0; - - /* Unsupported hardware */ - if (!is_bit_set(dfltcc_state->af.fns, DFLTCC_GDHT) || - !is_bit_set(dfltcc_state->af.fns, DFLTCC_CMPR) || - !is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0)) - return 0; - - return 1; -} - -int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm) { - deflate_state *state = (deflate_state *)strm->state; - - return dfltcc_can_deflate_with_params(strm, state->level, state->w_bits, state->strategy, state->reproducible); -} - -static inline void dfltcc_gdht(PREFIX3(streamp) strm) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - size_t avail_in = strm->avail_in; - - dfltcc(DFLTCC_GDHT, param, NULL, NULL, &strm->next_in, &avail_in, NULL); -} - -static inline dfltcc_cc dfltcc_cmpr(PREFIX3(streamp) strm) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - size_t avail_in = strm->avail_in; - size_t avail_out = strm->avail_out; - dfltcc_cc cc; - - cc = dfltcc(DFLTCC_CMPR | HBT_CIRCULAR, - param, &strm->next_out, &avail_out, - &strm->next_in, &avail_in, state->window); - strm->total_in += (strm->avail_in - avail_in); - strm->total_out += (strm->avail_out - avail_out); - strm->avail_in = avail_in; - strm->avail_out = avail_out; - return cc; -} - -static inline void send_eobs(PREFIX3(streamp) strm, const struct dfltcc_param_v0 *param) { - deflate_state *state = (deflate_state *)strm->state; - - send_bits(state, bi_reverse(param->eobs >> (15 - param->eobl), param->eobl), param->eobl, state->bi_buf, state->bi_valid); - flush_pending(strm); - if (state->pending != 0) { - /* The remaining data is located in pending_out[0:pending]. If someone - * calls put_byte() - this might happen in deflate() - the byte will be - * placed into pending_buf[pending], which is incorrect. Move the - * remaining data to the beginning of pending_buf so that put_byte() is - * usable again. - */ - memmove(state->pending_buf, state->pending_out, state->pending); - state->pending_out = state->pending_buf; - } -#ifdef ZLIB_DEBUG - state->compressed_len += param->eobl; -#endif -} - -int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; - uInt masked_avail_in; - dfltcc_cc cc; - int need_empty_block; - int soft_bcc; - int no_flush; - - if (!dfltcc_can_deflate(strm)) { - /* Clear history. */ - if (flush == Z_FULL_FLUSH) - param->hl = 0; - return 0; - } - -again: - masked_avail_in = 0; - soft_bcc = 0; - no_flush = flush == Z_NO_FLUSH; - - /* No input data. Return, except when Continuation Flag is set, which means - * that DFLTCC has buffered some output in the parameter block and needs to - * be called again in order to flush it. - */ - if (strm->avail_in == 0 && !param->cf) { - /* A block is still open, and the hardware does not support closing - * blocks without adding data. Thus, close it manually. - */ - if (!no_flush && param->bcf) { - send_eobs(strm, param); - param->bcf = 0; - } - /* Let one of deflate_* functions write a trailing empty block. */ - if (flush == Z_FINISH) - return 0; - /* Clear history. */ - if (flush == Z_FULL_FLUSH) - param->hl = 0; - /* Trigger block post-processing if necessary. */ - *result = no_flush ? need_more : block_done; - return 1; - } - - /* There is an open non-BFINAL block, we are not going to close it just - * yet, we have compressed more than DFLTCC_BLOCK_SIZE bytes and we see - * more than DFLTCC_DHT_MIN_SAMPLE_SIZE bytes. Open a new block with a new - * DHT in order to adapt to a possibly changed input data distribution. - */ - if (param->bcf && no_flush && - strm->total_in > dfltcc_state->block_threshold && - strm->avail_in >= dfltcc_state->dht_threshold) { - if (param->cf) { - /* We need to flush the DFLTCC buffer before writing the - * End-of-block Symbol. Mask the input data and proceed as usual. - */ - masked_avail_in += strm->avail_in; - strm->avail_in = 0; - no_flush = 0; - } else { - /* DFLTCC buffer is empty, so we can manually write the - * End-of-block Symbol right away. - */ - send_eobs(strm, param); - param->bcf = 0; - dfltcc_state->block_threshold = strm->total_in + dfltcc_state->block_size; - } - } - - /* No space for compressed data. If we proceed, dfltcc_cmpr() will return - * DFLTCC_CC_OP1_TOO_SHORT without buffering header bits, but we will still - * set BCF=1, which is wrong. Avoid complications and return early. - */ - if (strm->avail_out == 0) { - *result = need_more; - return 1; - } - - /* The caller gave us too much data. Pass only one block worth of - * uncompressed data to DFLTCC and mask the rest, so that on the next - * iteration we start a new block. - */ - if (no_flush && strm->avail_in > dfltcc_state->block_size) { - masked_avail_in += (strm->avail_in - dfltcc_state->block_size); - strm->avail_in = dfltcc_state->block_size; - } - - /* When we have an open non-BFINAL deflate block and caller indicates that - * the stream is ending, we need to close an open deflate block and open a - * BFINAL one. - */ - need_empty_block = flush == Z_FINISH && param->bcf && !param->bhf; - - /* Translate stream to parameter block */ - param->cvt = state->wrap == 2 ? CVT_CRC32 : CVT_ADLER32; - if (!no_flush) - /* We need to close a block. Always do this in software - when there is - * no input data, the hardware will not honor BCC. */ - soft_bcc = 1; - if (flush == Z_FINISH && !param->bcf) - /* We are about to open a BFINAL block, set Block Header Final bit - * until the stream ends. - */ - param->bhf = 1; - /* DFLTCC-CMPR will write to next_out, so make sure that buffers with - * higher precedence are empty. - */ - Assert(state->pending == 0, "There must be no pending bytes"); - Assert(state->bi_valid < 8, "There must be less than 8 pending bits"); - param->sbb = (unsigned int)state->bi_valid; - if (param->sbb > 0) - *strm->next_out = (unsigned char)state->bi_buf; - /* Honor history and check value */ - param->nt = 0; - param->cv = state->wrap == 2 ? ZSWAP32(strm->adler) : strm->adler; - - /* When opening a block, choose a Huffman-Table Type */ - if (!param->bcf) { - if (state->strategy == Z_FIXED || (strm->total_in == 0 && dfltcc_state->block_threshold > 0)) - param->htt = HTT_FIXED; - else { - param->htt = HTT_DYNAMIC; - dfltcc_gdht(strm); - } - } - - /* Deflate */ - do { - cc = dfltcc_cmpr(strm); - if (strm->avail_in < 4096 && masked_avail_in > 0) - /* We are about to call DFLTCC with a small input buffer, which is - * inefficient. Since there is masked data, there will be at least - * one more DFLTCC call, so skip the current one and make the next - * one handle more data. - */ - break; - } while (cc == DFLTCC_CC_AGAIN); - - /* Translate parameter block to stream */ - strm->msg = oesc_msg(dfltcc_state->msg, param->oesc); - state->bi_valid = param->sbb; - if (state->bi_valid == 0) - state->bi_buf = 0; /* Avoid accessing next_out */ - else - state->bi_buf = *strm->next_out & ((1 << state->bi_valid) - 1); - strm->adler = state->wrap == 2 ? ZSWAP32(param->cv) : param->cv; - - /* Unmask the input data */ - strm->avail_in += masked_avail_in; - masked_avail_in = 0; - - /* If we encounter an error, it means there is a bug in DFLTCC call */ - Assert(cc != DFLTCC_CC_OP2_CORRUPT || param->oesc == 0, "BUG"); - - /* Update Block-Continuation Flag. It will be used to check whether to call - * GDHT the next time. - */ - if (cc == DFLTCC_CC_OK) { - if (soft_bcc) { - send_eobs(strm, param); - param->bcf = 0; - dfltcc_state->block_threshold = strm->total_in + dfltcc_state->block_size; - } else - param->bcf = 1; - if (flush == Z_FINISH) { - if (need_empty_block) - /* Make the current deflate() call also close the stream */ - return 0; - else { - bi_windup(state); - *result = finish_done; - } - } else { - if (flush == Z_FULL_FLUSH) - param->hl = 0; /* Clear history */ - *result = flush == Z_NO_FLUSH ? need_more : block_done; - } - } else { - param->bcf = 1; - *result = need_more; - } - if (strm->avail_in != 0 && strm->avail_out != 0) - goto again; /* deflate() must use all input or all output */ - return 1; -} - -/* - Switching between hardware and software compression. - - DFLTCC does not support all zlib settings, e.g. generation of non-compressed - blocks or alternative window sizes. When such settings are applied on the - fly with deflateParams, we need to convert between hardware and software - window formats. -*/ -static int dfltcc_was_deflate_used(PREFIX3(streamp) strm) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - - return strm->total_in > 0 || param->nt == 0 || param->hl > 0; -} - -int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush) { - deflate_state *state = (deflate_state *)strm->state; - int could_deflate = dfltcc_can_deflate(strm); - int can_deflate = dfltcc_can_deflate_with_params(strm, level, state->w_bits, strategy, state->reproducible); - - if (can_deflate == could_deflate) - /* We continue to work in the same mode - no changes needed */ - return Z_OK; - - if (!dfltcc_was_deflate_used(strm)) - /* DFLTCC was not used yet - no changes needed */ - return Z_OK; - - /* For now, do not convert between window formats - simply get rid of the old data instead */ - *flush = Z_FULL_FLUSH; - return Z_OK; -} - -int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; - - /* When deflate(Z_FULL_FLUSH) is called with small avail_out, it might - * close the block without resetting the compression state. Detect this - * situation and return that deflation is not done. - */ - if (flush == Z_FULL_FLUSH && strm->avail_out == 0) - return 0; - - /* Return that deflation is not done if DFLTCC is used and either it - * buffered some data (Continuation Flag is set), or has not written EOBS - * yet (Block-Continuation Flag is set). - */ - return !dfltcc_can_deflate(strm) || (!param->cf && !param->bcf); -} - -int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible) { - deflate_state *state = (deflate_state *)strm->state; - - return reproducible != state->reproducible && !dfltcc_was_deflate_used(strm); -} - -/* - Preloading history. -*/ -static void append_history(struct dfltcc_param_v0 *param, unsigned char *history, const unsigned char *buf, uInt count) { - size_t offset; - size_t n; - - /* Do not use more than 32K */ - if (count > HB_SIZE) { - buf += count - HB_SIZE; - count = HB_SIZE; - } - offset = (param->ho + param->hl) % HB_SIZE; - if (offset + count <= HB_SIZE) - /* Circular history buffer does not wrap - copy one chunk */ - memcpy(history + offset, buf, count); - else { - /* Circular history buffer wraps - copy two chunks */ - n = HB_SIZE - offset; - memcpy(history + offset, buf, n); - memcpy(history, buf + n, count - n); - } - n = param->hl + count; - if (n <= HB_SIZE) - /* All history fits into buffer - no need to discard anything */ - param->hl = n; - else { - /* History does not fit into buffer - discard extra bytes */ - param->ho = (param->ho + (n - HB_SIZE)) % HB_SIZE; - param->hl = HB_SIZE; - } -} - -int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, - const unsigned char *dictionary, uInt dict_length) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; - - append_history(param, state->window, dictionary, dict_length); - state->strstart = 1; /* Add FDICT to zlib header */ - state->block_start = state->strstart; /* Make deflate_stored happy */ - return Z_OK; -} - -int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt *dict_length) { - deflate_state *state = (deflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; - - if (dictionary) { - if (param->ho + param->hl <= HB_SIZE) - /* Circular history buffer does not wrap - copy one chunk */ - memcpy(dictionary, state->window + param->ho, param->hl); - else { - /* Circular history buffer wraps - copy two chunks */ - memcpy(dictionary, state->window + param->ho, HB_SIZE - param->ho); - memcpy(dictionary + HB_SIZE - param->ho, state->window, param->ho + param->hl - HB_SIZE); - } - } - if (dict_length) - *dict_length = param->hl; - return Z_OK; -} diff --git a/libs/zlibng/arch/s390/dfltcc_deflate.h b/libs/zlibng/arch/s390/dfltcc_deflate.h deleted file mode 100644 index 7e32380bd..000000000 --- a/libs/zlibng/arch/s390/dfltcc_deflate.h +++ /dev/null @@ -1,56 +0,0 @@ -#ifndef DFLTCC_DEFLATE_H -#define DFLTCC_DEFLATE_H - -#include "dfltcc_common.h" - -int Z_INTERNAL dfltcc_can_deflate(PREFIX3(streamp) strm); -int Z_INTERNAL dfltcc_deflate(PREFIX3(streamp) strm, int flush, block_state *result); -int Z_INTERNAL dfltcc_deflate_params(PREFIX3(streamp) strm, int level, int strategy, int *flush); -int Z_INTERNAL dfltcc_deflate_done(PREFIX3(streamp) strm, int flush); -int Z_INTERNAL dfltcc_can_set_reproducible(PREFIX3(streamp) strm, int reproducible); -int Z_INTERNAL dfltcc_deflate_set_dictionary(PREFIX3(streamp) strm, - const unsigned char *dictionary, uInt dict_length); -int Z_INTERNAL dfltcc_deflate_get_dictionary(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length); - -#define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ - do { \ - if (dfltcc_can_deflate((strm))) \ - return dfltcc_deflate_set_dictionary((strm), (dict), (dict_len)); \ - } while (0) - -#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \ - do { \ - if (dfltcc_can_deflate((strm))) \ - return dfltcc_deflate_get_dictionary((strm), (dict), (dict_len)); \ - } while (0) - -#define DEFLATE_RESET_KEEP_HOOK(strm) \ - dfltcc_reset((strm), sizeof(deflate_state)) - -#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \ - do { \ - int err; \ -\ - err = dfltcc_deflate_params((strm), (level), (strategy), (hook_flush)); \ - if (err == Z_STREAM_ERROR) \ - return err; \ - } while (0) - -#define DEFLATE_DONE dfltcc_deflate_done - -#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \ - do { \ - if (dfltcc_can_deflate((strm))) \ - (complen) = (3 + 5 + 5 + 4 + 19 * 3 + (286 + 30) * 7 + \ - (source_len) * 16 + 15 + 7) >> 3; \ - } while (0) - -#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (dfltcc_can_deflate((strm))) - -#define DEFLATE_HOOK dfltcc_deflate - -#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm))) - -#define DEFLATE_CAN_SET_REPRODUCIBLE dfltcc_can_set_reproducible - -#endif diff --git a/libs/zlibng/arch/s390/dfltcc_detail.h b/libs/zlibng/arch/s390/dfltcc_detail.h deleted file mode 100644 index 4ec03f809..000000000 --- a/libs/zlibng/arch/s390/dfltcc_detail.h +++ /dev/null @@ -1,199 +0,0 @@ -#include -#include -#include - -#ifdef HAVE_SYS_SDT_H -#include -#endif - -/* - Tuning parameters. - */ -#ifndef DFLTCC_LEVEL_MASK -#define DFLTCC_LEVEL_MASK 0x2 -#endif -#ifndef DFLTCC_BLOCK_SIZE -#define DFLTCC_BLOCK_SIZE 1048576 -#endif -#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE -#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096 -#endif -#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE -#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096 -#endif -#ifndef DFLTCC_RIBM -#define DFLTCC_RIBM 0 -#endif - -/* - C wrapper for the DEFLATE CONVERSION CALL instruction. - */ -typedef enum { - DFLTCC_CC_OK = 0, - DFLTCC_CC_OP1_TOO_SHORT = 1, - DFLTCC_CC_OP2_TOO_SHORT = 2, - DFLTCC_CC_OP2_CORRUPT = 2, - DFLTCC_CC_AGAIN = 3, -} dfltcc_cc; - -#define DFLTCC_QAF 0 -#define DFLTCC_GDHT 1 -#define DFLTCC_CMPR 2 -#define DFLTCC_XPND 4 -#define HBT_CIRCULAR (1 << 7) -#define HB_BITS 15 -#define HB_SIZE (1 << HB_BITS) -#define DFLTCC_FACILITY 151 - -static inline dfltcc_cc dfltcc(int fn, void *param, - unsigned char **op1, size_t *len1, z_const unsigned char **op2, size_t *len2, void *hist) { - unsigned char *t2 = op1 ? *op1 : NULL; - size_t t3 = len1 ? *len1 : 0; - z_const unsigned char *t4 = op2 ? *op2 : NULL; - size_t t5 = len2 ? *len2 : 0; - Z_REGISTER int r0 __asm__("r0") = fn; - Z_REGISTER void *r1 __asm__("r1") = param; - Z_REGISTER unsigned char *r2 __asm__("r2") = t2; - Z_REGISTER size_t r3 __asm__("r3") = t3; - Z_REGISTER z_const unsigned char *r4 __asm__("r4") = t4; - Z_REGISTER size_t r5 __asm__("r5") = t5; - int cc; - - __asm__ volatile( -#ifdef HAVE_SYS_SDT_H - STAP_PROBE_ASM(zlib, dfltcc_entry, STAP_PROBE_ASM_TEMPLATE(5)) -#endif - ".insn rrf,0xb9390000,%[r2],%[r4],%[hist],0\n" -#ifdef HAVE_SYS_SDT_H - STAP_PROBE_ASM(zlib, dfltcc_exit, STAP_PROBE_ASM_TEMPLATE(5)) -#endif - "ipm %[cc]\n" - : [r2] "+r" (r2) - , [r3] "+r" (r3) - , [r4] "+r" (r4) - , [r5] "+r" (r5) - , [cc] "=r" (cc) - : [r0] "r" (r0) - , [r1] "r" (r1) - , [hist] "r" (hist) -#ifdef HAVE_SYS_SDT_H - , STAP_PROBE_ASM_OPERANDS(5, r2, r3, r4, r5, hist) -#endif - : "cc", "memory"); - t2 = r2; t3 = r3; t4 = r4; t5 = r5; - - if (op1) - *op1 = t2; - if (len1) - *len1 = t3; - if (op2) - *op2 = t4; - if (len2) - *len2 = t5; - return (cc >> 28) & 3; -} - -/* - Parameter Block for Query Available Functions. - */ -#define static_assert(c, msg) __attribute__((unused)) static char static_assert_failed_ ## msg[c ? 1 : -1] - -struct dfltcc_qaf_param { - char fns[16]; - char reserved1[8]; - char fmts[2]; - char reserved2[6]; -}; - -static_assert(sizeof(struct dfltcc_qaf_param) == 32, sizeof_struct_dfltcc_qaf_param_is_32); - -static inline int is_bit_set(const char *bits, int n) { - return bits[n / 8] & (1 << (7 - (n % 8))); -} - -static inline void clear_bit(char *bits, int n) { - bits[n / 8] &= ~(1 << (7 - (n % 8))); -} - -#define DFLTCC_FMT0 0 - -/* - Parameter Block for Generate Dynamic-Huffman Table, Compress and Expand. - */ -#define CVT_CRC32 0 -#define CVT_ADLER32 1 -#define HTT_FIXED 0 -#define HTT_DYNAMIC 1 - -struct dfltcc_param_v0 { - uint16_t pbvn; /* Parameter-Block-Version Number */ - uint8_t mvn; /* Model-Version Number */ - uint8_t ribm; /* Reserved for IBM use */ - uint32_t reserved32 : 31; - uint32_t cf : 1; /* Continuation Flag */ - uint8_t reserved64[8]; - uint32_t nt : 1; /* New Task */ - uint32_t reserved129 : 1; - uint32_t cvt : 1; /* Check Value Type */ - uint32_t reserved131 : 1; - uint32_t htt : 1; /* Huffman-Table Type */ - uint32_t bcf : 1; /* Block-Continuation Flag */ - uint32_t bcc : 1; /* Block Closing Control */ - uint32_t bhf : 1; /* Block Header Final */ - uint32_t reserved136 : 1; - uint32_t reserved137 : 1; - uint32_t dhtgc : 1; /* DHT Generation Control */ - uint32_t reserved139 : 5; - uint32_t reserved144 : 5; - uint32_t sbb : 3; /* Sub-Byte Boundary */ - uint8_t oesc; /* Operation-Ending-Supplemental Code */ - uint32_t reserved160 : 12; - uint32_t ifs : 4; /* Incomplete-Function Status */ - uint16_t ifl; /* Incomplete-Function Length */ - uint8_t reserved192[8]; - uint8_t reserved256[8]; - uint8_t reserved320[4]; - uint16_t hl; /* History Length */ - uint32_t reserved368 : 1; - uint16_t ho : 15; /* History Offset */ - uint32_t cv; /* Check Value */ - uint32_t eobs : 15; /* End-of-block Symbol */ - uint32_t reserved431: 1; - uint8_t eobl : 4; /* End-of-block Length */ - uint32_t reserved436 : 12; - uint32_t reserved448 : 4; - uint16_t cdhtl : 12; /* Compressed-Dynamic-Huffman Table - Length */ - uint8_t reserved464[6]; - uint8_t cdht[288]; - uint8_t reserved[32]; - uint8_t csb[1152]; -}; - -static_assert(sizeof(struct dfltcc_param_v0) == 1536, sizeof_struct_dfltcc_param_v0_is_1536); - -static inline z_const char *oesc_msg(char *buf, int oesc) { - if (oesc == 0x00) - return NULL; /* Successful completion */ - else { - sprintf(buf, "Operation-Ending-Supplemental Code is 0x%.2X", oesc); - return buf; - } -} - -/* - Extension of inflate_state and deflate_state. Must be doubleword-aligned. -*/ -struct dfltcc_state { - struct dfltcc_param_v0 param; /* Parameter block. */ - struct dfltcc_qaf_param af; /* Available functions. */ - uint16_t level_mask; /* Levels on which to use DFLTCC */ - uint32_t block_size; /* New block each X bytes */ - size_t block_threshold; /* New block after total_in > X */ - uint32_t dht_threshold; /* New block only if avail_in >= X */ - char msg[64]; /* Buffer for strm->msg */ -}; - -#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) - -#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8))) diff --git a/libs/zlibng/arch/s390/dfltcc_inflate.c b/libs/zlibng/arch/s390/dfltcc_inflate.c deleted file mode 100644 index f6a7e8f86..000000000 --- a/libs/zlibng/arch/s390/dfltcc_inflate.c +++ /dev/null @@ -1,137 +0,0 @@ -/* dfltcc_inflate.c - IBM Z DEFLATE CONVERSION CALL decompression support. */ - -/* - Use the following commands to build zlib-ng with DFLTCC decompression support: - - $ ./configure --with-dfltcc-inflate - or - - $ cmake -DWITH_DFLTCC_INFLATE=1 . - - and then - - $ make -*/ - -#include "../../zbuild.h" -#include "../../zutil.h" -#include "../../inftrees.h" -#include "../../inflate.h" -#include "dfltcc_inflate.h" -#include "dfltcc_detail.h" - -int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm) { - struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - - /* Unsupported compression settings */ - if (state->wbits != HB_BITS) - return 0; - - /* Unsupported hardware */ - return is_bit_set(dfltcc_state->af.fns, DFLTCC_XPND) && is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0); -} - -static inline dfltcc_cc dfltcc_xpnd(PREFIX3(streamp) strm) { - struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - size_t avail_in = strm->avail_in; - size_t avail_out = strm->avail_out; - dfltcc_cc cc; - - cc = dfltcc(DFLTCC_XPND | HBT_CIRCULAR, - param, &strm->next_out, &avail_out, - &strm->next_in, &avail_in, state->window); - strm->avail_in = avail_in; - strm->avail_out = avail_out; - return cc; -} - -dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret) { - struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - struct dfltcc_param_v0 *param = &dfltcc_state->param; - dfltcc_cc cc; - - if (flush == Z_BLOCK || flush == Z_TREES) { - /* DFLTCC does not support stopping on block boundaries */ - if (dfltcc_inflate_disable(strm)) { - *ret = Z_STREAM_ERROR; - return DFLTCC_INFLATE_BREAK; - } else - return DFLTCC_INFLATE_SOFTWARE; - } - - if (state->last) { - if (state->bits != 0) { - strm->next_in++; - strm->avail_in--; - state->bits = 0; - } - state->mode = CHECK; - return DFLTCC_INFLATE_CONTINUE; - } - - if (strm->avail_in == 0 && !param->cf) - return DFLTCC_INFLATE_BREAK; - - if (inflate_ensure_window(state)) { - state->mode = MEM; - return DFLTCC_INFLATE_CONTINUE; - } - - /* Translate stream to parameter block */ - param->cvt = state->flags ? CVT_CRC32 : CVT_ADLER32; - param->sbb = state->bits; - param->hl = state->whave; /* Software and hardware history formats match */ - param->ho = (state->wnext - state->whave) & ((1 << HB_BITS) - 1); - if (param->hl) - param->nt = 0; /* Honor history for the first block */ - param->cv = state->flags ? ZSWAP32(state->check) : state->check; - - /* Inflate */ - do { - cc = dfltcc_xpnd(strm); - } while (cc == DFLTCC_CC_AGAIN); - - /* Translate parameter block to stream */ - strm->msg = oesc_msg(dfltcc_state->msg, param->oesc); - state->last = cc == DFLTCC_CC_OK; - state->bits = param->sbb; - state->whave = param->hl; - state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1); - state->check = state->flags ? ZSWAP32(param->cv) : param->cv; - if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { - /* Report an error if stream is corrupted */ - state->mode = BAD; - return DFLTCC_INFLATE_CONTINUE; - } - state->mode = TYPEDO; - /* Break if operands are exhausted, otherwise continue looping */ - return (cc == DFLTCC_CC_OP1_TOO_SHORT || cc == DFLTCC_CC_OP2_TOO_SHORT) ? - DFLTCC_INFLATE_BREAK : DFLTCC_INFLATE_CONTINUE; -} - -int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm) { - struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param; - - return !param->nt; -} - -int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm) { - struct inflate_state *state = (struct inflate_state *)strm->state; - struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state); - - if (!dfltcc_can_inflate(strm)) - return 0; - if (dfltcc_was_inflate_used(strm)) - /* DFLTCC has already decompressed some data. Since there is not - * enough information to resume decompression in software, the call - * must fail. - */ - return 1; - /* DFLTCC was not used yet - decompress in software */ - memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af)); - return 0; -} diff --git a/libs/zlibng/arch/s390/dfltcc_inflate.h b/libs/zlibng/arch/s390/dfltcc_inflate.h deleted file mode 100644 index fc8a000f7..000000000 --- a/libs/zlibng/arch/s390/dfltcc_inflate.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef DFLTCC_INFLATE_H -#define DFLTCC_INFLATE_H - -#include "dfltcc_common.h" - -int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm); -typedef enum { - DFLTCC_INFLATE_CONTINUE, - DFLTCC_INFLATE_BREAK, - DFLTCC_INFLATE_SOFTWARE, -} dfltcc_inflate_action; -dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret); -int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm); -int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm); - -#define INFLATE_RESET_KEEP_HOOK(strm) \ - dfltcc_reset((strm), sizeof(struct inflate_state)) - -#define INFLATE_PRIME_HOOK(strm, bits, value) \ - do { if (dfltcc_inflate_disable((strm))) return Z_STREAM_ERROR; } while (0) - -#define INFLATE_TYPEDO_HOOK(strm, flush) \ - if (dfltcc_can_inflate((strm))) { \ - dfltcc_inflate_action action; \ -\ - RESTORE(); \ - action = dfltcc_inflate((strm), (flush), &ret); \ - LOAD(); \ - if (action == DFLTCC_INFLATE_CONTINUE) \ - break; \ - else if (action == DFLTCC_INFLATE_BREAK) \ - goto inf_leave; \ - } - -#define INFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_inflate((strm))) - -#define INFLATE_NEED_UPDATEWINDOW(strm) (!dfltcc_can_inflate((strm))) - -#define INFLATE_MARK_HOOK(strm) \ - do { \ - if (dfltcc_was_inflate_used((strm))) return -(1L << 16); \ - } while (0) - -#define INFLATE_SYNC_POINT_HOOK(strm) \ - do { \ - if (dfltcc_was_inflate_used((strm))) return Z_STREAM_ERROR; \ - } while (0) - -#endif diff --git a/libs/zlibng/arch/x86/INDEX.md b/libs/zlibng/arch/x86/INDEX.md deleted file mode 100644 index 8bf6d08e5..000000000 --- a/libs/zlibng/arch/x86/INDEX.md +++ /dev/null @@ -1,8 +0,0 @@ -Contents --------- - -|Name|Description| -|:-|:-| -|deflate_quick.c|SSE4 optimized deflate strategy for use as level 1| -|crc_folding.c|SSE4 + PCLMULQDQ optimized CRC folding implementation| -|slide_sse2.c|SSE2 optimized slide_hash| diff --git a/libs/zlibng/arch/x86/Makefile.in b/libs/zlibng/arch/x86/Makefile.in deleted file mode 100644 index 4f6594e6d..000000000 --- a/libs/zlibng/arch/x86/Makefile.in +++ /dev/null @@ -1,107 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -CC= -CFLAGS= -SFLAGS= -INCLUDES= -SUFFIX= - -AVX2FLAG=-mavx2 -SSE2FLAG=-msse2 -SSSE3FLAG=-mssse3 -SSE4FLAG=-msse4 -PCLMULFLAG=-mpclmul - -SRCDIR=. -SRCTOP=../.. -TOPDIR=$(SRCTOP) - -all: \ - x86.o x86.lo \ - adler32_avx.o adler32.lo \ - adler32_ssse3.o adler32_ssse3.lo \ - chunkset_avx.o chunkset_avx.lo \ - chunkset_sse.o chunkset_sse.lo \ - compare258_avx.o compare258_avx.lo \ - compare258_sse.o compare258_sse.lo \ - insert_string_sse.o insert_string_sse.lo \ - crc_folding.o crc_folding.lo \ - slide_avx.o slide_avx.lo \ - slide_sse.o slide_sse.lo - -x86.o: - $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/x86.c - -x86.lo: - $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/x86.c - -chunkset_avx.o: - $(CC) $(CFLAGS) $(AVX2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_avx.c - -chunkset_avx.lo: - $(CC) $(SFLAGS) $(AVX2FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_avx.c - -chunkset_sse.o: - $(CC) $(CFLAGS) $(SSE2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_sse.c - -chunkset_sse.lo: - $(CC) $(SFLAGS) $(SSE2FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_sse.c - -compare258_avx.o: - $(CC) $(CFLAGS) $(AVX2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_avx.c - -compare258_avx.lo: - $(CC) $(SFLAGS) $(AVX2FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_avx.c - -compare258_sse.o: - $(CC) $(CFLAGS) $(SSE4FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_sse.c - -compare258_sse.lo: - $(CC) $(SFLAGS) $(SSE4FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/compare258_sse.c - -insert_string_sse.o: - $(CC) $(CFLAGS) $(SSE4FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_sse.c - -insert_string_sse.lo: - $(CC) $(SFLAGS) $(SSE4FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/insert_string_sse.c - -crc_folding.o: - $(CC) $(CFLAGS) $(PCLMULFLAG) $(SSE4FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc_folding.c - -crc_folding.lo: - $(CC) $(SFLAGS) $(PCLMULFLAG) $(SSE4FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/crc_folding.c - -slide_avx.o: - $(CC) $(CFLAGS) $(AVX2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_avx.c - -slide_avx.lo: - $(CC) $(SFLAGS) $(AVX2FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/slide_avx.c - -slide_sse.o: - $(CC) $(CFLAGS) $(SSE2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_sse.c - -slide_sse.lo: - $(CC) $(SFLAGS) $(SSE2FLAG) -DPIC $(INCLUDES) -c -o $@ $(SRCDIR)/slide_sse.c - -adler32_avx.o: $(SRCDIR)/adler32_avx.c - $(CC) $(CFLAGS) $(AVX2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx.c - -adler32_avx.lo: $(SRCDIR)/adler32_avx.c - $(CC) $(SFLAGS) $(AVX2FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_avx.c - -adler32_ssse3.o: $(SRCDIR)/adler32_ssse3.c - $(CC) $(CFLAGS) $(SSSE3FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_ssse3.c - -adler32_ssse3.lo: $(SRCDIR)/adler32_ssse3.c - $(CC) $(SFLAGS) $(SSSE3FLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_ssse3.c - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ - rm -rf objs - rm -f *.gcda *.gcno *.gcov - -distclean: - rm -f Makefile diff --git a/libs/zlibng/arch/x86/adler32_avx.c b/libs/zlibng/arch/x86/adler32_avx.c deleted file mode 100644 index 106324654..000000000 --- a/libs/zlibng/arch/x86/adler32_avx.c +++ /dev/null @@ -1,117 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler - * Authors: - * Brian Bockelman - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#include "../../adler32_p.h" - -#include - -#ifdef X86_AVX2_ADLER32 - -Z_INTERNAL uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len) { - uint32_t sum2; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - uint32_t ALIGNED_(32) s1[8], s2[8]; - - memset(s1, 0, sizeof(s1)); s1[7] = adler; // TODO: would a masked load be faster? - memset(s2, 0, sizeof(s2)); s2[7] = sum2; - - char ALIGNED_(32) dot1[32] = \ - {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}; - __m256i dot1v = _mm256_load_si256((__m256i*)dot1); - char ALIGNED_(32) dot2[32] = \ - {32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, - 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - __m256i dot2v = _mm256_load_si256((__m256i*)dot2); - short ALIGNED_(32) dot3[16] = \ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - __m256i dot3v = _mm256_load_si256((__m256i*)dot3); - - // We will need to multiply by - char ALIGNED_(32) shift[16] = {5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - __m128i shiftv = _mm_load_si128((__m128i*)shift); - - while (len >= 32) { - __m256i vs1 = _mm256_load_si256((__m256i*)s1); - __m256i vs2 = _mm256_load_si256((__m256i*)s2); - __m256i vs1_0 = vs1; - - int k = (len < NMAX ? (int)len : NMAX); - k -= k % 32; - len -= k; - - while (k >= 32) { - /* - vs1 = adler + sum(c[i]) - vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) - */ - __m256i vbuf = _mm256_loadu_si256((__m256i*)buf); - buf += 32; - k -= 32; - - __m256i v_short_sum1 = _mm256_maddubs_epi16(vbuf, dot1v); // multiply-add, resulting in 8 shorts. - __m256i vsum1 = _mm256_madd_epi16(v_short_sum1, dot3v); // sum 8 shorts to 4 int32_t; - __m256i v_short_sum2 = _mm256_maddubs_epi16(vbuf, dot2v); - vs1 = _mm256_add_epi32(vsum1, vs1); - __m256i vsum2 = _mm256_madd_epi16(v_short_sum2, dot3v); - vs1_0 = _mm256_sll_epi32(vs1_0, shiftv); - vsum2 = _mm256_add_epi32(vsum2, vs2); - vs2 = _mm256_add_epi32(vsum2, vs1_0); - vs1_0 = vs1; - } - - // At this point, we have partial sums stored in vs1 and vs2. There are AVX512 instructions that - // would allow us to sum these quickly (VP4DPWSSD). For now, just unpack and move on. - uint32_t ALIGNED_(32) s1_unpack[8]; - uint32_t ALIGNED_(32) s2_unpack[8]; - - _mm256_store_si256((__m256i*)s1_unpack, vs1); - _mm256_store_si256((__m256i*)s2_unpack, vs2); - - adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE) + - (s1_unpack[4] % BASE) + (s1_unpack[5] % BASE) + (s1_unpack[6] % BASE) + (s1_unpack[7] % BASE); - adler %= BASE; - s1[7] = adler; - - sum2 = (s2_unpack[0] % BASE) + (s2_unpack[1] % BASE) + (s2_unpack[2] % BASE) + (s2_unpack[3] % BASE) + - (s2_unpack[4] % BASE) + (s2_unpack[5] % BASE) + (s2_unpack[6] % BASE) + (s2_unpack[7] % BASE); - sum2 %= BASE; - s2[7] = sum2; - } - - while (len) { - len--; - adler += *buf++; - sum2 += adler; - } - adler %= BASE; - sum2 %= BASE; - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -#endif diff --git a/libs/zlibng/arch/x86/adler32_ssse3.c b/libs/zlibng/arch/x86/adler32_ssse3.c deleted file mode 100644 index 101df4fe4..000000000 --- a/libs/zlibng/arch/x86/adler32_ssse3.c +++ /dev/null @@ -1,118 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler - * Authors: - * Brian Bockelman - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#include "../../adler32_p.h" - -#ifdef X86_SSSE3_ADLER32 - -#include - -Z_INTERNAL uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len) { - uint32_t sum2; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (UNLIKELY(len == 1)) - return adler32_len_1(adler, buf, sum2); - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (UNLIKELY(buf == NULL)) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (UNLIKELY(len < 16)) - return adler32_len_16(adler, buf, len, sum2); - - uint32_t ALIGNED_(16) s1[4], s2[4]; - - s1[0] = s1[1] = s1[2] = 0; s1[3] = adler; - s2[0] = s2[1] = s2[2] = 0; s2[3] = sum2; - - char ALIGNED_(16) dot1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; - __m128i dot1v = _mm_load_si128((__m128i*)dot1); - char ALIGNED_(16) dot2[16] = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - __m128i dot2v = _mm_load_si128((__m128i*)dot2); - short ALIGNED_(16) dot3[8] = {1, 1, 1, 1, 1, 1, 1, 1}; - __m128i dot3v = _mm_load_si128((__m128i*)dot3); - - // We will need to multiply by - //char ALIGNED_(16) shift[4] = {0, 0, 0, 4}; //{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4}; - - char ALIGNED_(16) shift[16] = {4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - __m128i shiftv = _mm_load_si128((__m128i*)shift); - - while (len >= 16) { - __m128i vs1 = _mm_load_si128((__m128i*)s1); - __m128i vs2 = _mm_load_si128((__m128i*)s2); - __m128i vs1_0 = vs1; - - int k = (len < NMAX ? (int)len : NMAX); - k -= k % 16; - len -= k; - - while (k >= 16) { - /* - vs1 = adler + sum(c[i]) - vs2 = sum2 + 16 vs1 + sum( (16-i+1) c[i] ) - - NOTE: 256-bit equivalents are: - _mm256_maddubs_epi16 <- operates on 32 bytes to 16 shorts - _mm256_madd_epi16 <- Sums 16 shorts to 8 int32_t. - We could rewrite the below to use 256-bit instructions instead of 128-bit. - */ - __m128i vbuf = _mm_loadu_si128((__m128i*)buf); - buf += 16; - k -= 16; - - __m128i v_short_sum1 = _mm_maddubs_epi16(vbuf, dot1v); // multiply-add, resulting in 8 shorts. - __m128i vsum1 = _mm_madd_epi16(v_short_sum1, dot3v); // sum 8 shorts to 4 int32_t; - __m128i v_short_sum2 = _mm_maddubs_epi16(vbuf, dot2v); - vs1 = _mm_add_epi32(vsum1, vs1); - __m128i vsum2 = _mm_madd_epi16(v_short_sum2, dot3v); - vs1_0 = _mm_sll_epi32(vs1_0, shiftv); - vsum2 = _mm_add_epi32(vsum2, vs2); - vs2 = _mm_add_epi32(vsum2, vs1_0); - vs1_0 = vs1; - } - - // At this point, we have partial sums stored in vs1 and vs2. There are AVX512 instructions that - // would allow us to sum these quickly (VP4DPWSSD). For now, just unpack and move on. - - uint32_t ALIGNED_(16) s1_unpack[4]; - uint32_t ALIGNED_(16) s2_unpack[4]; - - _mm_store_si128((__m128i*)s1_unpack, vs1); - _mm_store_si128((__m128i*)s2_unpack, vs2); - - adler = (s1_unpack[0] % BASE) + (s1_unpack[1] % BASE) + (s1_unpack[2] % BASE) + (s1_unpack[3] % BASE); - adler %= BASE; - s1[3] = adler; - - sum2 = (s2_unpack[0] % BASE) + (s2_unpack[1] % BASE) + (s2_unpack[2] % BASE) + (s2_unpack[3] % BASE); - sum2 %= BASE; - s2[3] = sum2; - } - - while (len) { - len--; - adler += *buf++; - sum2 += adler; - } - adler %= BASE; - sum2 %= BASE; - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -#endif diff --git a/libs/zlibng/arch/x86/chunkset_avx.c b/libs/zlibng/arch/x86/chunkset_avx.c deleted file mode 100644 index eb76c0db9..000000000 --- a/libs/zlibng/arch/x86/chunkset_avx.c +++ /dev/null @@ -1,50 +0,0 @@ -/* chunkset_avx.c -- AVX inline functions to copy small data chunks. - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#include "zbuild.h" -#include "zutil.h" - -#ifdef X86_AVX_CHUNKSET -#include - -typedef __m256i chunk_t; - -#define HAVE_CHUNKMEMSET_1 -#define HAVE_CHUNKMEMSET_2 -#define HAVE_CHUNKMEMSET_4 -#define HAVE_CHUNKMEMSET_8 - -static inline void chunkmemset_1(uint8_t *from, chunk_t *chunk) { - *chunk = _mm256_set1_epi8(*(int8_t *)from); -} - -static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { - *chunk = _mm256_set1_epi16(*(int16_t *)from); -} - -static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { - *chunk = _mm256_set1_epi32(*(int32_t *)from); -} - -static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { - *chunk = _mm256_set1_epi64x(*(int64_t *)from); -} - -static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { - *chunk = _mm256_loadu_si256((__m256i *)s); -} - -static inline void storechunk(uint8_t *out, chunk_t *chunk) { - _mm256_storeu_si256((__m256i *)out, *chunk); -} - -#define CHUNKSIZE chunksize_avx -#define CHUNKCOPY chunkcopy_avx -#define CHUNKCOPY_SAFE chunkcopy_safe_avx -#define CHUNKUNROLL chunkunroll_avx -#define CHUNKMEMSET chunkmemset_avx -#define CHUNKMEMSET_SAFE chunkmemset_safe_avx - -#include "chunkset_tpl.h" - -#endif diff --git a/libs/zlibng/arch/x86/chunkset_sse.c b/libs/zlibng/arch/x86/chunkset_sse.c deleted file mode 100644 index 1d5a0faa9..000000000 --- a/libs/zlibng/arch/x86/chunkset_sse.c +++ /dev/null @@ -1,51 +0,0 @@ -/* chunkset_sse.c -- SSE inline functions to copy small data chunks. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" - -#ifdef X86_SSE2 -#include - -typedef __m128i chunk_t; - -#define HAVE_CHUNKMEMSET_1 -#define HAVE_CHUNKMEMSET_2 -#define HAVE_CHUNKMEMSET_4 -#define HAVE_CHUNKMEMSET_8 - -static inline void chunkmemset_1(uint8_t *from, chunk_t *chunk) { - *chunk = _mm_set1_epi8(*(int8_t *)from); -} - -static inline void chunkmemset_2(uint8_t *from, chunk_t *chunk) { - *chunk = _mm_set1_epi16(*(int16_t *)from); -} - -static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { - *chunk = _mm_set1_epi32(*(int32_t *)from); -} - -static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { - *chunk = _mm_set1_epi64x(*(int64_t *)from); -} - -static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { - *chunk = _mm_loadu_si128((__m128i *)s); -} - -static inline void storechunk(uint8_t *out, chunk_t *chunk) { - _mm_storeu_si128((__m128i *)out, *chunk); -} - -#define CHUNKSIZE chunksize_sse2 -#define CHUNKCOPY chunkcopy_sse2 -#define CHUNKCOPY_SAFE chunkcopy_safe_sse2 -#define CHUNKUNROLL chunkunroll_sse2 -#define CHUNKMEMSET chunkmemset_sse2 -#define CHUNKMEMSET_SAFE chunkmemset_safe_sse2 - -#include "chunkset_tpl.h" - -#endif diff --git a/libs/zlibng/arch/x86/compare258_avx.c b/libs/zlibng/arch/x86/compare258_avx.c deleted file mode 100644 index d9108fdeb..000000000 --- a/libs/zlibng/arch/x86/compare258_avx.c +++ /dev/null @@ -1,67 +0,0 @@ -/* compare258_avx.c -- AVX2 version of compare258 - * Copyright Mika T. Lindqvist - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#include "fallback_builtins.h" - -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) - -#include -#ifdef _MSC_VER -# include -#endif - -/* UNALIGNED_OK, AVX2 intrinsic comparison */ -static inline uint32_t compare256_unaligned_avx2_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - __m256i ymm_src0, ymm_src1, ymm_cmp; - ymm_src0 = _mm256_loadu_si256((__m256i*)src0); - ymm_src1 = _mm256_loadu_si256((__m256i*)src1); - ymm_cmp = _mm256_cmpeq_epi8(ymm_src0, ymm_src1); /* non-identical bytes = 00, identical bytes = FF */ - unsigned mask = (unsigned)_mm256_movemask_epi8(ymm_cmp); - if (mask != 0xFFFFFFFF) { - uint32_t match_byte = (uint32_t)__builtin_ctz(~mask); /* Invert bits so identical = 0 */ - return len + match_byte; - } - - src0 += 32, src1 += 32, len += 32; - - ymm_src0 = _mm256_loadu_si256((__m256i*)src0); - ymm_src1 = _mm256_loadu_si256((__m256i*)src1); - ymm_cmp = _mm256_cmpeq_epi8(ymm_src0, ymm_src1); - mask = (unsigned)_mm256_movemask_epi8(ymm_cmp); - if (mask != 0xFFFFFFFF) { - uint32_t match_byte = (uint32_t)__builtin_ctz(~mask); - return len + match_byte; - } - - src0 += 32, src1 += 32, len += 32; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_avx2_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_avx2_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_avx2_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_avx2 -#define COMPARE256 compare256_unaligned_avx2_static -#define COMPARE258 compare258_unaligned_avx2_static - -#include "match_tpl.h" - -#endif diff --git a/libs/zlibng/arch/x86/compare258_sse.c b/libs/zlibng/arch/x86/compare258_sse.c deleted file mode 100644 index 17534c051..000000000 --- a/libs/zlibng/arch/x86/compare258_sse.c +++ /dev/null @@ -1,74 +0,0 @@ -/* compare258_sse.c -- SSE4.2 version of compare258 - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Wajdi Feghali - * Jim Guilford - * Vinodh Gopal - * Erdinc Ozturk - * Jim Kukunas - * - * Portions are Copyright (C) 2016 12Sided Technology, LLC. - * Author: - * Phil Vachon - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zbuild.h" -#include "../../zutil.h" - -#ifdef X86_SSE42_CMP_STR - -#include -#ifdef _MSC_VER -# include -#endif - -/* UNALIGNED_OK, SSE4.2 intrinsic comparison */ -static inline uint32_t compare256_unaligned_sse4_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - #define mode _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_EACH | _SIDD_NEGATIVE_POLARITY - __m128i xmm_src0, xmm_src1; - uint32_t ret; - - xmm_src0 = _mm_loadu_si128((__m128i *)src0); - xmm_src1 = _mm_loadu_si128((__m128i *)src1); - ret = (uint32_t)_mm_cmpestri(xmm_src0, 16, xmm_src1, 16, mode); - if (_mm_cmpestrc(xmm_src0, 16, xmm_src1, 16, mode)) { - return len + ret; - } - src0 += 16, src1 += 16, len += 16; - - xmm_src0 = _mm_loadu_si128((__m128i *)src0); - xmm_src1 = _mm_loadu_si128((__m128i *)src1); - ret = (uint32_t)_mm_cmpestri(xmm_src0, 16, xmm_src1, 16, mode); - if (_mm_cmpestrc(xmm_src0, 16, xmm_src1, 16, mode)) { - return len + ret; - } - src0 += 16, src1 += 16, len += 16; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_sse4_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_sse4_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_sse4_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_sse4 -#define COMPARE256 compare256_unaligned_sse4_static -#define COMPARE258 compare258_unaligned_sse4_static - -#include "match_tpl.h" - -#endif diff --git a/libs/zlibng/arch/x86/crc_folding.c b/libs/zlibng/arch/x86/crc_folding.c deleted file mode 100644 index 918bd9468..000000000 --- a/libs/zlibng/arch/x86/crc_folding.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Compute the CRC32 using a parallelized folding approach with the PCLMULQDQ - * instruction. - * - * A white paper describing this algorithm can be found at: - * http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Wajdi Feghali - * Jim Guilford - * Vinodh Gopal - * Erdinc Ozturk - * Jim Kukunas - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef X86_PCLMULQDQ_CRC - -#include "../../zbuild.h" -#include -#include -#include - -#include "crc_folding.h" - -Z_INTERNAL void crc_fold_init(deflate_state *const s) { - /* CRC_SAVE */ - _mm_storeu_si128((__m128i *)s->crc0 + 0, _mm_cvtsi32_si128(0x9db42487)); - _mm_storeu_si128((__m128i *)s->crc0 + 1, _mm_setzero_si128()); - _mm_storeu_si128((__m128i *)s->crc0 + 2, _mm_setzero_si128()); - _mm_storeu_si128((__m128i *)s->crc0 + 3, _mm_setzero_si128()); - - s->strm->adler = 0; -} - -static void fold_1(__m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, __m128i *xmm_crc3) { - const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, - 0x00000001, 0xc6e41596); - __m128i x_tmp3; - __m128 ps_crc0, ps_crc3, ps_res; - - x_tmp3 = *xmm_crc3; - - *xmm_crc3 = *xmm_crc0; - *xmm_crc0 = _mm_clmulepi64_si128(*xmm_crc0, xmm_fold4, 0x01); - *xmm_crc3 = _mm_clmulepi64_si128(*xmm_crc3, xmm_fold4, 0x10); - ps_crc0 = _mm_castsi128_ps(*xmm_crc0); - ps_crc3 = _mm_castsi128_ps(*xmm_crc3); - ps_res = _mm_xor_ps(ps_crc0, ps_crc3); - - *xmm_crc0 = *xmm_crc1; - *xmm_crc1 = *xmm_crc2; - *xmm_crc2 = x_tmp3; - *xmm_crc3 = _mm_castps_si128(ps_res); -} - -static void fold_2(__m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, __m128i *xmm_crc3) { - const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, - 0x00000001, 0xc6e41596); - __m128i x_tmp3, x_tmp2; - __m128 ps_crc0, ps_crc1, ps_crc2, ps_crc3, ps_res31, ps_res20; - - x_tmp3 = *xmm_crc3; - x_tmp2 = *xmm_crc2; - - *xmm_crc3 = *xmm_crc1; - *xmm_crc1 = _mm_clmulepi64_si128(*xmm_crc1, xmm_fold4, 0x01); - *xmm_crc3 = _mm_clmulepi64_si128(*xmm_crc3, xmm_fold4, 0x10); - ps_crc3 = _mm_castsi128_ps(*xmm_crc3); - ps_crc1 = _mm_castsi128_ps(*xmm_crc1); - ps_res31 = _mm_xor_ps(ps_crc3, ps_crc1); - - *xmm_crc2 = *xmm_crc0; - *xmm_crc0 = _mm_clmulepi64_si128(*xmm_crc0, xmm_fold4, 0x01); - *xmm_crc2 = _mm_clmulepi64_si128(*xmm_crc2, xmm_fold4, 0x10); - ps_crc0 = _mm_castsi128_ps(*xmm_crc0); - ps_crc2 = _mm_castsi128_ps(*xmm_crc2); - ps_res20 = _mm_xor_ps(ps_crc0, ps_crc2); - - *xmm_crc0 = x_tmp2; - *xmm_crc1 = x_tmp3; - *xmm_crc2 = _mm_castps_si128(ps_res20); - *xmm_crc3 = _mm_castps_si128(ps_res31); -} - -static void fold_3(__m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, __m128i *xmm_crc3) { - const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, - 0x00000001, 0xc6e41596); - __m128i x_tmp3; - __m128 ps_crc0, ps_crc1, ps_crc2, ps_crc3, ps_res32, ps_res21, ps_res10; - - x_tmp3 = *xmm_crc3; - - *xmm_crc3 = *xmm_crc2; - *xmm_crc2 = _mm_clmulepi64_si128(*xmm_crc2, xmm_fold4, 0x01); - *xmm_crc3 = _mm_clmulepi64_si128(*xmm_crc3, xmm_fold4, 0x10); - ps_crc2 = _mm_castsi128_ps(*xmm_crc2); - ps_crc3 = _mm_castsi128_ps(*xmm_crc3); - ps_res32 = _mm_xor_ps(ps_crc2, ps_crc3); - - *xmm_crc2 = *xmm_crc1; - *xmm_crc1 = _mm_clmulepi64_si128(*xmm_crc1, xmm_fold4, 0x01); - *xmm_crc2 = _mm_clmulepi64_si128(*xmm_crc2, xmm_fold4, 0x10); - ps_crc1 = _mm_castsi128_ps(*xmm_crc1); - ps_crc2 = _mm_castsi128_ps(*xmm_crc2); - ps_res21 = _mm_xor_ps(ps_crc1, ps_crc2); - - *xmm_crc1 = *xmm_crc0; - *xmm_crc0 = _mm_clmulepi64_si128(*xmm_crc0, xmm_fold4, 0x01); - *xmm_crc1 = _mm_clmulepi64_si128(*xmm_crc1, xmm_fold4, 0x10); - ps_crc0 = _mm_castsi128_ps(*xmm_crc0); - ps_crc1 = _mm_castsi128_ps(*xmm_crc1); - ps_res10 = _mm_xor_ps(ps_crc0, ps_crc1); - - *xmm_crc0 = x_tmp3; - *xmm_crc1 = _mm_castps_si128(ps_res10); - *xmm_crc2 = _mm_castps_si128(ps_res21); - *xmm_crc3 = _mm_castps_si128(ps_res32); -} - -static void fold_4(__m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, __m128i *xmm_crc3) { - const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, - 0x00000001, 0xc6e41596); - __m128i x_tmp0, x_tmp1, x_tmp2, x_tmp3; - __m128 ps_crc0, ps_crc1, ps_crc2, ps_crc3; - __m128 ps_t0, ps_t1, ps_t2, ps_t3; - __m128 ps_res0, ps_res1, ps_res2, ps_res3; - - x_tmp0 = *xmm_crc0; - x_tmp1 = *xmm_crc1; - x_tmp2 = *xmm_crc2; - x_tmp3 = *xmm_crc3; - - *xmm_crc0 = _mm_clmulepi64_si128(*xmm_crc0, xmm_fold4, 0x01); - x_tmp0 = _mm_clmulepi64_si128(x_tmp0, xmm_fold4, 0x10); - ps_crc0 = _mm_castsi128_ps(*xmm_crc0); - ps_t0 = _mm_castsi128_ps(x_tmp0); - ps_res0 = _mm_xor_ps(ps_crc0, ps_t0); - - *xmm_crc1 = _mm_clmulepi64_si128(*xmm_crc1, xmm_fold4, 0x01); - x_tmp1 = _mm_clmulepi64_si128(x_tmp1, xmm_fold4, 0x10); - ps_crc1 = _mm_castsi128_ps(*xmm_crc1); - ps_t1 = _mm_castsi128_ps(x_tmp1); - ps_res1 = _mm_xor_ps(ps_crc1, ps_t1); - - *xmm_crc2 = _mm_clmulepi64_si128(*xmm_crc2, xmm_fold4, 0x01); - x_tmp2 = _mm_clmulepi64_si128(x_tmp2, xmm_fold4, 0x10); - ps_crc2 = _mm_castsi128_ps(*xmm_crc2); - ps_t2 = _mm_castsi128_ps(x_tmp2); - ps_res2 = _mm_xor_ps(ps_crc2, ps_t2); - - *xmm_crc3 = _mm_clmulepi64_si128(*xmm_crc3, xmm_fold4, 0x01); - x_tmp3 = _mm_clmulepi64_si128(x_tmp3, xmm_fold4, 0x10); - ps_crc3 = _mm_castsi128_ps(*xmm_crc3); - ps_t3 = _mm_castsi128_ps(x_tmp3); - ps_res3 = _mm_xor_ps(ps_crc3, ps_t3); - - *xmm_crc0 = _mm_castps_si128(ps_res0); - *xmm_crc1 = _mm_castps_si128(ps_res1); - *xmm_crc2 = _mm_castps_si128(ps_res2); - *xmm_crc3 = _mm_castps_si128(ps_res3); -} - -static const unsigned ALIGNED_(32) pshufb_shf_table[60] = { - 0x84838281, 0x88878685, 0x8c8b8a89, 0x008f8e8d, /* shl 15 (16 - 1)/shr1 */ - 0x85848382, 0x89888786, 0x8d8c8b8a, 0x01008f8e, /* shl 14 (16 - 3)/shr2 */ - 0x86858483, 0x8a898887, 0x8e8d8c8b, 0x0201008f, /* shl 13 (16 - 4)/shr3 */ - 0x87868584, 0x8b8a8988, 0x8f8e8d8c, 0x03020100, /* shl 12 (16 - 4)/shr4 */ - 0x88878685, 0x8c8b8a89, 0x008f8e8d, 0x04030201, /* shl 11 (16 - 5)/shr5 */ - 0x89888786, 0x8d8c8b8a, 0x01008f8e, 0x05040302, /* shl 10 (16 - 6)/shr6 */ - 0x8a898887, 0x8e8d8c8b, 0x0201008f, 0x06050403, /* shl 9 (16 - 7)/shr7 */ - 0x8b8a8988, 0x8f8e8d8c, 0x03020100, 0x07060504, /* shl 8 (16 - 8)/shr8 */ - 0x8c8b8a89, 0x008f8e8d, 0x04030201, 0x08070605, /* shl 7 (16 - 9)/shr9 */ - 0x8d8c8b8a, 0x01008f8e, 0x05040302, 0x09080706, /* shl 6 (16 -10)/shr10*/ - 0x8e8d8c8b, 0x0201008f, 0x06050403, 0x0a090807, /* shl 5 (16 -11)/shr11*/ - 0x8f8e8d8c, 0x03020100, 0x07060504, 0x0b0a0908, /* shl 4 (16 -12)/shr12*/ - 0x008f8e8d, 0x04030201, 0x08070605, 0x0c0b0a09, /* shl 3 (16 -13)/shr13*/ - 0x01008f8e, 0x05040302, 0x09080706, 0x0d0c0b0a, /* shl 2 (16 -14)/shr14*/ - 0x0201008f, 0x06050403, 0x0a090807, 0x0e0d0c0b /* shl 1 (16 -15)/shr15*/ -}; - -static void partial_fold(const size_t len, __m128i *xmm_crc0, __m128i *xmm_crc1, __m128i *xmm_crc2, - __m128i *xmm_crc3, __m128i *xmm_crc_part) { - - const __m128i xmm_fold4 = _mm_set_epi32( 0x00000001, 0x54442bd4, - 0x00000001, 0xc6e41596); - const __m128i xmm_mask3 = _mm_set1_epi32(0x80808080); - - __m128i xmm_shl, xmm_shr, xmm_tmp1, xmm_tmp2, xmm_tmp3; - __m128i xmm_a0_0, xmm_a0_1; - __m128 ps_crc3, psa0_0, psa0_1, ps_res; - - xmm_shl = _mm_load_si128((__m128i *)pshufb_shf_table + (len - 1)); - xmm_shr = xmm_shl; - xmm_shr = _mm_xor_si128(xmm_shr, xmm_mask3); - - xmm_a0_0 = _mm_shuffle_epi8(*xmm_crc0, xmm_shl); - - *xmm_crc0 = _mm_shuffle_epi8(*xmm_crc0, xmm_shr); - xmm_tmp1 = _mm_shuffle_epi8(*xmm_crc1, xmm_shl); - *xmm_crc0 = _mm_or_si128(*xmm_crc0, xmm_tmp1); - - *xmm_crc1 = _mm_shuffle_epi8(*xmm_crc1, xmm_shr); - xmm_tmp2 = _mm_shuffle_epi8(*xmm_crc2, xmm_shl); - *xmm_crc1 = _mm_or_si128(*xmm_crc1, xmm_tmp2); - - *xmm_crc2 = _mm_shuffle_epi8(*xmm_crc2, xmm_shr); - xmm_tmp3 = _mm_shuffle_epi8(*xmm_crc3, xmm_shl); - *xmm_crc2 = _mm_or_si128(*xmm_crc2, xmm_tmp3); - - *xmm_crc3 = _mm_shuffle_epi8(*xmm_crc3, xmm_shr); - *xmm_crc_part = _mm_shuffle_epi8(*xmm_crc_part, xmm_shl); - *xmm_crc3 = _mm_or_si128(*xmm_crc3, *xmm_crc_part); - - xmm_a0_1 = _mm_clmulepi64_si128(xmm_a0_0, xmm_fold4, 0x10); - xmm_a0_0 = _mm_clmulepi64_si128(xmm_a0_0, xmm_fold4, 0x01); - - ps_crc3 = _mm_castsi128_ps(*xmm_crc3); - psa0_0 = _mm_castsi128_ps(xmm_a0_0); - psa0_1 = _mm_castsi128_ps(xmm_a0_1); - - ps_res = _mm_xor_ps(ps_crc3, psa0_0); - ps_res = _mm_xor_ps(ps_res, psa0_1); - - *xmm_crc3 = _mm_castps_si128(ps_res); -} - -Z_INTERNAL void crc_fold_copy(deflate_state *const s, unsigned char *dst, const unsigned char *src, long len) { - unsigned long algn_diff; - __m128i xmm_t0, xmm_t1, xmm_t2, xmm_t3; - char ALIGNED_(16) partial_buf[16] = { 0 }; - - /* CRC_LOAD */ - __m128i xmm_crc0 = _mm_loadu_si128((__m128i *)s->crc0 + 0); - __m128i xmm_crc1 = _mm_loadu_si128((__m128i *)s->crc0 + 1); - __m128i xmm_crc2 = _mm_loadu_si128((__m128i *)s->crc0 + 2); - __m128i xmm_crc3 = _mm_loadu_si128((__m128i *)s->crc0 + 3); - __m128i xmm_crc_part; - - if (len < 16) { - if (len == 0) - return; - - memcpy(partial_buf, src, len); - xmm_crc_part = _mm_loadu_si128((const __m128i *)partial_buf); - memcpy(dst, partial_buf, len); - goto partial; - } - - algn_diff = ((uintptr_t)16 - ((uintptr_t)src & 0xF)) & 0xF; - if (algn_diff) { - xmm_crc_part = _mm_loadu_si128((__m128i *)src); - _mm_storeu_si128((__m128i *)dst, xmm_crc_part); - - dst += algn_diff; - src += algn_diff; - len -= algn_diff; - - partial_fold(algn_diff, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, &xmm_crc_part); - } else { - xmm_crc_part = _mm_setzero_si128(); - } - - while ((len -= 64) >= 0) { - /* CRC_LOAD */ - xmm_t0 = _mm_load_si128((__m128i *)src); - xmm_t1 = _mm_load_si128((__m128i *)src + 1); - xmm_t2 = _mm_load_si128((__m128i *)src + 2); - xmm_t3 = _mm_load_si128((__m128i *)src + 3); - - fold_4(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - /* CRC_SAVE */ - _mm_storeu_si128((__m128i *)dst, xmm_t0); - _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); - _mm_storeu_si128((__m128i *)dst + 2, xmm_t2); - _mm_storeu_si128((__m128i *)dst + 3, xmm_t3); - - xmm_crc0 = _mm_xor_si128(xmm_crc0, xmm_t0); - xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_t1); - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t2); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t3); - - src += 64; - dst += 64; - } - - /* - * len = num bytes left - 64 - */ - if (len + 16 >= 0) { - len += 16; - - xmm_t0 = _mm_load_si128((__m128i *)src); - xmm_t1 = _mm_load_si128((__m128i *)src + 1); - xmm_t2 = _mm_load_si128((__m128i *)src + 2); - - fold_3(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - _mm_storeu_si128((__m128i *)dst, xmm_t0); - _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); - _mm_storeu_si128((__m128i *)dst + 2, xmm_t2); - - xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_t0); - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t1); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t2); - - if (len == 0) - goto done; - - dst += 48; - memcpy(&xmm_crc_part, (__m128i *)src + 3, len); - } else if (len + 32 >= 0) { - len += 32; - - xmm_t0 = _mm_load_si128((__m128i *)src); - xmm_t1 = _mm_load_si128((__m128i *)src + 1); - - fold_2(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - _mm_storeu_si128((__m128i *)dst, xmm_t0); - _mm_storeu_si128((__m128i *)dst + 1, xmm_t1); - - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_t0); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t1); - - if (len == 0) - goto done; - - dst += 32; - memcpy(&xmm_crc_part, (__m128i *)src + 2, len); - } else if (len + 48 >= 0) { - len += 48; - - xmm_t0 = _mm_load_si128((__m128i *)src); - - fold_1(&xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3); - - _mm_storeu_si128((__m128i *)dst, xmm_t0); - - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_t0); - - if (len == 0) - goto done; - - dst += 16; - memcpy(&xmm_crc_part, (__m128i *)src + 1, len); - } else { - len += 64; - if (len == 0) - goto done; - memcpy(&xmm_crc_part, src, len); - } - - _mm_storeu_si128((__m128i *)partial_buf, xmm_crc_part); - memcpy(dst, partial_buf, len); - -partial: - partial_fold(len, &xmm_crc0, &xmm_crc1, &xmm_crc2, &xmm_crc3, &xmm_crc_part); -done: - /* CRC_SAVE */ - _mm_storeu_si128((__m128i *)s->crc0 + 0, xmm_crc0); - _mm_storeu_si128((__m128i *)s->crc0 + 1, xmm_crc1); - _mm_storeu_si128((__m128i *)s->crc0 + 2, xmm_crc2); - _mm_storeu_si128((__m128i *)s->crc0 + 3, xmm_crc3); - _mm_storeu_si128((__m128i *)s->crc0 + 4, xmm_crc_part); -} - -static const unsigned ALIGNED_(16) crc_k[] = { - 0xccaa009e, 0x00000000, /* rk1 */ - 0x751997d0, 0x00000001, /* rk2 */ - 0xccaa009e, 0x00000000, /* rk5 */ - 0x63cd6124, 0x00000001, /* rk6 */ - 0xf7011640, 0x00000001, /* rk7 */ - 0xdb710640, 0x00000001 /* rk8 */ -}; - -static const unsigned ALIGNED_(16) crc_mask[4] = { - 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000 -}; - -static const unsigned ALIGNED_(16) crc_mask2[4] = { - 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF -}; - -uint32_t Z_INTERNAL crc_fold_512to32(deflate_state *const s) { - const __m128i xmm_mask = _mm_load_si128((__m128i *)crc_mask); - const __m128i xmm_mask2 = _mm_load_si128((__m128i *)crc_mask2); - - uint32_t crc; - __m128i x_tmp0, x_tmp1, x_tmp2, crc_fold; - - /* CRC_LOAD */ - __m128i xmm_crc0 = _mm_loadu_si128((__m128i *)s->crc0 + 0); - __m128i xmm_crc1 = _mm_loadu_si128((__m128i *)s->crc0 + 1); - __m128i xmm_crc2 = _mm_loadu_si128((__m128i *)s->crc0 + 2); - __m128i xmm_crc3 = _mm_loadu_si128((__m128i *)s->crc0 + 3); - - /* - * k1 - */ - crc_fold = _mm_load_si128((__m128i *)crc_k); - - x_tmp0 = _mm_clmulepi64_si128(xmm_crc0, crc_fold, 0x10); - xmm_crc0 = _mm_clmulepi64_si128(xmm_crc0, crc_fold, 0x01); - xmm_crc1 = _mm_xor_si128(xmm_crc1, x_tmp0); - xmm_crc1 = _mm_xor_si128(xmm_crc1, xmm_crc0); - - x_tmp1 = _mm_clmulepi64_si128(xmm_crc1, crc_fold, 0x10); - xmm_crc1 = _mm_clmulepi64_si128(xmm_crc1, crc_fold, 0x01); - xmm_crc2 = _mm_xor_si128(xmm_crc2, x_tmp1); - xmm_crc2 = _mm_xor_si128(xmm_crc2, xmm_crc1); - - x_tmp2 = _mm_clmulepi64_si128(xmm_crc2, crc_fold, 0x10); - xmm_crc2 = _mm_clmulepi64_si128(xmm_crc2, crc_fold, 0x01); - xmm_crc3 = _mm_xor_si128(xmm_crc3, x_tmp2); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc2); - - /* - * k5 - */ - crc_fold = _mm_load_si128((__m128i *)crc_k + 1); - - xmm_crc0 = xmm_crc3; - xmm_crc3 = _mm_clmulepi64_si128(xmm_crc3, crc_fold, 0); - xmm_crc0 = _mm_srli_si128(xmm_crc0, 8); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc0); - - xmm_crc0 = xmm_crc3; - xmm_crc3 = _mm_slli_si128(xmm_crc3, 4); - xmm_crc3 = _mm_clmulepi64_si128(xmm_crc3, crc_fold, 0x10); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc0); - xmm_crc3 = _mm_and_si128(xmm_crc3, xmm_mask2); - - /* - * k7 - */ - xmm_crc1 = xmm_crc3; - xmm_crc2 = xmm_crc3; - crc_fold = _mm_load_si128((__m128i *)crc_k + 2); - - xmm_crc3 = _mm_clmulepi64_si128(xmm_crc3, crc_fold, 0); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc2); - xmm_crc3 = _mm_and_si128(xmm_crc3, xmm_mask); - - xmm_crc2 = xmm_crc3; - xmm_crc3 = _mm_clmulepi64_si128(xmm_crc3, crc_fold, 0x10); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc2); - xmm_crc3 = _mm_xor_si128(xmm_crc3, xmm_crc1); - - crc = _mm_extract_epi32(xmm_crc3, 2); - return ~crc; -} - -#endif diff --git a/libs/zlibng/arch/x86/crc_folding.h b/libs/zlibng/arch/x86/crc_folding.h deleted file mode 100644 index 0d3c24b29..000000000 --- a/libs/zlibng/arch/x86/crc_folding.h +++ /dev/null @@ -1,19 +0,0 @@ -/* crc_folding.h - * - * Compute the CRC32 using a parallelized folding approach with the PCLMULQDQ - * instruction. - * - * Copyright (C) 2013 Intel Corporation Jim Kukunas - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef CRC_FOLDING_H_ -#define CRC_FOLDING_H_ - -#include "../../deflate.h" - -Z_INTERNAL void crc_fold_init(deflate_state *const); -Z_INTERNAL uint32_t crc_fold_512to32(deflate_state *const); -Z_INTERNAL void crc_fold_copy(deflate_state *const, unsigned char *, const unsigned char *, long); - -#endif diff --git a/libs/zlibng/arch/x86/insert_string_sse.c b/libs/zlibng/arch/x86/insert_string_sse.c deleted file mode 100644 index d0c316b19..000000000 --- a/libs/zlibng/arch/x86/insert_string_sse.c +++ /dev/null @@ -1,46 +0,0 @@ -/* insert_string_sse -- insert_string variant using SSE4.2's CRC instructions - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#include "../../zbuild.h" -#include -#ifdef _MSC_VER -# include -#endif -#include "../../deflate.h" - -#ifdef X86_SSE42_CRC_INTRIN -# ifdef _MSC_VER -# define UPDATE_HASH(s, h, val)\ - h = _mm_crc32_u32(h, val) -# else -# define UPDATE_HASH(s, h, val)\ - h = __builtin_ia32_crc32si(h, val) -# endif -#else -# ifdef _MSC_VER -# define UPDATE_HASH(s, h, val) {\ - __asm mov edx, h\ - __asm mov eax, val\ - __asm crc32 eax, edx\ - __asm mov val, eax\ - } -# else -# define UPDATE_HASH(s, h, val) \ - __asm__ __volatile__ (\ - "crc32 %1,%0\n\t"\ - : "+r" (h)\ - : "r" (val)\ - ); -# endif -#endif - -#define INSERT_STRING insert_string_sse4 -#define QUICK_INSERT_STRING quick_insert_string_sse4 - -#ifdef X86_SSE42_CRC_HASH -# include "../../insert_string_tpl.h" -#endif diff --git a/libs/zlibng/arch/x86/slide_avx.c b/libs/zlibng/arch/x86/slide_avx.c deleted file mode 100644 index be9a9b7ea..000000000 --- a/libs/zlibng/arch/x86/slide_avx.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * AVX2 optimized hash slide, based on Intel's slide_sse implementation - * - * Copyright (C) 2017 Intel Corporation - * Authors: - * Arjan van de Ven - * Jim Kukunas - * Mika T. Lindqvist - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#include "../../zbuild.h" -#include "../../deflate.h" - -#include - -Z_INTERNAL void slide_hash_avx2(deflate_state *s) { - Pos *p; - unsigned n; - uint16_t wsize = (uint16_t)s->w_size; - const __m256i ymm_wsize = _mm256_set1_epi16((short)wsize); - - n = HASH_SIZE; - p = &s->head[n] - 16; - do { - __m256i value, result; - - value = _mm256_loadu_si256((__m256i *)p); - result= _mm256_subs_epu16(value, ymm_wsize); - _mm256_storeu_si256((__m256i *)p, result); - p -= 16; - n -= 16; - } while (n > 0); - - n = wsize; - p = &s->prev[n] - 16; - do { - __m256i value, result; - - value = _mm256_loadu_si256((__m256i *)p); - result= _mm256_subs_epu16(value, ymm_wsize); - _mm256_storeu_si256((__m256i *)p, result); - - p -= 16; - n -= 16; - } while (n > 0); -} diff --git a/libs/zlibng/arch/x86/slide_sse.c b/libs/zlibng/arch/x86/slide_sse.c deleted file mode 100644 index abf447475..000000000 --- a/libs/zlibng/arch/x86/slide_sse.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SSE optimized hash slide - * - * Copyright (C) 2017 Intel Corporation - * Authors: - * Arjan van de Ven - * Jim Kukunas - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#include "../../zbuild.h" -#include "../../deflate.h" - -#include - -Z_INTERNAL void slide_hash_sse2(deflate_state *s) { - Pos *p; - unsigned n; - uint16_t wsize = (uint16_t)s->w_size; - const __m128i xmm_wsize = _mm_set1_epi16((short)wsize); - - n = HASH_SIZE; - p = &s->head[n] - 8; - do { - __m128i value, result; - - value = _mm_loadu_si128((__m128i *)p); - result= _mm_subs_epu16(value, xmm_wsize); - _mm_storeu_si128((__m128i *)p, result); - p -= 8; - n -= 8; - } while (n > 0); - - n = wsize; - p = &s->prev[n] - 8; - do { - __m128i value, result; - - value = _mm_loadu_si128((__m128i *)p); - result= _mm_subs_epu16(value, xmm_wsize); - _mm_storeu_si128((__m128i *)p, result); - - p -= 8; - n -= 8; - } while (n > 0); -} diff --git a/libs/zlibng/arch/x86/x86.c b/libs/zlibng/arch/x86/x86.c deleted file mode 100644 index e782cb8ee..000000000 --- a/libs/zlibng/arch/x86/x86.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * x86 feature check - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Author: - * Jim Kukunas - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "../../zutil.h" - -#ifdef _MSC_VER -# include -#else -// Newer versions of GCC and clang come with cpuid.h -# include -#endif - -Z_INTERNAL int x86_cpu_has_avx2; -Z_INTERNAL int x86_cpu_has_sse2; -Z_INTERNAL int x86_cpu_has_ssse3; -Z_INTERNAL int x86_cpu_has_sse42; -Z_INTERNAL int x86_cpu_has_pclmulqdq; -Z_INTERNAL int x86_cpu_has_tzcnt; - -static void cpuid(int info, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { -#ifdef _MSC_VER - unsigned int registers[4]; - __cpuid((int *)registers, info); - - *eax = registers[0]; - *ebx = registers[1]; - *ecx = registers[2]; - *edx = registers[3]; -#else - __cpuid(info, *eax, *ebx, *ecx, *edx); -#endif -} - -static void cpuidex(int info, int subinfo, unsigned* eax, unsigned* ebx, unsigned* ecx, unsigned* edx) { -#ifdef _MSC_VER - unsigned int registers[4]; - __cpuidex((int *)registers, info, subinfo); - - *eax = registers[0]; - *ebx = registers[1]; - *ecx = registers[2]; - *edx = registers[3]; -#else - __cpuid_count(info, subinfo, *eax, *ebx, *ecx, *edx); -#endif -} - -void Z_INTERNAL x86_check_features(void) { - unsigned eax, ebx, ecx, edx; - unsigned maxbasic; - - cpuid(0, &maxbasic, &ebx, &ecx, &edx); - - cpuid(1 /*CPU_PROCINFO_AND_FEATUREBITS*/, &eax, &ebx, &ecx, &edx); - - x86_cpu_has_sse2 = edx & 0x4000000; - x86_cpu_has_ssse3 = ecx & 0x200; - x86_cpu_has_sse42 = ecx & 0x100000; - x86_cpu_has_pclmulqdq = ecx & 0x2; - - if (maxbasic >= 7) { - cpuidex(7, 0, &eax, &ebx, &ecx, &edx); - - // check BMI1 bit - // Reference: https://software.intel.com/sites/default/files/article/405250/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family.pdf - x86_cpu_has_tzcnt = ebx & 0x8; - // check AVX2 bit - x86_cpu_has_avx2 = ebx & 0x20; - } else { - x86_cpu_has_tzcnt = 0; - x86_cpu_has_avx2 = 0; - } -} diff --git a/libs/zlibng/arch/x86/x86.h b/libs/zlibng/arch/x86/x86.h deleted file mode 100644 index 8471e155c..000000000 --- a/libs/zlibng/arch/x86/x86.h +++ /dev/null @@ -1,18 +0,0 @@ -/* cpu.h -- check for CPU features -* Copyright (C) 2013 Intel Corporation Jim Kukunas -* For conditions of distribution and use, see copyright notice in zlib.h -*/ - -#ifndef CPU_H_ -#define CPU_H_ - -extern int x86_cpu_has_avx2; -extern int x86_cpu_has_sse2; -extern int x86_cpu_has_ssse3; -extern int x86_cpu_has_sse42; -extern int x86_cpu_has_pclmulqdq; -extern int x86_cpu_has_tzcnt; - -void Z_INTERNAL x86_check_features(void); - -#endif /* CPU_H_ */ diff --git a/libs/zlibng/chunkset.c b/libs/zlibng/chunkset.c deleted file mode 100644 index 2aa8d4e47..000000000 --- a/libs/zlibng/chunkset.c +++ /dev/null @@ -1,81 +0,0 @@ -/* chunkset.c -- inline functions to copy small data chunks. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" - -// We need sizeof(chunk_t) to be 8, no matter what. -#if defined(UNALIGNED64_OK) -typedef uint64_t chunk_t; -#elif defined(UNALIGNED_OK) -typedef struct chunk_t { uint32_t u32[2]; } chunk_t; -#else -typedef struct chunk_t { uint8_t u8[8]; } chunk_t; -#endif - -#define HAVE_CHUNKMEMSET_1 -#define HAVE_CHUNKMEMSET_4 -#define HAVE_CHUNKMEMSET_8 - -static inline void chunkmemset_1(uint8_t *from, chunk_t *chunk) { -#if defined(UNALIGNED64_OK) - *chunk = 0x0101010101010101 * (uint8_t)*from; -#elif defined(UNALIGNED_OK) - chunk->u32[0] = 0x01010101 * (uint8_t)*from; - chunk->u32[1] = chunk->u32[0]; -#else - memset(chunk, *from, sizeof(chunk_t)); -#endif -} - -static inline void chunkmemset_4(uint8_t *from, chunk_t *chunk) { -#if defined(UNALIGNED64_OK) - uint32_t half_chunk; - half_chunk = *(uint32_t *)from; - *chunk = 0x0000000100000001 * (uint64_t)half_chunk; -#elif defined(UNALIGNED_OK) - chunk->u32[0] = *(uint32_t *)from; - chunk->u32[1] = chunk->u32[0]; -#else - uint8_t *chunkptr = (uint8_t *)chunk; - memcpy(chunkptr, from, 4); - memcpy(chunkptr+4, from, 4); -#endif -} - -static inline void chunkmemset_8(uint8_t *from, chunk_t *chunk) { -#if defined(UNALIGNED64_OK) - *chunk = *(uint64_t *)from; -#elif defined(UNALIGNED_OK) - uint32_t* p = (uint32_t *)from; - chunk->u32[0] = p[0]; - chunk->u32[1] = p[1]; -#else - memcpy(chunk, from, sizeof(chunk_t)); -#endif -} - -static inline void loadchunk(uint8_t const *s, chunk_t *chunk) { - chunkmemset_8((uint8_t *)s, chunk); -} - -static inline void storechunk(uint8_t *out, chunk_t *chunk) { -#if defined(UNALIGNED64_OK) - *(uint64_t *)out = *chunk; -#elif defined(UNALIGNED_OK) - ((uint32_t *)out)[0] = chunk->u32[0]; - ((uint32_t *)out)[1] = chunk->u32[1]; -#else - memcpy(out, chunk, sizeof(chunk_t)); -#endif -} - -#define CHUNKSIZE chunksize_c -#define CHUNKCOPY chunkcopy_c -#define CHUNKCOPY_SAFE chunkcopy_safe_c -#define CHUNKUNROLL chunkunroll_c -#define CHUNKMEMSET chunkmemset_c -#define CHUNKMEMSET_SAFE chunkmemset_safe_c - -#include "chunkset_tpl.h" diff --git a/libs/zlibng/chunkset_tpl.h b/libs/zlibng/chunkset_tpl.h deleted file mode 100644 index 9e8ede559..000000000 --- a/libs/zlibng/chunkset_tpl.h +++ /dev/null @@ -1,172 +0,0 @@ -/* chunkset_tpl.h -- inline functions to copy small data chunks. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* Returns the chunk size */ -Z_INTERNAL uint32_t CHUNKSIZE(void) { - return sizeof(chunk_t); -} - -/* Behave like memcpy, but assume that it's OK to overwrite at least - chunk_t bytes of output even if the length is shorter than this, - that the length is non-zero, and that `from` lags `out` by at least - sizeof chunk_t bytes (or that they don't overlap at all or simply that - the distance is less than the length of the copy). - - Aside from better memory bus utilisation, this means that short copies - (chunk_t bytes or fewer) will fall straight through the loop - without iteration, which will hopefully make the branch prediction more - reliable. */ -Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { - chunk_t chunk; - --len; - loadchunk(from, &chunk); - storechunk(out, &chunk); - out += (len % sizeof(chunk_t)) + 1; - from += (len % sizeof(chunk_t)) + 1; - len /= sizeof(chunk_t); - while (len > 0) { - loadchunk(from, &chunk); - storechunk(out, &chunk); - out += sizeof(chunk_t); - from += sizeof(chunk_t); - --len; - } - return out; -} - -/* Behave like chunkcopy, but avoid writing beyond of legal output. */ -Z_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { - if ((safe - out) < (ptrdiff_t)sizeof(chunk_t)) { - int32_t use_chunk16 = sizeof(chunk_t) > 16 && (len & 16); - if (use_chunk16) { - memcpy(out, from, 16); - out += 16; - from += 16; - } - if (len & 8) { - memcpy(out, from, 8); - out += 8; - from += 8; - } - if (len & 4) { - memcpy(out, from, 4); - out += 4; - from += 4; - } - if (len & 2) { - memcpy(out, from, 2); - out += 2; - from += 2; - } - if (len & 1) { - *out++ = *from++; - } - return out; - } - return CHUNKCOPY(out, from, len); -} - -/* Perform short copies until distance can be rewritten as being at least - sizeof chunk_t. - - This assumes that it's OK to overwrite at least the first - 2*sizeof(chunk_t) bytes of output even if the copy is shorter than this. - This assumption holds because inflate_fast() starts every iteration with at - least 258 bytes of output space available (258 being the maximum length - output from a single token; see inflate_fast()'s assumptions below). */ -Z_INTERNAL uint8_t* CHUNKUNROLL(uint8_t *out, unsigned *dist, unsigned *len) { - unsigned char const *from = out - *dist; - chunk_t chunk; - while (*dist < *len && *dist < sizeof(chunk_t)) { - loadchunk(from, &chunk); - storechunk(out, &chunk); - out += *dist; - *len -= *dist; - *dist += *dist; - } - return out; -} - -/* Copy DIST bytes from OUT - DIST into OUT + DIST * k, for 0 <= k < LEN/DIST. - Return OUT + LEN. */ -Z_INTERNAL uint8_t* CHUNKMEMSET(uint8_t *out, unsigned dist, unsigned len) { - /* Debug performance related issues when len < sizeof(uint64_t): - Assert(len >= sizeof(uint64_t), "chunkmemset should be called on larger chunks"); */ - Assert(dist > 0, "cannot have a distance 0"); - - unsigned char *from = out - dist; - chunk_t chunk; - unsigned sz = sizeof(chunk); - if (len < sz) { - do { - *out++ = *from++; - --len; - } while (len != 0); - return out; - } - -#ifdef HAVE_CHUNKMEMSET_1 - if (dist == 1) { - chunkmemset_1(from, &chunk); - } else -#endif -#ifdef HAVE_CHUNKMEMSET_2 - if (dist == 2) { - chunkmemset_2(from, &chunk); - } else -#endif -#ifdef HAVE_CHUNKMEMSET_4 - if (dist == 4) { - chunkmemset_4(from, &chunk); - } else -#endif -#ifdef HAVE_CHUNKMEMSET_8 - if (dist == 8) { - chunkmemset_8(from, &chunk); - } else -#endif - if (dist == sz) { - loadchunk(from, &chunk); - } else if (dist < sz) { - unsigned char *end = out + len - 1; - while (len > dist) { - out = CHUNKCOPY_SAFE(out, from, dist, end); - len -= dist; - } - if (len > 0) { - out = CHUNKCOPY_SAFE(out, from, len, end); - } - return out; - } else { - out = CHUNKUNROLL(out, &dist, &len); - return CHUNKCOPY(out, out - dist, len); - } - - unsigned rem = len % sz; - len -= rem; - while (len) { - storechunk(out, &chunk); - out += sz; - len -= sz; - } - - /* Last, deal with the case when LEN is not a multiple of SZ. */ - if (rem) - memcpy(out, from, rem); - out += rem; - - return out; -} - -Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, unsigned left) { - if (left < (unsigned)(3 * sizeof(chunk_t))) { - while (len > 0) { - *out = *(out - dist); - out++; - --len; - } - return out; - } - return CHUNKMEMSET(out, dist, len); -} diff --git a/libs/zlibng/cmake/detect-arch.c b/libs/zlibng/cmake/detect-arch.c deleted file mode 100644 index 571553582..000000000 --- a/libs/zlibng/cmake/detect-arch.c +++ /dev/null @@ -1,99 +0,0 @@ -// archdetect.c -- Detect compiler architecture and raise preprocessor error -// containing a simple arch identifier. -// Copyright (C) 2019 Hans Kristian Rosbach -// Licensed under the Zlib license, see LICENSE.md for details - -// x86_64 -#if defined(__x86_64__) || defined(_M_X64) - #error archfound x86_64 - -// x86 -#elif defined(__i386) || defined(_M_IX86) - #error archfound i686 - -// ARM -#elif defined(__aarch64__) || defined(_M_ARM64) - #error archfound aarch64 -#elif defined(__arm__) || defined(__arm) || defined(_M_ARM) || defined(__TARGET_ARCH_ARM) - #if defined(__ARM64_ARCH_8__) || defined(__ARMv8__) || defined(__ARMv8_A__) - #error archfound armv8 - #elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) - #error archfound armv7 - #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6M__) - #error archfound armv6 - #elif defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) - #error archfound armv5 - #elif defined(__ARM_ARCH_4T__) || defined(__TARGET_ARCH_5E__) - #error archfound armv4 - #elif defined(__ARM_ARCH_3__) || defined(__TARGET_ARCH_3M__) - #error archfound armv3 - #elif defined(__ARM_ARCH_2__) - #error archfound armv2 - #endif - -// PowerPC -#elif defined(__powerpc__) || defined(_ppc__) || defined(__PPC__) - #if defined(__64BIT__) || defined(__powerpc64__) || defined(__ppc64__) - #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - #error archfound powerpc64le - #else - #error archfound powerpc64 - #endif - #else - #error archfound powerpc - #endif - -// --------------- Less common architectures alphabetically below --------------- - -// ALPHA -#elif defined(__alpha__) || defined(__alpha) - #error archfound alpha - -// Blackfin -#elif defined(__BFIN__) - #error archfound blackfin - -// Itanium -#elif defined(__ia64) || defined(_M_IA64) - #error archfound ia64 - -// MIPS -#elif defined(__mips__) || defined(__mips) - #error archfound mips - -// Motorola 68000-series -#elif defined(__m68k__) - #error archfound m68k - -// SuperH -#elif defined(__sh__) - #error archfound sh - -// SPARC -#elif defined(__sparc__) || defined(__sparc) - #if defined(__sparcv9) || defined(__sparc_v9__) - #error archfound sparc9 - #elif defined(__sparcv8) || defined(__sparc_v8__) - #error archfound sparc8 - #endif - -// SystemZ -#elif defined(__370__) - #error archfound s370 -#elif defined(__s390__) - #error archfound s390 -#elif defined(__s390x) || defined(__zarch__) - #error archfound s390x - -// PARISC -#elif defined(__hppa__) - #error archfound parisc - -// RS-6000 -#elif defined(__THW_RS6000) - #error archfound rs6000 - -// return 'unrecognized' if we do not know what architecture this is -#else - #error archfound unrecognized -#endif diff --git a/libs/zlibng/cmake/detect-arch.cmake b/libs/zlibng/cmake/detect-arch.cmake deleted file mode 100644 index b80d6666f..000000000 --- a/libs/zlibng/cmake/detect-arch.cmake +++ /dev/null @@ -1,93 +0,0 @@ -# detect-arch.cmake -- Detect compiler architecture and set ARCH and BASEARCH -# Copyright (C) 2019 Hans Kristian Rosbach -# Licensed under the Zlib license, see LICENSE.md for details -set(ARCHDETECT_FOUND TRUE) - -if(CMAKE_OSX_ARCHITECTURES) - # If multiple architectures are requested (universal build), pick only the first - list(GET CMAKE_OSX_ARCHITECTURES 0 ARCH) -elseif(MSVC) - if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86") - set(ARCH "i686") - elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64") - set(ARCH "x86_64") - elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM" OR "${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARMV7") - set(ARCH "arm") - elseif ("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64") - set(ARCH "aarch64") - endif() -elseif(CMAKE_CROSSCOMPILING) - set(ARCH ${CMAKE_C_COMPILER_TARGET}) -else() - # Let preprocessor parse archdetect.c and raise an error containing the arch identifier - enable_language(C) - try_run( - run_result_unused - compile_result_unused - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect-arch.c - COMPILE_OUTPUT_VARIABLE RAWOUTPUT - CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} - ) - - # Find basearch tag, and extract the arch word into BASEARCH variable - string(REGEX REPLACE ".*archfound ([a-zA-Z0-9_]+).*" "\\1" ARCH "${RAWOUTPUT}") - if(NOT ARCH) - set(ARCH unknown) - endif() -endif() - -# Make sure we have ARCH set -if(NOT ARCH OR ARCH STREQUAL "unknown") - set(ARCH ${CMAKE_SYSTEM_PROCESSOR}) - message(STATUS "Arch not recognized, falling back to cmake arch: '${ARCH}'") -else() - message(STATUS "Arch detected: '${ARCH}'") -endif() - -# Base arch detection -if("${ARCH}" MATCHES "(x86_64|AMD64|i[3-6]86)") - set(BASEARCH "x86") - set(BASEARCH_X86_FOUND TRUE) -elseif("${ARCH}" MATCHES "(arm(v[0-9])?|aarch64)") - set(BASEARCH "arm") - set(BASEARCH_ARM_FOUND TRUE) -elseif("${ARCH}" MATCHES "ppc(64(le)?)?|powerpc(64(le)?)?") - set(BASEARCH "ppc") - set(BASEARCH_PPC_FOUND TRUE) -elseif("${ARCH}" MATCHES "alpha") - set(BASEARCH "alpha") - set(BASEARCH_ALPHA_FOUND TRUE) -elseif("${ARCH}" MATCHES "blackfin") - set(BASEARCH "blackfin") - set(BASEARCH_BLACKFIN_FOUND TRUE) -elseif("${ARCH}" MATCHES "ia64") - set(BASEARCH "ia64") - set(BASEARCH_IA64_FOUND TRUE) -elseif("${ARCH}" MATCHES "mips") - set(BASEARCH "mips") - set(BASEARCH_MIPS_FOUND TRUE) -elseif("${ARCH}" MATCHES "m68k") - set(BASEARCH "m68k") - set(BASEARCH_M68K_FOUND TRUE) -elseif("${ARCH}" MATCHES "sh") - set(BASEARCH "sh") - set(BASEARCH_SH_FOUND TRUE) -elseif("${ARCH}" MATCHES "sparc[89]?") - set(BASEARCH "sparc") - set(BASEARCH_SPARC_FOUND TRUE) -elseif("${ARCH}" MATCHES "s3[679]0x?") - set(BASEARCH "s360") - set(BASEARCH_S360_FOUND TRUE) -elseif("${ARCH}" MATCHES "parisc") - set(BASEARCH "parisc") - set(BASEARCH_PARISC_FOUND TRUE) -elseif("${ARCH}" MATCHES "rs6000") - set(BASEARCH "rs6000") - set(BASEARCH_RS6000_FOUND TRUE) -else() - set(BASEARCH "x86") - set(BASEARCH_X86_FOUND TRUE) - message(STATUS "Basearch '${ARCH}' not recognized, defaulting to 'x86'.") -endif() -message(STATUS "Basearch of '${ARCH}' has been detected as: '${BASEARCH}'") diff --git a/libs/zlibng/cmake/detect-sanitizer.cmake b/libs/zlibng/cmake/detect-sanitizer.cmake deleted file mode 100644 index 172a8d558..000000000 --- a/libs/zlibng/cmake/detect-sanitizer.cmake +++ /dev/null @@ -1,123 +0,0 @@ -# detect-sanitizer.cmake -- Detect supported compiler sanitizer flags -# Licensed under the Zlib license, see LICENSE.md for details - -macro(check_sanitizer_support known_checks supported_checks) - set(available_checks "") - - # Build list of supported sanitizer flags by incrementally trying compilation with - # known sanitizer checks - - foreach(check ${known_checks}) - if(available_checks STREQUAL "") - set(compile_checks "${check}") - else() - set(compile_checks "${available_checks},${check}") - endif() - - set(CMAKE_REQUIRED_FLAGS "-fsanitize=${compile_checks}") - - check_c_source_compiles("int main() { return 0; }" HAS_SANITIZER_${check} - FAIL_REGEX "not supported|unrecognized command|unknown option") - - set(CMAKE_REQUIRED_FLAGS) - - if(HAS_SANITIZER_${check}) - set(available_checks ${compile_checks}) - endif() - endforeach() - - set(${supported_checks} ${available_checks}) -endmacro() - -macro(add_address_sanitizer) - set(known_checks - address - pointer-compare - pointer-subtract - ) - - check_sanitizer_support("${known_checks}" supported_checks) - if(NOT ${supported_checks} STREQUAL "") - message(STATUS "Address sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") - else() - message(STATUS "Address sanitizer is not supported") - endif() - - if(CMAKE_CROSSCOMPILING_EMULATOR) - # Only check for leak sanitizer if not cross-compiling due to qemu crash - message(WARNING "Leak sanitizer is not supported when cross compiling") - else() - # Leak sanitizer requires address sanitizer - check_sanitizer_support("leak" supported_checks) - if(NOT ${supported_checks} STREQUAL "") - message(STATUS "Leak sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") - else() - message(STATUS "Leak sanitizer is not supported") - endif() - endif() -endmacro() - -macro(add_memory_sanitizer) - check_sanitizer_support("memory" supported_checks) - if(NOT ${supported_checks} STREQUAL "") - message(STATUS "Memory sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") - else() - message(STATUS "Memory sanitizer is not supported") - endif() -endmacro() - -macro(add_undefined_sanitizer) - set(known_checks - array-bounds - bool - bounds - builtin - enum - float-cast-overflow - float-divide-by-zero - function - integer-divide-by-zero - local-bounds - null - nonnull-attribute - pointer-overflow - return - returns-nonnull-attribute - shift - shift-base - shift-exponent - signed-integer-overflow - undefined - unsigned-integer-overflow - unsigned-shift-base - vla-bound - vptr - ) - - # Only check for alignment sanitizer flag if unaligned access is not supported - if(NOT UNALIGNED_OK) - list(APPEND known_checks alignment) - endif() - # Object size sanitizer has no effect at -O0 and produces compiler warning if enabled - if(NOT CMAKE_C_FLAGS MATCHES "-O0") - list(APPEND known_checks object-size) - endif() - - check_sanitizer_support("${known_checks}" supported_checks) - - if(NOT ${supported_checks} STREQUAL "") - message(STATUS "Undefined behavior sanitizer is enabled: ${supported_checks}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}") - - # Group sanitizer flag -fsanitize=undefined will automatically add alignment, even if - # it is not in our sanitize flag list, so we need to explicitly disable alignment sanitizing. - if(UNALIGNED_OK) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize=alignment") - endif() - else() - message(STATUS "UNdefined behavior sanitizer is not supported") - endif() -endmacro() \ No newline at end of file diff --git a/libs/zlibng/cmake/run-and-compare.cmake b/libs/zlibng/cmake/run-and-compare.cmake deleted file mode 100644 index 0e9343373..000000000 --- a/libs/zlibng/cmake/run-and-compare.cmake +++ /dev/null @@ -1,48 +0,0 @@ -if(NOT DEFINED OUTPUT OR NOT DEFINED COMPARE OR NOT DEFINED COMMAND) - message(FATAL_ERROR "Run and compare arguments missing") -endif() - -if(INPUT) - # Run command with stdin input and redirect stdout to output - execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${COMMAND}" - -DINPUT=${INPUT} - -DOUTPUT=${OUTPUT} - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) -else() - # Run command and redirect stdout to output - execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${COMMAND}" - -DOUTPUT=${OUTPUT} - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) -endif() - -if(CMD_RESULT) - message(FATAL_ERROR "Run before compare failed: ${CMD_RESULT}") -endif() - -# Use configure_file to normalize line-endings -if(IGNORE_LINE_ENDINGS) - configure_file(${COMPARE} ${COMPARE}.cmp NEWLINE_STYLE LF) - set(COMPARE ${COMPARE}.cmp) - configure_file(${OUTPUT} ${OUTPUT}.cmp NEWLINE_STYLE LF) - set(OUTPUT ${OUTPUT}.cmp) -endif() - -# Compare that output is equal to specified file -execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${COMPARE} ${OUTPUT} - RESULT_VARIABLE CMD_RESULT) - -# Delete temporary files used to normalize line-endings -if(IGNORE_LINE_ENDINGS) - file(REMOVE ${COMPARE} ${OUTPUT}) -endif() - -if(CMD_RESULT) - message(FATAL_ERROR "Run compare failed: ${CMD_RESULT}") -endif() \ No newline at end of file diff --git a/libs/zlibng/cmake/run-and-redirect.cmake b/libs/zlibng/cmake/run-and-redirect.cmake deleted file mode 100644 index 30c574112..000000000 --- a/libs/zlibng/cmake/run-and-redirect.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# If no output is specified, discard output -if(NOT DEFINED OUTPUT) - if(WIN32) - set(OUTPUT NUL) - else() - set(OUTPUT /dev/null) - endif() -endif() - -if(INPUT) - # Check to see that input file exists - if(NOT EXISTS ${INPUT}) - message(FATAL_ERROR "Cannot find input: ${INPUT}") - endif() - # Execute with both stdin and stdout file - execute_process(COMMAND ${COMMAND} - RESULT_VARIABLE CMD_RESULT - INPUT_FILE ${INPUT} - OUTPUT_FILE ${OUTPUT}) -else() - # Execute with only stdout file - execute_process(COMMAND ${COMMAND} - RESULT_VARIABLE CMD_RESULT - OUTPUT_FILE ${OUTPUT}) -endif() - -# Check if exit code is in list of successful exit codes -if(SUCCESS_EXIT) - list(FIND SUCCESS_EXIT ${CMD_RESULT} _INDEX) - if (${_INDEX} GREATER -1) - set(CMD_RESULT 0) - endif() -endif() - -# Check to see if successful -if(CMD_RESULT) - message(FATAL_ERROR "${COMMAND} failed: ${CMD_RESULT}") -endif() diff --git a/libs/zlibng/cmake/test-compress.cmake b/libs/zlibng/cmake/test-compress.cmake deleted file mode 100644 index 75355bc73..000000000 --- a/libs/zlibng/cmake/test-compress.cmake +++ /dev/null @@ -1,188 +0,0 @@ -if(TARGET) - set(COMPRESS_TARGET ${TARGET}) - set(DECOMPRESS_TARGET ${TARGET}) -endif() - -if(NOT DEFINED INPUT OR NOT DEFINED COMPRESS_TARGET OR NOT DEFINED DECOMPRESS_TARGET) - message(FATAL_ERROR "Compress test arguments missing") -endif() - -# Set default values -if(NOT DEFINED COMPARE) - set(COMPARE ON) -endif() -if(NOT DEFINED COMPRESS_ARGS) - set(COMPRESS_ARGS -c -k) -endif() -if(NOT DEFINED DECOMPRESS_ARGS) - set(DECOMPRESS_ARGS -d -c) -endif() -if(NOT DEFINED GZIP_VERIFY) - set(GZIP_VERIFY ON) -endif() -if(NOT DEFINED SUCCESS_EXIT) - set(SUCCESS_EXIT 0) -endif() - -# Generate unique output path so multiple tests can be executed at the same time -if(NOT OUTPUT) - # Output name based on input and unique id - string(RANDOM UNIQUE_ID) - set(OUTPUT ${INPUT}-${UNIQUE_ID}) -else() - # Output name appends unique id in case multiple tests with same output name - string(RANDOM LENGTH 6 UNIQUE_ID) - set(OUTPUT ${OUTPUT}-${UNIQUE_ID}) -endif() -string(REPLACE ".gz" "" OUTPUT "${OUTPUT}") - -macro(cleanup) - # Cleanup temporary mingizip files - file(REMOVE ${OUTPUT}.gz ${OUTPUT}.out) - # Cleanup temporary gzip files - file(REMOVE ${OUTPUT}.gzip.gz ${OUTPUT}.gzip.out) -endmacro() - -# Compress input file -if(NOT EXISTS ${INPUT}) - message(FATAL_ERROR "Cannot find compress input: ${INPUT}") -endif() - -set(COMPRESS_COMMAND ${COMPRESS_TARGET} ${COMPRESS_ARGS}) - -execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${COMPRESS_COMMAND}" - -DINPUT=${INPUT} - -DOUTPUT=${OUTPUT}.gz - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) - -if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Compress failed: ${CMD_RESULT}") -endif() - -# Decompress output -if(NOT EXISTS ${OUTPUT}.gz) - cleanup() - message(FATAL_ERROR "Cannot find decompress input: ${OUTPUT}.gz") -endif() - -set(DECOMPRESS_COMMAND ${DECOMPRESS_TARGET} ${DECOMPRESS_ARGS}) - -execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${DECOMPRESS_COMMAND}" - -DINPUT=${OUTPUT}.gz - -DOUTPUT=${OUTPUT}.out - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) - -if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Decompress failed: ${CMD_RESULT}") -endif() - -if(COMPARE) - # Compare decompressed output with original input file - execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${INPUT} ${OUTPUT}.out - RESULT_VARIABLE CMD_RESULT) - - if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Compare minigzip decompress failed: ${CMD_RESULT}") - endif() -endif() - -if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T") - # Transparent writing does not use gzip format - find_program(GZIP gzip) - if(GZIP) - if(NOT EXISTS ${OUTPUT}.gz) - cleanup() - message(FATAL_ERROR "Cannot find gzip decompress input: ${OUTPUT}.gz") - endif() - - # Check gzip can decompress our compressed output - set(GZ_DECOMPRESS_COMMAND ${GZIP} --decompress) - - execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${GZ_DECOMPRESS_COMMAND}" - -DINPUT=${OUTPUT}.gz - -DOUTPUT=${OUTPUT}.gzip.out - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) - - if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Gzip decompress failed: ${CMD_RESULT}") - endif() - - # Compare gzip output with original input file - execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${INPUT} ${OUTPUT}.gzip.out - RESULT_VARIABLE CMD_RESULT) - - if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Compare gzip decompress failed: ${CMD_RESULT}") - endif() - - if(NOT EXISTS ${OUTPUT}.gz) - cleanup() - message(FATAL_ERROR "Cannot find gzip compress input: ${INPUT}") - endif() - - # Compress input file with gzip - set(GZ_COMPRESS_COMMAND ${GZIP} --stdout) - - execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${GZ_COMPRESS_COMMAND}" - -DINPUT=${INPUT} - -DOUTPUT=${OUTPUT}.gzip.gz - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) - - if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Gzip compress failed: ${CMD_RESULT}") - endif() - - if(NOT EXISTS ${OUTPUT}.gz) - cleanup() - message(FATAL_ERROR "Cannot find minigzip decompress input: ${OUTPUT}.gzip.gz") - endif() - - # Check minigzip can decompress gzip compressed output - execute_process(COMMAND ${CMAKE_COMMAND} - "-DCOMMAND=${DECOMPRESS_COMMAND}" - -DINPUT=${OUTPUT}.gzip.gz - -DOUTPUT=${OUTPUT}.gzip.out - "-DSUCCESS_EXIT=${SUCCESS_EXIT}" - -P ${CMAKE_CURRENT_LIST_DIR}/run-and-redirect.cmake - RESULT_VARIABLE CMD_RESULT) - - if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Minigzip decompress gzip failed: ${CMD_RESULT}") - endif() - - if(COMPARE) - # Compare original input file with gzip decompressed output - execute_process(COMMAND ${CMAKE_COMMAND} - -E compare_files ${INPUT} ${OUTPUT}.gzip.out - RESULT_VARIABLE CMD_RESULT) - - if(CMD_RESULT) - cleanup() - message(FATAL_ERROR "Compare minigzip decompress gzip failed: ${CMD_RESULT}") - endif() - endif() - endif() -endif() - -cleanup() \ No newline at end of file diff --git a/libs/zlibng/cmake/toolchain-aarch64.cmake b/libs/zlibng/cmake/toolchain-aarch64.cmake deleted file mode 100644 index 31894fdcd..000000000 --- a/libs/zlibng/cmake/toolchain-aarch64.cmake +++ /dev/null @@ -1,26 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR aarch64) -set(CMAKE_SYSTEM_VERSION 1) - -message(STATUS "Using cross-compile toolchain: ${CROSS_COMPILE_TOOLCHAIN}") - -set(CMAKE_C_COMPILER_TARGET "aarch64-linux-gnu") -set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/cmake/toolchain-arm.cmake b/libs/zlibng/cmake/toolchain-arm.cmake deleted file mode 100644 index 0e3c5c377..000000000 --- a/libs/zlibng/cmake/toolchain-arm.cmake +++ /dev/null @@ -1,24 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR arm) -set(CMAKE_SYSTEM_VERSION 1) - -message(STATUS "Using cross-compile toolchain: ${CMAKE_C_COMPILER_TARGET}") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/cmake/toolchain-mingw-i686.cmake b/libs/zlibng/cmake/toolchain-mingw-i686.cmake deleted file mode 100644 index 588ec0ef9..000000000 --- a/libs/zlibng/cmake/toolchain-mingw-i686.cmake +++ /dev/null @@ -1,16 +0,0 @@ -set(CMAKE_SYSTEM_NAME Windows) - -set(CMAKE_C_COMPILER_TARGET i686) -set(CMAKE_CXX_COMPILER_TARGET i686) - -set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) -set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) -set(CMAKE_RC_COMPILER i686-w64-mingw32-windres) - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR wine) - -set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/libs/zlibng/cmake/toolchain-mingw-x86_64.cmake b/libs/zlibng/cmake/toolchain-mingw-x86_64.cmake deleted file mode 100644 index c778b7222..000000000 --- a/libs/zlibng/cmake/toolchain-mingw-x86_64.cmake +++ /dev/null @@ -1,16 +0,0 @@ -set(CMAKE_SYSTEM_NAME Windows) - -set(CMAKE_C_COMPILER_TARGET x86_64) -set(CMAKE_CXX_COMPILER_TARGET x86_64) - -set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) -set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) -set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR wine) - -set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/libs/zlibng/cmake/toolchain-powerpc.cmake b/libs/zlibng/cmake/toolchain-powerpc.cmake deleted file mode 100644 index 4f7f8e92f..000000000 --- a/libs/zlibng/cmake/toolchain-powerpc.cmake +++ /dev/null @@ -1,25 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR powerpc) -set(CMAKE_SYSTEM_VERSION 1) - -set(CMAKE_C_COMPILER_TARGET "powerpc-linux-gnu") -set(CMAKE_CXX_COMPILER_TARGET "powerpc-linux-gnu") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/cmake/toolchain-powerpc64.cmake b/libs/zlibng/cmake/toolchain-powerpc64.cmake deleted file mode 100644 index 4be3bbd59..000000000 --- a/libs/zlibng/cmake/toolchain-powerpc64.cmake +++ /dev/null @@ -1,25 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR ppc64) -set(CMAKE_SYSTEM_VERSION 1) - -set(CMAKE_C_COMPILER_TARGET "powerpc64-linux-gnu") -set(CMAKE_CXX_COMPILER_TARGET "powerpc64-linux-gnu") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/cmake/toolchain-powerpc64le.cmake b/libs/zlibng/cmake/toolchain-powerpc64le.cmake deleted file mode 100644 index 5535f616f..000000000 --- a/libs/zlibng/cmake/toolchain-powerpc64le.cmake +++ /dev/null @@ -1,25 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR ppc64le) -set(CMAKE_SYSTEM_VERSION 1) - -set(CMAKE_C_COMPILER_TARGET "powerpc64le-linux-gnu") -set(CMAKE_CXX_COMPILER_TARGET "powerpc64le-linux-gnu") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64le -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/cmake/toolchain-s390x.cmake b/libs/zlibng/cmake/toolchain-s390x.cmake deleted file mode 100644 index 41bc0d101..000000000 --- a/libs/zlibng/cmake/toolchain-s390x.cmake +++ /dev/null @@ -1,25 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR s390x) -set(CMAKE_SYSTEM_VERSION 1) - -set(CMAKE_C_COMPILER_TARGET "s390x-linux-gnu") -set(CMAKE_CXX_COMPILER_TARGET "s390x-linux-gnu") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-s390x -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/cmake/toolchain-sparc64.cmake b/libs/zlibng/cmake/toolchain-sparc64.cmake deleted file mode 100644 index f0cd99565..000000000 --- a/libs/zlibng/cmake/toolchain-sparc64.cmake +++ /dev/null @@ -1,25 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR sparc64) -set(CMAKE_SYSTEM_VERSION 1) - -set(CMAKE_C_COMPILER_TARGET "sparc64-linux-gnu") -set(CMAKE_CXX_COMPILER_TARGET "sparc64-linux-gnu") - -set(CMAKE_CROSSCOMPILING TRUE) -set(CMAKE_CROSSCOMPILING_EMULATOR qemu-sparc64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) - -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) - -find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) -if(NOT C_COMPILER_FULL_PATH) - message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") -endif() -set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) - -find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) -if(CXX_COMPILER_FULL_PATH) - set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) -endif() diff --git a/libs/zlibng/compare258.c b/libs/zlibng/compare258.c deleted file mode 100644 index bc41638ae..000000000 --- a/libs/zlibng/compare258.c +++ /dev/null @@ -1,186 +0,0 @@ -/* compare258.c -- aligned and unaligned versions of compare258 - * Copyright (C) 2020 Nathan Moinvaziri - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" - -#include "fallback_builtins.h" - -/* ALIGNED, byte comparison */ -static inline uint32_t compare256_c_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - if (*src0 != *src1) - return len + (*src0 == *src1); - src0 += 1, src1 += 1, len += 1; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_c_static(const unsigned char *src0, const unsigned char *src1) { - if (*src0 != *src1) - return 0; - src0 += 1, src1 += 1; - if (*src0 != *src1) - return 1; - src0 += 1, src1 += 1; - - return compare256_c_static(src0, src1) + 2; -} - -Z_INTERNAL uint32_t compare258_c(const unsigned char *src0, const unsigned char *src1) { - return compare258_c_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_c -#define COMPARE256 compare256_c_static -#define COMPARE258 compare258_c_static - -#include "match_tpl.h" - -#ifdef UNALIGNED_OK -/* UNALIGNED_OK, 16-bit integer comparison */ -static inline uint32_t compare256_unaligned_16_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return len + (*src0 == *src1); - src0 += 2, src1 += 2, len += 2; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_16_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_16_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_16_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_16 -#define COMPARE256 compare256_unaligned_16_static -#define COMPARE258 compare258_unaligned_16_static - -#include "match_tpl.h" - -#ifdef HAVE_BUILTIN_CTZ -/* UNALIGNED_OK, 32-bit integer comparison */ -static inline uint32_t compare256_unaligned_32_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - uint32_t sv = *(uint32_t *)src0; - uint32_t mv = *(uint32_t *)src1; - uint32_t diff = sv ^ mv; - - if (diff) { - uint32_t match_byte = __builtin_ctz(diff) / 8; - return len + match_byte; - } - - src0 += 4, src1 += 4, len += 4; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_32_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_32_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_32_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_32 -#define COMPARE256 compare256_unaligned_32_static -#define COMPARE258 compare258_unaligned_32_static - -#include "match_tpl.h" - -#endif - -#if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) -/* UNALIGNED64_OK, 64-bit integer comparison */ -static inline uint32_t compare256_unaligned_64_static(const unsigned char *src0, const unsigned char *src1) { - uint32_t len = 0; - - do { - uint64_t sv = *(uint64_t *)src0; - uint64_t mv = *(uint64_t *)src1; - uint64_t diff = sv ^ mv; - - if (diff) { - uint64_t match_byte = __builtin_ctzll(diff) / 8; - return len + (uint32_t)match_byte; - } - - src0 += 8, src1 += 8, len += 8; - } while (len < 256); - - return 256; -} - -static inline uint32_t compare258_unaligned_64_static(const unsigned char *src0, const unsigned char *src1) { - if (*(uint16_t *)src0 != *(uint16_t *)src1) - return (*src0 == *src1); - - return compare256_unaligned_64_static(src0+2, src1+2) + 2; -} - -Z_INTERNAL uint32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1) { - return compare258_unaligned_64_static(src0, src1); -} - -#define LONGEST_MATCH longest_match_unaligned_64 -#define COMPARE256 compare256_unaligned_64_static -#define COMPARE258 compare258_unaligned_64_static - -#include "match_tpl.h" - -#endif - -#endif diff --git a/libs/zlibng/compress.c b/libs/zlibng/compress.c deleted file mode 100644 index d5379591d..000000000 --- a/libs/zlibng/compress.c +++ /dev/null @@ -1,83 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#define ZLIB_INTERNAL -#include "zbuild.h" -#if defined(ZLIB_COMPAT) -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int Z_EXPORT PREFIX(compress2)(unsigned char *dest, z_size_t *destLen, const unsigned char *source, - z_size_t sourceLen, int level) { - PREFIX3(stream) stream; - int err; - const unsigned int max = (unsigned int)-1; - z_size_t left; - - left = *destLen; - *destLen = 0; - - stream.zalloc = NULL; - stream.zfree = NULL; - stream.opaque = NULL; - - err = PREFIX(deflateInit)(&stream, level); - if (err != Z_OK) - return err; - - stream.next_out = dest; - stream.avail_out = 0; - stream.next_in = (z_const unsigned char *)source; - stream.avail_in = 0; - - do { - if (stream.avail_out == 0) { - stream.avail_out = left > (unsigned long)max ? max : (unsigned int)left; - left -= stream.avail_out; - } - if (stream.avail_in == 0) { - stream.avail_in = sourceLen > (unsigned long)max ? max : (unsigned int)sourceLen; - sourceLen -= stream.avail_in; - } - err = PREFIX(deflate)(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); - } while (err == Z_OK); - - *destLen = (z_size_t)stream.total_out; - PREFIX(deflateEnd)(&stream); - return err == Z_STREAM_END ? Z_OK : err; -} - -/* =========================================================================== - */ -int Z_EXPORT PREFIX(compress)(unsigned char *dest, z_size_t *destLen, const unsigned char *source, z_size_t sourceLen) { - return PREFIX(compress2)(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -z_size_t Z_EXPORT PREFIX(compressBound)(z_size_t sourceLen) { -#ifndef NO_QUICK_STRATEGY - /* Quick deflate strategy worse case is 9 bits per literal, rounded to nearest byte, - plus the size of block & gzip headers and footers */ - return sourceLen + ((sourceLen + 13 + 7) >> 3) + 18; -#else - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13; -#endif -} diff --git a/libs/zlibng/configure b/libs/zlibng/configure deleted file mode 100644 index 171a76876..000000000 --- a/libs/zlibng/configure +++ /dev/null @@ -1,1725 +0,0 @@ -#!/usr/bin/env bash -# configure script for zlib. -# -# Normally configure builds both a static and a shared library. -# If you want to build just a static library, use: ./configure --static -# -# To impose specific compiler or flags or install directory, use for example: -# prefix=$HOME CC=cc CFLAGS="-O4" ./configure -# or for csh/tcsh users: -# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) - -# Incorrect settings of CC or CFLAGS may prevent creating a shared library. -# If you have problems, try without defining CC and CFLAGS before reporting -# an error. - -# start off configure.log -echo -------------------- >> configure.log -echo $0 $* >> configure.log -date >> configure.log - -SRCDIR=$(cd $(dirname $0); pwd) -BUILDDIR=$(pwd) - -# set command prefix for cross-compilation -if [ -n "${CHOST}" ]; then - # normalize the chost before parsing it - NORM_CHOST=$(sh "$SRCDIR"/tools/config.sub $CHOST) - uname="$(echo "${NORM_CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/')" - CROSS_PREFIX="${CHOST}-" - ARCH="$(echo "${NORM_CHOST}" | sed -e 's/-.*//')" -else - ARCH="`uname -m`" -fi - -case "${ARCH}" in - x86_64) - case "${CFLAGS}" in - *-m32*) - ARCH=i686 - ;; - esac - ;; - i386 | i486 | i586 | i686) - case "${CFLAGS}" in - *-m64*) - ARCH=x86_64 - ;; - esac - ;; -esac - -# destination name for windows import library -IMPORTLIB= - -# establish commands for library building -if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then - AR=${AR-"${CROSS_PREFIX}ar"} - test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log -else - AR=${AR-"ar"} - test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log -fi -ARFLAGS=${ARFLAGS-"rc"} -if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then - RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} - test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log -else - RANLIB=${RANLIB-"ranlib"} -fi - -# set defaults before processing command line options -LDCONFIG=${LDCONFIG-"ldconfig"} -LDFLAGS=${LDFLAGS} -LDSHAREDLIBC="${LDSHAREDLIBC}" -DEFFILE= -RC= -RCFLAGS= -RCOBJS= -STRIP= -ARCHS= -prefix=${prefix-/usr/local} -exec_prefix=${exec_prefix-'${prefix}'} -bindir=${bindir-'${exec_prefix}/bin'} -libdir=${libdir-'${exec_prefix}/lib'} -sharedlibdir=${sharedlibdir-'${libdir}'} -includedir=${includedir-'${prefix}/include'} -mandir=${mandir-'${prefix}/share/man'} -shared_ext='.so' -shared=1 -gzfileops=1 -compat=0 -cover=0 -build32=0 -build64=0 -buildacle=1 -buildneon=1 -builddfltccdeflate=0 -builddfltccinflate=0 -with_sanitizer="" -with_fuzzers=0 -floatabi= -native=0 -forcesse2=0 -avx2flag="-mavx2" -sse2flag="-msse2" -ssse3flag="-mssse3" -sse4flag="-msse4" -sse42flag="-msse4.2" -pclmulflag="-mpclmul" -acleflag= -neonflag= -without_optimizations=0 -without_new_strategies=0 -gcc=0 -warn=0 -debug=0 -old_cc="$CC" -old_cflags="$CFLAGS" -OBJC='$(OBJZ)' -PIC_OBJC='$(PIC_OBJZ)' -INSTALLTARGETS="install-shared install-static" -UNINSTALLTARGETS="uninstall-shared uninstall-static" - -TEST="teststatic" - -# leave this script, optionally in a bad way -leave() -{ - if test "$*" != "0"; then - echo "** $0 aborting." | tee -a configure.log - fi - rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version - echo -------------------- >> configure.log - echo >> configure.log - echo >> configure.log - exit $1 -} - -# process command line options -while test $# -ge 1 -do -case "$1" in - -h* | --help) - echo 'usage:' | tee -a configure.log - echo ' configure [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log - echo ' [--static] [--32] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log - echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log - echo ' [--warn] Enables extra compiler warnings' | tee -a configure.log - echo ' [--debug] Enables extra debug prints during operation' | tee -a configure.log - echo ' [--zlib-compat] Compiles for zlib-compatible API instead of zlib-ng API' | tee -a configure.log - echo ' [--without-gzfileops] Compiles with the gzfile parts of the API enabled' | tee -a configure.log - echo ' [--without-optimizations] Compiles without support for optional instruction sets' | tee -a configure.log - echo ' [--without-new-strategies] Compiles without using new additional deflate strategies' | tee -a configure.log - echo ' [--without-acle] Compiles without ARM C Language Extensions' | tee -a configure.log - echo ' [--without-neon] Compiles without ARM Neon SIMD instruction set' | tee -a configure.log - echo ' [--with-dfltcc-deflate] Use DEFLATE CONVERSION CALL instruction for compression on IBM Z' | tee -a configure.log - echo ' [--with-dfltcc-inflate] Use DEFLATE CONVERSION CALL instruction for decompression on IBM Z' | tee -a configure.log - echo ' [--force-sse2] Assume SSE2 instructions are always available (disabled by default on x86, enabled on x86_64)' | tee -a configure.log - echo ' [--with-sanitizer] Build with sanitizer (memory, address, undefined)' | tee -a configure.log - echo ' [--with-fuzzers] Build test/fuzz (disabled by default)' | tee -a configure.log - echo ' [--native] Compiles with full instruction set supported on this host' | tee -a configure.log - exit 0 ;; - -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; - --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; - -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; - -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; - -p* | --prefix) prefix="$2"; shift; shift ;; - -e* | --eprefix) exec_prefix="$2"; shift; shift ;; - -l* | --libdir) libdir="$2"; shift; shift ;; - -i* | --includedir) includedir="$2"; shift; shift ;; - -s* | --shared | --enable-shared) shared=1; shift ;; - -t | --static) shared=0; shift ;; - --zlib-compat) compat=1; shift ;; - --without-gzfileops) gzfileops=0; shift ;; - --cover) cover=1; shift ;; - -3* | --32) build32=1; shift ;; - -6* | --64) build64=1; shift ;; - --without-acle) buildacle=0; shift ;; - --without-neon) buildneon=0; shift ;; - --with-dfltcc-deflate) builddfltccdeflate=1; shift ;; - --with-dfltcc-inflate) builddfltccinflate=1; shift ;; - --force-sse2) forcesse2=1; shift ;; - -n | --native) native=1; shift ;; - -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; - --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; - --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; - -noopt | --without-optimizations) without_optimizations=1; shift;; - -oldstrat | --without-new-strategies) without_new_strategies=1; shift;; - -w* | --warn) warn=1; shift ;; - -d* | --debug) debug=1; shift ;; - --with-sanitizer=*) with_sanitizer=`echo $1 | sed 's/.*=//'`; shift ;; - --with-fuzzers) with_fuzzers=1; shift ;; - - *) - echo "unknown option: $1" | tee -a configure.log - echo "$0 --help for help" | tee -a configure.log - leave 1;; - esac -done - -# temporary file name -test=ztest$$ - -# put arguments in log, also put test file in log if used in arguments -show() -{ - case "$*" in - *$test.c*) - echo === $test.c === >> configure.log - cat $test.c >> configure.log - echo === >> configure.log;; - esac - echo $* >> configure.log -} - -# check for gcc vs. cc and set compile and link flags based on the system identified by uname -cat > $test.c <&1` in - *gcc*) gcc=1 ;; - *clang*) gcc=1 ;; -esac - -if test $build32 -eq 1; then - CFLAGS="${CFLAGS} -m32" - SFLAGS="${SFLAGS} -m32" - LDFLAGS="${LDFLAGS} -m32" -fi -if test $build64 -eq 1; then - CFLAGS="${CFLAGS} -m64" - SFLAGS="${SFLAGS} -m64" - LDFLAGS="${LDFLAGS} -m64" -fi - -# Set library name depending on zlib-compat option -if test $compat -eq 0; then - LIBNAME=libz-ng - LIBNAME2=zlib-ng - SUFFIX=-ng -else - LIBNAME=libz - LIBNAME2=zlib - SUFFIX="" -fi - -STATICLIB=${LIBNAME}.a -MAPNAME=${LIBNAME2}.map - -# extract zlib version numbers from zlib.h -if test $compat -eq 0; then - VER=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib-ng.h` - VER3=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib-ng.h` - VER2=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib-ng.h` - VER1=`sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib-ng.h` -else - VER=`sed -n -e '/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib.h` - VER3=`sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib.h` - VER2=`sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib.h` - VER1=`sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}/zlib.h` -fi - -show $cc -c $test.c -if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then - echo "$cc" | tee -a configure.log - CC="$cc" - CFLAGS="${CFLAGS} -std=c99" - - # Re-check ARCH if the compiler is a cross-compiler. - if $CC -print-multiarch 1> /dev/null 2>&1 && test -n "$($CC -print-multiarch)" 1> /dev/null 2>&1; then - CC_ARCH=`$CC $CFLAGS -print-multiarch | sed 's/-.*//g'` - else - CC_ARCH=`$CC $CFLAGS -dumpmachine | sed 's/-.*//g'` - fi - case $CC_ARCH in - i386 | i486 | i586 | i686) - # Honor user choice if gcc is multilib and 64-bit is requested - if test $build64 -eq 1; then - ARCH=x86_64 - else - ARCH=$CC_ARCH - fi ;; - x86_64) - # Honor user choice if gcc is multilib and 32-bit is requested - if test $build32 -ne 1; then - ARCH=$CC_ARCH - fi ;; - arm | armeb) - if test $native -eq 0; then - ARCH=arm - else - ARCH=native - fi - if test "${uname}" = "eabi"; then - # No ACLE support - uname=arm - if test $buildacle -eq 1; then - echo ACLE support not available - buildacle=0 - fi - fi - if test $buildacle -eq 1; then - if test $native -eq 0; then - ARCH=armv8-a+crc - fi - fi ;; - armv8l) - if test $native -eq 0; then - ARCH=armv8-a - else - ARCH=native - fi ;; - aarch64 | aarch64_be) - if test "${uname}" = "elf"; then - uname=aarch64 - fi - if test $native -eq 0; then - ARCH=aarch64 - else - ARCH=native - fi ;; - powerpc | ppc) - ARCH=powerpc ;; - powerpc64 | ppc64) - ARCH=powerpc64 ;; - powerpc64le | ppc64le) - ARCH=powerpc64le ;; - esac - CFLAGS="-O2 ${CFLAGS}" - if test -n "${ARCHS}"; then - CFLAGS="${CFLAGS} ${ARCHS}" - LDFLAGS="${LDFLAGS} ${ARCHS}" - fi - CFLAGS="${CFLAGS} -Wall" - SFLAGS="${CFLAGS} -fPIC" - if test $native -eq 1; then - case $ARCH in - powerpc*) - NATIVE_FLAG="-mcpu=native" ;; - *) - NATIVE_FLAG="-march=native" ;; - esac - CFLAGS="${CFLAGS} ${NATIVE_FLAG}" - SFLAGS="${SFLAGS} ${NATIVE_FLAG}" - fi - if test "$warn" -eq 1; then - CFLAGS="${CFLAGS} -Wextra -Wpedantic -Wno-implicit-fallthrough" - fi - if test $debug -eq 1; then - CFLAGS="${CFLAGS} -DZLIB_DEBUG" - SFLAGS="${SFLAGS} -DZLIB_DEBUG" - fi - if test -z "$uname"; then - uname=`(uname -s || echo unknown) 2>/dev/null` - fi - case "$uname" in - Linux* | linux* | GNU | GNU/* | solaris*) - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" ;; - *BSD | *bsd* | DragonFly) - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1},--version-script,${SRCDIR}/${MAPNAME}" - LDCONFIG="ldconfig -m" ;; - CYGWIN* | Cygwin* | cygwin*) - ARFLAGS="rcs" - SFLAGS="${CFLAGS}" - shared_ext='.dll' - sharedlibdir='${bindir}' - if test $compat -eq 0; then - SHAREDLIB=cygz-ng$shared_ext - else - SHAREDLIB=cygz$shared_ext - fi - SHAREDLIBM='' - SHAREDLIBV='' - SHAREDTARGET=$SHAREDLIB - IMPORTLIB="${LIBNAME}.dll.a" - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB},--version-script,${SRCDIR}/${MAPNAME}" - LDSHAREDLIBC="" - DEFFILE='win32/${LIBNAME2}.def' - RC="${CROSS_PREFIX}windres" - RCFLAGS='--define GCC_WINDRES' - RCOBJS='zlibrc.o' - STRIP="${CROSS_PREFIX}strip" - EXE='.exe' ;; - MSYS* | msys*) - ARFLAGS="rcs" - SFLAGS="${CFLAGS}" - shared_ext='.dll' - sharedlibdir='${bindir}' - if test $compat -eq 0; then - SHAREDLIB=msys-z-ng$shared_ext - else - SHAREDLIB=msys-z$shared_ext - fi - SHAREDLIBM='' - SHAREDLIBV='' - SHAREDTARGET=$SHAREDLIB - IMPORTLIB="${LIBNAME}.dll.a" - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib,${IMPORTLIB}" - LDSHAREDLIBC="" - DEFFILE='win32/${LIBNAME2}.def' - RC="${CROSS_PREFIX}windres" - RCFLAGS='--define GCC_WINDRES' - RCOBJS='zlibrc.o' - STRIP="${CROSS_PREFIX}strip" - EXE='.exe' ;; - MINGW* | mingw*) - ARFLAGS="rcs" - CFLAGS="${CFLAGS} -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1" - SFLAGS="${CFLAGS}" - shared_ext='.dll' - sharedlibdir='${bindir}' - SHAREDLIB=${LIBNAME}-$VER1$shared_ext - SHAREDLIBM='' - SHAREDLIBV='' - SHAREDTARGET=$SHAREDLIB - IMPORTLIB="${LIBNAME}.dll.a" - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,--out-implib=${IMPORTLIB} -Wl,--version-script=${SRCDIR}/${MAPNAME}" - LDSHAREDLIBC="" - DEFFILE='win32/${LIBNAME2}.def' - RC="${CROSS_PREFIX}windres" - RCFLAGS='--define GCC_WINDRES' - if [ "$CC" == "mingw32-gcc" ]; then - case $ARCH in - i386 | i486 | i586 | i686) RCFLAGS="${RCFLAGS} -F pe-i386";; - esac; - fi - RCOBJS='zlibrc.o' - STRIP="${CROSS_PREFIX}strip" - 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"} - LDSHAREDFLAGS="-shared -Wl,-h${LIBNAME}.so.${VER1}" ;; - HP-UX*) - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared" - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='${LIBNAME}.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='${LIBNAME}.sl' ;; - esac ;; - Darwin* | darwin*) - shared_ext='.dylib' - SHAREDLIB=${LIBNAME}$shared_ext - SHAREDLIBV=${LIBNAME}.$VER$shared_ext - SHAREDLIBM=${LIBNAME}.$VER1$shared_ext - SHAREDTARGET=$SHAREDLIBV - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-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" ;; - aarch64) - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared -Wl,-soname,${LIBNAME}.so.${VER1} -Wl,--version-script,${SRCDIR}/${MAPNAME}" - LDSHAREDLIBC="-Wl,--start-group -lc -lrdimon -Wl,--end-group" ;; - *) - LDSHARED=${LDSHARED-"$cc"} - LDSHAREDFLAGS="-shared" ;; - esac -else - # find system name and corresponding cc options - CC=${CC-cc} - gcc=0 - echo "$CC" | tee -a configure.log - if test -z "$uname"; then - uname=`(uname -sr || echo unknown) 2>/dev/null` - fi - case "$uname" in - HP-UX*) SFLAGS=${CFLAGS-"-O +z"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"ld"} - LDSHAREDFLAGS="-b" - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='${LIBNAME}.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='${LIBNAME}.sl' ;; - esac ;; - AIX*) # Courtesy of dbakker@arrayasolutions.com - SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - LDSHARED=${LDSHARED-"xlc"} - LDSHAREDFLAGS="-G" ;; - # send working options for other systems to zlib@gzip.org - *) SFLAGS=${CFLAGS-"-O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc"} - LDSHAREDFLAGS="-shared" ;; - esac -fi - -# destination names for shared library if not defined above -SHAREDLIB=${SHAREDLIB-"${LIBNAME}$shared_ext"} -SHAREDLIBV=${SHAREDLIBV-"${LIBNAME}$shared_ext.$VER"} -SHAREDLIBM=${SHAREDLIBM-"${LIBNAME}$shared_ext.$VER1"} -SHAREDTARGET=${SHAREDTARGET-"${LIBNAME}$shared_ext.$VER"} - -echo >> configure.log - -# define functions for testing compiler and library characteristics and logging the results - -cat > $test.c </dev/null; then - try() - { - show $* - test "`( $* ) 2>&1 | tee -a configure.log`" = "" - } - echo - using any output from compiler to indicate an error >> configure.log -else -try() -{ - show $* - ( $* ) >> configure.log 2>&1 - ret=$? - if test $ret -ne 0; then - echo "(exit code "$ret")" >> configure.log - fi - return $ret -} -fi - -tryboth() -{ - show $* - got=`( $* ) 2>&1` - ret=$? - printf %s "$got" >> configure.log - if test $ret -ne 0; then - return $ret - fi - test "$got" = "" -} - -cat > $test.c << EOF -int foo() { return 0; } -EOF -echo "Checking for obsessive-compulsive compiler options..." >> configure.log -if try $CC -c $CFLAGS $test.c; then - : -else - echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log - leave 1 -fi - -echo >> configure.log - -if test "$with_sanitizer" = "address"; then - echo -n "Checking for address sanitizer... " | tee -a configure.log - sanitizers="" - for san in address pointer-compare pointer-subtract; do - if try $CC -c $CFLAGS $test.c -fsanitize=$san ; then - if test -n "$sanitizers"; then - sanitizers="$sanitizers,$san" - else - sanitizers="$san" - fi - fi - done - - if test -n "$sanitizers"; then - echo "-fsanitize=$sanitizers" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=$sanitizers" - SFLAGS="$SFLAGS -fsanitize=$sanitizers" - LDFLAGS="$LDFLAGS -fsanitize=$sanitizers" - else - echo No | tee -a configure.log - fi - - echo -n "Checking for leak sanitizer... " | tee -a configure.log - if try $CC -c $CFLAGS $test.c -fsanitize=leak; then - echo "-fsanitize=leak" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=leak" - SFLAGS="$SFLAGS -fsanitize=leak" - LDFLAGS="$LDFLAGS -fsanitize=leak" - else - echo No | tee -a configure.log - fi - - echo >> configure.log -fi - -if test "$with_sanitizer" = "memory"; then - echo -n "Checking for memory sanitizer... " | tee -a configure.log - if try $CC -c $CFLAGS $test.c -fsanitize=memory ; then - echo "-fsanitize=memory" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=memory" - SFLAGS="$SFLAGS -fsanitize=memory" - LDFLAGS="$LDFLAGS -fsanitize=memory" - else - echo No | tee -a configure.log - fi - - echo >> configure.log -fi - -if test "$with_sanitizer" = "undefined"; then - echo -n "Checking for undefined behavior sanitizer... " | tee -a configure.log - sanitizers="" - for san in array-bounds bool bounds builtin enum float-cast-overflow float-divide-by-zero function integer-divide-by-zero local-bounds null nonnull-attribute object-size pointer-overflow return returns-nonnull-attribute shift shift-base shift-exponent signed-integer-overflow undefined unsigned-integer-overflow unsigned-shift-base vla-bound vptr; do - if try $CC -c $CFLAGS $test.c -fsanitize=$san; then - if test -n "$sanitizers"; then - sanitizers="$sanitizers,$san" - else - sanitizers="$san" - fi - fi - done - - if test -n "$sanitizers"; then - echo "-fsanitize=$sanitizers" | tee -a configure.log - CFLAGS="$CFLAGS -fsanitize=$sanitizers" - SFLAGS="$SFLAGS -fsanitize=$sanitizers" - LDFLAGS="$LDFLAGS -fsanitize=$sanitizers" - else - echo No | tee -a configure.log - fi - - echo >> configure.log -fi - -# see if shared library build supported -cat > $test.c <> configure.log - -# check for large file support, and if none, check for fseeko() -cat > $test.c < -off64_t dummy = 0; -EOF -if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then - CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" - SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" - echo "Checking for off64_t... Yes." | tee -a configure.log - echo "Checking for fseeko... Yes." | tee -a configure.log -else - echo "Checking for off64_t... No." | tee -a configure.log - echo >> configure.log - cat > $test.c < -int main() { - _off64_t dummy = 0; - return 0; -} -EOF - if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then - echo "Checking for _off64_t... Yes." | tee -a configure.log - else - echo "Checking for _off64_t... No." | tee -a configure.log - fi - echo >> configure.log - cat > $test.c < -int main(void) { - fseeko(NULL, 0, 0); - return 0; -} -EOF - if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then - echo "Checking for fseeko... Yes." | tee -a configure.log - else - CFLAGS="${CFLAGS} -DNO_FSEEKO" - SFLAGS="${SFLAGS} -DNO_FSEEKO" - echo "Checking for fseeko... No." | tee -a configure.log - fi -fi - -echo >> configure.log - -# check for strerror() for use by gz* functions -cat > $test.c < -#include -int main() { return strlen(strerror(errno)); } -EOF -if try $CC $CFLAGS -o $test $test.c $LDSHAREDLIBC; then - echo "Checking for strerror... Yes." | tee -a configure.log -else - CFLAGS="${CFLAGS} -DNO_STRERROR" - SFLAGS="${SFLAGS} -DNO_STRERROR" - echo "Checking for strerror... No." | tee -a configure.log -fi - -# We need to remove zconf.h from source directory if building outside of it -if [ "$SRCDIR" != "$BUILDDIR" ]; then - rm -f $SRCDIR/zconf${SUFFIX}.h -fi - -# copy clean zconf.h for subsequent edits -cp -p $SRCDIR/zconf${SUFFIX}.h.in zconf${SUFFIX}.h - -echo >> configure.log - -# check for unistd.h and save result in zconf.h -cat > $test.c < -int main() { return 0; } -EOF -if try $CC -c $CFLAGS $test.c; then - sed < zconf${SUFFIX}.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf${SUFFIX}.temp.h - mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h - echo "Checking for unistd.h... Yes." | tee -a configure.log -else - echo "Checking for unistd.h... No." | tee -a configure.log -fi - -echo >> configure.log - -# check for ptrdiff_t and save result in zconf.h -echo -n "Checking for ptrdiff_t... " | tee -a configure.log -cat > $test.c < -int fun(ptrdiff_t *a) { (void)a; return 0; } -EOF -if try $CC -c $CFLAGS $test.c; then - echo "Yes." | tee -a configure.log -else - echo "No." | tee -a configure.log - sed < zconf${SUFFIX}.h "/^#ifdef NEED_PTRDIFF_T.* may be/s/def NEED_PTRDIFF_T\(.*\) may be/ 1\1 was/" > zconf${SUFFIX}.temp.h - mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h - - echo -n "Checking for sizeof(void *)... " | tee -a configure.log - cat > $test.c < -#define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; } -COMPILE_TIME_ASSERT(sizeof(int32_t) == sizeof(void *)); -EOF - if try $CC -c $CFLAGS $test.c; then - echo "sizeof(int32_t)." | tee -a configure.log - sed < zconf${SUFFIX}.h "s/^typedef PTRDIFF_TYPE ptrdiff_t;/typedef int32_t ptrdiff_t;/g" > zconf${SUFFIX}.temp.h - mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h - else - cat > $test.c < -#define COMPILE_TIME_ASSERT(pred) struct s { int x: (pred) ? 1 : -1; } -COMPILE_TIME_ASSERT(sizeof(int64_t) == sizeof(void *)); -EOF - if try $CC -c $CFLAGS $test.c; then - echo "sizeof(int64_t)." | tee -a configure.log - sed < zconf${SUFFIX}.h "s/^typedef PTRDIFF_TYPE ptrdiff_t;/typedef int64_t ptrdiff_t;/g" > zconf${SUFFIX}.temp.h - mv zconf${SUFFIX}.temp.h zconf${SUFFIX}.h - else - echo "unknown." | tee -a configure.log - exit 1 - fi - fi -fi - -# if --zlib-compat was requested -if test $compat -eq 1; then - gzfileops=1 - CFLAGS="${CFLAGS} -DZLIB_COMPAT" - SFLAGS="${SFLAGS} -DZLIB_COMPAT" - case "$uname" in - CYGWIN* | Cygwin* | cygwin* | MSYS* | msys* | MINGW* | mingw*) - DEFFILE="win32/zlibcompat.def" ;; - esac -fi - -# if --gzfileops was requested -if test $gzfileops -eq 1; then - CFLAGS="${CFLAGS} -DWITH_GZFILEOP" - SFLAGS="${SFLAGS} -DWITH_GZFILEOP" - OBJC="${OBJC} \$(OBJG)" - PIC_OBJC="${PIC_OBJC} \$(PIC_OBJG)" -fi - -# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X -if test $cover -eq 1; then - CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" - LDFLAGS="${LDFLAGS} -fprofile-arcs -ftest-coverage" - if test -n "$GCC_CLASSIC"; then - CC=$GCC_CLASSIC - fi -fi - -echo >> configure.log - -# Check for ANSI C compliant compiler -cat > $test.c < -#include -#include "zconf${SUFFIX}.h" -int main() { -#ifdef STDC - return 0; -#endif - return 1; -} -EOF -if try $CC -c $CFLAGS $test.c; then - echo "Checking for ANSI C compliant compiler... Yes." | tee -a configure.log - : -else - echo "Checking for ANSI C compliant compiler... No." | tee -a configure.log - echo "Error: ANSI C compatible compiler needed, cannot continue." | tee -a configure.log - leave 1 -fi - -# Check for -fno-semantic-interposition compiler support -echo "" > test.c - cat > $test.c <> configure.log 2>&1; then - echo "Checking for -no-semantic-interposition... Yes." | tee -a configure.log - SFLAGS="$SFLAGS -fno-semantic-interposition" -else - echo "Checking for -no-semantic-interposition... No." | tee -a configure.log -fi - -# see if we can hide zlib internal symbols that are linked between separate source files using hidden -if test "$gcc" -eq 1; then - echo >> configure.log - cat > $test.c <> configure.log - echo "Checking for attribute(visibility(hidden)) support... Yes." | tee -a configure.log - else - echo >> configure.log - echo "Checking for attribute(visibility(hidden)) support... No." | tee -a configure.log - fi -fi - -# see if we can hide zlib internal symbols that are linked between separate source files using internal -if test "$gcc" -eq 1; then - echo >> configure.log - cat > $test.c <> configure.log - echo "Checking for attribute(visibility(internal)) support... Yes." | tee -a configure.log - else - echo >> configure.log - echo "Checking for attribute(visibility(internal)) support... No." | tee -a configure.log - fi -fi - -# Check for __builtin_ctz() support in compiler -cat > $test.c << EOF -int main(void) { - unsigned int zero = 0; - long test = __builtin_ctz(zero); - (void)test; - return 0; -} -EOF -if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then - echo "Checking for __builtin_ctz ... Yes." | tee -a configure.log - CFLAGS="$CFLAGS -DHAVE_BUILTIN_CTZ" - SFLAGS="$SFLAGS -DHAVE_BUILTIN_CTZ" -else - echo "Checking for __builtin_ctz ... No." | tee -a configure.log -fi - -# Check for __builtin_ctzll() support in compiler -cat > $test.c << EOF -int main(void) { - unsigned long long zero = 0; - long test = __builtin_ctzll(zero); - (void)test; - return 0; -} -EOF -if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then - echo "Checking for __builtin_ctzll ... Yes." | tee -a configure.log - CFLAGS="$CFLAGS -DHAVE_BUILTIN_CTZLL" - SFLAGS="$SFLAGS -DHAVE_BUILTIN_CTZLL" -else - echo "Checking for __builtin_ctzll ... No." | tee -a configure.log -fi - -# Check for SSE2 intrinsics -case "${ARCH}" in - i386 | i486 | i586 | i686 | x86_64) - cat > $test.c << EOF -#include -int main(void) { - __m128i zero = _mm_setzero_si128(); - (void)zero; - return 0; -} -EOF - if try ${CC} ${CFLAGS} ${sse2flag} $test.c; then - echo "Checking for SSE2 intrinsics ... Yes." | tee -a configure.log - HAVE_SSE2_INTRIN=1 - else - echo "Checking for SSE2 intrinsics ... No." | tee -a configure.log - HAVE_SSE2_INTRIN=0 - fi - ;; -esac - -# Check for SSSE3 intrinsics - -cat > $test.c << EOF -#include -int main(void) -{ - __m128i u, v, w; - u = _mm_set1_epi32(1); - v = _mm_set1_epi32(2); - w = _mm_hadd_epi32(u, v); - (void)w; - return 0; -} -EOF -if try ${CC} ${CFLAGS} ${ssse3flag} $test.c; then - echo "Checking for SSSE3 intrinsics ... Yes." | tee -a configure.log - HAVE_SSSE3_INTRIN=1 -else - echo "Checking for SSSE3 intrinsics ... No." | tee -a configure.log - HAVE_SSSE3_INTRIN=0 -fi - -# Check for SSE4.2 CRC inline assembly -case "${ARCH}" in - i386 | i486 | i586 | i686 | x86_64) - cat > $test.c << EOF -int main(void) { - unsigned val = 0, h = 0; - __asm__ __volatile__ ( "crc32 %1,%0" : "+r" (h) : "r" (val) ); - return (int) h; -} -EOF - if try ${CC} ${CFLAGS} ${sse42flag} $test.c; then - echo "Checking for SSE4.2 CRC inline assembly ... Yes." | tee -a configure.log - HAVE_SSE42CRC_INLINE_ASM=1 - else - echo "Checking for SSE4.2 CRC inline assembly ... No." | tee -a configure.log - HAVE_SSE42CRC_INLINE_ASM=0 - fi - ;; -esac - -# Check for SSE4.2 CRC intrinsics -case "${ARCH}" in - i386 | i486 | i586 | i686 | x86_64) - cat > $test.c << EOF -int main(void) { - unsigned crc = 0; - char c = 'c'; - crc = __builtin_ia32_crc32qi(crc, c); - (void)crc; - return 0; -} -EOF - if try ${CC} ${CFLAGS} ${sse42flag} $test.c; then - echo "Checking for SSE4.2 CRC intrinsics ... Yes." | tee -a configure.log - HAVE_SSE42CRC_INTRIN=1 - else - echo "Checking for SSE4.2 CRC intrinsics ... No." | tee -a configure.log - HAVE_SSE42CRC_INTRIN=0 - fi - ;; -esac - -# Check for SSE4.2 compare string intrinsics -case "${ARCH}" in - i386 | i486 | i586 | i686 | x86_64) - cat > $test.c << EOF -#include -int main(void) -{ - unsigned char a[64] = { 0 }; - unsigned char b[64] = { 0 }; - __m128i xmm_src0, xmm_src1; - xmm_src0 = _mm_loadu_si128((__m128i *)(char *)a); - xmm_src1 = _mm_loadu_si128((__m128i *)(char *)b); - return _mm_cmpestri(xmm_src0, 16, xmm_src1, 16, 0); -} -EOF - if try ${CC} ${CFLAGS} ${sse42flag} $test.c; then - echo "Checking for SSE4.2 compare string intrinsics ... Yes." | tee -a configure.log - HAVE_SSE42CMPSTR_INTRIN=1 - else - echo "Checking for SSE4.2 compare string intrinsics ... No." | tee -a configure.log - HAVE_SSE42CMPSTR_INTRIN=0 - fi - ;; -esac - -# Check for PCLMULQDQ intrinsics -case "${ARCH}" in - i386 | i486 | i586 | i686 | x86_64) - cat > $test.c << EOF -#include -#include -int main(void) { - __m128i a = _mm_setzero_si128(); - __m128i b = _mm_setzero_si128(); - __m128i c = _mm_clmulepi64_si128(a, b, 0x10); - (void)c; - return 0; -} -EOF - if try ${CC} ${CFLAGS} ${pclmulflag} $test.c; then - echo "Checking for PCLMULQDQ intrinsics ... Yes." | tee -a configure.log - HAVE_PCLMULQDQ_INTRIN=1 - else - echo "Checking for PCLMULQDQ intrinsics ... No." | tee -a configure.log - HAVE_PCLMULQDQ_INTRIN=0 - fi - - # Enable deflate_medium at level 1 - if test $without_new_strategies -eq 1; then - CFLAGS="${CFLAGS} -DNO_QUICK_STRATEGY" - SFLAGS="${SFLAGS} -DNO_QUICK_STRATEGY" - fi - # Enable deflate_medium at level 4-6 - if test $without_new_strategies -eq 1; then - CFLAGS="${CFLAGS} -DNO_MEDIUM_STRATEGY" - SFLAGS="${SFLAGS} -DNO_MEDIUM_STRATEGY" - fi - ;; -esac - -# Check for AVX2 intrinsics -case "${ARCH}" in - i386 | i486 | i586 | i686 | x86_64) - cat > $test.c << EOF -#include -int main(void) { - __m256i x = _mm256_set1_epi16(2); - const __m256i y = _mm256_set1_epi16(1); - x = _mm256_subs_epu16(x, y); - (void)x; - return 0; -} -EOF - if try ${CC} ${CFLAGS} ${avx2flag} $test.c; then - echo "Checking for AVX2 intrinsics ... Yes." | tee -a configure.log - HAVE_AVX2_INTRIN=1 - else - echo "Checking for AVX2 intrinsics ... No." | tee -a configure.log - HAVE_AVX2_INTRIN=0 - fi - ;; -esac - - -# Check whether -mfpu=neon is available on ARM processors. -case "${ARCH}" in - arm*) - cat > $test.c << EOF -int main() { return 0; } -EOF - if try $CC -c $CFLAGS -mfpu=neon $test.c; then - MFPU_NEON_AVAILABLE=1 - echo "Check whether -mfpu=neon is available ... Yes." | tee -a configure.log - else - MFPU_NEON_AVAILABLE=0 - echo "Check whether -mfpu=neon is available ... No." | tee -a configure.log - fi - ;; -esac - -# Check whether features needed by POWER optimisations are available -case "${ARCH}" in - powerpc*) - cat > $test.c << EOF -#include -int main() { return (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07); } -EOF - if try $CC -c $CFLAGS -mcpu=power8 $test.c; then - HAVE_POWER8=1 - echo "Check whether POWER8 instructions are available ... Yes." | tee -a configure.log - else - HAVE_POWER8=0 - echo "Check whether POWER8 instructions are available ... No." | tee -a configure.log - fi -esac - -# Check whether sys/sdt.h is available -cat > $test.c << EOF -#include -int main() { return 0; } -EOF -if try ${CC} ${CFLAGS} $test.c; then - echo "Checking for sys/sdt.h ... Yes." | tee -a configure.log - CFLAGS="$CFLAGS -DHAVE_SYS_SDT_H" - SFLAGS="$SFLAGS -DHAVE_SYS_SDT_H" -else - echo "Checking for sys/sdt.h ... No." | tee -a configure.log -fi - -ARCHDIR='arch/generic' -ARCH_STATIC_OBJS='' -ARCH_SHARED_OBJS='' - -# Set ARCH specific FLAGS -case "${ARCH}" in - # x86/amd64 specific optimizations - i386 | i486 | i586 | i686 |x86_64) - ARCHDIR=arch/x86 - - CFLAGS="${CFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - - # Enable arch-specific optimizations - if test $without_optimizations -eq 0; then - CFLAGS="${CFLAGS} -DX86_FEATURES" - SFLAGS="${SFLAGS} -DX86_FEATURES" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} x86.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} x86.lo" - - if test ${HAVE_AVX2_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET" - SFLAGS="${SFLAGS} -DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} slide_avx.o chunkset_avx.o compare258_avx.o adler32_avx.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} slide_avx.lo chunkset_avx.lo compare258_avx.lo adler32_avx.lo" - fi - - if test ${HAVE_SSE42CRC_INTRIN} -eq 1 || test ${HAVE_SSE42CRC_INLINE_ASM} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSE42_CRC_HASH" - SFLAGS="${SFLAGS} -DX86_SSE42_CRC_HASH" - - if test ${HAVE_SSE42CRC_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSE42_CRC_INTRIN" - SFLAGS="${SFLAGS} -DX86_SSE42_CRC_INTRIN" - fi - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} insert_string_sse.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} insert_string_sse.lo" - fi - - if test ${HAVE_SSE42CMPSTR_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSE42_CMP_STR" - SFLAGS="${SFLAGS} -DX86_SSE42_CMP_STR" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} compare258_sse.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} compare258_sse.lo" - fi - - if test ${HAVE_SSE2_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSE2 -DX86_SSE2_CHUNKSET" - SFLAGS="${SFLAGS} -DX86_SSE2 -DX86_SSE2_CHUNKSET" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} chunkset_sse.o slide_sse.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} chunkset_sse.lo slide_sse.lo" - - if test $forcesse2 -eq 1; then - CFLAGS="${CFLAGS} -DX86_NOCHECK_SSE2" - SFLAGS="${SFLAGS} -DX86_NOCHECK_SSE2" - fi - fi - - if test ${HAVE_SSSE3_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_SSSE3 -DX86_SSSE3_ADLER32" - SFLAGS="${SFLAGS} -DX86_SSSE3 -DX86_SSSE3_ADLER32" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_ssse3.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_ssse3.lo" - fi - - if test ${HAVE_PCLMULQDQ_INTRIN} -eq 1; then - CFLAGS="${CFLAGS} -DX86_PCLMULQDQ_CRC" - SFLAGS="${SFLAGS} -DX86_PCLMULQDQ_CRC" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc_folding.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc_folding.lo" - fi - fi - ;; - - # ARM specific optimizations - arm*) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=arm - ARCHDIR=arch/arm - - if test $without_optimizations -eq 0; then - CFLAGS="${CFLAGS} -DARM_FEATURES" - SFLAGS="${SFLAGS} -DARM_FEATURES" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} armfeature.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} armfeature.lo" - fi - - GCC_MACHINE=$(${CC} -dumpmachine) - case "${GCC_MACHINE}" in - *gnueabihf) - floatabi="-mfloat-abi=hard" ;; - *gnueabi) - floatabi="-mfloat-abi=softfp" ;; - esac - CFLAGS="${CFLAGS} ${floatabi}" - SFLAGS="${SFLAGS} ${floatabi}" - - case "${ARCH}" in - armv[345]*) - if test $without_optimizations -eq 0; then - if test $buildacle -eq 1; then - echo ACLE support not available - fi - - if test $buildneon -eq 1; then - echo NEON support not available - fi - fi - ;; - armv6l | armv6hl) - CFLAGS="${CFLAGS} -DUNALIGNED_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK" - - if test $without_optimizations -eq 0; then - if test $buildacle -eq 1; then - echo ACLE support not available - fi - - if test $buildneon -eq 1; then - echo NEON support not available - fi - fi - ;; - arm | armv7*) - CFLAGS="${CFLAGS} -DUNALIGNED_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK" - - if test $without_optimizations -eq 0; then - if test $buildacle -eq 1; then - echo ACLE support not available - fi - - if test $buildneon -eq 1; then - if test $MFPU_NEON_AVAILABLE -eq 1;then - neonflag="-mfpu=neon" - fi - - CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o slide_neon.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo slide_neon.lo" - fi - fi - ;; - armv8-a | armv8-a+simd) - CFLAGS="${CFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - - if test $without_optimizations -eq 0; then - if test $buildacle -eq 1; then - echo ACLE support not available - fi - - if test $buildneon -eq 1; then - if test $MFPU_NEON_AVAILABLE -eq 1;then - neonflag="-mfpu=neon" - fi - - CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o slide_neon.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo slide_neon.lo" - fi - fi - ;; - armv8-a+crc | armv8-a+crc+simd | armv8.[1234]-a | armv8.[1234]-a+simd) - CFLAGS="${CFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - - acleflag="-march=${ARCH}" - - if test $without_optimizations -eq 0; then - CFLAGS="${CFLAGS} -DARM_ACLE_CRC_HASH" - SFLAGS="${SFLAGS} -DARM_ACLE_CRC_HASH" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_acle.o insert_string_acle.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_acle.lo insert_string_acle.lo" - - if test $buildneon -eq 1; then - if test $MFPU_NEON_AVAILABLE -eq 1;then - neonflag="-mfpu=neon" - fi - - CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o slide_neon.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo slide_neon.lo" - fi - fi - ;; - esac - - ;; - # 64-bit ARM specific optimizations - aarch64) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=aarch64 - ARCHDIR=arch/arm - - if test $native -eq 0; then - ARCH="armv8-a" - else - ARCH="native" - fi - - if test $without_optimizations -eq 0; then - CFLAGS="${CFLAGS} -DARM_FEATURES" - SFLAGS="${SFLAGS} -DARM_FEATURES" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} armfeature.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} armfeature.lo" - - if test $buildacle -eq 1; then - if test $native -eq 0; then - ARCH="${ARCH}+crc" - fi - CFLAGS="${CFLAGS} -DARM_ACLE_CRC_HASH" - SFLAGS="${SFLAGS} -DARM_ACLE_CRC_HASH" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} crc32_acle.o insert_string_acle.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} crc32_acle.lo insert_string_acle.lo" - fi - - if test $buildneon -eq 1; then - if test $native -eq 0; then - ARCH="${ARCH}+simd" - fi - CFLAGS="${CFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - SFLAGS="${SFLAGS} -DARM_NEON_ADLER32 -DARM_NEON_CHUNKSET -DARM_NEON_SLIDEHASH" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} adler32_neon.o chunkset_neon.o slide_neon.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} adler32_neon.lo chunkset_neon.lo slide_neon.lo" - fi - fi - - neonflag="-march=${ARCH}" - acleflag="-march=${ARCH}" - - CFLAGS="${CFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - ;; - powerpc*) - case "${ARCH}" in - powerpc) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc - ;; - powerpc64) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc64 - ;; - powerpc64le) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=ppc64le - CFLAGS="${CFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - SFLAGS="${SFLAGS} -DUNALIGNED_OK -DUNALIGNED64_OK" - ;; - esac - - ARCHDIR=arch/power - - if test $without_optimizations -eq 0; then - if test $HAVE_POWER8 -eq 1; then - CFLAGS="${CFLAGS} -DPOWER8 -DPOWER_FEATURES -DPOWER8_VSX_ADLER32 -DPOWER8_VSX_SLIDEHASH" - SFLAGS="${SFLAGS} -DPOWER8 -DPOWER_FEATURES -DPOWER8_VSX_ADLER32 -DPOWER8_VSX_SLIDEHASH" - - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} power.o adler32_power8.o slide_hash_power8.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} power.lo adler32_power8.lo slide_hash_power8.lo" - fi - fi - ;; - s390x) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=s390x - ARCHDIR=arch/s390 - - if test $without_optimizations -eq 0; then - if test $builddfltccdeflate -eq 1 -o $builddfltccinflate -eq 1; then - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_common.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_common.lo" - fi - - if test $builddfltccdeflate -eq 1; then - CFLAGS="${CFLAGS} -DS390_DFLTCC_DEFLATE" - SFLAGS="${SFLAGS} -DS390_DFLTCC_DEFLATE" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_deflate.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_deflate.lo" - ARCH="${ARCH}+dfltcc-deflate" - fi - - if test $builddfltccinflate -eq 1; then - CFLAGS="${CFLAGS} -DS390_DFLTCC_INFLATE" - SFLAGS="${SFLAGS} -DS390_DFLTCC_INFLATE" - ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} dfltcc_inflate.o" - ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} dfltcc_inflate.lo" - ARCH="${ARCH}+dfltcc-inflate" - fi - fi - ;; - *) - [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=$ARCH - ;; -esac - -echo "ARCH: ${ARCH}" -echo "Using arch directory: ${ARCHDIR}" - -# show the results in the log -echo >> configure.log -echo ALL = $ALL >> configure.log -echo AR = $AR >> configure.log -echo ARFLAGS = $ARFLAGS >> configure.log -echo CC = $CC >> configure.log -echo CFLAGS = $CFLAGS >> configure.log -echo EXE = $EXE >> configure.log -echo LDCONFIG = $LDCONFIG >> configure.log -echo LDFLAGS = $LDFLAGS >> configure.log -echo LDSHARED = $LDSHARED >> configure.log -echo LDSHAREDFLAGS = $LDSHAREDFLAGS >> configure.log -echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log -echo DEFFILE = $DEFFILE >> configure.log -echo RC = $RC >> configure.log -echo RCFLAGS = $RCFLAGS >> configure.log -echo RCOBJS = $RCOBJS >> configure.log -echo STRIP = $STRIP >> configure.log -echo OBJC = $OBJC >> configure.log -echo PIC_OBJC = $PIC_OBJC >> configure.log -echo RANLIB = $RANLIB >> configure.log -echo SFLAGS = $SFLAGS >> configure.log -echo SHAREDLIB = $SHAREDLIB >> configure.log -echo SHAREDLIBM = $SHAREDLIBM >> configure.log -echo SHAREDLIBV = $SHAREDLIBV >> configure.log -echo SHAREDTARGET = $SHAREDTARGET >> configure.log -echo IMPORTLIB = $IMPORTLIB >> configure.log -echo INSTALLTARGETS = $INSTALLTARGETS >> configure.log -echo UNINSTALLTARGETS = $UNINSTALLTARGETS >> configure.log -echo SRCDIR = $SRCDIR >> configure.log -echo BUILDDIR = $BUILDDIR >> configure.log -echo STATICLIB = $STATICLIB >> configure.log -echo TEST = $TEST >> configure.log -echo VER = $VER >> configure.log -echo exec_prefix = $exec_prefix >> configure.log -echo includedir = $includedir >> configure.log -echo bindir = $bindir >> configure.log -echo libdir = $libdir >> configure.log -echo mandir = $mandir >> configure.log -echo prefix = $prefix >> configure.log -echo sharedlibdir = $sharedlibdir >> configure.log -echo uname = $uname >> configure.log -echo sse2flag = $sse2flag >> configure.log -echo ssse3flag = $ssse3flag >> configure.log -echo sse4flag = $sse4flag >> configure.log -echo pclmulflag = $pclmulflag >> configure.log -echo acleflag = $acleflag >> configure.log -echo neonflag = $neonflag >> configure.log -echo ARCHDIR = ${ARCHDIR} >> configure.log -echo ARCH_STATIC_OBJS = ${ARCH_STATIC_OBJS} >> configure.log -echo ARCH_SHARED_OBJS = ${ARCH_SHARED_OBJS} >> configure.log - -# Handle sed incompatibilities when using -i -replace_in_file() { - if [ "$OS" = 'Darwin' ]; then - sed -i '.tmp' -e "$1" "$2" - else - sed -i'.tmp' -e "$1" "$2" - fi -} - -# update Makefile with the configure results - -INCLUDES="-I$SRCDIR" -if [ "$SRCDIR" != "$BUILDDIR" ]; then INCLUDES="-I$BUILDDIR ${INCLUDES}"; fi - -sed < $SRCDIR/Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^WITH_FUZZERS *=/s#=.*#=$with_fuzzers# -/^SFLAGS *=/s#=.*#=$SFLAGS# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^LDSHAREDFLAGS *=/s#=.*#=$LDSHAREDFLAGS# -/^LIBNAME1 *=/s#=.*#=$LIBNAME# -/^LIBNAME2 *=/s#=.*#=$LIBNAME2# -/^SUFFIX *=/s#=.*#=$SUFFIX# -/^STATICLIB *=/s#=.*#=$STATICLIB# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^SHAREDTARGET *=/s#=.*#=$SHAREDTARGET# -/^IMPORTLIB *=/s#=.*#=$IMPORTLIB# -/^VER *=/s#=.*#=$VER# -/^VER1 *=/s#=.*#=$VER1# -/^AR *=/s#=.*#=$AR# -/^ARFLAGS *=/s#=.*#=$ARFLAGS# -/^RANLIB *=/s#=.*#=$RANLIB# -/^LDCONFIG *=/s#=.*#=$LDCONFIG# -/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# -/^DEFFILE *=/s#=.*#=$DEFFILE# -/^RC *=/s#=.*#=$RC# -/^RCFLAGS *=/s#=.*#=$RCFLAGS# -/^RCOBJS *=/s#=.*#=$RCOBJS# -/^STRIP *=/s#=.*#=$STRIP# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#= $prefix# -/^exec_prefix *=/s#=.*#= $exec_prefix# -/^bindir *=/s#=.*#= $bindir# -/^libdir *=/s#=.*#= $libdir# -/^sharedlibdir *=/s#=.*#= $sharedlibdir# -/^includedir *=/s#=.*#= $includedir# -/^mandir *=/s#=.*#= $mandir# -/^SRCDIR *=/s#=.*#=$SRCDIR# -/^INCLUDES *=/s#=.*#=$INCLUDES# -/^OBJC *=/s#=.*#= $OBJC# -/^PIC_OBJC *=/s#=.*#= $PIC_OBJC# -/^all: */s#:.*#: $ALL# -/^install-libs: */s#:.*#: $INSTALLTARGETS# -/^uninstall-libs: */s#:.*#: $UNINSTALLTARGETS# -/^ARCHDIR *=/s#=.*#=$ARCHDIR# -/^ARCH_STATIC_OBJS *=/s#=.*#=$ARCH_STATIC_OBJS# -/^ARCH_SHARED_OBJS *=/s#=.*#=$ARCH_SHARED_OBJS# -" > Makefile - -# Append header files dependences. -for file in $(ls -1 $SRCDIR/*.c $SRCDIR/test/*.c $SRCDIR/test/fuzz/*.c $SRCDIR/$ARCHDIR/*.c $SRCDIR/tools/*.c); do - short_name=$(echo $file | sed -e "s#$SRCDIR/##g") - incs=$(grep -h include $file | sed -n 's/# *\include *"\(.*\.h\)".*/\1/p' | sort | uniq) - includes=$(for i in $incs; do - # Check that the include file exists in the current dir, - # otherwise it may be one of the system include header. - if test -e $SRCDIR/$i; then - echo -n " \$(SRCDIR)/$i" - fi - # We also need to check whether the include file is in the ARCHDIR. - if test -e $SRCDIR/$ARCHDIR/$i; then - echo -n " \$(SRCDIR)/$ARCHDIR/$i" - fi - done) - obj=$(basename $(echo $file | sed -e 's/\.c/\.o/g' -e 's#^\./##g')) - lobj=$(basename $(echo $file | sed -e 's/\.c/\.lo/g' -e 's#^\./##g')) - - if grep -q "^$obj:" Makefile; then - # Replace the existing line with a line with all dependences. - $(replace_in_file "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" Makefile) - else - # Append at the end of Makefile a new line with the header dependences. - echo "$obj: \$(SRCDIR)/$short_name $includes" >> Makefile - - # In case this is one of the ARCHDIR files, append a dependence line - # that will force the `$(MAKE) -C $(ARCHDIR)` generic rule. Without this - # we would only execute the copy rule from ARCHDIR to SRCDIR. - if test -e $SRCDIR/$ARCHDIR/$(basename $file); then - echo "$ARCHDIR/$obj: \$(SRCDIR)/$short_name $includes" >> Makefile - fi - fi - - if grep -q "^$lobj:" Makefile; then - # Replace the existing line with a line with all dependences. - $(replace_in_file "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" Makefile) - else - # Append at the end of Makefile a new line with the header dependences. - echo "$lobj: \$(SRCDIR)/$short_name $includes" >> Makefile - fi -done - -# Generate Makefile in arch dir -mkdir -p $ARCHDIR - -ARCHINCLUDES="-I$SRCDIR/$ARCHDIR -I$SRCDIR" -if [ "$SRCDIR" != "$BUILDDIR" ]; then ARCHINCLUDES="-I$BUILDDIR ${ARCHINCLUDES}"; fi - -sed < $SRCDIR/$ARCHDIR/Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^SFLAGS *=/s#=.*#=$SFLAGS# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^INCLUDES *=/s#=.*#=$ARCHINCLUDES# -/^SUFFIX *=/s#=.*#=$SUFFIX# -/^SRCDIR *=/s#=.*#=$SRCDIR/$ARCHDIR# -/^SRCTOP *=/s#=.*#=$SRCDIR# -/^TOPDIR *=/s#=.*#=$BUILDDIR# -/^AVX2FLAG *=/s#=.*#=$avx2flag# -/^SSE2FLAG *=/s#=.*#=$sse2flag# -/^SSSE3FLAG *=/s#=.*#=$ssse3flag# -/^SSE4FLAG *=/s#=.*#=$sse4flag# -/^PCLMULFLAG *=/s#=.*#=$pclmulflag# -/^ACLEFLAG *=/s#=.*#=$acleflag# -/^NEONFLAG *=/s#=.*#=$neonflag# -" > $ARCHDIR/Makefile - -# Append header files dependences. -for file in $(ls -1 $SRCDIR/$ARCHDIR/*.c); do - incs=$(grep -h include $file | sed -n 's/# *\include *"\(.*\.h\)".*/\1/p' | sort | uniq) - includes=$(for i in $incs; do - # Check that the include file exists in the current dir, - # otherwise it may be one of the system include header. - if test -e $SRCDIR/$i; then - echo -n " \$(SRCTOP)/$i" - fi - # We also need to check whether the include file is in the ARCHDIR. - if test -e $SRCDIR/$ARCHDIR/$i; then - echo -n " \$(SRCDIR)/$i" - fi - done) - obj=$(basename $(echo $file | sed -e 's/\.c/\.o/g' -e 's#^\./##g')) - lobj=$(basename $(echo $file | sed -e 's/\.c/\.lo/g' -e 's#^\./##g')) - short_name=$(basename $file) - if grep -q "^$obj:" $ARCHDIR/Makefile; then - # Replace the existing line with a line with all dependences. - $(replace_in_file "s#$obj:.*#$obj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile) - else - # Append at the end of Makefile a new line with the header dependences. - echo "$obj: \$(SRCDIR)/$short_name $includes" >> $ARCHDIR/Makefile - fi - - if grep -q "^$lobj:" $ARCHDIR/Makefile; then - # Replace the existing line with a line with all dependences. - $(replace_in_file "s#$lobj:.*#$lobj: \$(SRCDIR)/$short_name $includes#g" $ARCHDIR/Makefile) - else - # Append at the end of Makefile a new line with the header dependences. - echo "$lobj: \$(SRCDIR)/$short_name $includes" >> $ARCHDIR/Makefile - fi -done - -# Generate Makefile in test dir -mkdir -p test -if test $compat -eq 1; then COMPATTESTS="compattests"; fi -if test $QEMU_ARCH; then QEMU_RUN="qemu-$QEMU_ARCH -L /usr/${CHOST}/"; fi -sed < $SRCDIR/test/Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^EXE *=/s#=.*#=$EXE# -/^oldtests: */s#:.*#: $TEST# -/^SRCDIR *=/s#=.*#=$SRCDIR/test# -/^SRCTOP *=/s#=.*#=$SRCDIR# -/^COMPATTESTS *=/s#=.*#=$COMPATTESTS# -/^QEMU_RUN *=/s#=.*#=$QEMU_RUN# -/^WITH_FUZZERS *=/s#=.*#=$with_fuzzers# -/^LIBNAME *=/s#=.*#=$LIBNAME# -" > test/Makefile - -# create zlib.pc with the configure results -sed < $SRCDIR/zlib.pc.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^LDSHAREDFLAGS *=/s#=.*#=$LDSHAREDFLAGS# -/^STATICLIB *=/s#=.*#=$STATICLIB# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^IMPORTLIB *=/s#=.*#=$IMPORTLIB# -/^AR *=/s#=.*#=$AR# -/^ARFLAGS *=/s#=.*#=$ARFLAGS# -/^RANLIB *=/s#=.*#=$RANLIB# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^bindir *=/s#=.*#=$bindir# -/^libdir *=/s#=.*#=$libdir# -/^sharedlibdir *=/s#=.*#=$sharedlibdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -" | sed -e " -s/\@VERSION\@/$VER/g; -s/\@SUFFIX\@/$SUFFIX/g; -" > ${LIBNAME2}.pc - -# done -leave 0 diff --git a/libs/zlibng/crc32.c b/libs/zlibng/crc32.c deleted file mode 100644 index 4b488e617..000000000 --- a/libs/zlibng/crc32.c +++ /dev/null @@ -1,202 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 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. - */ - -#include "zbuild.h" -#include "zendian.h" -#include -#include "deflate.h" -#include "functable.h" -#include "crc32_tbl.h" - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const uint32_t * Z_EXPORT PREFIX(get_crc_table)(void) { - return (const uint32_t *)crc_table; -} - -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(crc32_z)(unsigned long crc, const unsigned char *buf, size_t len) { - if (buf == NULL) return 0; - - return (unsigned long)functable.crc32((uint32_t)crc, buf, len); -} -#else -uint32_t Z_EXPORT PREFIX(crc32_z)(uint32_t crc, const unsigned char *buf, size_t len) { - if (buf == NULL) return 0; - - return functable.crc32(crc, buf, len); -} -#endif -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 -#define DO4 DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -Z_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, uint64_t len) { - crc = crc ^ 0xffffffff; - -#ifdef UNROLL_MORE - while (len >= 8) { - DO8; - len -= 8; - } -#else - while (len >= 4) { - DO4; - len -= 4; - } -#endif - - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffff; -} - -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(crc32)(unsigned long crc, const unsigned char *buf, unsigned int len) { - return (unsigned long)PREFIX(crc32_z)((uint32_t)crc, buf, len); -} -#else -uint32_t Z_EXPORT PREFIX(crc32)(uint32_t crc, const unsigned char *buf, uint32_t len) { - return PREFIX(crc32_z)(crc, buf, len); -} -#endif - -/* - 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. - */ - -/* ========================================================================= */ -#if BYTE_ORDER == LITTLE_ENDIAN -#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 - -/* ========================================================================= */ -Z_INTERNAL uint32_t crc32_little(uint32_t crc, const unsigned char *buf, uint64_t len) { - Z_REGISTER uint32_t c; - Z_REGISTER const uint32_t *buf4; - - c = crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const uint32_t *)(const void *)buf; - -#ifdef UNROLL_MORE - while (len >= 32) { - DOLIT32; - len -= 32; - } -#endif - - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return c; -} -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -/* ========================================================================= */ -#if BYTE_ORDER == BIG_ENDIAN -#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 - -/* ========================================================================= */ -Z_INTERNAL uint32_t crc32_big(uint32_t crc, const unsigned char *buf, uint64_t len) { - Z_REGISTER uint32_t c; - Z_REGISTER const uint32_t *buf4; - - c = ZSWAP32(crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const uint32_t *)(const void *)buf; - -#ifdef UNROLL_MORE - while (len >= 32) { - DOBIG32; - len -= 32; - } -#endif - - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf = (const unsigned char *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return ZSWAP32(c); -} -#endif /* BYTE_ORDER == BIG_ENDIAN */ - -#ifdef X86_PCLMULQDQ_CRC -#include "arch/x86/x86.h" -#include "arch/x86/crc_folding.h" - -Z_INTERNAL void crc_finalize(deflate_state *const s) { - if (x86_cpu_has_pclmulqdq) - s->strm->adler = crc_fold_512to32(s); -} -#endif - -Z_INTERNAL void crc_reset(deflate_state *const s) { -#ifdef X86_PCLMULQDQ_CRC - x86_check_features(); - if (x86_cpu_has_pclmulqdq) { - crc_fold_init(s); - return; - } -#endif - s->strm->adler = PREFIX(crc32)(0L, NULL, 0); -} - -Z_INTERNAL void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size) { -#ifdef X86_PCLMULQDQ_CRC - if (x86_cpu_has_pclmulqdq) { - crc_fold_copy(strm->state, dst, strm->next_in, size); - return; - } -#endif - memcpy(dst, strm->next_in, size); - strm->adler = PREFIX(crc32)(strm->adler, dst, size); -} diff --git a/libs/zlibng/crc32_comb.c b/libs/zlibng/crc32_comb.c deleted file mode 100644 index 092c595d9..000000000 --- a/libs/zlibng/crc32_comb.c +++ /dev/null @@ -1,108 +0,0 @@ -/* crc32_comb.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 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. - */ - -#include "zbuild.h" -#include -#include "deflate.h" -#include "crc32_p.h" -#include "crc32_comb_tbl.h" - - -/* Local functions for crc concatenation */ -static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2); -static void crc32_combine_gen_(uint32_t *op, z_off64_t len2); - -/* ========================================================================= */ -static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2) { - int n; - - if (len2 > 0) - /* operator for 2^n zeros repeats every GF2_DIM n values */ - for (n = 0; len2; n = (n + 1) % GF2_DIM, len2 >>= 1) - if (len2 & 1) - crc1 = gf2_matrix_times(crc_comb[n], crc1); - return crc1 ^ crc2; -} - -/* ========================================================================= */ -#ifdef ZLIB_COMPAT -unsigned long Z_EXPORT PREFIX(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off_t len2) { - return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2); -} - -unsigned long Z_EXPORT PREFIX4(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off64_t len2) { - return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2); -} -#else -uint32_t Z_EXPORT PREFIX4(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off64_t len2) { - return crc32_combine_(crc1, crc2, len2); -} -#endif - -/* ========================================================================= */ - -static void crc32_combine_gen_(uint32_t *op, z_off64_t len2) { - uint32_t row; - int j; - unsigned i; - - /* if len2 is zero or negative, return the identity matrix */ - if (len2 <= 0) { - row = 1; - for (j = 0; j < GF2_DIM; j++) { - op[j] = row; - row <<= 1; - } - return; - } - - /* at least one bit in len2 is set -- find it, and copy the operator - corresponding to that position into op */ - i = 0; - for (;;) { - if (len2 & 1) { - for (j = 0; j < GF2_DIM; j++) - op[j] = crc_comb[i][j]; - break; - } - len2 >>= 1; - i = (i + 1) % GF2_DIM; - } - - /* for each remaining bit set in len2 (if any), multiply op by the operator - corresponding to that position */ - for (;;) { - len2 >>= 1; - i = (i + 1) % GF2_DIM; - if (len2 == 0) - break; - if (len2 & 1) - for (j = 0; j < GF2_DIM; j++) - op[j] = gf2_matrix_times(crc_comb[i], op[j]); - } -} - -/* ========================================================================= */ - -#ifdef ZLIB_COMPAT -void Z_EXPORT PREFIX(crc32_combine_gen)(uint32_t *op, z_off_t len2) { - crc32_combine_gen_(op, len2); -} -#endif - -void Z_EXPORT PREFIX4(crc32_combine_gen)(uint32_t *op, z_off64_t len2) { - crc32_combine_gen_(op, len2); -} - -/* ========================================================================= */ -uint32_t Z_EXPORT PREFIX(crc32_combine_op)(uint32_t crc1, uint32_t crc2, const uint32_t *op) { - return gf2_matrix_times(op, crc1) ^ crc2; -} diff --git a/libs/zlibng/crc32_comb_tbl.h b/libs/zlibng/crc32_comb_tbl.h deleted file mode 100644 index 43818c3e0..000000000 --- a/libs/zlibng/crc32_comb_tbl.h +++ /dev/null @@ -1,300 +0,0 @@ -#ifndef CRC32_COMB_TBL_H_ -#define CRC32_COMB_TBL_H_ - -/* crc32_comb_tbl.h -- zero operators table for CRC combine - * Generated automatically by makecrct.c - */ - -static const uint32_t crc_comb[32][32] = -{ - { - 0x77073096, 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, - 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, - 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040, - 0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000, - 0x00020000, 0x00040000, 0x00080000, 0x00100000, 0x00200000, - 0x00400000, 0x00800000 - }, - { - 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, 0x4ac21251, - 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, 0xee0e612c, - 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, 0x76dc4190, - 0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100, - 0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000, - 0x00004000, 0x00008000 - }, - { - 0xb8bc6765, 0xaa09c88b, 0x8f629757, 0xc5b428ef, 0x5019579f, - 0xa032af3e, 0x9b14583d, 0xed59b63b, 0x01c26a37, 0x0384d46e, - 0x0709a8dc, 0x0e1351b8, 0x1c26a370, 0x384d46e0, 0x709a8dc0, - 0xe1351b80, 0x191b3141, 0x32366282, 0x646cc504, 0xc8d98a08, - 0x4ac21251, 0x958424a2, 0xf0794f05, 0x3b83984b, 0x77073096, - 0xee0e612c, 0x076dc419, 0x0edb8832, 0x1db71064, 0x3b6e20c8, - 0x76dc4190, 0xedb88320 - }, - { - 0xccaa009e, 0x4225077d, 0x844a0efa, 0xd3e51bb5, 0x7cbb312b, - 0xf9766256, 0x299dc2ed, 0x533b85da, 0xa6770bb4, 0x979f1129, - 0xf44f2413, 0x33ef4e67, 0x67de9cce, 0xcfbd399c, 0x440b7579, - 0x8816eaf2, 0xcb5cd3a5, 0x4dc8a10b, 0x9b914216, 0xec53826d, - 0x03d6029b, 0x07ac0536, 0x0f580a6c, 0x1eb014d8, 0x3d6029b0, - 0x7ac05360, 0xf580a6c0, 0x30704bc1, 0x60e09782, 0xc1c12f04, - 0x58f35849, 0xb1e6b092 - }, - { - 0xae689191, 0x87a02563, 0xd4314c87, 0x73139f4f, 0xe6273e9e, - 0x173f7b7d, 0x2e7ef6fa, 0x5cfdedf4, 0xb9fbdbe8, 0xa886b191, - 0x8a7c6563, 0xcf89cc87, 0x44629f4f, 0x88c53e9e, 0xcafb7b7d, - 0x4e87f0bb, 0x9d0fe176, 0xe16ec4ad, 0x19ac8f1b, 0x33591e36, - 0x66b23c6c, 0xcd6478d8, 0x41b9f7f1, 0x8373efe2, 0xdd96d985, - 0x605cb54b, 0xc0b96a96, 0x5a03d36d, 0xb407a6da, 0xb37e4bf5, - 0xbd8d91ab, 0xa06a2517 - }, - { - 0xf1da05aa, 0x38c50d15, 0x718a1a2a, 0xe3143454, 0x1d596ee9, - 0x3ab2ddd2, 0x7565bba4, 0xeacb7748, 0x0ee7e8d1, 0x1dcfd1a2, - 0x3b9fa344, 0x773f4688, 0xee7e8d10, 0x078c1c61, 0x0f1838c2, - 0x1e307184, 0x3c60e308, 0x78c1c610, 0xf1838c20, 0x38761e01, - 0x70ec3c02, 0xe1d87804, 0x18c1f649, 0x3183ec92, 0x6307d924, - 0xc60fb248, 0x576e62d1, 0xaedcc5a2, 0x86c88d05, 0xd6e01c4b, - 0x76b13ed7, 0xed627dae - }, - { - 0x8f352d95, 0xc51b5d6b, 0x5147bc97, 0xa28f792e, 0x9e6ff41d, - 0xe7aeee7b, 0x142cdab7, 0x2859b56e, 0x50b36adc, 0xa166d5b8, - 0x99bcad31, 0xe8085c23, 0x0b61be07, 0x16c37c0e, 0x2d86f81c, - 0x5b0df038, 0xb61be070, 0xb746c6a1, 0xb5fc8b03, 0xb0881047, - 0xba6126cf, 0xafb34bdf, 0x841791ff, 0xd35e25bf, 0x7dcd4d3f, - 0xfb9a9a7e, 0x2c4432bd, 0x5888657a, 0xb110caf4, 0xb95093a9, - 0xa9d02113, 0x88d14467 - }, - { - 0x33fff533, 0x67ffea66, 0xcfffd4cc, 0x448eafd9, 0x891d5fb2, - 0xc94bb925, 0x49e6740b, 0x93cce816, 0xfce8d66d, 0x22a0aa9b, - 0x45415536, 0x8a82aa6c, 0xce745299, 0x4799a373, 0x8f3346e6, - 0xc5178b8d, 0x515e115b, 0xa2bc22b6, 0x9e09432d, 0xe763801b, - 0x15b60677, 0x2b6c0cee, 0x56d819dc, 0xadb033b8, 0x80116131, - 0xdb53c423, 0x6dd68e07, 0xdbad1c0e, 0x6c2b3e5d, 0xd8567cba, - 0x6bddff35, 0xd7bbfe6a - }, - { - 0xce3371cb, 0x4717e5d7, 0x8e2fcbae, 0xc72e911d, 0x552c247b, - 0xaa5848f6, 0x8fc197ad, 0xc4f2291b, 0x52955477, 0xa52aa8ee, - 0x9124579d, 0xf939a97b, 0x290254b7, 0x5204a96e, 0xa40952dc, - 0x9363a3f9, 0xfdb641b3, 0x201d8527, 0x403b0a4e, 0x8076149c, - 0xdb9d2f79, 0x6c4b58b3, 0xd896b166, 0x6a5c648d, 0xd4b8c91a, - 0x72009475, 0xe40128ea, 0x13735795, 0x26e6af2a, 0x4dcd5e54, - 0x9b9abca8, 0xec447f11 - }, - { - 0x1072db28, 0x20e5b650, 0x41cb6ca0, 0x8396d940, 0xdc5cb4c1, - 0x63c86fc3, 0xc790df86, 0x5450b94d, 0xa8a1729a, 0x8a33e375, - 0xcf16c0ab, 0x455c8717, 0x8ab90e2e, 0xce031a1d, 0x4777327b, - 0x8eee64f6, 0xc6adcfad, 0x562a991b, 0xac553236, 0x83db622d, - 0xdcc7c21b, 0x62fe8277, 0xc5fd04ee, 0x508b0f9d, 0xa1161f3a, - 0x995d3835, 0xe9cb762b, 0x08e7ea17, 0x11cfd42e, 0x239fa85c, - 0x473f50b8, 0x8e7ea170 - }, - { - 0xf891f16f, 0x2a52e49f, 0x54a5c93e, 0xa94b927c, 0x89e622b9, - 0xc8bd4333, 0x4a0b8027, 0x9417004e, 0xf35f06dd, 0x3dcf0bfb, - 0x7b9e17f6, 0xf73c2fec, 0x35095999, 0x6a12b332, 0xd4256664, - 0x733bca89, 0xe6779512, 0x179e2c65, 0x2f3c58ca, 0x5e78b194, - 0xbcf16328, 0xa293c011, 0x9e568663, 0xe7dc0a87, 0x14c9134f, - 0x2992269e, 0x53244d3c, 0xa6489a78, 0x97e032b1, 0xf4b16323, - 0x3213c007, 0x6427800e - }, - { - 0x88b6ba63, 0xca1c7287, 0x4f49e34f, 0x9e93c69e, 0xe6568b7d, - 0x17dc10bb, 0x2fb82176, 0x5f7042ec, 0xbee085d8, 0xa6b00df1, - 0x96111da3, 0xf7533d07, 0x35d77c4f, 0x6baef89e, 0xd75df13c, - 0x75cae439, 0xeb95c872, 0x0c5a96a5, 0x18b52d4a, 0x316a5a94, - 0x62d4b528, 0xc5a96a50, 0x5023d2e1, 0xa047a5c2, 0x9bfe4dc5, - 0xec8d9dcb, 0x026a3dd7, 0x04d47bae, 0x09a8f75c, 0x1351eeb8, - 0x26a3dd70, 0x4d47bae0 - }, - { - 0x5ad8a92c, 0xb5b15258, 0xb013a2f1, 0xbb5643a3, 0xaddd8107, - 0x80ca044f, 0xdae50edf, 0x6ebb1bff, 0xdd7637fe, 0x619d69bd, - 0xc33ad37a, 0x5d04a0b5, 0xba09416a, 0xaf638495, 0x85b60f6b, - 0xd01d1897, 0x7b4b376f, 0xf6966ede, 0x365ddbfd, 0x6cbbb7fa, - 0xd9776ff4, 0x699fd9a9, 0xd33fb352, 0x7d0e60e5, 0xfa1cc1ca, - 0x2f4885d5, 0x5e910baa, 0xbd221754, 0xa13528e9, 0x991b5793, - 0xe947a967, 0x09fe548f - }, - { - 0xb566f6e2, 0xb1bceb85, 0xb808d14b, 0xab60a4d7, 0x8db04fef, - 0xc011999f, 0x5b52357f, 0xb6a46afe, 0xb639d3bd, 0xb702a13b, - 0xb5744437, 0xb1998e2f, 0xb8421a1f, 0xabf5327f, 0x8c9b62bf, - 0xc247c33f, 0x5ffe803f, 0xbffd007e, 0xa48b06bd, 0x92670b3b, - 0xffbf1037, 0x240f262f, 0x481e4c5e, 0x903c98bc, 0xfb083739, - 0x2d616833, 0x5ac2d066, 0xb585a0cc, 0xb07a47d9, 0xbb8589f3, - 0xac7a15a7, 0x83852d0f - }, - { - 0x9d9129bf, 0xe053553f, 0x1bd7ac3f, 0x37af587e, 0x6f5eb0fc, - 0xdebd61f8, 0x660bc5b1, 0xcc178b62, 0x435e1085, 0x86bc210a, - 0xd6094455, 0x77638eeb, 0xeec71dd6, 0x06ff3ded, 0x0dfe7bda, - 0x1bfcf7b4, 0x37f9ef68, 0x6ff3ded0, 0xdfe7bda0, 0x64be7d01, - 0xc97cfa02, 0x4988f245, 0x9311e48a, 0xfd52cf55, 0x21d498eb, - 0x43a931d6, 0x875263ac, 0xd5d5c119, 0x70da8473, 0xe1b508e6, - 0x181b178d, 0x30362f1a - }, - { - 0x2ee43a2c, 0x5dc87458, 0xbb90e8b0, 0xac50d721, 0x83d0a803, - 0xdcd05647, 0x62d1aacf, 0xc5a3559e, 0x5037ad7d, 0xa06f5afa, - 0x9bafb3b5, 0xec2e612b, 0x032dc417, 0x065b882e, 0x0cb7105c, - 0x196e20b8, 0x32dc4170, 0x65b882e0, 0xcb7105c0, 0x4d930dc1, - 0x9b261b82, 0xed3d3145, 0x010b64cb, 0x0216c996, 0x042d932c, - 0x085b2658, 0x10b64cb0, 0x216c9960, 0x42d932c0, 0x85b26580, - 0xd015cd41, 0x7b5a9cc3 - }, - { - 0x1b4511ee, 0x368a23dc, 0x6d1447b8, 0xda288f70, 0x6f2018a1, - 0xde403142, 0x67f164c5, 0xcfe2c98a, 0x44b49555, 0x89692aaa, - 0xc9a35315, 0x4837a06b, 0x906f40d6, 0xfbaf87ed, 0x2c2e099b, - 0x585c1336, 0xb0b8266c, 0xba014a99, 0xaf739373, 0x859620a7, - 0xd05d470f, 0x7bcb885f, 0xf79710be, 0x345f273d, 0x68be4e7a, - 0xd17c9cf4, 0x79883fa9, 0xf3107f52, 0x3d51f8e5, 0x7aa3f1ca, - 0xf547e394, 0x31fec169 - }, - { - 0xbce15202, 0xa2b3a245, 0x9e1642cb, 0xe75d83d7, 0x15ca01ef, - 0x2b9403de, 0x572807bc, 0xae500f78, 0x87d118b1, 0xd4d33723, - 0x72d76807, 0xe5aed00e, 0x102ca65d, 0x20594cba, 0x40b29974, - 0x816532e8, 0xd9bb6391, 0x6807c163, 0xd00f82c6, 0x7b6e03cd, - 0xf6dc079a, 0x36c90975, 0x6d9212ea, 0xdb2425d4, 0x6d394de9, - 0xda729bd2, 0x6f9431e5, 0xdf2863ca, 0x6521c1d5, 0xca4383aa, - 0x4ff60115, 0x9fec022a - }, - { - 0xff08e5ef, 0x2560cd9f, 0x4ac19b3e, 0x9583367c, 0xf0776ab9, - 0x3b9fd333, 0x773fa666, 0xee7f4ccc, 0x078f9fd9, 0x0f1f3fb2, - 0x1e3e7f64, 0x3c7cfec8, 0x78f9fd90, 0xf1f3fb20, 0x3896f001, - 0x712de002, 0xe25bc004, 0x1fc68649, 0x3f8d0c92, 0x7f1a1924, - 0xfe343248, 0x271962d1, 0x4e32c5a2, 0x9c658b44, 0xe3ba10c9, - 0x1c0527d3, 0x380a4fa6, 0x70149f4c, 0xe0293e98, 0x1b237b71, - 0x3646f6e2, 0x6c8dedc4 - }, - { - 0x6f76172e, 0xdeec2e5c, 0x66a95af9, 0xcd52b5f2, 0x41d46da5, - 0x83a8db4a, 0xdc20b0d5, 0x633067eb, 0xc660cfd6, 0x57b099ed, - 0xaf6133da, 0x85b361f5, 0xd017c5ab, 0x7b5e8d17, 0xf6bd1a2e, - 0x360b321d, 0x6c16643a, 0xd82cc874, 0x6b2896a9, 0xd6512d52, - 0x77d35ce5, 0xefa6b9ca, 0x043c75d5, 0x0878ebaa, 0x10f1d754, - 0x21e3aea8, 0x43c75d50, 0x878ebaa0, 0xd46c7301, 0x73a9e043, - 0xe753c086, 0x15d6874d - }, - { - 0x56f5cab9, 0xadeb9572, 0x80a62ca5, 0xda3d5f0b, 0x6f0bb857, - 0xde1770ae, 0x675fe71d, 0xcebfce3a, 0x460e9a35, 0x8c1d346a, - 0xc34b6e95, 0x5de7db6b, 0xbbcfb6d6, 0xacee6bed, 0x82add19b, - 0xde2aa577, 0x67244caf, 0xce48995e, 0x47e034fd, 0x8fc069fa, - 0xc4f1d5b5, 0x5292ad2b, 0xa5255a56, 0x913bb2ed, 0xf906639b, - 0x297dc177, 0x52fb82ee, 0xa5f705dc, 0x909f0df9, 0xfa4f1db3, - 0x2fef3d27, 0x5fde7a4e - }, - { - 0x385993ac, 0x70b32758, 0xe1664eb0, 0x19bd9b21, 0x337b3642, - 0x66f66c84, 0xcdecd908, 0x40a8b451, 0x815168a2, 0xd9d3d705, - 0x68d6a84b, 0xd1ad5096, 0x782ba76d, 0xf0574eda, 0x3bdf9bf5, - 0x77bf37ea, 0xef7e6fd4, 0x058dd9e9, 0x0b1bb3d2, 0x163767a4, - 0x2c6ecf48, 0x58dd9e90, 0xb1bb3d20, 0xb8077c01, 0xab7ffe43, - 0x8d8efac7, 0xc06cf3cf, 0x5ba8e1df, 0xb751c3be, 0xb5d2813d, - 0xb0d4043b, 0xbad90e37 - }, - { - 0xb4247b20, 0xb339f001, 0xbd02e643, 0xa174cac7, 0x999893cf, - 0xe84021df, 0x0bf145ff, 0x17e28bfe, 0x2fc517fc, 0x5f8a2ff8, - 0xbf145ff0, 0xa559b9a1, 0x91c27503, 0xf8f5ec47, 0x2a9adecf, - 0x5535bd9e, 0xaa6b7b3c, 0x8fa7f039, 0xc43ee633, 0x530cca27, - 0xa619944e, 0x97422edd, 0xf5f55bfb, 0x309bb1b7, 0x6137636e, - 0xc26ec6dc, 0x5fac8bf9, 0xbf5917f2, 0xa5c329a5, 0x90f7550b, - 0xfa9fac57, 0x2e4e5eef - }, - { - 0x695186a7, 0xd2a30d4e, 0x7e371cdd, 0xfc6e39ba, 0x23ad7535, - 0x475aea6a, 0x8eb5d4d4, 0xc61aafe9, 0x57445993, 0xae88b326, - 0x8660600d, 0xd7b1c65b, 0x74128af7, 0xe82515ee, 0x0b3b2d9d, - 0x16765b3a, 0x2cecb674, 0x59d96ce8, 0xb3b2d9d0, 0xbc14b5e1, - 0xa3586d83, 0x9dc1dd47, 0xe0f2bccf, 0x1a947fdf, 0x3528ffbe, - 0x6a51ff7c, 0xd4a3fef8, 0x7236fbb1, 0xe46df762, 0x13aae885, - 0x2755d10a, 0x4eaba214 - }, - { - 0x66bc001e, 0xcd78003c, 0x41810639, 0x83020c72, 0xdd751ea5, - 0x619b3b0b, 0xc3367616, 0x5d1dea6d, 0xba3bd4da, 0xaf06aff5, - 0x857c59ab, 0xd189b517, 0x78626c6f, 0xf0c4d8de, 0x3af8b7fd, - 0x75f16ffa, 0xebe2dff4, 0x0cb4b9a9, 0x19697352, 0x32d2e6a4, - 0x65a5cd48, 0xcb4b9a90, 0x4de63361, 0x9bcc66c2, 0xece9cbc5, - 0x02a291cb, 0x05452396, 0x0a8a472c, 0x15148e58, 0x2a291cb0, - 0x54523960, 0xa8a472c0 - }, - { - 0xb58b27b3, 0xb0674927, 0xbbbf940f, 0xac0e2e5f, 0x836d5aff, - 0xddabb3bf, 0x6026613f, 0xc04cc27e, 0x5be882bd, 0xb7d1057a, - 0xb4d30cb5, 0xb2d71f2b, 0xbedf3817, 0xa6cf766f, 0x96efea9f, - 0xf6aed37f, 0x362ca0bf, 0x6c59417e, 0xd8b282fc, 0x6a1403b9, - 0xd4280772, 0x732108a5, 0xe642114a, 0x17f524d5, 0x2fea49aa, - 0x5fd49354, 0xbfa926a8, 0xa4234b11, 0x93379063, 0xfd1e2687, - 0x214d4b4f, 0x429a969e - }, - { - 0xfe273162, 0x273f6485, 0x4e7ec90a, 0x9cfd9214, 0xe28a2269, - 0x1e654293, 0x3cca8526, 0x79950a4c, 0xf32a1498, 0x3d252f71, - 0x7a4a5ee2, 0xf494bdc4, 0x32587dc9, 0x64b0fb92, 0xc961f724, - 0x49b2e809, 0x9365d012, 0xfdbaa665, 0x20044a8b, 0x40089516, - 0x80112a2c, 0xdb535219, 0x6dd7a273, 0xdbaf44e6, 0x6c2f8f8d, - 0xd85f1f1a, 0x6bcf3875, 0xd79e70ea, 0x744de795, 0xe89bcf2a, - 0x0a469815, 0x148d302a - }, - { - 0xd3c98813, 0x7ce21667, 0xf9c42cce, 0x28f95fdd, 0x51f2bfba, - 0xa3e57f74, 0x9cbbf8a9, 0xe206f713, 0x1f7ce867, 0x3ef9d0ce, - 0x7df3a19c, 0xfbe74338, 0x2cbf8031, 0x597f0062, 0xb2fe00c4, - 0xbe8d07c9, 0xa66b09d3, 0x97a715e7, 0xf43f2d8f, 0x330f5d5f, - 0x661ebabe, 0xcc3d757c, 0x430becb9, 0x8617d972, 0xd75eb4a5, - 0x75cc6f0b, 0xeb98de16, 0x0c40ba6d, 0x188174da, 0x3102e9b4, - 0x6205d368, 0xc40ba6d0 - }, - { - 0xf7d6deb4, 0x34dcbb29, 0x69b97652, 0xd372eca4, 0x7d94df09, - 0xfb29be12, 0x2d227a65, 0x5a44f4ca, 0xb489e994, 0xb262d569, - 0xbfb4ac93, 0xa4185f67, 0x9341b88f, 0xfdf2775f, 0x2095e8ff, - 0x412bd1fe, 0x8257a3fc, 0xdfde41b9, 0x64cd8533, 0xc99b0a66, - 0x4847128d, 0x908e251a, 0xfa6d4c75, 0x2fab9eab, 0x5f573d56, - 0xbeae7aac, 0xa62df319, 0x972ae073, 0xf524c6a7, 0x31388b0f, - 0x6271161e, 0xc4e22c3c - }, - { - 0xedb88320, 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, 0x00000100, - 0x00000200, 0x00000400, 0x00000800, 0x00001000, 0x00002000, - 0x00004000, 0x00008000, 0x00010000, 0x00020000, 0x00040000, - 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, - 0x20000000, 0x40000000 - }, - { - 0x76dc4190, 0xedb88320, 0x00000001, 0x00000002, 0x00000004, - 0x00000008, 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, 0x00001000, - 0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000, - 0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, - 0x00800000, 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000 - }, - { - 0x1db71064, 0x3b6e20c8, 0x76dc4190, 0xedb88320, 0x00000001, - 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, - 0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400, - 0x00000800, 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, 0x00100000, - 0x00200000, 0x00400000, 0x00800000, 0x01000000, 0x02000000, - 0x04000000, 0x08000000 - } -}; - -#endif /* CRC32_COMB_TBL_H_ */ diff --git a/libs/zlibng/crc32_p.h b/libs/zlibng/crc32_p.h deleted file mode 100644 index 47b4b3751..000000000 --- a/libs/zlibng/crc32_p.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CRC32_P_H_ -#define CRC32_P_H_ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - - -static inline uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) { - uint32_t sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - - -#endif /* CRC32_P_H_ */ diff --git a/libs/zlibng/crc32_tbl.h b/libs/zlibng/crc32_tbl.h deleted file mode 100644 index ee2030c6c..000000000 --- a/libs/zlibng/crc32_tbl.h +++ /dev/null @@ -1,444 +0,0 @@ -#ifndef CRC32_TBL_H_ -#define CRC32_TBL_H_ - -/* crc32_tbl.h -- tables for rapid CRC calculation - * Generated automatically by makecrct.c - */ - -static const uint32_t crc_table[8][256] = -{ - { - 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 - }, - { - 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, 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, 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, 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 /* CRC32_TBL_H_ */ diff --git a/libs/zlibng/deflate.c b/libs/zlibng/deflate.c deleted file mode 100644 index 1707f75c2..000000000 --- a/libs/zlibng/deflate.c +++ /dev/null @@ -1,1782 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2016 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://tools.ietf.org/html/rfc1951 - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -#include "zbuild.h" -#include "deflate.h" -#include "deflate_p.h" -#include "functable.h" - -const char PREFIX(deflate_copyright)[] = " deflate 1.2.11.f Copyright 1995-2016 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 - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Architecture-specific hooks. - */ -#ifdef S390_DFLTCC_DEFLATE -# include "arch/s390/dfltcc_deflate.h" -#else -/* Memory management for the deflate state. Useful for allocating arch-specific extension blocks. */ -# define ZALLOC_STATE(strm, items, size) ZALLOC(strm, items, size) -# define ZFREE_STATE(strm, addr) ZFREE(strm, addr) -# define ZCOPY_STATE(dst, src, size) memcpy(dst, src, size) -/* Memory management for the window. Useful for allocation the aligned window. */ -# define ZALLOC_WINDOW(strm, items, size) ZALLOC(strm, items, size) -# define TRY_FREE_WINDOW(strm, addr) TRY_FREE(strm, addr) -/* Invoked at the beginning of deflateSetDictionary(). Useful for checking arch-specific window data. */ -# define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0) -/* Invoked at the beginning of deflateGetDictionary(). Useful for adjusting arch-specific window data. */ -# define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0) -/* Invoked at the end of deflateResetKeep(). Useful for initializing arch-specific extension blocks. */ -# define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0) -/* Invoked at the beginning of deflateParams(). Useful for updating arch-specific compression parameters. */ -# define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) do {} while (0) -/* Returns whether the last deflate(flush) operation did everything it's supposed to do. */ -# define DEFLATE_DONE(strm, flush) 1 -/* Adjusts the upper bound on compressed data length based on compression parameters and uncompressed data length. - * Useful when arch-specific deflation code behaves differently than regular zlib-ng algorithms. */ -# define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen) do {} while (0) -/* Returns whether an optimistic upper bound on compressed data length should *not* be used. - * Useful when arch-specific deflation code behaves differently than regular zlib-ng algorithms. */ -# define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) 0 -/* Invoked for each deflate() call. Useful for plugging arch-specific deflation code. */ -# define DEFLATE_HOOK(strm, flush, bstate) 0 -/* Returns whether zlib-ng should compute a checksum. Set to 0 if arch-specific deflation code already does that. */ -# define DEFLATE_NEED_CHECKSUM(strm) 1 -/* Returns whether reproducibility parameter can be set to a given value. */ -# define DEFLATE_CAN_SET_REPRODUCIBLE(strm, reproducible) 1 -#endif - -/* =========================================================================== - * Function prototypes. - */ -typedef block_state (*compress_func) (deflate_state *s, int flush); -/* Compression function. Returns the block state after the call. */ - -static int deflateStateCheck (PREFIX3(stream) *strm); -static block_state deflate_stored (deflate_state *s, int flush); -Z_INTERNAL block_state deflate_fast (deflate_state *s, int flush); -Z_INTERNAL block_state deflate_quick (deflate_state *s, int flush); -#ifndef NO_MEDIUM_STRATEGY -Z_INTERNAL block_state deflate_medium (deflate_state *s, int flush); -#endif -Z_INTERNAL block_state deflate_slow (deflate_state *s, int flush); -static block_state deflate_rle (deflate_state *s, int flush); -static block_state deflate_huff (deflate_state *s, int flush); -static void lm_init (deflate_state *s); -Z_INTERNAL unsigned read_buf (PREFIX3(stream) *strm, unsigned char *buf, unsigned size); - -extern void crc_reset(deflate_state *const s); -#ifdef X86_PCLMULQDQ_CRC -extern void crc_finalize(deflate_state *const s); -#endif -extern void copy_with_crc(PREFIX3(stream) *strm, unsigned char *dst, unsigned long size); - -/* =========================================================================== - * Local data - */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - uint16_t good_length; /* reduce lazy search above this match length */ - uint16_t max_lazy; /* do not perform lazy search above this match length */ - uint16_t nice_length; /* quit search above this match length */ - uint16_t max_chain; - compress_func func; -} config; - -static const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ - -#ifndef NO_QUICK_STRATEGY -/* 1 */ {4, 4, 8, 4, deflate_quick}, -/* 2 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -#else -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -#endif - -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -#ifdef NO_MEDIUM_STRATEGY -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -#else -/* 4 */ {4, 4, 16, 16, deflate_medium}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_medium}, -/* 6 */ {8, 16, 128, 128, deflate_medium}, -#endif - -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ -#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0)) - - -/* =========================================================================== - * Initialize the hash table. prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) do { \ - memset((unsigned char *)s->head, 0, HASH_SIZE * sizeof(*s->head)); \ - } while (0) - -/* =========================================================================== - * Slide the hash table when sliding the window down (could be avoided with 32 - * bit values at the expense of memory usage). We slide even when level == 0 to - * keep the hash table consistent if we switch back to level > 0 later. - */ -Z_INTERNAL void slide_hash_c(deflate_state *s) { - Pos *p; - unsigned n; - unsigned int wsize = s->w_size; - - n = HASH_SIZE; - p = &s->head[n]; -#ifdef NOT_TWEAK_COMPILER - do { - unsigned m; - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : 0); - } while (--n); -#else - /* As of I make this change, gcc (4.8.*) isn't able to vectorize - * this hot loop using saturated-subtraction on x86-64 architecture. - * To avoid this defect, we can change the loop such that - * o. the pointer advance forward, and - * o. demote the variable 'm' to be local to the loop, and - * choose type "Pos" (instead of 'unsigned int') for the - * variable to avoid unncessary zero-extension. - */ - { - unsigned int i; - Pos *q = p - n; - for (i = 0; i < n; i++) { - Pos m = *q; - Pos t = (Pos)wsize; - *q++ = (Pos)(m >= t ? m-t: 0); - } - } -#endif /* NOT_TWEAK_COMPILER */ - - n = wsize; - p = &s->prev[n]; -#ifdef NOT_TWEAK_COMPILER - do { - unsigned m; - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#else - { - unsigned int i; - Pos *q = p - n; - for (i = 0; i < n; i++) { - Pos m = *q; - Pos t = (Pos)wsize; - *q++ = (Pos)(m >= t ? m-t: 0); - } - } -#endif /* NOT_TWEAK_COMPILER */ -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateInit_)(PREFIX3(stream) *strm, int32_t level, const char *version, int32_t stream_size) { - return PREFIX(deflateInit2_)(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); - /* Todo: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateInit2_)(PREFIX3(stream) *strm, int32_t level, int32_t method, int32_t windowBits, - int32_t memLevel, int32_t strategy, const char *version, int32_t stream_size) { - uint32_t window_padding = 0; - deflate_state *s; - int wrap = 1; - static const char my_version[] = PREFIX2(VERSION); - -#if defined(X86_FEATURES) - x86_check_features(); -#elif defined(ARM_FEATURES) - arm_check_features(); -#endif - - if (version == NULL || version[0] != my_version[0] || stream_size != sizeof(PREFIX3(stream))) { - return Z_VERSION_ERROR; - } - if (strm == NULL) - return Z_STREAM_ERROR; - - strm->msg = NULL; - if (strm->zalloc == NULL) { - strm->zalloc = zng_calloc; - strm->opaque = NULL; - } - if (strm->zfree == NULL) - strm->zfree = zng_cfree; - - if (level == Z_DEFAULT_COMPRESSION) - level = 6; - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; -#ifdef GZIP - } else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; -#endif - } - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || - windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED || - (windowBits == 8 && wrap != 1)) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) - windowBits = 9; /* until 256-byte window bug fixed */ - -#if !defined(NO_QUICK_STRATEGY) && !defined(S390_DFLTCC_DEFLATE) - if (level == 1) - windowBits = 13; -#endif - - s = (deflate_state *) ZALLOC_STATE(strm, 1, sizeof(deflate_state)); - if (s == NULL) - return Z_MEM_ERROR; - strm->state = (struct internal_state *)s; - s->strm = strm; - s->status = INIT_STATE; /* to pass state test in deflateReset() */ - - s->wrap = wrap; - s->gzhead = NULL; - s->w_bits = (unsigned int)windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - -#ifdef X86_PCLMULQDQ_CRC - window_padding = 8; -#endif - - s->window = (unsigned char *) ZALLOC_WINDOW(strm, s->w_size + window_padding, 2*sizeof(unsigned char)); - s->prev = (Pos *) ZALLOC(strm, s->w_size, sizeof(Pos)); - memset(s->prev, 0, s->w_size * sizeof(Pos)); - s->head = (Pos *) ZALLOC(strm, HASH_SIZE, sizeof(Pos)); - - s->high_water = 0; /* nothing written to s->window yet */ - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - /* 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 = (unsigned char *) ZALLOC(strm, s->lit_bufsize, 4); - s->pending_buf_size = s->lit_bufsize * 4; - - if (s->window == NULL || s->prev == NULL || s->head == NULL || s->pending_buf == NULL) { - s->status = FINISH_STATE; - strm->msg = ERR_MSG(Z_MEM_ERROR); - PREFIX(deflateEnd)(strm); - return Z_MEM_ERROR; - } - 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; - s->block_open = 0; - s->reproducible = 0; - - return PREFIX(deflateReset)(strm); -} - -/* ========================================================================= - * Check for a valid deflate stream state. Return 0 if ok, 1 if not. - */ -static int deflateStateCheck (PREFIX3(stream) *strm) { - deflate_state *s; - if (strm == NULL || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) - return 1; - s = strm->state; - if (s == NULL || s->strm != strm || (s->status != INIT_STATE && -#ifdef GZIP - s->status != GZIP_STATE && -#endif - s->status != EXTRA_STATE && - s->status != NAME_STATE && - s->status != COMMENT_STATE && - s->status != HCRC_STATE && - s->status != BUSY_STATE && - s->status != FINISH_STATE)) - return 1; - return 0; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateSetDictionary)(PREFIX3(stream) *strm, const uint8_t *dictionary, uint32_t dictLength) { - deflate_state *s; - unsigned int str, n; - int wrap; - uint32_t avail; - const unsigned char *next; - - if (deflateStateCheck(strm) || dictionary == NULL) - return Z_STREAM_ERROR; - s = strm->state; - wrap = s->wrap; - if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) - return Z_STREAM_ERROR; - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap == 1) - strm->adler = functable.adler32(strm->adler, dictionary, dictLength); - DEFLATE_SET_DICTIONARY_HOOK(strm, dictionary, dictLength); /* hook for IBM Z DFLTCC */ - s->wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s->w_size) { - if (wrap == 0) { /* already empty otherwise */ - CLEAR_HASH(s); - s->strstart = 0; - s->block_start = 0; - s->insert = 0; - } - dictionary += dictLength - s->w_size; /* use the tail */ - dictLength = s->w_size; - } - - /* insert dictionary into window and hash */ - avail = strm->avail_in; - next = strm->next_in; - strm->avail_in = dictLength; - strm->next_in = (z_const unsigned char *)dictionary; - fill_window(s); - while (s->lookahead >= MIN_MATCH) { - str = s->strstart; - n = s->lookahead - (MIN_MATCH-1); - functable.insert_string(s, str, n); - s->strstart = str + n; - s->lookahead = MIN_MATCH-1; - fill_window(s); - } - s->strstart += s->lookahead; - s->block_start = (int)s->strstart; - s->insert = s->lookahead; - s->lookahead = 0; - s->prev_length = MIN_MATCH-1; - s->match_available = 0; - strm->next_in = (z_const unsigned char *)next; - strm->avail_in = avail; - s->wrap = wrap; - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateGetDictionary)(PREFIX3(stream) *strm, uint8_t *dictionary, uint32_t *dictLength) { - deflate_state *s; - unsigned int len; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - DEFLATE_GET_DICTIONARY_HOOK(strm, dictionary, dictLength); /* hook for IBM Z DFLTCC */ - s = strm->state; - len = s->strstart + s->lookahead; - if (len > s->w_size) - len = s->w_size; - if (dictionary != NULL && len) - memcpy(dictionary, s->window + s->strstart + s->lookahead - len, len); - if (dictLength != NULL) - *dictLength = len; - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateResetKeep)(PREFIX3(stream) *strm) { - deflate_state *s; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - - strm->total_in = strm->total_out = 0; - strm->msg = NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - - s->status = -#ifdef GZIP - s->wrap == 2 ? GZIP_STATE : -#endif - INIT_STATE; - -#ifdef GZIP - if (s->wrap == 2) - crc_reset(s); - else -#endif - strm->adler = ADLER32_INITIAL_VALUE; - s->last_flush = -2; - - zng_tr_init(s); - - DEFLATE_RESET_KEEP_HOOK(strm); /* hook for IBM Z DFLTCC */ - - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateReset)(PREFIX3(stream) *strm) { - int ret; - - ret = PREFIX(deflateResetKeep)(strm); - if (ret == Z_OK) - lm_init(strm->state); - return ret; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateSetHeader)(PREFIX3(stream) *strm, PREFIX(gz_headerp) head) { - if (deflateStateCheck(strm) || strm->state->wrap != 2) - return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflatePending)(PREFIX3(stream) *strm, uint32_t *pending, int32_t *bits) { - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - if (pending != NULL) - *pending = strm->state->pending; - if (bits != NULL) - *bits = strm->state->bi_valid; - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflatePrime)(PREFIX3(stream) *strm, int32_t bits, int32_t value) { - deflate_state *s; - uint64_t value64 = (uint64_t)value; - int32_t put; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - s = strm->state; - if (bits < 0 || bits > BIT_BUF_SIZE || bits > (int32_t)(sizeof(value) << 3) || - s->sym_buf < s->pending_out + ((BIT_BUF_SIZE + 7) >> 3)) - return Z_BUF_ERROR; - do { - put = BIT_BUF_SIZE - s->bi_valid; - if (put > bits) - put = bits; - if (s->bi_valid == 0) - s->bi_buf = value64; - else - s->bi_buf |= (value64 & ((UINT64_C(1) << put) - 1)) << s->bi_valid; - s->bi_valid += put; - zng_tr_flush_bits(s); - value64 >>= put; - bits -= put; - } while (bits); - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateParams)(PREFIX3(stream) *strm, int32_t level, int32_t strategy) { - deflate_state *s; - compress_func func; - int hook_flush = Z_NO_FLUSH; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - s = strm->state; - - if (level == Z_DEFAULT_COMPRESSION) - level = 6; - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) - return Z_STREAM_ERROR; - DEFLATE_PARAMS_HOOK(strm, level, strategy, &hook_flush); /* hook for IBM Z DFLTCC */ - func = configuration_table[s->level].func; - - if (((strategy != s->strategy || func != configuration_table[level].func) && s->last_flush != -2) - || hook_flush != Z_NO_FLUSH) { - /* Flush the last buffer. Use Z_BLOCK mode, unless the hook requests a "stronger" one. */ - int flush = RANK(hook_flush) > RANK(Z_BLOCK) ? hook_flush : Z_BLOCK; - int err = PREFIX(deflate)(strm, flush); - if (err == Z_STREAM_ERROR) - return err; - if (strm->avail_in || ((int)s->strstart - s->block_start) + s->lookahead || !DEFLATE_DONE(strm, flush)) - return Z_BUF_ERROR; - } - if (s->level != level) { - if (s->level == 0 && s->matches != 0) { - if (s->matches == 1) { - functable.slide_hash(s); - } else { - CLEAR_HASH(s); - } - s->matches = 0; - } - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateTune)(PREFIX3(stream) *strm, int32_t good_length, int32_t max_lazy, int32_t nice_length, int32_t max_chain) { - deflate_state *s; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - s = strm->state; - s->good_match = (unsigned int)good_length; - s->max_lazy_match = (unsigned int)max_lazy; - s->nice_match = nice_length; - s->max_chain_length = (unsigned int)max_chain; - return Z_OK; -} - -/* ========================================================================= - * 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 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. - * - * 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. - */ -unsigned long Z_EXPORT PREFIX(deflateBound)(PREFIX3(stream) *strm, unsigned long sourceLen) { - deflate_state *s; - unsigned long complen, wraplen; - - /* conservative upper bound for compressed data */ - complen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; - DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen); /* hook for IBM Z DFLTCC */ - - /* if can't get parameters, return conservative bound plus zlib wrapper */ - if (deflateStateCheck(strm)) - return complen + 6; - - /* compute wrapper length */ - s = strm->state; - switch (s->wrap) { - case 0: /* raw deflate */ - wraplen = 0; - break; - case 1: /* zlib wrapper */ - wraplen = 6 + (s->strstart ? 4 : 0); - break; -#ifdef GZIP - case 2: /* gzip wrapper */ - wraplen = 18; - if (s->gzhead != NULL) { /* user-supplied gzip header */ - unsigned char *str; - if (s->gzhead->extra != NULL) { - wraplen += 2 + s->gzhead->extra_len; - } - str = s->gzhead->name; - if (str != NULL) { - do { - wraplen++; - } while (*str++); - } - str = s->gzhead->comment; - if (str != NULL) { - do { - wraplen++; - } while (*str++); - } - if (s->gzhead->hcrc) - wraplen += 2; - } - break; -#endif - default: /* for compiler happiness */ - wraplen = 6; - } - - /* if not default parameters, return conservative bound */ - if (DEFLATE_NEED_CONSERVATIVE_BOUND(strm) || /* hook for IBM Z DFLTCC */ - s->w_bits != 15 || HASH_BITS < 15) - return complen + wraplen; - - /* default settings: return tight bound for that case */ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13 - 6 + wraplen; -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output, except for - * some deflate_stored() output, goes through this function so some - * applications may wish to modify it to avoid allocating a large - * strm->next_out buffer and copying into it. (See also read_buf()). - */ -Z_INTERNAL void flush_pending(PREFIX3(stream) *strm) { - uint32_t len; - deflate_state *s = strm->state; - - zng_tr_flush_bits(s); - len = s->pending; - if (len > strm->avail_out) - len = strm->avail_out; - if (len == 0) - return; - - Tracev((stderr, "[FLUSH]")); - memcpy(strm->next_out, s->pending_out, len); - strm->next_out += len; - s->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - s->pending -= len; - if (s->pending == 0) - s->pending_out = s->pending_buf; -} - -/* =========================================================================== - * Update the header CRC with the bytes s->pending_buf[beg..s->pending - 1]. - */ -#define HCRC_UPDATE(beg) \ - do { \ - if (s->gzhead->hcrc && s->pending > (beg)) \ - strm->adler = PREFIX(crc32)(strm->adler, s->pending_buf + (beg), s->pending - (beg)); \ - } while (0) - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflate)(PREFIX3(stream) *strm, int32_t flush) { - int32_t old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) - return Z_STREAM_ERROR; - s = strm->state; - - if (strm->next_out == NULL || (strm->avail_in != 0 && strm->next_in == NULL) - || (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - old_flush = s->last_flush; - s->last_flush = flush; - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Write the header */ - if (s->status == INIT_STATE && s->wrap == 0) - s->status = BUSY_STATE; - if (s->status == INIT_STATE) { - /* zlib header */ - unsigned int header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - unsigned int level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) - header |= PRESET_DICT; - header += 31 - (header % 31); - - put_short_msb(s, (uint16_t)header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) - put_uint32_msb(s, strm->adler); - strm->adler = ADLER32_INITIAL_VALUE; - s->status = BUSY_STATE; - - /* Compression must start with an empty pending buffer */ - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } -#ifdef GZIP - if (s->status == GZIP_STATE) { - /* gzip header */ - crc_reset(s); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == NULL) { - put_uint32(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - - /* Compression must start with an empty pending buffer */ - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == NULL ? 0 : 4) + - (s->gzhead->name == NULL ? 0 : 8) + - (s->gzhead->comment == NULL ? 0 : 16) - ); - put_uint32(s, s->gzhead->time); - put_byte(s, s->level == 9 ? 2 : (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != NULL) - put_short(s, (uint16_t)s->gzhead->extra_len); - if (s->gzhead->hcrc) - strm->adler = PREFIX(crc32)(strm->adler, s->pending_buf, s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != NULL) { - uint32_t beg = s->pending; /* start of bytes to update crc */ - uint32_t left = (s->gzhead->extra_len & 0xffff) - s->gzindex; - - while (s->pending + left > s->pending_buf_size) { - uint32_t copy = s->pending_buf_size - s->pending; - memcpy(s->pending_buf + s->pending, s->gzhead->extra + s->gzindex, copy); - s->pending = s->pending_buf_size; - HCRC_UPDATE(beg); - s->gzindex += copy; - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - beg = 0; - left -= copy; - } - memcpy(s->pending_buf + s->pending, s->gzhead->extra + s->gzindex, left); - s->pending += left; - HCRC_UPDATE(beg); - s->gzindex = 0; - } - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != NULL) { - uint32_t beg = s->pending; /* start of bytes to update crc */ - unsigned char val; - - do { - if (s->pending == s->pending_buf_size) { - HCRC_UPDATE(beg); - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - beg = 0; - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - HCRC_UPDATE(beg); - s->gzindex = 0; - } - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != NULL) { - uint32_t beg = s->pending; /* start of bytes to update crc */ - unsigned char val; - - do { - if (s->pending == s->pending_buf_size) { - HCRC_UPDATE(beg); - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - beg = 0; - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - HCRC_UPDATE(beg); - } - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) { - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } - put_short(s, (uint16_t)strm->adler); - crc_reset(s); - } - s->status = BUSY_STATE; - - /* Compression must start with an empty pending buffer */ - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } -#endif - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = DEFLATE_HOOK(strm, flush, &bstate) ? bstate : /* hook for IBM Z DFLTCC */ - s->level == 0 ? deflate_stored(s, flush) : - s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : - s->strategy == Z_RLE ? deflate_rle(s, flush) : - (*(configuration_table[s->level].func))(s, flush); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - zng_tr_align(s); - } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - zng_tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - if (s->lookahead == 0) { - s->strstart = 0; - s->block_start = 0; - s->insert = 0; - } - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - - if (flush != Z_FINISH) - return Z_OK; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { -# ifdef X86_PCLMULQDQ_CRC - crc_finalize(s); -# endif - put_uint32(s, strm->adler); - put_uint32(s, (uint32_t)strm->total_in); - } else -#endif - if (s->wrap == 1) - put_uint32_msb(s, strm->adler); - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) - s->wrap = -s->wrap; /* write the trailer only once! */ - if (s->pending == 0) { - Assert(s->bi_valid == 0, "bi_buf not flushed"); - return Z_STREAM_END; - } - return Z_OK; -} - -/* ========================================================================= */ -int32_t Z_EXPORT PREFIX(deflateEnd)(PREFIX3(stream) *strm) { - int32_t status; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - - status = strm->state->status; - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE_WINDOW(strm, strm->state->window); - - ZFREE_STATE(strm, strm->state); - strm->state = NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - */ -int32_t Z_EXPORT PREFIX(deflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *source) { - deflate_state *ds; - deflate_state *ss; - uint32_t window_padding = 0; - - if (deflateStateCheck(source) || dest == NULL) - return Z_STREAM_ERROR; - - ss = source->state; - - memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream))); - - ds = (deflate_state *) ZALLOC_STATE(dest, 1, sizeof(deflate_state)); - if (ds == NULL) - return Z_MEM_ERROR; - dest->state = (struct internal_state *) ds; - ZCOPY_STATE((void *)ds, (void *)ss, sizeof(deflate_state)); - ds->strm = dest; - -#ifdef X86_PCLMULQDQ_CRC - window_padding = 8; -#endif - - ds->window = (unsigned char *) ZALLOC_WINDOW(dest, ds->w_size + window_padding, 2*sizeof(unsigned char)); - ds->prev = (Pos *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Pos *) ZALLOC(dest, HASH_SIZE, sizeof(Pos)); - ds->pending_buf = (unsigned char *) ZALLOC(dest, ds->lit_bufsize, 4); - - if (ds->window == NULL || ds->prev == NULL || ds->head == NULL || ds->pending_buf == NULL) { - PREFIX(deflateEnd)(dest); - return Z_MEM_ERROR; - } - - memcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(unsigned char)); - memcpy((void *)ds->prev, (void *)ss->prev, ds->w_size * sizeof(Pos)); - memcpy((void *)ds->head, (void *)ss->head, HASH_SIZE * sizeof(Pos)); - memcpy(ds->pending_buf, ss->pending_buf, ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - 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; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -Z_INTERNAL unsigned read_buf(PREFIX3(stream) *strm, unsigned char *buf, unsigned size) { - uint32_t len = strm->avail_in; - - if (len > size) - len = size; - if (len == 0) - return 0; - - strm->avail_in -= len; - - if (!DEFLATE_NEED_CHECKSUM(strm)) { - memcpy(buf, strm->next_in, len); -#ifdef GZIP - } else if (strm->state->wrap == 2) { - copy_with_crc(strm, buf, len); -#endif - } else { - memcpy(buf, strm->next_in, len); - if (strm->state->wrap == 1) - strm->adler = functable.adler32(strm->adler, buf, len); - } - strm->next_in += len; - strm->total_in += len; - - return len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -static void lm_init(deflate_state *s) { - s->window_size = 2 * s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0; - s->lookahead = 0; - s->insert = 0; - s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->match_start = 0; -} - -#ifdef ZLIB_DEBUG -#define EQUAL 0 -/* result of memcmp for equal strings */ - -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -void check_match(deflate_state *s, Pos start, Pos match, int length) { - /* check that the match length is valid*/ - if (length < MIN_MATCH || length > MAX_MATCH) { - fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); - z_error("invalid match length"); - } - /* check that the match isn't at the same position as the start string */ - if (match == start) { - fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); - z_error("invalid match position"); - } - /* check that the match is indeed a match */ - if (memcmp(s->window + match, s->window + start, length) != EQUAL) { - int32_t i = 0; - fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); - do { - fprintf(stderr, " %03d: match [%02x] start [%02x]\n", i++, s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr, "\\[%u,%d]", start-match, length); - do { - putc(s->window[start++], stderr); - } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* ZLIB_DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ - -void Z_INTERNAL fill_window(deflate_state *s) { - unsigned n; - unsigned int more; /* Amount of free space at the end of the window. */ - unsigned int wsize = s->w_size; - - Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s->window_size - s->lookahead - s->strstart; - - /* 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)) { - memcpy(s->window, s->window+wsize, (unsigned)wsize); - if (s->match_start >= wsize) { - s->match_start -= wsize; - } else { - s->match_start = 0; - s->prev_length = 0; - } - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (int)wsize; - if (s->insert > s->strstart) - s->insert = s->strstart; - functable.slide_hash(s); - more += wsize; - } - if (s->strm->avail_in == 0) - break; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead + s->insert >= MIN_MATCH) { - unsigned int str = s->strstart - s->insert; - if (str >= 1) - functable.quick_insert_string(s, str + 2 - MIN_MATCH); -#if MIN_MATCH != 3 -#error Call insert_string() MIN_MATCH-3 more times - while (s->insert) { - functable.quick_insert_string(s, str); - str++; - s->insert--; - if (s->lookahead + s->insert < MIN_MATCH) - break; - } -#else - unsigned int count; - if (UNLIKELY(s->lookahead == 1)) { - count = s->insert - 1; - } else { - count = s->insert; - } - if (count > 0) { - functable.insert_string(s, str, count); - s->insert -= count; - } -#endif - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - if (s->high_water < s->window_size) { - unsigned int curr = s->strstart + s->lookahead; - unsigned int init; - - if (s->high_water < curr) { - /* Previous high water mark below current data -- zero WIN_INIT - * bytes or up to end of window, whichever is less. - */ - init = s->window_size - curr; - if (init > WIN_INIT) - init = WIN_INIT; - memset(s->window + curr, 0, init); - s->high_water = curr + init; - } else if (s->high_water < curr + WIN_INIT) { - /* High water mark at or above current data, but below current data - * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - * to end of window, whichever is less. - */ - init = curr + WIN_INIT - s->high_water; - if (init > s->window_size - s->high_water) - init = s->window_size - s->high_water; - memset(s->window + s->high_water, 0, init); - s->high_water += init; - } - } - - Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD, - "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * - * In case deflateParams() is used to later switch to a non-zero compression - * level, s->matches (otherwise unused when storing) keeps track of the number - * of hash table slides to perform. If s->matches is 1, then one hash table - * slide will be done when switching. If s->matches is 2, the maximum value - * allowed here, then the hash table will be cleared, since two or more slides - * is the same as a clear. - * - * 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. - */ -static block_state deflate_stored(deflate_state *s, int flush) { - /* Smallest worthy block size when not flushing or finishing. By default - * this is 32K. This can be as small as 507 bytes for memLevel == 1. For - * large input and output buffers, the stored block size will be larger. - */ - unsigned min_block = MIN(s->pending_buf_size - 5, s->w_size); - - /* Copy as many min_block or larger stored blocks directly to next_out as - * possible. If flushing, copy the remaining available input to next_out as - * stored blocks, if there is enough space. - */ - unsigned len, left, have, last = 0; - unsigned used = s->strm->avail_in; - do { - /* Set len to the maximum size block that we can copy directly with the - * available input data and output space. Set left to how much of that - * would be copied from what's left in the window. - */ - len = MAX_STORED; /* maximum deflate stored block length */ - have = (s->bi_valid + 42) >> 3; /* number of header bytes */ - if (s->strm->avail_out < have) /* need room for header */ - break; - /* maximum stored block length that will fit in avail_out: */ - have = s->strm->avail_out - have; - left = (int)s->strstart - s->block_start; /* bytes left in window */ - if (len > (unsigned long)left + s->strm->avail_in) - len = left + s->strm->avail_in; /* limit len to the input */ - if (len > have) - len = have; /* limit len to the output */ - - /* If the stored block would be less than min_block in length, or if - * unable to copy all of the available input when flushing, then try - * copying to the window and the pending buffer instead. Also don't - * write an empty block when flushing -- deflate() does that. - */ - if (len < min_block && ((len == 0 && flush != Z_FINISH) || flush == Z_NO_FLUSH || len != left + s->strm->avail_in)) - break; - - /* Make a dummy stored block in pending to get the header bytes, - * including any pending bits. This also updates the debugging counts. - */ - last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0; - zng_tr_stored_block(s, (char *)0, 0L, last); - - /* Replace the lengths in the dummy stored block with len. */ - s->pending -= 4; - put_short(s, (uint16_t)len); - put_short(s, (uint16_t)~len); - - /* Write the stored block header bytes. */ - flush_pending(s->strm); - - /* Update debugging counts for the data about to be copied. */ - cmpr_bits_add(s, len << 3); - sent_bits_add(s, len << 3); - - /* Copy uncompressed bytes from the window to next_out. */ - if (left) { - if (left > len) - left = len; - memcpy(s->strm->next_out, s->window + s->block_start, left); - s->strm->next_out += left; - s->strm->avail_out -= left; - s->strm->total_out += left; - s->block_start += (int)left; - len -= left; - } - - /* Copy uncompressed bytes directly from next_in to next_out, updating - * the check value. - */ - if (len) { - read_buf(s->strm, s->strm->next_out, len); - s->strm->next_out += len; - s->strm->avail_out -= len; - s->strm->total_out += len; - } - } while (last == 0); - - /* Update the sliding window with the last s->w_size bytes of the copied - * data, or append all of the copied data to the existing window if less - * than s->w_size bytes were copied. Also update the number of bytes to - * insert in the hash tables, in the event that deflateParams() switches to - * a non-zero compression level. - */ - used -= s->strm->avail_in; /* number of input bytes directly copied */ - if (used) { - /* If any input was used, then no unused input remains in the window, - * therefore s->block_start == s->strstart. - */ - if (used >= s->w_size) { /* supplant the previous history */ - s->matches = 2; /* clear hash */ - memcpy(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) { - /* Slide the window down. */ - s->strstart -= s->w_size; - memcpy(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; - } - memcpy(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 = (int)s->strstart; - } - if (s->high_water < s->strstart) - s->high_water = s->strstart; - - /* If the last block was written to next_out, then done. */ - if (last) - return finish_done; - - /* If flushing and all input has been consumed, then done. */ - if (flush != Z_NO_FLUSH && flush != Z_FINISH && s->strm->avail_in == 0 && (int)s->strstart == s->block_start) - return block_done; - - /* Fill the window with any remaining input. */ - have = s->window_size - s->strstart; - if (s->strm->avail_in > have && s->block_start >= (int)s->w_size) { - /* Slide the window down. */ - s->block_start -= (int)s->w_size; - s->strstart -= s->w_size; - memcpy(s->window, s->window + s->w_size, s->strstart); - 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; - - /* There was not enough avail_out to write a complete worthy or flushed - * stored block to next_out. Write a stored block to pending instead, if we - * have enough input for a worthy block, or if flushing and there is enough - * room for the remaining input as a stored block in the pending buffer. - */ - have = (s->bi_valid + 42) >> 3; /* number of header bytes */ - /* maximum stored block length that will fit in pending: */ - have = MIN(s->pending_buf_size - have, MAX_STORED); - min_block = MIN(have, s->w_size); - left = (int)s->strstart - s->block_start; - if (left >= min_block || ((left || flush == Z_FINISH) && flush != Z_NO_FLUSH && s->strm->avail_in == 0 && left <= have)) { - len = MIN(left, have); - last = flush == Z_FINISH && s->strm->avail_in == 0 && len == left ? 1 : 0; - zng_tr_stored_block(s, (char *)s->window + s->block_start, len, last); - s->block_start += (int)len; - flush_pending(s->strm); - } - - /* We've done all we can with the available input and output. */ - return last ? finish_started : need_more; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -static block_state deflate_rle(deflate_state *s, int flush) { - int bflush = 0; /* set if current block must be flushed */ - unsigned int prev; /* byte at distance one to match */ - unsigned char *scan, *strend; /* scan goes up to strend for length of run */ - uint32_t match_len = 0; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s->lookahead <= MAX_MATCH) { - fill_window(s); - if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) - return need_more; - if (s->lookahead == 0) - break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - if (s->lookahead >= MIN_MATCH && s->strstart > 0) { - scan = s->window + s->strstart - 1; - prev = *scan; - if (prev == *++scan && prev == *++scan && prev == *++scan) { - strend = s->window + s->strstart + MAX_MATCH; - do { - } while (prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - scan < strend); - match_len = MAX_MATCH - (unsigned int)(strend - scan); - if (match_len > s->lookahead) - match_len = s->lookahead; - } - Assert(scan <= s->window + s->window_size - 1, "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (match_len >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, match_len); - - bflush = zng_tr_tally_dist(s, 1, match_len - MIN_MATCH); - - s->lookahead -= match_len; - s->strstart += match_len; - match_len = 0; - } else { - /* No match, output a literal byte */ - bflush = zng_tr_tally_lit(s, s->window[s->strstart]); - s->lookahead--; - s->strstart++; - } - if (bflush) - FLUSH_BLOCK(s, 0); - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->sym_next) - FLUSH_BLOCK(s, 0); - return block_done; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -static block_state deflate_huff(deflate_state *s, int flush) { - int bflush = 0; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s->lookahead == 0) { - fill_window(s); - if (s->lookahead == 0) { - if (flush == Z_NO_FLUSH) - return need_more; - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - bflush = zng_tr_tally_lit(s, s->window[s->strstart]); - s->lookahead--; - s->strstart++; - if (bflush) - FLUSH_BLOCK(s, 0); - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->sym_next) - FLUSH_BLOCK(s, 0); - return block_done; -} - -#ifndef ZLIB_COMPAT -/* ========================================================================= - * Checks whether buffer size is sufficient and whether this parameter is a duplicate. - */ -static int32_t deflateSetParamPre(zng_deflate_param_value **out, size_t min_size, zng_deflate_param_value *param) { - int32_t buf_error = param->size < min_size; - - if (*out != NULL) { - (*out)->status = Z_BUF_ERROR; - buf_error = 1; - } - *out = param; - return buf_error; -} - -/* ========================================================================= */ -int32_t Z_EXPORT zng_deflateSetParams(zng_stream *strm, zng_deflate_param_value *params, size_t count) { - size_t i; - deflate_state *s; - zng_deflate_param_value *new_level = NULL; - zng_deflate_param_value *new_strategy = NULL; - zng_deflate_param_value *new_reproducible = NULL; - int param_buf_error; - int version_error = 0; - int buf_error = 0; - int stream_error = 0; - int ret; - int val; - - /* Initialize the statuses. */ - for (i = 0; i < count; i++) - params[i].status = Z_OK; - - /* Check whether the stream state is consistent. */ - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - s = strm->state; - - /* Check buffer sizes and detect duplicates. */ - for (i = 0; i < count; i++) { - switch (params[i].param) { - case Z_DEFLATE_LEVEL: - param_buf_error = deflateSetParamPre(&new_level, sizeof(int), ¶ms[i]); - break; - case Z_DEFLATE_STRATEGY: - param_buf_error = deflateSetParamPre(&new_strategy, sizeof(int), ¶ms[i]); - break; - case Z_DEFLATE_REPRODUCIBLE: - param_buf_error = deflateSetParamPre(&new_reproducible, sizeof(int), ¶ms[i]); - break; - default: - params[i].status = Z_VERSION_ERROR; - version_error = 1; - param_buf_error = 0; - break; - } - if (param_buf_error) { - params[i].status = Z_BUF_ERROR; - buf_error = 1; - } - } - /* Exit early if small buffers or duplicates are detected. */ - if (buf_error) - return Z_BUF_ERROR; - - /* Apply changes, remember if there were errors. */ - if (new_level != NULL || new_strategy != NULL) { - ret = PREFIX(deflateParams)(strm, new_level == NULL ? s->level : *(int *)new_level->buf, - new_strategy == NULL ? s->strategy : *(int *)new_strategy->buf); - if (ret != Z_OK) { - if (new_level != NULL) - new_level->status = Z_STREAM_ERROR; - if (new_strategy != NULL) - new_strategy->status = Z_STREAM_ERROR; - stream_error = 1; - } - } - if (new_reproducible != NULL) { - val = *(int *)new_reproducible->buf; - if (DEFLATE_CAN_SET_REPRODUCIBLE(strm, val)) { - s->reproducible = val; - } else { - new_reproducible->status = Z_STREAM_ERROR; - stream_error = 1; - } - } - - /* Report version errors only if there are no real errors. */ - return stream_error ? Z_STREAM_ERROR : (version_error ? Z_VERSION_ERROR : Z_OK); -} - -/* ========================================================================= */ -int32_t Z_EXPORT zng_deflateGetParams(zng_stream *strm, zng_deflate_param_value *params, size_t count) { - deflate_state *s; - size_t i; - int32_t buf_error = 0; - int32_t version_error = 0; - - /* Initialize the statuses. */ - for (i = 0; i < count; i++) - params[i].status = Z_OK; - - /* Check whether the stream state is consistent. */ - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - s = strm->state; - - for (i = 0; i < count; i++) { - switch (params[i].param) { - case Z_DEFLATE_LEVEL: - if (params[i].size < sizeof(int)) - params[i].status = Z_BUF_ERROR; - else - *(int *)params[i].buf = s->level; - break; - case Z_DEFLATE_STRATEGY: - if (params[i].size < sizeof(int)) - params[i].status = Z_BUF_ERROR; - else - *(int *)params[i].buf = s->strategy; - break; - case Z_DEFLATE_REPRODUCIBLE: - if (params[i].size < sizeof(int)) - params[i].status = Z_BUF_ERROR; - else - *(int *)params[i].buf = s->reproducible; - break; - default: - params[i].status = Z_VERSION_ERROR; - version_error = 1; - break; - } - if (params[i].status == Z_BUF_ERROR) - buf_error = 1; - } - return buf_error ? Z_BUF_ERROR : (version_error ? Z_VERSION_ERROR : Z_OK); -} -#endif diff --git a/libs/zlibng/deflate.h b/libs/zlibng/deflate.h deleted file mode 100644 index 03ea3126f..000000000 --- a/libs/zlibng/deflate.h +++ /dev/null @@ -1,411 +0,0 @@ -#ifndef DEFLATE_H_ -#define DEFLATE_H_ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -#include "zutil.h" -#include "zendian.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define BIT_BUF_SIZE 64 -/* size of bit buffer in bi_buf */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define INIT_STATE 42 /* zlib header -> BUSY_STATE */ -#ifdef GZIP -# define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */ -#endif -#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */ -#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */ -#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */ -#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */ -#define BUSY_STATE 113 /* deflate -> FINISH_STATE */ -#define FINISH_STATE 666 /* stream complete */ -/* Stream status */ - -#define HASH_BITS 16u /* log2(HASH_SIZE) */ -#define HASH_SIZE 65536u /* number of elements in hash table */ -#define HASH_MASK (HASH_SIZE - 1u) /* HASH_SIZE-1 */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - uint16_t freq; /* frequency count */ - uint16_t code; /* bit string */ - } fc; - union { - uint16_t dad; /* father node in Huffman tree */ - uint16_t len; /* length of bit string */ - } dl; -} ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - const static_tree_desc *stat_desc; /* the corresponding static tree */ -} tree_desc; - -typedef uint16_t Pos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. - */ - -typedef struct internal_state { - PREFIX3(stream) *strm; /* pointer back to this zlib stream */ - unsigned char *pending_buf; /* output still pending */ - unsigned char *pending_out; /* next pending byte to output to the stream */ - uint32_t pending_buf_size; /* size of pending_buf */ - uint32_t pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - uint32_t gzindex; /* where in extra, name, or comment */ - PREFIX(gz_headerp) gzhead; /* gzip header information to write */ - int status; /* as the name implies */ - int last_flush; /* value of flush param for previous deflate call */ - int reproducible; /* Whether reproducible compression results are required. */ - - int block_open; - /* Whether or not a block is currently open for the QUICK deflation scheme. - * This is set to 1 if there is an active block, or 0 if the block was just closed. - */ - - /* used by deflate.c: */ - - unsigned int w_size; /* LZ77 window size (32K by default) */ - unsigned int w_bits; /* log2(w_size) (8..16) */ - unsigned int w_mask; /* w_size - 1 */ - unsigned int lookahead; /* number of valid bytes ahead in window */ - - unsigned int high_water; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ - - unsigned int window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - unsigned char *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - Pos *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Pos *head; /* Heads of the hash chains or 0. */ - - int block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - unsigned int match_length; /* length of best match */ - Pos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - unsigned int strstart; /* start of string to insert */ - unsigned int match_start; /* start of matching string */ - - unsigned int prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - unsigned int max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this length. - * A higher limit improves compression ratio but degrades the speed. - */ - - unsigned int max_lazy_match; - /* Attempt to find a better match only when the current match is strictly smaller - * than this value. This mechanism is used only for compression levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - unsigned int good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - -#if defined(__x86_64__) || defined(_M_X64) || defined(__i386) || defined(_M_IX86) - /* Only used if X86_PCLMULQDQ_CRC is defined */ - unsigned crc0[4 * 5]; -#endif - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to suppress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - uint16_t bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - unsigned char depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - unsigned int lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - unsigned char *sym_buf; /* buffer for distances and literals/lengths */ - unsigned int sym_next; /* running index in sym_buf */ - unsigned int sym_end; /* symbol table full when sym_next reaches this */ - - unsigned long opt_len; /* bit length of current block with optimal trees */ - unsigned long static_len; /* bit length of current block with static trees */ - unsigned int matches; /* number of string matches in current block */ - unsigned int insert; /* bytes at end of window left to insert */ - - /* compressed_len and bits_sent are only used if ZLIB_DEBUG is defined */ - unsigned long compressed_len; /* total bit length of compressed file mod 2^32 */ - unsigned long bits_sent; /* bit length of compressed data sent mod 2^32 */ - - /* Reserved for future use and alignment purposes */ - char *reserved_p; - - uint64_t bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least significant bits). */ - - int32_t bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit are always zero. */ - - /* Reserved for future use and alignment purposes */ - int32_t reserved[11]; -} ALIGNED_(8) deflate_state; - -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) { \ - s->pending_buf[s->pending++] = (unsigned char)(c); \ -} - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pending_buf. - */ -static inline void put_short(deflate_state *s, uint16_t w) { -#if defined(UNALIGNED_OK) - *(uint16_t *)(&s->pending_buf[s->pending]) = w; - s->pending += 2; -#else - put_byte(s, (w & 0xff)); - put_byte(s, ((w >> 8) & 0xff)); -#endif -} - -/* =========================================================================== - * Output a short MSB first on the stream. - * IN assertion: there is enough room in pending_buf. - */ -static inline void put_short_msb(deflate_state *s, uint16_t w) { - put_byte(s, ((w >> 8) & 0xff)); - put_byte(s, (w & 0xff)); -} - -/* =========================================================================== - * Output a 32-bit unsigned int LSB first on the stream. - * IN assertion: there is enough room in pending_buf. - */ -static inline void put_uint32(deflate_state *s, uint32_t dw) { -#if defined(UNALIGNED_OK) - *(uint32_t *)(&s->pending_buf[s->pending]) = dw; - s->pending += 4; -#else - put_byte(s, (dw & 0xff)); - put_byte(s, ((dw >> 8) & 0xff)); - put_byte(s, ((dw >> 16) & 0xff)); - put_byte(s, ((dw >> 24) & 0xff)); -#endif -} - -/* =========================================================================== - * Output a 32-bit unsigned int MSB first on the stream. - * IN assertion: there is enough room in pending_buf. - */ -static inline void put_uint32_msb(deflate_state *s, uint32_t dw) { -#if defined(UNALIGNED_OK) - *(uint32_t *)(&s->pending_buf[s->pending]) = ZSWAP32(dw); - s->pending += 4; -#else - put_byte(s, ((dw >> 24) & 0xff)); - put_byte(s, ((dw >> 16) & 0xff)); - put_byte(s, ((dw >> 8) & 0xff)); - put_byte(s, (dw & 0xff)); -#endif -} - -/* =========================================================================== - * Output a 64-bit unsigned int LSB first on the stream. - * IN assertion: there is enough room in pending_buf. - */ -static inline void put_uint64(deflate_state *s, uint64_t lld) { -#if defined(UNALIGNED64_OK) - *(uint64_t *)(&s->pending_buf[s->pending]) = lld; - s->pending += 8; -#elif defined(UNALIGNED_OK) - *(uint32_t *)(&s->pending_buf[s->pending]) = lld & 0xffffffff; - s->pending += 4; - *(uint32_t *)(&s->pending_buf[s->pending]) = (lld >> 32) & 0xffffffff; - s->pending += 4; -#else - put_byte(s, (lld & 0xff)); - put_byte(s, ((lld >> 8) & 0xff)); - put_byte(s, ((lld >> 16) & 0xff)); - put_byte(s, ((lld >> 24) & 0xff)); - put_byte(s, ((lld >> 32) & 0xff)); - put_byte(s, ((lld >> 40) & 0xff)); - put_byte(s, ((lld >> 48) & 0xff)); - put_byte(s, ((lld >> 56) & 0xff)); -#endif -} - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - -#define WIN_INIT MAX_MATCH -/* Number of bytes after end of data in window to initialize in order to avoid - memory checker errors from longest match routines */ - - -void Z_INTERNAL fill_window(deflate_state *s); -void Z_INTERNAL slide_hash_c(deflate_state *s); - - /* in trees.c */ -void Z_INTERNAL zng_tr_init(deflate_state *s); -void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last); -void Z_INTERNAL zng_tr_flush_bits(deflate_state *s); -void Z_INTERNAL zng_tr_align(deflate_state *s); -void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last); -unsigned Z_INTERNAL bi_reverse(unsigned code, int len); -void Z_INTERNAL flush_pending(PREFIX3(streamp) strm); -#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. zng_dist_code[256] and zng_dist_code[257] are never - * used. - */ - -/* Bit buffer and compress bits calculation debugging */ -#ifdef ZLIB_DEBUG -# define cmpr_bits_add(s, len) s->compressed_len += (len) -# define cmpr_bits_align(s) s->compressed_len = (s->compressed_len + 7) & ~7L -# define sent_bits_add(s, bits) s->bits_sent += (bits) -# define sent_bits_align(s) s->bits_sent = (s->bits_sent + 7) & ~7L -#else -# define cmpr_bits_add(s, len) (void)(len) -# define cmpr_bits_align(s) -# define sent_bits_add(s, bits) (void)(bits) -# define sent_bits_align(s) -#endif - -#endif /* DEFLATE_H_ */ diff --git a/libs/zlibng/deflate_fast.c b/libs/zlibng/deflate_fast.c deleted file mode 100644 index 14718ba14..000000000 --- a/libs/zlibng/deflate_fast.c +++ /dev/null @@ -1,106 +0,0 @@ -/* deflate_fast.c -- compress data using the fast strategy of deflation algorithm - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "deflate.h" -#include "deflate_p.h" -#include "functable.h" - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { - Pos hash_head; /* head of the hash chain */ - int bflush = 0; /* set if current block must be flushed */ - int64_t dist; - uint32_t match_len = 0; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) { - return need_more; - } - if (UNLIKELY(s->lookahead == 0)) - break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - hash_head = functable.quick_insert_string(s, s->strstart); - dist = (int64_t)s->strstart - hash_head; - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match length < MIN_MATCH - */ - - if (dist <= MAX_DIST(s) && dist > 0) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - match_len = functable.longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - } - - if (match_len >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, match_len); - - bflush = zng_tr_tally_dist(s, s->strstart - s->match_start, match_len - MIN_MATCH); - - s->lookahead -= match_len; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (match_len <= s->max_insert_length && s->lookahead >= MIN_MATCH) { - match_len--; /* string at strstart already in table */ - s->strstart++; - - functable.insert_string(s, s->strstart, match_len); - s->strstart += match_len; - } else { - s->strstart += match_len; -#if MIN_MATCH != 3 - functable.insert_string(s, s->strstart + 2 - MIN_MATCH, MIN_MATCH - 2); -#else - functable.quick_insert_string(s, s->strstart + 2 - MIN_MATCH); -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - match_len = 0; - } else { - /* No match, output a literal byte */ - bflush = zng_tr_tally_lit(s, s->window[s->strstart]); - s->lookahead--; - s->strstart++; - } - if (UNLIKELY(bflush)) - FLUSH_BLOCK(s, 0); - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (UNLIKELY(flush == Z_FINISH)) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (UNLIKELY(s->sym_next)) - FLUSH_BLOCK(s, 0); - return block_done; -} diff --git a/libs/zlibng/deflate_medium.c b/libs/zlibng/deflate_medium.c deleted file mode 100644 index dad550cd1..000000000 --- a/libs/zlibng/deflate_medium.c +++ /dev/null @@ -1,293 +0,0 @@ -/* deflate_medium.c -- The deflate_medium deflate strategy - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Arjan van de Ven - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ -#ifndef NO_MEDIUM_STRATEGY -#include -#include "zbuild.h" -#include "deflate.h" -#include "deflate_p.h" -#include "functable.h" - -struct match { - uint16_t match_start; - uint16_t match_length; - uint16_t strstart; - uint16_t orgstart; -}; - -static int emit_match(deflate_state *s, struct match match) { - int bflush = 0; - - /* matches that are not long enough we need to emit as literals */ - if (match.match_length < MIN_MATCH) { - while (match.match_length) { - bflush += zng_tr_tally_lit(s, s->window[match.strstart]); - s->lookahead--; - match.strstart++; - match.match_length--; - } - return bflush; - } - - check_match(s, match.strstart, match.match_start, match.match_length); - - bflush += zng_tr_tally_dist(s, match.strstart - match.match_start, match.match_length - MIN_MATCH); - - s->lookahead -= match.match_length; - return bflush; -} - -static void insert_match(deflate_state *s, struct match match) { - if (UNLIKELY(s->lookahead <= (unsigned int)(match.match_length + MIN_MATCH))) - return; - - /* matches that are not long enough we need to emit as literals */ - if (LIKELY(match.match_length < MIN_MATCH)) { - match.strstart++; - match.match_length--; - if (UNLIKELY(match.match_length > 0)) { - if (match.strstart >= match.orgstart) { - if (match.strstart + match.match_length - 1 >= match.orgstart) { - functable.insert_string(s, match.strstart, match.match_length); - } else { - functable.insert_string(s, match.strstart, match.orgstart - match.strstart + 1); - } - match.strstart += match.match_length; - match.match_length = 0; - } - } - return; - } - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (match.match_length <= 16* s->max_insert_length && s->lookahead >= MIN_MATCH) { - match.match_length--; /* string at strstart already in table */ - match.strstart++; - - if (LIKELY(match.strstart >= match.orgstart)) { - if (LIKELY(match.strstart + match.match_length - 1 >= match.orgstart)) { - functable.insert_string(s, match.strstart, match.match_length); - } else { - functable.insert_string(s, match.strstart, match.orgstart - match.strstart + 1); - } - } else if (match.orgstart < match.strstart + match.match_length) { - functable.insert_string(s, match.orgstart, match.strstart + match.match_length - match.orgstart); - } - match.strstart += match.match_length; - match.match_length = 0; - } else { - match.strstart += match.match_length; - match.match_length = 0; - if (match.strstart >= (MIN_MATCH - 2)) -#if MIN_MATCH != 3 - functable.insert_string(s, match.strstart + 2 - MIN_MATCH, MIN_MATCH - 2); -#else - functable.quick_insert_string(s, match.strstart + 2 - MIN_MATCH); -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } -} - -static void fizzle_matches(deflate_state *s, struct match *current, struct match *next) { - Pos limit; - unsigned char *match, *orig; - int changed = 0; - struct match c, n; - /* step zero: sanity checks */ - - if (current->match_length <= 1) - return; - - if (UNLIKELY(current->match_length > 1 + next->match_start)) - return; - - if (UNLIKELY(current->match_length > 1 + next->strstart)) - return; - - match = s->window - current->match_length + 1 + next->match_start; - orig = s->window - current->match_length + 1 + next->strstart; - - /* quick exit check.. if this fails then don't bother with anything else */ - if (LIKELY(*match != *orig)) - return; - - c = *current; - n = *next; - - /* step one: try to move the "next" match to the left as much as possible */ - limit = next->strstart > MAX_DIST(s) ? next->strstart - (Pos)MAX_DIST(s) : 0; - - match = s->window + n.match_start - 1; - orig = s->window + n.strstart - 1; - - while (*match == *orig) { - if (UNLIKELY(c.match_length < 1)) - break; - if (UNLIKELY(n.strstart <= limit)) - break; - if (UNLIKELY(n.match_length >= 256)) - break; - if (UNLIKELY(n.match_start <= 1)) - break; - - n.strstart--; - n.match_start--; - n.match_length++; - c.match_length--; - match--; - orig--; - changed++; - } - - if (!changed) - return; - - if (c.match_length <= 1 && n.match_length != 2) { - n.orgstart++; - *current = c; - *next = n; - } else { - return; - } -} - -Z_INTERNAL block_state deflate_medium(deflate_state *s, int flush) { - /* Align the first struct to start on a new cacheline, this allows us to fit both structs in one cacheline */ - ALIGNED_(16) struct match current_match; - struct match next_match; - - memset(¤t_match, 0, sizeof(struct match)); - memset(&next_match, 0, sizeof(struct match)); - - for (;;) { - Pos hash_head = 0; /* head of the hash chain */ - int bflush = 0; /* set if current block must be flushed */ - int64_t dist; - - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next current_match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (UNLIKELY(s->lookahead == 0)) - break; /* flush the current block */ - next_match.match_length = 0; - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - - /* If we already have a future match from a previous round, just use that */ - if (next_match.match_length > 0) { - current_match = next_match; - next_match.match_length = 0; - } else { - hash_head = 0; - if (s->lookahead >= MIN_MATCH) { - hash_head = functable.quick_insert_string(s, s->strstart); - } - - current_match.strstart = (uint16_t)s->strstart; - current_match.orgstart = current_match.strstart; - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - - dist = (int64_t)s->strstart - hash_head; - if (dist <= MAX_DIST(s) && dist > 0) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - current_match.match_length = (uint16_t)functable.longest_match(s, hash_head); - current_match.match_start = (uint16_t)s->match_start; - if (UNLIKELY(current_match.match_length < MIN_MATCH)) - current_match.match_length = 1; - if (UNLIKELY(current_match.match_start >= current_match.strstart)) { - /* this can happen due to some restarts */ - current_match.match_length = 1; - } - } else { - /* Set up the match to be a 1 byte literal */ - current_match.match_start = 0; - current_match.match_length = 1; - } - } - - insert_match(s, current_match); - - /* now, look ahead one */ - if (LIKELY(s->lookahead > MIN_LOOKAHEAD && (uint32_t)(current_match.strstart + current_match.match_length) < (s->window_size - MIN_LOOKAHEAD))) { - s->strstart = current_match.strstart + current_match.match_length; - hash_head = functable.quick_insert_string(s, s->strstart); - - next_match.strstart = (uint16_t)s->strstart; - next_match.orgstart = next_match.strstart; - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - - dist = (int64_t)s->strstart - hash_head; - if (dist <= MAX_DIST(s) && dist > 0) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - next_match.match_length = (uint16_t)functable.longest_match(s, hash_head); - next_match.match_start = (uint16_t)s->match_start; - if (UNLIKELY(next_match.match_start >= next_match.strstart)) { - /* this can happen due to some restarts */ - next_match.match_length = 1; - } - if (next_match.match_length < MIN_MATCH) - next_match.match_length = 1; - else - fizzle_matches(s, ¤t_match, &next_match); - } else { - /* Set up the match to be a 1 byte literal */ - next_match.match_start = 0; - next_match.match_length = 1; - } - - s->strstart = current_match.strstart; - } else { - next_match.match_length = 0; - } - - /* now emit the current match */ - bflush = emit_match(s, current_match); - - /* move the "cursor" forward */ - s->strstart += current_match.match_length; - - if (UNLIKELY(bflush)) - FLUSH_BLOCK(s, 0); - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (UNLIKELY(s->sym_next)) - FLUSH_BLOCK(s, 0); - - return block_done; -} -#endif diff --git a/libs/zlibng/deflate_p.h b/libs/zlibng/deflate_p.h deleted file mode 100644 index 102a4de06..000000000 --- a/libs/zlibng/deflate_p.h +++ /dev/null @@ -1,82 +0,0 @@ -/* deflate_p.h -- Private inline functions and macros shared with more than - * one deflate method - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#ifndef DEFLATE_P_H -#define DEFLATE_P_H - -/* Forward declare common non-inlined functions declared in deflate.c */ - -#ifdef ZLIB_DEBUG -void check_match(deflate_state *s, Pos start, Pos match, int length); -#else -#define check_match(s, start, match, length) -#endif -void flush_pending(PREFIX3(stream) *strm); - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ - -extern const unsigned char Z_INTERNAL zng_length_code[]; -extern const unsigned char Z_INTERNAL zng_dist_code[]; - -static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { - /* c is the unmatched char */ - s->sym_buf[s->sym_next++] = 0; - s->sym_buf[s->sym_next++] = 0; - s->sym_buf[s->sym_next++] = c; - s->dyn_ltree[c].Freq++; - Tracevv((stderr, "%c", c)); - Assert(c <= (MAX_MATCH-MIN_MATCH), "zng_tr_tally: bad literal"); - return (s->sym_next == s->sym_end); -} - -static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { - /* dist: distance of matched string */ - /* len: match length-MIN_MATCH */ - s->sym_buf[s->sym_next++] = (uint8_t)(dist); - s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); - s->sym_buf[s->sym_next++] = (uint8_t)len; - s->matches++; - dist--; - Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, - "zng_tr_tally: bad match"); - - s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - return (s->sym_next == s->sym_end); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, last) { \ - zng_tr_flush_block(s, (s->block_start >= 0 ? \ - (char *)&s->window[(unsigned)s->block_start] : \ - NULL), \ - (uint32_t)((int)s->strstart - s->block_start), \ - (last)); \ - s->block_start = (int)s->strstart; \ - flush_pending(s->strm); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, last) { \ - FLUSH_BLOCK_ONLY(s, last); \ - if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ -} - -/* Maximum stored block length in deflate format (not including header). */ -#define MAX_STORED 65535 - -/* Minimum of a and b. */ -#define MIN(a, b) ((a) > (b) ? (b) : (a)) - -#endif diff --git a/libs/zlibng/deflate_quick.c b/libs/zlibng/deflate_quick.c deleted file mode 100644 index 268cce80d..000000000 --- a/libs/zlibng/deflate_quick.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * The deflate_quick deflate strategy, designed to be used when cycles are - * at a premium. - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Wajdi Feghali - * Jim Guilford - * Vinodh Gopal - * Erdinc Ozturk - * Jim Kukunas - * - * Portions are Copyright (C) 2016 12Sided Technology, LLC. - * Author: - * Phil Vachon - * - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "deflate.h" -#include "deflate_p.h" -#include "functable.h" -#include "trees_emit.h" - -extern const ct_data static_ltree[L_CODES+2]; -extern const ct_data static_dtree[D_CODES]; - -#define QUICK_START_BLOCK(s, last) { \ - zng_tr_emit_tree(s, STATIC_TREES, last); \ - s->block_open = 1 + (int)last; \ - s->block_start = (int)s->strstart; \ -} - -#define QUICK_END_BLOCK(s, last) { \ - if (s->block_open) { \ - zng_tr_emit_end_block(s, static_ltree, last); \ - s->block_open = 0; \ - s->block_start = (int)s->strstart; \ - flush_pending(s->strm); \ - if (s->strm->avail_out == 0) \ - return (last) ? finish_started : need_more; \ - } \ -} - -Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) { - Pos hash_head; - int64_t dist; - unsigned match_len, last; - - - last = (flush == Z_FINISH) ? 1 : 0; - if (UNLIKELY(last && s->block_open != 2)) { - /* Emit end of previous block */ - QUICK_END_BLOCK(s, 0); - /* Emit start of last block */ - QUICK_START_BLOCK(s, last); - } else if (UNLIKELY(s->block_open == 0 && s->lookahead > 0)) { - /* Start new block only when we have lookahead data, so that if no - input data is given an empty block will not be written */ - QUICK_START_BLOCK(s, last); - } - - for (;;) { - if (UNLIKELY(s->pending + ((BIT_BUF_SIZE + 7) >> 3) >= s->pending_buf_size)) { - flush_pending(s->strm); - if (s->strm->avail_out == 0) { - return (last && s->strm->avail_in == 0) ? finish_started : need_more; - } - } - - if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD)) { - fill_window(s); - if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) { - return need_more; - } - if (UNLIKELY(s->lookahead == 0)) - break; - - if (UNLIKELY(s->block_open == 0)) { - /* Start new block when we have lookahead data, so that if no - input data is given an empty block will not be written */ - QUICK_START_BLOCK(s, last); - } - } - - if (LIKELY(s->lookahead >= MIN_MATCH)) { - hash_head = functable.quick_insert_string(s, s->strstart); - dist = (int64_t)s->strstart - hash_head; - - if (dist <= MAX_DIST(s) && dist > 0) { - match_len = functable.compare258(s->window + s->strstart, s->window + hash_head); - - if (match_len >= MIN_MATCH) { - if (UNLIKELY(match_len > s->lookahead)) - match_len = s->lookahead; - - check_match(s, s->strstart, hash_head, match_len); - - zng_tr_emit_dist(s, static_ltree, static_dtree, match_len - MIN_MATCH, (uint32_t)dist); - s->lookahead -= match_len; - s->strstart += match_len; - continue; - } - } - } - - zng_tr_emit_lit(s, static_ltree, s->window[s->strstart]); - s->strstart++; - s->lookahead--; - } - - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (UNLIKELY(last)) { - QUICK_END_BLOCK(s, 1); - return finish_done; - } - - QUICK_END_BLOCK(s, 0); - return block_done; -} diff --git a/libs/zlibng/deflate_slow.c b/libs/zlibng/deflate_slow.c deleted file mode 100644 index cac8a9629..000000000 --- a/libs/zlibng/deflate_slow.c +++ /dev/null @@ -1,137 +0,0 @@ -/* deflate_slow.c -- compress data using the slow strategy of deflation algorithm - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "deflate.h" -#include "deflate_p.h" -#include "functable.h" - -/* =========================================================================== - * Same as deflate_medium, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) { - Pos hash_head; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - int64_t dist; - uint32_t match_len; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) { - return need_more; - } - if (UNLIKELY(s->lookahead == 0)) - break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0; - if (LIKELY(s->lookahead >= MIN_MATCH)) { - hash_head = functable.quick_insert_string(s, s->strstart); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_match = (Pos)s->match_start; - match_len = MIN_MATCH-1; - dist = (int64_t)s->strstart - hash_head; - - if (dist <= MAX_DIST(s) && dist > 0 && s->prev_length < s->max_lazy_match) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - match_len = functable.longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (match_len <= 5 && (s->strategy == Z_FILTERED)) { - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - match_len = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && match_len <= s->prev_length) { - unsigned int 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); - - bflush = zng_tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH); - - /* Insert in hash table all strings up to the end of the match. - * 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; - - unsigned int mov_fwd = s->prev_length - 2; - if (max_insert > s->strstart) { - unsigned int insert_cnt = mov_fwd; - if (UNLIKELY(insert_cnt > max_insert - s->strstart)) - insert_cnt = max_insert - s->strstart; - - functable.insert_string(s, s->strstart + 1, insert_cnt); - } - s->prev_length = 0; - s->match_available = 0; - s->strstart += mov_fwd + 1; - - if (UNLIKELY(bflush)) - FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - bflush = zng_tr_tally_lit(s, s->window[s->strstart-1]); - if (UNLIKELY(bflush)) - FLUSH_BLOCK_ONLY(s, 0); - s->prev_length = match_len; - s->strstart++; - s->lookahead--; - if (UNLIKELY(s->strm->avail_out == 0)) - return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->prev_length = match_len; - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert(flush != Z_NO_FLUSH, "no flush?"); - if (UNLIKELY(s->match_available)) { - (void) zng_tr_tally_lit(s, s->window[s->strstart-1]); - s->match_available = 0; - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (UNLIKELY(flush == Z_FINISH)) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (UNLIKELY(s->sym_next)) - FLUSH_BLOCK(s, 0); - return block_done; -} diff --git a/libs/zlibng/doc/algorithm.txt b/libs/zlibng/doc/algorithm.txt deleted file mode 100644 index c97f49502..000000000 --- a/libs/zlibng/doc/algorithm.txt +++ /dev/null @@ -1,209 +0,0 @@ -1. Compression algorithm (deflate) - -The deflation algorithm used by gzip (also zip and zlib) is a variation of -LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in -the input data. The second occurrence of a string is replaced by a -pointer to the previous string, in the form of a pair (distance, -length). Distances are limited to 32K bytes, and lengths are limited -to 258 bytes. When a string does not occur anywhere in the previous -32K bytes, it is emitted as a sequence of literal bytes. (In this -description, `string' must be taken as an arbitrary sequence of bytes, -and is not restricted to printable characters.) - -Literals or match lengths are compressed with one Huffman tree, and -match distances are compressed with another tree. The trees are stored -in a compact form at the start of each block. The blocks can have any -size (except that the compressed data for one block must fit in -available memory). A block is terminated when deflate() determines that -it would be useful to start another block with fresh trees. (This is -somewhat similar to the behavior of LZW-based _compress_.) - -Duplicated strings are found using a hash table. All input strings of -length 3 are inserted in the hash table. A hash index is computed for -the next 3 bytes. If the hash chain for this index is not empty, all -strings in the chain are compared with the current input string, and -the longest match is selected. - -The hash chains are searched starting with the most recent strings, to -favor small distances and thus take advantage of the Huffman encoding. -The hash chains are singly linked. There are no deletions from the -hash chains, the algorithm simply discards matches that are too old. - -To avoid a worst-case situation, very long hash chains are arbitrarily -truncated at a certain length, determined by a runtime option (level -parameter of deflateInit). So deflate() does not always find the longest -possible match but generally finds a match which is long enough. - -deflate() also defers the selection of matches with a lazy evaluation -mechanism. After a match of length N has been found, deflate() searches for -a longer match at the next input byte. If a longer match is found, the -previous match is truncated to a length of one (thus producing a single -literal byte) and the process of lazy evaluation begins again. Otherwise, -the original match is kept, and the next match search is attempted only N -steps later. - -The lazy match evaluation is also subject to a runtime parameter. If -the current match is long enough, deflate() reduces the search for a longer -match, thus speeding up the whole process. If compression ratio is more -important than speed, deflate() attempts a complete second search even if -the first match is already long enough. - -The lazy match evaluation is not performed for the fastest compression -modes (level parameter 1 to 3). For these fast modes, new strings -are inserted in the hash table only when no match was found, or -when the match is not too long. This degrades the compression ratio -but saves time since there are both fewer insertions and fewer searches. - - -2. Decompression algorithm (inflate) - -2.1 Introduction - -The key question is how to represent a Huffman code (or any prefix code) so -that you can decode fast. The most important characteristic is that shorter -codes are much more common than longer codes, so pay attention to decoding the -short codes fast, and let the long codes take longer to decode. - -inflate() sets up a first level table that covers some number of bits of -input less than the length of longest code. It gets that many bits from the -stream, and looks it up in the table. The table will tell if the next -code is that many bits or less and how many, and if it is, it will tell -the value, else it will point to the next level table for which inflate() -grabs more bits and tries to decode a longer code. - -How many bits to make the first lookup is a tradeoff between the time it -takes to decode and the time it takes to build the table. If building the -table took no time (and if you had infinite memory), then there would only -be a first level table to cover all the way to the longest code. However, -building the table ends up taking a lot longer for more bits since short -codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then -to set that variable for the maximum speed. - -For inflate, which has 286 possible codes for the literal/length tree, the size -of the first table is nine bits. Also the distance trees have 30 possible -values, and the size of the first table is six bits. Note that for each of -those cases, the table ended up one bit longer than the ``average'' code -length, i.e. the code length of an approximately flat code which would be a -little more than eight bits for 286 symbols and a little less than five bits -for 30 symbols. - - -2.2 More details on the inflate table lookup - -Ok, you want to know what this cleverly obfuscated inflate tree actually -looks like. You are correct that it's not a Huffman tree. It is simply a -lookup table for the first, let's say, nine bits of a Huffman symbol. The -symbol could be as short as one bit or as long as 15 bits. If a particular -symbol is shorter than nine bits, then that symbol's translation is duplicated -in all those entries that start with that symbol's bits. For example, if the -symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a -symbol is nine bits long, it appears in the table once. - -If the symbol is longer than nine bits, then that entry in the table points -to another similar table for the remaining bits. Again, there are duplicated -entries as needed. The idea is that most of the time the symbol will be short -and there will only be one table look up. (That's whole idea behind data -compression in the first place.) For the less frequent long symbols, there -will be two lookups. If you had a compression method with really long -symbols, you could have as many levels of lookups as is efficient. For -inflate, two is enough. - -So a table entry either points to another table (in which case nine bits in -the above example are gobbled), or it contains the translation for the symbol -and the number of bits to gobble. Then you start again with the next -ungobbled bit. - -You may wonder: why not just have one lookup table for how ever many bits the -longest symbol is? The reason is that if you do that, you end up spending -more time filling in duplicate symbol entries than you do actually decoding. -At least for deflate's output that generates new trees every several 10's of -kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code -would take too long if you're only decoding several thousand symbols. At the -other extreme, you could make a new table for every bit in the code. In fact, -that's essentially a Huffman tree. But then you spend too much time -traversing the tree while decoding, even for short symbols. - -So the number of bits for the first lookup table is a trade of the time to -fill out the table vs. the time spent looking at the second level and above of -the table. - -Here is an example, scaled down: - -The code being decoded, with 10 symbols, from 1 to 6 bits long: - -A: 0 -B: 10 -C: 1100 -D: 11010 -E: 11011 -F: 11100 -G: 11101 -H: 11110 -I: 111110 -J: 111111 - -Let's make the first table three bits long (eight entries): - -000: A,1 -001: A,1 -010: A,1 -011: A,1 -100: B,2 -101: B,2 -110: -> table X (gobble 3 bits) -111: -> table Y (gobble 3 bits) - -Each entry is what the bits decode as and how many bits that is, i.e. how -many bits to gobble. Or the entry points to another table, with the number of -bits to gobble implicit in the size of the table. - -Table X is two bits long since the longest code starting with 110 is five bits -long: - -00: C,1 -01: C,1 -10: D,2 -11: E,2 - -Table Y is three bits long since the longest code starting with 111 is six -bits long: - -000: F,2 -001: F,2 -010: G,2 -011: G,2 -100: H,2 -101: H,2 -110: I,3 -111: J,3 - -So what we have here are three tables with a total of 20 entries that had to -be constructed. That's compared to 64 entries for a single table. Or -compared to 16 entries for a Huffman tree (six two entry tables and one four -entry table). Assuming that the code ideally represents the probability of -the symbols, it takes on the average 1.25 lookups per symbol. That's compared -to one lookup for the single table, or 1.66 lookups per symbol for the -Huffman tree. - -There, I think that gives you a picture of what's going on. For inflate, the -meaning of a particular symbol is often more than just a letter. It can be a -byte (a "literal"), or it can be either a length or a distance which -indicates a base value and a number of bits to fetch after the code that is -added to the base value. Or it might be the special end-of-block code. The -data structures created in inftrees.c try to encode all that information -compactly in the tables. - - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -References: - -[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data -Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, -pp. 337-343. - -``DEFLATE Compressed Data Format Specification'' available in -http://tools.ietf.org/html/rfc1951 diff --git a/libs/zlibng/doc/rfc1950.txt b/libs/zlibng/doc/rfc1950.txt deleted file mode 100644 index ce6428a0f..000000000 --- a/libs/zlibng/doc/rfc1950.txt +++ /dev/null @@ -1,619 +0,0 @@ - - - - - - -Network Working Group P. Deutsch -Request for Comments: 1950 Aladdin Enterprises -Category: Informational J-L. Gailly - Info-ZIP - May 1996 - - - ZLIB Compressed Data Format Specification version 3.3 - -Status of This Memo - - This memo provides information for the Internet community. This memo - does not specify an Internet standard of any kind. Distribution of - this memo is unlimited. - -IESG Note: - - The IESG takes no position on the validity of any Intellectual - Property Rights statements contained in this document. - -Notices - - Copyright (c) 1996 L. Peter Deutsch and Jean-Loup Gailly - - Permission is granted to copy and distribute this document for any - purpose and without charge, including translations into other - languages and incorporation into compilations, provided that the - copyright notice and this notice are preserved, and that any - substantive changes or deletions from the original are clearly - marked. - - A pointer to the latest version of this and related documentation in - HTML format can be found at the URL - . - -Abstract - - This specification defines a lossless compressed data format. The - data can be produced or consumed, even for an arbitrarily long - sequentially presented input data stream, using only an a priori - bounded amount of intermediate storage. The format presently uses - the DEFLATE compression method but can be easily extended to use - other compression methods. It can be implemented readily in a manner - not covered by patents. This specification also defines the ADLER-32 - checksum (an extension and improvement of the Fletcher checksum), - used for detection of data corruption, and provides an algorithm for - computing it. - - - - -Deutsch & Gailly Informational [Page 1] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - -Table of Contents - - 1. Introduction ................................................... 2 - 1.1. Purpose ................................................... 2 - 1.2. Intended audience ......................................... 3 - 1.3. Scope ..................................................... 3 - 1.4. Compliance ................................................ 3 - 1.5. Definitions of terms and conventions used ................ 3 - 1.6. Changes from previous versions ............................ 3 - 2. Detailed specification ......................................... 3 - 2.1. Overall conventions ....................................... 3 - 2.2. Data format ............................................... 4 - 2.3. Compliance ................................................ 7 - 3. References ..................................................... 7 - 4. Source code .................................................... 8 - 5. Security Considerations ........................................ 8 - 6. Acknowledgements ............................................... 8 - 7. Authors' Addresses ............................................. 8 - 8. Appendix: Rationale ............................................ 9 - 9. Appendix: Sample code ..........................................10 - -1. Introduction - - 1.1. Purpose - - The purpose of this specification is to define a lossless - compressed data format that: - - * Is independent of CPU type, operating system, file system, - and character set, and hence can be used for interchange; - - * Can be produced or consumed, 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 or similar structures such as - Unix filters; - - * Can use a number of different compression methods; - - * Can be implemented readily in a manner not covered by - patents, and hence can be practiced freely. - - The data format defined by this specification does not attempt to - allow random access to compressed data. - - - - - - - -Deutsch & Gailly Informational [Page 2] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - - 1.2. Intended audience - - This specification is intended for use by implementors of software - to compress data into zlib format and/or decompress data from zlib - format. - - The text of the specification assumes a basic background in - programming at the level of bits and other primitive data - representations. - - 1.3. Scope - - The specification specifies a compressed data format that can be - used for in-memory compression of a sequence of arbitrary bytes. - - 1.4. Compliance - - Unless otherwise indicated below, a compliant decompressor must be - able to accept and decompress any data set that conforms to all - the specifications presented here; a compliant compressor must - produce data sets that conform to all the specifications presented - here. - - 1.5. Definitions of terms and conventions used - - byte: 8 bits stored or transmitted as a unit (same as an octet). - (For this specification, a byte is exactly 8 bits, even on - machines which store a character on a number of bits different - from 8.) See below, for the numbering of bits within a byte. - - 1.6. Changes from previous versions - - Version 3.1 was the first public release of this specification. - In version 3.2, some terminology was changed and the Adler-32 - sample code was rewritten for clarity. In version 3.3, the - support for a preset dictionary was introduced, and the - specification was converted to RFC style. - -2. Detailed specification - - 2.1. Overall conventions - - In the diagrams below, a box like this: - - +---+ - | | <-- the vertical bars might be missing - +---+ - - - - -Deutsch & Gailly Informational [Page 3] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - - represents one byte; a box like this: - - +==============+ - | | - +==============+ - - represents a variable number of bytes. - - Bytes stored within a computer do not have a "bit order", since - they are always treated as a unit. However, a byte considered as - an integer between 0 and 255 does have a most- and least- - significant bit, and since we write numbers with the most- - significant digit on the left, we also write bytes with the most- - significant bit on the left. In the diagrams below, we number the - bits of a byte so that bit 0 is the least-significant bit, i.e., - the bits are numbered: - - +--------+ - |76543210| - +--------+ - - Within a computer, a number may occupy multiple bytes. All - multi-byte numbers in the format described here are stored with - the MOST-significant byte first (at the lower memory address). - For example, the decimal number 520 is stored as: - - 0 1 - +--------+--------+ - |00000010|00001000| - +--------+--------+ - ^ ^ - | | - | + less significant byte = 8 - + more significant byte = 2 x 256 - - 2.2. Data format - - A zlib stream has the following structure: - - 0 1 - +---+---+ - |CMF|FLG| (more-->) - +---+---+ - - - - - - - - -Deutsch & Gailly Informational [Page 4] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - - (if FLG.FDICT set) - - 0 1 2 3 - +---+---+---+---+ - | DICTID | (more-->) - +---+---+---+---+ - - +=====================+---+---+---+---+ - |...compressed data...| ADLER32 | - +=====================+---+---+---+---+ - - Any data which may appear after ADLER32 are not part of the zlib - stream. - - CMF (Compression Method and flags) - This byte is divided into a 4-bit compression method and a 4- - bit information field depending on the compression method. - - bits 0 to 3 CM Compression method - bits 4 to 7 CINFO Compression info - - CM (Compression method) - This identifies the compression method used in the file. CM = 8 - denotes the "deflate" compression method with a window size up - to 32K. This is the method used by gzip and PNG (see - references [1] and [2] in Chapter 3, below, for the reference - documents). CM = 15 is reserved. It might be used in a future - version of this specification to indicate the presence of an - extra field before the compressed data. - - CINFO (Compression info) - For CM = 8, CINFO is the base-2 logarithm of the LZ77 window - size, minus eight (CINFO=7 indicates a 32K window size). Values - of CINFO above 7 are not allowed in this version of the - specification. CINFO is not defined in this specification for - CM not equal to 8. - - FLG (FLaGs) - This flag byte is divided as follows: - - bits 0 to 4 FCHECK (check bits for CMF and FLG) - bit 5 FDICT (preset dictionary) - bits 6 to 7 FLEVEL (compression level) - - The FCHECK value must be such that CMF and FLG, when viewed as - a 16-bit unsigned integer stored in MSB order (CMF*256 + FLG), - is a multiple of 31. - - - - -Deutsch & Gailly Informational [Page 5] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - - FDICT (Preset dictionary) - If FDICT is set, a DICT dictionary identifier is present - immediately after the FLG byte. The dictionary is a sequence of - bytes which are initially fed to the compressor without - producing any compressed output. DICT is the Adler-32 checksum - of this sequence of bytes (see the definition of ADLER32 - below). The decompressor can use this identifier to determine - which dictionary has been used by the compressor. - - FLEVEL (Compression level) - These flags are available for use by specific compression - methods. The "deflate" method (CM = 8) sets these flags as - follows: - - 0 - compressor used fastest algorithm - 1 - compressor used fast algorithm - 2 - compressor used default algorithm - 3 - compressor used maximum compression, slowest algorithm - - The information in FLEVEL is not needed for decompression; it - is there to indicate if recompression might be worthwhile. - - compressed data - For compression method 8, the compressed data is stored in the - deflate compressed data format as described in the document - "DEFLATE Compressed Data Format Specification" by L. Peter - Deutsch. (See reference [3] in Chapter 3, below) - - Other compressed data formats are not specified in this version - of the zlib specification. - - ADLER32 (Adler-32 checksum) - This contains a checksum value of the uncompressed data - (excluding any dictionary data) computed according to Adler-32 - algorithm. This algorithm is a 32-bit extension and improvement - of the Fletcher algorithm, used in the ITU-T X.224 / ISO 8073 - standard. See references [4] and [5] in Chapter 3, below) - - Adler-32 is composed of two sums accumulated per byte: s1 is - the sum of all bytes, s2 is the sum of all s1 values. Both sums - are done modulo 65521. s1 is initialized to 1, s2 to zero. The - Adler-32 checksum is stored as s2*65536 + s1 in most- - significant-byte first (network) order. - - - - - - - - -Deutsch & Gailly Informational [Page 6] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - - 2.3. Compliance - - A compliant compressor must produce streams with correct CMF, FLG - and ADLER32, but need not support preset dictionaries. When the - zlib data format is used as part of another standard data format, - the compressor may use only preset dictionaries that are specified - by this other data format. If this other format does not use the - preset dictionary feature, the compressor must not set the FDICT - flag. - - A compliant decompressor must check CMF, FLG, and ADLER32, and - provide an error indication if any of these have incorrect values. - A compliant decompressor must give an error indication if CM is - not one of the values defined in this specification (only the - value 8 is permitted in this version), since another value could - indicate the presence of new features that would cause subsequent - data to be interpreted incorrectly. A compliant decompressor must - give an error indication if FDICT is set and DICTID is not the - identifier of a known preset dictionary. A decompressor may - ignore FLEVEL and still be compliant. When the zlib data format - is being used as a part of another standard format, a compliant - decompressor must support all the preset dictionaries specified by - the other format. When the other format does not use the preset - dictionary feature, a compliant decompressor must reject any - stream in which the FDICT flag is set. - -3. References - - [1] Deutsch, L.P.,"GZIP Compressed Data Format Specification", - available in ftp://ftp.uu.net/pub/archiving/zip/doc/ - - [2] Thomas Boutell, "PNG (Portable Network Graphics) specification", - available in ftp://ftp.uu.net/graphics/png/documents/ - - [3] Deutsch, L.P.,"DEFLATE Compressed Data Format Specification", - available in ftp://ftp.uu.net/pub/archiving/zip/doc/ - - [4] Fletcher, J. G., "An Arithmetic Checksum for Serial - Transmissions," IEEE Transactions on Communications, Vol. COM-30, - No. 1, January 1982, pp. 247-252. - - [5] ITU-T Recommendation X.224, Annex D, "Checksum Algorithms," - November, 1993, pp. 144, 145. (Available from - gopher://info.itu.ch). ITU-T X.244 is also the same as ISO 8073. - - - - - - - -Deutsch & Gailly Informational [Page 7] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - -4. Source code - - Source code for a C language implementation of a "zlib" compliant - library is available at ftp://ftp.uu.net/pub/archiving/zip/zlib/. - -5. Security Considerations - - A decoder that fails to check the ADLER32 checksum value may be - subject to undetected data corruption. - -6. Acknowledgements - - Trademarks cited in this document are the property of their - respective owners. - - Jean-Loup Gailly and Mark Adler designed the zlib format and wrote - the related software described in this specification. Glenn - Randers-Pehrson converted this document to RFC and HTML format. - -7. Authors' Addresses - - L. Peter Deutsch - Aladdin Enterprises - 203 Santa Margarita Ave. - Menlo Park, CA 94025 - - Phone: (415) 322-0103 (AM only) - FAX: (415) 322-1734 - EMail: - - - Jean-Loup Gailly - - EMail: - - Questions about the technical content of this specification can be - sent by email to - - Jean-Loup Gailly and - Mark Adler - - Editorial comments on this specification can be sent by email to - - L. Peter Deutsch and - Glenn Randers-Pehrson - - - - - - -Deutsch & Gailly Informational [Page 8] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - -8. Appendix: Rationale - - 8.1. Preset dictionaries - - A preset dictionary is specially useful to compress short input - sequences. The compressor can take advantage of the dictionary - context to encode the input in a more compact manner. The - decompressor can be initialized with the appropriate context by - virtually decompressing a compressed version of the dictionary - without producing any output. However for certain compression - algorithms such as the deflate algorithm this operation can be - achieved without actually performing any decompression. - - The compressor and the decompressor must use exactly the same - dictionary. The dictionary may be fixed or may be chosen among a - certain number of predefined dictionaries, according to the kind - of input data. The decompressor can determine which dictionary has - been chosen by the compressor by checking the dictionary - identifier. This document does not specify the contents of - predefined dictionaries, since the optimal dictionaries are - application specific. Standard data formats using this feature of - the zlib specification must precisely define the allowed - dictionaries. - - 8.2. The Adler-32 algorithm - - The Adler-32 algorithm is much faster than the CRC32 algorithm yet - still provides an extremely low probability of undetected errors. - - The modulo on unsigned long accumulators can be delayed for 5552 - bytes, so the modulo operation time is negligible. If the bytes - are a, b, c, the second sum is 3a + 2b + c + 3, and so is position - and order sensitive, unlike the first sum, which is just a - checksum. That 65521 is prime is important to avoid a possible - large class of two-byte errors that leave the check unchanged. - (The Fletcher checksum uses 255, which is not prime and which also - makes the Fletcher check insensitive to single byte changes 0 <-> - 255.) - - The sum s1 is initialized to 1 instead of zero to make the length - of the sequence part of s2, so that the length does not have to be - checked separately. (Any sequence of zeroes has a Fletcher - checksum of zero.) - - - - - - - - -Deutsch & Gailly Informational [Page 9] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - -9. Appendix: Sample code - - The following C code computes the Adler-32 checksum of a data buffer. - It is written for clarity, not for speed. The sample code is in the - ANSI C programming language. Non C users may find it easier to read - with these hints: - - & Bitwise AND operator. - >> Bitwise right shift operator. When applied to an - unsigned quantity, as here, right shift inserts zero bit(s) - at the left. - << Bitwise left shift operator. Left shift inserts zero - bit(s) at the right. - ++ "n++" increments the variable n. - % modulo operator: a % b is the remainder of a divided by b. - - #define BASE 65521 /* largest prime smaller than 65536 */ - - /* - Update a running Adler-32 checksum with the bytes buf[0..len-1] - and return the updated checksum. The Adler-32 checksum should be - initialized to 1. - - Usage example: - - unsigned long adler = 1L; - - while (read_buffer(buffer, length) != EOF) { - adler = update_adler32(adler, buffer, length); - } - if (adler != original_adler) error(); - */ - unsigned long update_adler32(unsigned long adler, - unsigned char *buf, int len) - { - unsigned long s1 = adler & 0xffff; - unsigned long s2 = (adler >> 16) & 0xffff; - int n; - - for (n = 0; n < len; n++) { - s1 = (s1 + buf[n]) % BASE; - s2 = (s2 + s1) % BASE; - } - return (s2 << 16) + s1; - } - - /* Return the adler32 of the bytes buf[0..len-1] */ - - - - -Deutsch & Gailly Informational [Page 10] - -RFC 1950 ZLIB Compressed Data Format Specification May 1996 - - - unsigned long adler32(unsigned char *buf, int len) - { - return update_adler32(1L, buf, len); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Deutsch & Gailly Informational [Page 11] - diff --git a/libs/zlibng/doc/rfc1951.txt b/libs/zlibng/doc/rfc1951.txt deleted file mode 100644 index 403c8c722..000000000 --- a/libs/zlibng/doc/rfc1951.txt +++ /dev/null @@ -1,955 +0,0 @@ - - - - - - -Network Working Group P. Deutsch -Request for Comments: 1951 Aladdin Enterprises -Category: Informational May 1996 - - - DEFLATE Compressed Data Format Specification version 1.3 - -Status of This Memo - - This memo provides information for the Internet community. This memo - does not specify an Internet standard of any kind. Distribution of - this memo is unlimited. - -IESG Note: - - The IESG takes no position on the validity of any Intellectual - Property Rights statements contained in this document. - -Notices - - Copyright (c) 1996 L. Peter Deutsch - - Permission is granted to copy and distribute this document for any - purpose and without charge, including translations into other - languages and incorporation into compilations, provided that the - copyright notice and this notice are preserved, and that any - substantive changes or deletions from the original are clearly - marked. - - A pointer to the latest version of this and related documentation in - HTML format can be found at the URL - . - -Abstract - - This specification defines a lossless compressed data format that - compresses data using a combination of the LZ77 algorithm and Huffman - coding, with efficiency comparable to the best currently available - general-purpose compression methods. The data can be produced or - consumed, even for an arbitrarily long sequentially presented input - data stream, using only an a priori bounded amount of intermediate - storage. The format can be implemented readily in a manner not - covered by patents. - - - - - - - - -Deutsch Informational [Page 1] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - -Table of Contents - - 1. Introduction ................................................... 2 - 1.1. Purpose ................................................... 2 - 1.2. Intended audience ......................................... 3 - 1.3. Scope ..................................................... 3 - 1.4. Compliance ................................................ 3 - 1.5. Definitions of terms and conventions used ................ 3 - 1.6. Changes from previous versions ............................ 4 - 2. Compressed representation overview ............................. 4 - 3. Detailed specification ......................................... 5 - 3.1. Overall conventions ....................................... 5 - 3.1.1. Packing into bytes .................................. 5 - 3.2. Compressed block format ................................... 6 - 3.2.1. Synopsis of prefix and Huffman coding ............... 6 - 3.2.2. Use of Huffman coding in the "deflate" format ....... 7 - 3.2.3. Details of block format ............................. 9 - 3.2.4. Non-compressed blocks (BTYPE=00) ................... 11 - 3.2.5. Compressed blocks (length and distance codes) ...... 11 - 3.2.6. Compression with fixed Huffman codes (BTYPE=01) .... 12 - 3.2.7. Compression with dynamic Huffman codes (BTYPE=10) .. 13 - 3.3. Compliance ............................................... 14 - 4. Compression algorithm details ................................. 14 - 5. References .................................................... 16 - 6. Security Considerations ....................................... 16 - 7. Source code ................................................... 16 - 8. Acknowledgements .............................................. 16 - 9. Author's Address .............................................. 17 - -1. Introduction - - 1.1. Purpose - - The purpose of this specification is to define a lossless - compressed data format that: - * Is independent of CPU type, operating system, file system, - and character set, and hence can be used for interchange; - * Can be produced or consumed, 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 or similar structures - such as Unix filters; - * Compresses data with efficiency comparable to the best - currently available general-purpose compression methods, - and in particular considerably better than the "compress" - program; - * Can be implemented readily in a manner not covered by - patents, and hence can be practiced freely; - - - -Deutsch Informational [Page 2] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - * Is compatible with the file format produced by the current - widely used gzip utility, in that conforming decompressors - will be able to read data produced by the existing gzip - compressor. - - The data format defined by this specification does not attempt to: - - * Allow random access to compressed data; - * Compress specialized data (e.g., raster graphics) as well - as the best currently available specialized algorithms. - - A simple counting argument shows that no lossless compression - algorithm can compress every possible input data set. For the - format defined here, the worst case expansion is 5 bytes per 32K- - byte block, i.e., a size increase of 0.015% for large data sets. - English text usually compresses by a factor of 2.5 to 3; - executable files usually compress somewhat less; graphical data - such as raster images may compress much more. - - 1.2. Intended audience - - This specification is intended for use by implementors of software - to compress data into "deflate" format and/or decompress data from - "deflate" format. - - The text of the specification assumes a basic background in - programming at the level of bits and other primitive data - representations. Familiarity with the technique of Huffman coding - is helpful but not required. - - 1.3. Scope - - The specification specifies a method for representing a sequence - of bytes as a (usually shorter) sequence of bits, and a method for - packing the latter bit sequence into bytes. - - 1.4. Compliance - - Unless otherwise indicated below, a compliant decompressor must be - able to accept and decompress any data set that conforms to all - the specifications presented here; a compliant compressor must - produce data sets that conform to all the specifications presented - here. - - 1.5. Definitions of terms and conventions used - - Byte: 8 bits stored or transmitted as a unit (same as an octet). - For this specification, a byte is exactly 8 bits, even on machines - - - -Deutsch Informational [Page 3] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - which store a character on a number of bits different from eight. - See below, for the numbering of bits within a byte. - - String: a sequence of arbitrary bytes. - - 1.6. Changes from previous versions - - There have been no technical changes to the deflate format since - version 1.1 of this specification. In version 1.2, some - terminology was changed. Version 1.3 is a conversion of the - specification to RFC style. - -2. Compressed representation overview - - A compressed data set consists of a series of blocks, corresponding - to successive blocks of input data. The block sizes are arbitrary, - except that non-compressible blocks are limited to 65,535 bytes. - - Each block is compressed using a combination of the LZ77 algorithm - and Huffman coding. The Huffman trees for each block are independent - of those for previous or subsequent blocks; the LZ77 algorithm may - use a reference to a duplicated string occurring in a previous block, - up to 32K input bytes before. - - Each block consists of two parts: a pair of Huffman code trees that - describe the representation of the compressed data part, and a - compressed data part. (The Huffman trees themselves are compressed - using Huffman encoding.) The compressed data consists of a series of - elements of two types: literal bytes (of strings that have not been - detected as duplicated within the previous 32K input bytes), and - pointers to duplicated strings, where a pointer is represented as a - pair . The representation used in the - "deflate" format limits distances to 32K bytes and lengths to 258 - bytes, but does not limit the size of a block, except for - uncompressible blocks, which are limited as noted above. - - Each type of value (literals, distances, and lengths) in the - compressed data is represented using a Huffman code, using one code - tree for literals and lengths and a separate code tree for distances. - The code trees for each block appear in a compact form just before - the compressed data for that block. - - - - - - - - - - -Deutsch Informational [Page 4] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - -3. Detailed specification - - 3.1. Overall conventions In the diagrams below, a box like this: - - +---+ - | | <-- the vertical bars might be missing - +---+ - - represents one byte; a box like this: - - +==============+ - | | - +==============+ - - represents a variable number of bytes. - - Bytes stored within a computer do not have a "bit order", since - they are always treated as a unit. However, a byte considered as - an integer between 0 and 255 does have a most- and least- - significant bit, and since we write numbers with the most- - significant digit on the left, we also write bytes with the most- - significant bit on the left. In the diagrams below, we number the - bits of a byte so that bit 0 is the least-significant bit, i.e., - the bits are numbered: - - +--------+ - |76543210| - +--------+ - - Within a computer, a number may occupy multiple bytes. All - multi-byte numbers in the format described here are stored with - the least-significant byte first (at the lower memory address). - For example, the decimal number 520 is stored as: - - 0 1 - +--------+--------+ - |00001000|00000010| - +--------+--------+ - ^ ^ - | | - | + more significant byte = 2 x 256 - + less significant byte = 8 - - 3.1.1. Packing into bytes - - This document does not address the issue of the order in which - bits of a byte are transmitted on a bit-sequential medium, - since the final data format described here is byte- rather than - - - -Deutsch Informational [Page 5] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - bit-oriented. However, we describe the compressed block format - in below, as a sequence of data elements of various bit - lengths, not a sequence of bytes. We must therefore specify - how to pack these data elements into bytes to form the final - compressed byte sequence: - - * Data elements are packed into bytes in order of - increasing bit number within the byte, i.e., starting - with the least-significant bit of the byte. - * Data elements other than Huffman codes are packed - starting with the least-significant bit of the data - element. - * Huffman codes are packed starting with the most- - significant bit of the code. - - In other words, if one were to print out the compressed data as - a sequence of bytes, starting with the first byte at the - *right* margin and proceeding to the *left*, with the most- - significant bit of each byte on the left as usual, one would be - able to parse the result from right to left, with fixed-width - elements in the correct MSB-to-LSB order and Huffman codes in - bit-reversed order (i.e., with the first bit of the code in the - relative LSB position). - - 3.2. Compressed block format - - 3.2.1. Synopsis of prefix and Huffman coding - - Prefix coding represents symbols from an a priori known - alphabet by bit sequences (codes), one code for each symbol, in - a manner such that different symbols may be represented by bit - sequences of different lengths, but a parser can always parse - an encoded string unambiguously symbol-by-symbol. - - We define a prefix code in terms of a binary tree in which the - two edges descending from each non-leaf node are labeled 0 and - 1 and in which the leaf nodes correspond one-for-one with (are - labeled with) the symbols of the alphabet; then the code for a - symbol is the sequence of 0's and 1's on the edges leading from - the root to the leaf labeled with that symbol. For example: - - - - - - - - - - - -Deutsch Informational [Page 6] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - /\ Symbol Code - 0 1 ------ ---- - / \ A 00 - /\ B B 1 - 0 1 C 011 - / \ D 010 - A /\ - 0 1 - / \ - D C - - A parser can decode the next symbol from an encoded input - stream by walking down the tree from the root, at each step - choosing the edge corresponding to the next input bit. - - Given an alphabet with known symbol frequencies, the Huffman - algorithm allows the construction of an optimal prefix code - (one which represents strings with those symbol frequencies - using the fewest bits of any possible prefix codes for that - alphabet). Such a code is called a Huffman code. (See - reference [1] in Chapter 5, references for additional - information on Huffman codes.) - - Note that in the "deflate" format, the Huffman codes for the - various alphabets must not exceed certain maximum code lengths. - This constraint complicates the algorithm for computing code - lengths from symbol frequencies. Again, see Chapter 5, - references for details. - - 3.2.2. Use of Huffman coding in the "deflate" format - - The Huffman codes used for each alphabet in the "deflate" - format have two additional rules: - - * All codes of a given bit length have lexicographically - consecutive values, in the same order as the symbols - they represent; - - * Shorter codes lexicographically precede longer codes. - - - - - - - - - - - - -Deutsch Informational [Page 7] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - We could recode the example above to follow this rule as - follows, assuming that the order of the alphabet is ABCD: - - Symbol Code - ------ ---- - A 10 - B 0 - C 110 - D 111 - - I.e., 0 precedes 10 which precedes 11x, and 110 and 111 are - lexicographically consecutive. - - Given this rule, we can define the Huffman code for an alphabet - just by giving the bit lengths of the codes for each symbol of - the alphabet in order; this is sufficient to determine the - actual codes. In our example, the code is completely defined - by the sequence of bit lengths (2, 1, 3, 3). The following - algorithm generates the codes as integers, intended to be read - from most- to least-significant bit. The code lengths are - initially in tree[I].Len; the codes are produced in - tree[I].Code. - - 1) Count the number of codes for each code length. Let - bl_count[N] be the number of codes of length N, N >= 1. - - 2) Find the numerical value of the smallest code for each - code length: - - code = 0; - bl_count[0] = 0; - for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; - next_code[bits] = code; - } - - 3) Assign numerical values to all codes, using consecutive - values for all codes of the same length with the base - values determined at step 2. Codes that are never used - (which have a bit length of zero) must not be assigned a - value. - - for (n = 0; n <= max_code; n++) { - len = tree[n].Len; - if (len != 0) { - tree[n].Code = next_code[len]; - next_code[len]++; - } - - - -Deutsch Informational [Page 8] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - } - - Example: - - Consider the alphabet ABCDEFGH, with bit lengths (3, 3, 3, 3, - 3, 2, 4, 4). After step 1, we have: - - N bl_count[N] - - ----------- - 2 1 - 3 5 - 4 2 - - Step 2 computes the following next_code values: - - N next_code[N] - - ------------ - 1 0 - 2 0 - 3 2 - 4 14 - - Step 3 produces the following code values: - - Symbol Length Code - ------ ------ ---- - A 3 010 - B 3 011 - C 3 100 - D 3 101 - E 3 110 - F 2 00 - G 4 1110 - H 4 1111 - - 3.2.3. Details of block format - - Each block of compressed data begins with 3 header bits - containing the following data: - - first bit BFINAL - next 2 bits BTYPE - - Note that the header bits do not necessarily begin on a byte - boundary, since a block does not necessarily occupy an integral - number of bytes. - - - - - -Deutsch Informational [Page 9] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - BFINAL is set if and only if this is the last block of the data - set. - - BTYPE specifies how the data are compressed, as follows: - - 00 - no compression - 01 - compressed with fixed Huffman codes - 10 - compressed with dynamic Huffman codes - 11 - reserved (error) - - The only difference between the two compressed cases is how the - Huffman codes for the literal/length and distance alphabets are - defined. - - In all cases, the decoding algorithm for the actual data is as - follows: - - do - read block header from input stream. - if stored with no compression - skip any remaining bits in current partially - processed byte - read LEN and NLEN (see next section) - copy LEN bytes of data to output - otherwise - if compressed with dynamic Huffman codes - read representation of code trees (see - subsection below) - loop (until end of block code recognized) - decode literal/length value from input stream - if value < 256 - copy value (literal byte) to output stream - otherwise - if value = end of block (256) - break from loop - otherwise (value = 257..285) - decode distance from input stream - - move backwards distance bytes in the output - stream, and copy length bytes from this - position to the output stream. - end loop - while not last block - - Note that a duplicated string reference may refer to a string - in a previous block; i.e., the backward distance may cross one - or more block boundaries. However a distance cannot refer past - the beginning of the output stream. (An application using a - - - -Deutsch Informational [Page 10] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - preset dictionary might discard part of the output stream; a - distance can refer to that part of the output stream anyway) - Note also that the referenced string may overlap the current - position; for example, if the last 2 bytes decoded have values - X and Y, a string reference with - adds X,Y,X,Y,X to the output stream. - - We now specify each compression method in turn. - - 3.2.4. Non-compressed blocks (BTYPE=00) - - Any bits of input up to the next byte boundary are ignored. - The rest of the block consists of the following information: - - 0 1 2 3 4... - +---+---+---+---+================================+ - | LEN | NLEN |... LEN bytes of literal data...| - +---+---+---+---+================================+ - - LEN is the number of data bytes in the block. NLEN is the - one's complement of LEN. - - 3.2.5. Compressed blocks (length and distance codes) - - As noted above, encoded data blocks in the "deflate" format - consist of sequences of symbols drawn from three conceptually - distinct alphabets: either literal bytes, from the alphabet of - byte values (0..255), or pairs, - where the length is drawn from (3..258) and the distance is - drawn from (1..32,768). In fact, the literal and length - alphabets are merged into a single alphabet (0..285), where - values 0..255 represent literal bytes, the value 256 indicates - end-of-block, and values 257..285 represent length codes - (possibly in conjunction with extra bits following the symbol - code) as follows: - - - - - - - - - - - - - - - - -Deutsch Informational [Page 11] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - Extra Extra Extra - Code Bits Length(s) Code Bits Lengths Code Bits Length(s) - ---- ---- ------ ---- ---- ------- ---- ---- ------- - 257 0 3 267 1 15,16 277 4 67-82 - 258 0 4 268 1 17,18 278 4 83-98 - 259 0 5 269 2 19-22 279 4 99-114 - 260 0 6 270 2 23-26 280 4 115-130 - 261 0 7 271 2 27-30 281 5 131-162 - 262 0 8 272 2 31-34 282 5 163-194 - 263 0 9 273 3 35-42 283 5 195-226 - 264 0 10 274 3 43-50 284 5 227-257 - 265 1 11,12 275 3 51-58 285 0 258 - 266 1 13,14 276 3 59-66 - - The extra bits should be interpreted as a machine integer - stored with the most-significant bit first, e.g., bits 1110 - represent the value 14. - - Extra Extra Extra - Code Bits Dist Code Bits Dist Code Bits Distance - ---- ---- ---- ---- ---- ------ ---- ---- -------- - 0 0 1 10 4 33-48 20 9 1025-1536 - 1 0 2 11 4 49-64 21 9 1537-2048 - 2 0 3 12 5 65-96 22 10 2049-3072 - 3 0 4 13 5 97-128 23 10 3073-4096 - 4 1 5,6 14 6 129-192 24 11 4097-6144 - 5 1 7,8 15 6 193-256 25 11 6145-8192 - 6 2 9-12 16 7 257-384 26 12 8193-12288 - 7 2 13-16 17 7 385-512 27 12 12289-16384 - 8 3 17-24 18 8 513-768 28 13 16385-24576 - 9 3 25-32 19 8 769-1024 29 13 24577-32768 - - 3.2.6. Compression with fixed Huffman codes (BTYPE=01) - - The Huffman codes for the two alphabets are fixed, and are not - represented explicitly in the data. The Huffman code lengths - for the literal/length alphabet are: - - Lit Value Bits Codes - --------- ---- ----- - 0 - 143 8 00110000 through - 10111111 - 144 - 255 9 110010000 through - 111111111 - 256 - 279 7 0000000 through - 0010111 - 280 - 287 8 11000000 through - 11000111 - - - -Deutsch Informational [Page 12] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - The code lengths are sufficient to generate the actual codes, - as described above; we show the codes in the table for added - clarity. Literal/length values 286-287 will never actually - occur in the compressed data, but participate in the code - construction. - - Distance codes 0-31 are represented by (fixed-length) 5-bit - codes, with possible additional bits as shown in the table - shown in Paragraph 3.2.5, above. Note that distance codes 30- - 31 will never actually occur in the compressed data. - - 3.2.7. Compression with dynamic Huffman codes (BTYPE=10) - - The Huffman codes for the two alphabets appear in the block - immediately after the header bits and before the actual - compressed data, first the literal/length code and then the - distance code. Each code is defined by a sequence of code - lengths, as discussed in Paragraph 3.2.2, above. For even - greater compactness, the code length sequences themselves are - compressed using a Huffman code. The alphabet for code lengths - is as follows: - - 0 - 15: Represent code lengths of 0 - 15 - 16: Copy the previous code length 3 - 6 times. - The next 2 bits indicate repeat length - (0 = 3, ... , 3 = 6) - Example: Codes 8, 16 (+2 bits 11), - 16 (+2 bits 10) will expand to - 12 code lengths of 8 (1 + 6 + 5) - 17: Repeat a code length of 0 for 3 - 10 times. - (3 bits of length) - 18: Repeat a code length of 0 for 11 - 138 times - (7 bits of length) - - A code length of 0 indicates that the corresponding symbol in - the literal/length or distance alphabet will not occur in the - block, and should not participate in the Huffman code - construction algorithm given earlier. If only one distance - code is used, it is encoded using one bit, not zero bits; in - this case there is a single code length of one, with one unused - code. One distance code of zero bits means that there are no - distance codes used at all (the data is all literals). - - We can now define the format of the block: - - 5 Bits: HLIT, # of Literal/Length codes - 257 (257 - 286) - 5 Bits: HDIST, # of Distance codes - 1 (1 - 32) - 4 Bits: HCLEN, # of Code Length codes - 4 (4 - 19) - - - -Deutsch Informational [Page 13] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - (HCLEN + 4) x 3 bits: code lengths for the code length - alphabet given just above, in the order: 16, 17, 18, - 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 - - These code lengths are interpreted as 3-bit integers - (0-7); as above, a code length of 0 means the - corresponding symbol (literal/length or distance code - length) is not used. - - HLIT + 257 code lengths for the literal/length alphabet, - encoded using the code length Huffman code - - HDIST + 1 code lengths for the distance alphabet, - encoded using the code length Huffman code - - The actual compressed data of the block, - encoded using the literal/length and distance Huffman - codes - - The literal/length symbol 256 (end of data), - encoded using the literal/length Huffman code - - The code length repeat codes can cross from HLIT + 257 to the - HDIST + 1 code lengths. In other words, all code lengths form - a single sequence of HLIT + HDIST + 258 values. - - 3.3. Compliance - - A compressor may limit further the ranges of values specified in - the previous section and still be compliant; for example, it may - limit the range of backward pointers to some value smaller than - 32K. Similarly, a compressor may limit the size of blocks so that - a compressible block fits in memory. - - A compliant decompressor must accept the full range of possible - values defined in the previous section, and must accept blocks of - arbitrary size. - -4. Compression algorithm details - - While it is the intent of this document to define the "deflate" - compressed data format without reference to any particular - compression algorithm, the format is related to the compressed - formats produced by LZ77 (Lempel-Ziv 1977, see reference [2] below); - since many variations of LZ77 are patented, it is strongly - recommended that the implementor of a compressor follow the general - algorithm presented here, which is known not to be patented per se. - The material in this section is not part of the definition of the - - - -Deutsch Informational [Page 14] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - - specification per se, and a compressor need not follow it in order to - be compliant. - - The compressor terminates a block when it determines that starting a - new block with fresh trees would be useful, or when the block size - fills up the compressor's block buffer. - - The compressor uses a chained hash table to find duplicated strings, - using a hash function that operates on 3-byte sequences. At any - given point during compression, let XYZ be the next 3 input bytes to - be examined (not necessarily all different, of course). First, the - compressor examines the hash chain for XYZ. If the chain is empty, - the compressor simply writes out X as a literal byte and advances one - byte in the input. If the hash chain is not empty, indicating that - the sequence XYZ (or, if we are unlucky, some other 3 bytes with the - same hash function value) has occurred recently, the compressor - compares all strings on the XYZ hash chain with the actual input data - sequence starting at the current point, and selects the longest - match. - - The compressor searches the hash chains starting with the most recent - strings, to favor small distances and thus take advantage of the - Huffman encoding. The hash chains are singly linked. There are no - deletions from the hash chains; the algorithm simply discards matches - that are too old. To avoid a worst-case situation, very long hash - chains are arbitrarily truncated at a certain length, determined by a - run-time parameter. - - To improve overall compression, the compressor optionally defers the - selection of matches ("lazy matching"): after a match of length N has - been found, the compressor searches for a longer match starting at - the next input byte. If it finds a longer match, it truncates the - previous match to a length of one (thus producing a single literal - byte) and then emits the longer match. Otherwise, it emits the - original match, and, as described above, advances N bytes before - continuing. - - Run-time parameters also control this "lazy match" procedure. If - compression ratio is most important, the compressor attempts a - complete second search regardless of the length of the first match. - In the normal case, if the current match is "long enough", the - compressor reduces the search for a longer match, thus speeding up - the process. If speed is most important, the compressor inserts new - strings in the hash table only when no match was found, or when the - match is not "too long". This degrades the compression ratio but - saves time since there are both fewer insertions and fewer searches. - - - - - -Deutsch Informational [Page 15] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - -5. References - - [1] Huffman, D. A., "A Method for the Construction of Minimum - Redundancy Codes", Proceedings of the Institute of Radio - Engineers, September 1952, Volume 40, Number 9, pp. 1098-1101. - - [2] Ziv J., Lempel A., "A Universal Algorithm for Sequential Data - Compression", IEEE Transactions on Information Theory, Vol. 23, - No. 3, pp. 337-343. - - [3] Gailly, J.-L., and Adler, M., ZLIB documentation and sources, - available in ftp://ftp.uu.net/pub/archiving/zip/doc/ - - [4] Gailly, J.-L., and Adler, M., GZIP documentation and sources, - available as gzip-*.tar in ftp://prep.ai.mit.edu/pub/gnu/ - - [5] Schwartz, E. S., and Kallick, B. "Generating a canonical prefix - encoding." Comm. ACM, 7,3 (Mar. 1964), pp. 166-169. - - [6] Hirschberg and Lelewer, "Efficient decoding of prefix codes," - Comm. ACM, 33,4, April 1990, pp. 449-459. - -6. Security Considerations - - Any data compression method involves the reduction of redundancy in - the data. Consequently, any corruption of the data is likely to have - severe effects and be difficult to correct. Uncompressed text, on - the other hand, will probably still be readable despite the presence - of some corrupted bytes. - - It is recommended that systems using this data format provide some - means of validating the integrity of the compressed data. See - reference [3], for example. - -7. Source code - - Source code for a C language implementation of a "deflate" compliant - compressor and decompressor is available within the zlib package at - ftp://ftp.uu.net/pub/archiving/zip/zlib/. - -8. Acknowledgements - - Trademarks cited in this document are the property of their - respective owners. - - Phil Katz designed the deflate format. Jean-Loup Gailly and Mark - Adler wrote the related software described in this specification. - Glenn Randers-Pehrson converted this document to RFC and HTML format. - - - -Deutsch Informational [Page 16] - -RFC 1951 DEFLATE Compressed Data Format Specification May 1996 - - -9. Author's Address - - L. Peter Deutsch - Aladdin Enterprises - 203 Santa Margarita Ave. - Menlo Park, CA 94025 - - Phone: (415) 322-0103 (AM only) - FAX: (415) 322-1734 - EMail: - - Questions about the technical content of this specification can be - sent by email to: - - Jean-Loup Gailly and - Mark Adler - - Editorial comments on this specification can be sent by email to: - - L. Peter Deutsch and - Glenn Randers-Pehrson - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Deutsch Informational [Page 17] - diff --git a/libs/zlibng/doc/rfc1952.txt b/libs/zlibng/doc/rfc1952.txt deleted file mode 100644 index a8e51b456..000000000 --- a/libs/zlibng/doc/rfc1952.txt +++ /dev/null @@ -1,675 +0,0 @@ - - - - - - -Network Working Group P. Deutsch -Request for Comments: 1952 Aladdin Enterprises -Category: Informational May 1996 - - - GZIP file format specification version 4.3 - -Status of This Memo - - This memo provides information for the Internet community. This memo - does not specify an Internet standard of any kind. Distribution of - this memo is unlimited. - -IESG Note: - - The IESG takes no position on the validity of any Intellectual - Property Rights statements contained in this document. - -Notices - - Copyright (c) 1996 L. Peter Deutsch - - Permission is granted to copy and distribute this document for any - purpose and without charge, including translations into other - languages and incorporation into compilations, provided that the - copyright notice and this notice are preserved, and that any - substantive changes or deletions from the original are clearly - marked. - - A pointer to the latest version of this and related documentation in - HTML format can be found at the URL - . - -Abstract - - This specification defines a lossless compressed data format that is - compatible with the widely used GZIP utility. The format includes a - cyclic redundancy check value for detecting data corruption. The - format presently uses the DEFLATE method of compression but can be - easily extended to use other compression methods. The format can be - implemented readily in a manner not covered by patents. - - - - - - - - - - -Deutsch Informational [Page 1] - -RFC 1952 GZIP File Format Specification May 1996 - - -Table of Contents - - 1. Introduction ................................................... 2 - 1.1. Purpose ................................................... 2 - 1.2. Intended audience ......................................... 3 - 1.3. Scope ..................................................... 3 - 1.4. Compliance ................................................ 3 - 1.5. Definitions of terms and conventions used ................. 3 - 1.6. Changes from previous versions ............................ 3 - 2. Detailed specification ......................................... 4 - 2.1. Overall conventions ....................................... 4 - 2.2. File format ............................................... 5 - 2.3. Member format ............................................. 5 - 2.3.1. Member header and trailer ........................... 6 - 2.3.1.1. Extra field ................................... 8 - 2.3.1.2. Compliance .................................... 9 - 3. References .................................................. 9 - 4. Security Considerations .................................... 10 - 5. Acknowledgements ........................................... 10 - 6. Author's Address ........................................... 10 - 7. Appendix: Jean-Loup Gailly's gzip utility .................. 11 - 8. Appendix: Sample CRC Code .................................. 11 - -1. Introduction - - 1.1. Purpose - - The purpose of this specification is to define a lossless - compressed data format that: - - * Is independent of CPU type, operating system, file system, - and character set, and hence can be used for interchange; - * Can compress or decompress a data stream (as opposed to a - randomly accessible file) to produce another data stream, - using only an a priori bounded amount of intermediate - storage, and hence can be used in data communications or - similar structures such as Unix filters; - * Compresses data with efficiency comparable to the best - currently available general-purpose compression methods, - and in particular considerably better than the "compress" - program; - * Can be implemented readily in a manner not covered by - patents, and hence can be practiced freely; - * Is compatible with the file format produced by the current - widely used gzip utility, in that conforming decompressors - will be able to read data produced by the existing gzip - compressor. - - - - -Deutsch Informational [Page 2] - -RFC 1952 GZIP File Format Specification May 1996 - - - The data format defined by this specification does not attempt to: - - * Provide random access to compressed data; - * Compress specialized data (e.g., raster graphics) as well as - the best currently available specialized algorithms. - - 1.2. Intended audience - - This specification is intended for use by implementors of software - to compress data into gzip format and/or decompress data from gzip - format. - - The text of the specification assumes a basic background in - programming at the level of bits and other primitive data - representations. - - 1.3. Scope - - The specification specifies a compression method and a file format - (the latter assuming only that a file can store a sequence of - arbitrary bytes). It does not specify any particular interface to - a file system or anything about character sets or encodings - (except for file names and comments, which are optional). - - 1.4. Compliance - - Unless otherwise indicated below, a compliant decompressor must be - able to accept and decompress any file that conforms to all the - specifications presented here; a compliant compressor must produce - files that conform to all the specifications presented here. The - material in the appendices is not part of the specification per se - and is not relevant to compliance. - - 1.5. Definitions of terms and conventions used - - byte: 8 bits stored or transmitted as a unit (same as an octet). - (For this specification, a byte is exactly 8 bits, even on - machines which store a character on a number of bits different - from 8.) See below for the numbering of bits within a byte. - - 1.6. Changes from previous versions - - There have been no technical changes to the gzip format since - version 4.1 of this specification. In version 4.2, some - terminology was changed, and the sample CRC code was rewritten for - clarity and to eliminate the requirement for the caller to do pre- - and post-conditioning. Version 4.3 is a conversion of the - specification to RFC style. - - - -Deutsch Informational [Page 3] - -RFC 1952 GZIP File Format Specification May 1996 - - -2. Detailed specification - - 2.1. Overall conventions - - In the diagrams below, a box like this: - - +---+ - | | <-- the vertical bars might be missing - +---+ - - represents one byte; a box like this: - - +==============+ - | | - +==============+ - - represents a variable number of bytes. - - Bytes stored within a computer do not have a "bit order", since - they are always treated as a unit. However, a byte considered as - an integer between 0 and 255 does have a most- and least- - significant bit, and since we write numbers with the most- - significant digit on the left, we also write bytes with the most- - significant bit on the left. In the diagrams below, we number the - bits of a byte so that bit 0 is the least-significant bit, i.e., - the bits are numbered: - - +--------+ - |76543210| - +--------+ - - This document does not address the issue of the order in which - bits of a byte are transmitted on a bit-sequential medium, since - the data format described here is byte- rather than bit-oriented. - - Within a computer, a number may occupy multiple bytes. All - multi-byte numbers in the format described here are stored with - the least-significant byte first (at the lower memory address). - For example, the decimal number 520 is stored as: - - 0 1 - +--------+--------+ - |00001000|00000010| - +--------+--------+ - ^ ^ - | | - | + more significant byte = 2 x 256 - + less significant byte = 8 - - - -Deutsch Informational [Page 4] - -RFC 1952 GZIP File Format Specification May 1996 - - - 2.2. File format - - A gzip file consists of a series of "members" (compressed data - sets). The format of each member is specified in the following - section. The members simply appear one after another in the file, - with no additional information before, between, or after them. - - 2.3. Member format - - Each member has the following structure: - - +---+---+---+---+---+---+---+---+---+---+ - |ID1|ID2|CM |FLG| MTIME |XFL|OS | (more-->) - +---+---+---+---+---+---+---+---+---+---+ - - (if FLG.FEXTRA set) - - +---+---+=================================+ - | XLEN |...XLEN bytes of "extra field"...| (more-->) - +---+---+=================================+ - - (if FLG.FNAME set) - - +=========================================+ - |...original file name, zero-terminated...| (more-->) - +=========================================+ - - (if FLG.FCOMMENT set) - - +===================================+ - |...file comment, zero-terminated...| (more-->) - +===================================+ - - (if FLG.FHCRC set) - - +---+---+ - | CRC16 | - +---+---+ - - +=======================+ - |...compressed blocks...| (more-->) - +=======================+ - - 0 1 2 3 4 5 6 7 - +---+---+---+---+---+---+---+---+ - | CRC32 | ISIZE | - +---+---+---+---+---+---+---+---+ - - - - -Deutsch Informational [Page 5] - -RFC 1952 GZIP File Format Specification May 1996 - - - 2.3.1. Member header and trailer - - ID1 (IDentification 1) - ID2 (IDentification 2) - These have the fixed values ID1 = 31 (0x1f, \037), ID2 = 139 - (0x8b, \213), to identify the file as being in gzip format. - - CM (Compression Method) - This identifies the compression method used in the file. CM - = 0-7 are reserved. CM = 8 denotes the "deflate" - compression method, which is the one customarily used by - gzip and which is documented elsewhere. - - FLG (FLaGs) - This flag byte is divided into individual bits as follows: - - bit 0 FTEXT - bit 1 FHCRC - bit 2 FEXTRA - bit 3 FNAME - bit 4 FCOMMENT - bit 5 reserved - bit 6 reserved - bit 7 reserved - - If FTEXT is set, the file is probably ASCII text. This is - an optional indication, which the compressor may set by - checking a small amount of the input data to see whether any - non-ASCII characters are present. In case of doubt, FTEXT - is cleared, indicating binary data. For systems which have - different file formats for ascii text and binary data, the - decompressor can use FTEXT to choose the appropriate format. - We deliberately do not specify the algorithm used to set - this bit, since a compressor always has the option of - leaving it cleared and a decompressor always has the option - of ignoring it and letting some other program handle issues - of data conversion. - - If FHCRC is set, a CRC16 for the gzip header is present, - immediately before the compressed data. The CRC16 consists - of the two least significant bytes of the CRC32 for all - bytes of the gzip header up to and not including the CRC16. - [The FHCRC bit was never set by versions of gzip up to - 1.2.4, even though it was documented with a different - meaning in gzip 1.2.4.] - - If FEXTRA is set, optional extra fields are present, as - described in a following section. - - - -Deutsch Informational [Page 6] - -RFC 1952 GZIP File Format Specification May 1996 - - - If FNAME is set, an original file name is present, - terminated by a zero byte. The name must consist of ISO - 8859-1 (LATIN-1) characters; on operating systems using - EBCDIC or any other character set for file names, the name - must be translated to the ISO LATIN-1 character set. This - is the original name of the file being compressed, with any - directory components removed, and, if the file being - compressed is on a file system with case insensitive names, - forced to lower case. There is no original file name if the - data was compressed from a source other than a named file; - for example, if the source was stdin on a Unix system, there - is no file name. - - If FCOMMENT is set, a zero-terminated file comment is - present. This comment is not interpreted; it is only - intended for human consumption. The comment must consist of - ISO 8859-1 (LATIN-1) characters. Line breaks should be - denoted by a single line feed character (10 decimal). - - Reserved FLG bits must be zero. - - MTIME (Modification TIME) - This gives the most recent modification time of the original - file being compressed. The time is in Unix format, i.e., - seconds since 00:00:00 GMT, Jan. 1, 1970. (Note that this - may cause problems for MS-DOS and other systems that use - local rather than Universal time.) If the compressed data - did not come from a file, MTIME is set to the time at which - compression started. MTIME = 0 means no time stamp is - available. - - XFL (eXtra FLags) - These flags are available for use by specific compression - methods. The "deflate" method (CM = 8) sets these flags as - follows: - - XFL = 2 - compressor used maximum compression, - slowest algorithm - XFL = 4 - compressor used fastest algorithm - - OS (Operating System) - This identifies the type of file system on which compression - took place. This may be useful in determining end-of-line - convention for text files. The currently defined values are - as follows: - - - - - - -Deutsch Informational [Page 7] - -RFC 1952 GZIP File Format Specification May 1996 - - - 0 - FAT filesystem (MS-DOS, OS/2, NT/Win32) - 1 - Amiga - 2 - VMS (or OpenVMS) - 3 - Unix - 4 - VM/CMS - 5 - Atari TOS - 6 - HPFS filesystem (OS/2, NT) - 7 - Macintosh - 8 - Z-System - 9 - CP/M - 10 - TOPS-20 - 11 - NTFS filesystem (NT) - 12 - QDOS - 13 - Acorn RISCOS - 255 - unknown - - XLEN (eXtra LENgth) - If FLG.FEXTRA is set, this gives the length of the optional - extra field. See below for details. - - CRC32 (CRC-32) - This contains a Cyclic Redundancy Check value of the - uncompressed data computed according to CRC-32 algorithm - used in the ISO 3309 standard and in section 8.1.1.6.2 of - ITU-T recommendation V.42. (See http://www.iso.ch for - ordering ISO documents. See gopher://info.itu.ch for an - online version of ITU-T V.42.) - - ISIZE (Input SIZE) - This contains the size of the original (uncompressed) input - data modulo 2^32. - - 2.3.1.1. Extra field - - If the FLG.FEXTRA bit is set, an "extra field" is present in - the header, with total length XLEN bytes. It consists of a - series of subfields, each of the form: - - +---+---+---+---+==================================+ - |SI1|SI2| LEN |... LEN bytes of subfield data ...| - +---+---+---+---+==================================+ - - SI1 and SI2 provide a subfield ID, typically two ASCII letters - with some mnemonic value. Jean-Loup Gailly - is maintaining a registry of subfield - IDs; please send him any subfield ID you wish to use. Subfield - IDs with SI2 = 0 are reserved for future use. The following - IDs are currently defined: - - - -Deutsch Informational [Page 8] - -RFC 1952 GZIP File Format Specification May 1996 - - - SI1 SI2 Data - ---------- ---------- ---- - 0x41 ('A') 0x70 ('P') Apollo file type information - - LEN gives the length of the subfield data, excluding the 4 - initial bytes. - - 2.3.1.2. Compliance - - A compliant compressor must produce files with correct ID1, - ID2, CM, CRC32, and ISIZE, but may set all the other fields in - the fixed-length part of the header to default values (255 for - OS, 0 for all others). The compressor must set all reserved - bits to zero. - - A compliant decompressor must check ID1, ID2, and CM, and - provide an error indication if any of these have incorrect - values. It must examine FEXTRA/XLEN, FNAME, FCOMMENT and FHCRC - at least so it can skip over the optional fields if they are - present. It need not examine any other part of the header or - trailer; in particular, a decompressor may ignore FTEXT and OS - and always produce binary output, and still be compliant. A - compliant decompressor must give an error indication if any - reserved bit is non-zero, since such a bit could indicate the - presence of a new field that would cause subsequent data to be - interpreted incorrectly. - -3. References - - [1] "Information Processing - 8-bit single-byte coded graphic - character sets - Part 1: Latin alphabet No.1" (ISO 8859-1:1987). - The ISO 8859-1 (Latin-1) character set is a superset of 7-bit - ASCII. Files defining this character set are available as - iso_8859-1.* in ftp://ftp.uu.net/graphics/png/documents/ - - [2] ISO 3309 - - [3] ITU-T recommendation V.42 - - [4] Deutsch, L.P.,"DEFLATE Compressed Data Format Specification", - available in ftp://ftp.uu.net/pub/archiving/zip/doc/ - - [5] Gailly, J.-L., GZIP documentation, available as gzip-*.tar in - ftp://prep.ai.mit.edu/pub/gnu/ - - [6] Sarwate, D.V., "Computation of Cyclic Redundancy Checks via Table - Look-Up", Communications of the ACM, 31(8), pp.1008-1013. - - - - -Deutsch Informational [Page 9] - -RFC 1952 GZIP File Format Specification May 1996 - - - [7] Schwaderer, W.D., "CRC Calculation", April 85 PC Tech Journal, - pp.118-133. - - [8] ftp://ftp.adelaide.edu.au/pub/rocksoft/papers/crc_v3.txt, - describing the CRC concept. - -4. Security Considerations - - Any data compression method involves the reduction of redundancy in - the data. Consequently, any corruption of the data is likely to have - severe effects and be difficult to correct. Uncompressed text, on - the other hand, will probably still be readable despite the presence - of some corrupted bytes. - - It is recommended that systems using this data format provide some - means of validating the integrity of the compressed data, such as by - setting and checking the CRC-32 check value. - -5. Acknowledgements - - Trademarks cited in this document are the property of their - respective owners. - - Jean-Loup Gailly designed the gzip format and wrote, with Mark Adler, - the related software described in this specification. Glenn - Randers-Pehrson converted this document to RFC and HTML format. - -6. Author's Address - - L. Peter Deutsch - Aladdin Enterprises - 203 Santa Margarita Ave. - Menlo Park, CA 94025 - - Phone: (415) 322-0103 (AM only) - FAX: (415) 322-1734 - EMail: - - Questions about the technical content of this specification can be - sent by email to: - - Jean-Loup Gailly and - Mark Adler - - Editorial comments on this specification can be sent by email to: - - L. Peter Deutsch and - Glenn Randers-Pehrson - - - -Deutsch Informational [Page 10] - -RFC 1952 GZIP File Format Specification May 1996 - - -7. Appendix: Jean-Loup Gailly's gzip utility - - The most widely used implementation of gzip compression, and the - original documentation on which this specification is based, were - created by Jean-Loup Gailly . Since this - implementation is a de facto standard, we mention some more of its - features here. Again, the material in this section is not part of - the specification per se, and implementations need not follow it to - be compliant. - - When compressing or decompressing a file, gzip preserves the - protection, ownership, and modification time attributes on the local - file system, since there is no provision for representing protection - attributes in the gzip file format itself. Since the file format - includes a modification time, the gzip decompressor provides a - command line switch that assigns the modification time from the file, - rather than the local modification time of the compressed input, to - the decompressed output. - -8. Appendix: Sample CRC Code - - The following sample code represents a practical implementation of - the CRC (Cyclic Redundancy Check). (See also ISO 3309 and ITU-T V.42 - for a formal specification.) - - The sample code is in the ANSI C programming language. Non C users - may find it easier to read with these hints: - - & Bitwise AND operator. - ^ Bitwise exclusive-OR operator. - >> Bitwise right shift operator. When applied to an - unsigned quantity, as here, right shift inserts zero - bit(s) at the left. - ! Logical NOT operator. - ++ "n++" increments the variable n. - 0xNNN 0x introduces a hexadecimal (base 16) constant. - Suffix L indicates a long value (at least 32 bits). - - /* Table of CRCs of all 8-bit messages. */ - unsigned long crc_table[256]; - - /* Flag: has the table been computed? Initially false. */ - int crc_table_computed = 0; - - /* Make the table for a fast CRC. */ - void make_crc_table(void) - { - unsigned long c; - - - -Deutsch Informational [Page 11] - -RFC 1952 GZIP File Format Specification May 1996 - - - int n, k; - for (n = 0; n < 256; n++) { - c = (unsigned long) n; - for (k = 0; k < 8; k++) { - if (c & 1) { - c = 0xedb88320L ^ (c >> 1); - } else { - c = c >> 1; - } - } - crc_table[n] = c; - } - crc_table_computed = 1; - } - - /* - Update a running crc with the bytes buf[0..len-1] and return - the updated crc. The crc should be initialized to zero. Pre- and - post-conditioning (one's complement) is performed within this - function so it shouldn't be done by the caller. Usage example: - - unsigned long crc = 0L; - - while (read_buffer(buffer, length) != EOF) { - crc = update_crc(crc, buffer, length); - } - if (crc != original_crc) error(); - */ - unsigned long update_crc(unsigned long crc, - unsigned char *buf, int len) - { - unsigned long c = crc ^ 0xffffffffL; - int n; - - if (!crc_table_computed) - make_crc_table(); - for (n = 0; n < len; n++) { - c = crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8); - } - return c ^ 0xffffffffL; - } - - /* Return the CRC of the bytes buf[0..len-1]. */ - unsigned long crc(unsigned char *buf, int len) - { - return update_crc(0L, buf, len); - } - - - - -Deutsch Informational [Page 12] - diff --git a/libs/zlibng/doc/txtvsbin.txt b/libs/zlibng/doc/txtvsbin.txt deleted file mode 100644 index 3d0f0634f..000000000 --- a/libs/zlibng/doc/txtvsbin.txt +++ /dev/null @@ -1,107 +0,0 @@ -A Fast Method for Identifying Plain Text Files -============================================== - - -Introduction ------------- - -Given a file coming from an unknown source, it is sometimes desirable -to find out whether the format of that file is plain text. Although -this may appear like a simple task, a fully accurate detection of the -file type requires heavy-duty semantic analysis on the file contents. -It is, however, possible to obtain satisfactory results by employing -various heuristics. - -Previous versions of PKZip and other zip-compatible compression tools -were using a crude detection scheme: if more than 80% (4/5) of the bytes -found in a certain buffer are within the range [7..127], the file is -labeled as plain text, otherwise it is labeled as binary. A prominent -limitation of this scheme is the restriction to Latin-based alphabets. -Other alphabets, like Greek, Cyrillic or Asian, make extensive use of -the bytes within the range [128..255], and texts using these alphabets -are most often misidentified by this scheme; in other words, the rate -of false negatives is sometimes too high, which means that the recall -is low. Another weakness of this scheme is a reduced precision, due to -the false positives that may occur when binary files containing large -amounts of textual characters are misidentified as plain text. - -In this article we propose a new, simple detection scheme that features -a much increased precision and a near-100% recall. This scheme is -designed to work on ASCII, Unicode and other ASCII-derived alphabets, -and it handles single-byte encodings (ISO-8859, MacRoman, KOI8, etc.) -and variable-sized encodings (ISO-2022, UTF-8, etc.). Wider encodings -(UCS-2/UTF-16 and UCS-4/UTF-32) are not handled, however. - - -The Algorithm -------------- - -The algorithm works by dividing the set of bytecodes [0..255] into three -categories: -- The white 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: - 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 -plain text; otherwise, it is categorized as binary. (The boundary case, -when the file is empty, automatically falls into the latter category.) - - -Rationale ---------- - -The idea behind this algorithm relies on two observations. - -The first observation is that, although the full range of 7-bit codes -[0..127] is properly specified by the ASCII standard, most control -characters in the range [0..31] are not used in practice. The only -widely-used, almost universally-portable control codes are 9 (TAB), -10 (LF) and 13 (CR). There are a few more control codes that are -recognized on a reduced range of platforms and text viewers/editors: -7 (BEL), 8 (BS), 11 (VT), 12 (FF), 26 (SUB) and 27 (ESC); but these -codes are rarely (if ever) used alone, without being accompanied by -some printable text. Even the newer, portable text formats such as -XML avoid using control characters outside the list mentioned here. - -The second observation is that most of the binary files tend to contain -control characters, especially 0 (NUL). Even though the older text -detection schemes observe the presence of non-ASCII codes from the range -[128..255], the precision rarely has to suffer if this upper range is -labeled as textual, because the files that are genuinely binary tend to -contain both control characters and codes from the upper range. On the -other hand, the upper range needs to be labeled as textual, because it -is used by virtually all ASCII extensions. In particular, this range is -used for encoding non-Latin scripts. - -Since there is no counting involved, other than simply observing the -presence or the absence of some byte values, the algorithm produces -consistent results, regardless what alphabet encoding is being used. -(If counting were involved, it could be possible to obtain different -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 -considerations. In such cases, a scheme that tolerates a small fraction -of black-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 -be regarded as binary by general-purpose text detection schemes, because -general-purpose text processing algorithms might not be applicable. -Under this premise, it is safe to say that our detection method provides -a near-100% recall. - -Experiments have been run on many files coming from various platforms -and applications. We tried plain text files, system logs, source code, -formatted office documents, compiled object code, etc. The results -confirm the optimistic assumptions about the capabilities of this -algorithm. - - --- -Cosmin Truta -Last updated: 2006-May-28 diff --git a/libs/zlibng/fallback_builtins.h b/libs/zlibng/fallback_builtins.h deleted file mode 100644 index 314ad3267..000000000 --- a/libs/zlibng/fallback_builtins.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef X86_BUILTIN_CTZ_H -#define X86_BUILTIN_CTZ_H - -#if defined(_MSC_VER) && !defined(__clang__) -#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64) || defined(_M_ARM) || defined(_M_ARM64) - -#include -#ifdef X86_FEATURES -# include "arch/x86/x86.h" -#endif - -/* This is not a general purpose replacement for __builtin_ctz. The function expects that value is != 0 - * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward is not checked - */ -static __forceinline unsigned long __builtin_ctz(uint32_t value) { -#ifdef X86_FEATURES - if (x86_cpu_has_tzcnt) - return _tzcnt_u32(value); -#endif - unsigned long trailing_zero; - _BitScanForward(&trailing_zero, value); - return trailing_zero; -} -#define HAVE_BUILTIN_CTZ - -#ifdef _M_AMD64 -/* This is not a general purpose replacement for __builtin_ctzll. The function expects that value is != 0 - * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward64 is not checked - */ -static __forceinline unsigned long long __builtin_ctzll(uint64_t value) { -#ifdef X86_FEATURES - if (x86_cpu_has_tzcnt) - return _tzcnt_u64(value); -#endif - unsigned long trailing_zero; - _BitScanForward64(&trailing_zero, value); - return trailing_zero; -} -#define HAVE_BUILTIN_CTZLL -#endif - -#endif -#endif -#endif diff --git a/libs/zlibng/functable.c b/libs/zlibng/functable.c deleted file mode 100644 index acae44641..000000000 --- a/libs/zlibng/functable.c +++ /dev/null @@ -1,466 +0,0 @@ -/* functable.c -- Choose relevant optimized functions at runtime - * Copyright (C) 2017 Hans Kristian Rosbach - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zendian.h" -#include "deflate.h" -#include "deflate_p.h" - -#include "functable.h" - -#ifdef X86_FEATURES -# include "fallback_builtins.h" -#endif - -/* insert_string */ -extern void insert_string_c(deflate_state *const s, const uint32_t str, uint32_t count); -#ifdef X86_SSE42_CRC_HASH -extern void insert_string_sse4(deflate_state *const s, const uint32_t str, uint32_t count); -#elif defined(ARM_ACLE_CRC_HASH) -extern void insert_string_acle(deflate_state *const s, const uint32_t str, uint32_t count); -#endif - -/* quick_insert_string */ -extern Pos quick_insert_string_c(deflate_state *const s, const uint32_t str); -#ifdef X86_SSE42_CRC_HASH -extern Pos quick_insert_string_sse4(deflate_state *const s, const uint32_t str); -#elif defined(ARM_ACLE_CRC_HASH) -extern Pos quick_insert_string_acle(deflate_state *const s, const uint32_t str); -#endif - -/* slide_hash */ -#ifdef X86_SSE2 -void slide_hash_sse2(deflate_state *s); -#elif defined(ARM_NEON_SLIDEHASH) -void slide_hash_neon(deflate_state *s); -#elif defined(POWER8_VSX_SLIDEHASH) -void slide_hash_power8(deflate_state *s); -#endif -#ifdef X86_AVX2 -void slide_hash_avx2(deflate_state *s); -#endif - -/* adler32 */ -extern uint32_t adler32_c(uint32_t adler, const unsigned char *buf, size_t len); -#ifdef ARM_NEON_ADLER32 -extern uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t len); -#endif -#ifdef X86_SSSE3_ADLER32 -extern uint32_t adler32_ssse3(uint32_t adler, const unsigned char *buf, size_t len); -#endif -#ifdef X86_AVX2_ADLER32 -extern uint32_t adler32_avx2(uint32_t adler, const unsigned char *buf, size_t len); -#endif -#ifdef POWER8_VSX_ADLER32 -extern uint32_t adler32_power8(uint32_t adler, const unsigned char* buf, size_t len); -#endif - -/* memory chunking */ -extern uint32_t chunksize_c(void); -extern uint8_t* chunkcopy_c(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_c(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_c(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_c(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_c(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#ifdef X86_SSE2_CHUNKSET -extern uint32_t chunksize_sse2(void); -extern uint8_t* chunkcopy_sse2(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_sse2(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_sse2(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_sse2(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_sse2(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef X86_AVX_CHUNKSET -extern uint32_t chunksize_avx(void); -extern uint8_t* chunkcopy_avx(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_avx(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_avx(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_avx(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_avx(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif -#ifdef ARM_NEON_CHUNKSET -extern uint32_t chunksize_neon(void); -extern uint8_t* chunkcopy_neon(uint8_t *out, uint8_t const *from, unsigned len); -extern uint8_t* chunkcopy_safe_neon(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); -extern uint8_t* chunkunroll_neon(uint8_t *out, unsigned *dist, unsigned *len); -extern uint8_t* chunkmemset_neon(uint8_t *out, unsigned dist, unsigned len); -extern uint8_t* chunkmemset_safe_neon(uint8_t *out, unsigned dist, unsigned len, unsigned left); -#endif - -/* CRC32 */ -Z_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t); - -#ifdef ARM_ACLE_CRC_HASH -extern uint32_t crc32_acle(uint32_t, const unsigned char *, uint64_t); -#endif - -#if BYTE_ORDER == LITTLE_ENDIAN -extern uint32_t crc32_little(uint32_t, const unsigned char *, uint64_t); -#elif BYTE_ORDER == BIG_ENDIAN -extern uint32_t crc32_big(uint32_t, const unsigned char *, uint64_t); -#endif - -/* compare258 */ -extern uint32_t compare258_c(const unsigned char *src0, const unsigned char *src1); -#ifdef UNALIGNED_OK -extern uint32_t compare258_unaligned_16(const unsigned char *src0, const unsigned char *src1); -extern uint32_t compare258_unaligned_32(const unsigned char *src0, const unsigned char *src1); -#ifdef UNALIGNED64_OK -extern uint32_t compare258_unaligned_64(const unsigned char *src0, const unsigned char *src1); -#endif -#ifdef X86_SSE42_CMP_STR -extern uint32_t compare258_unaligned_sse4(const unsigned char *src0, const unsigned char *src1); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t compare258_unaligned_avx2(const unsigned char *src0, const unsigned char *src1); -#endif -#endif - -/* longest_match */ -extern uint32_t longest_match_c(deflate_state *const s, Pos cur_match); -#ifdef UNALIGNED_OK -extern uint32_t longest_match_unaligned_16(deflate_state *const s, Pos cur_match); -extern uint32_t longest_match_unaligned_32(deflate_state *const s, Pos cur_match); -#ifdef UNALIGNED64_OK -extern uint32_t longest_match_unaligned_64(deflate_state *const s, Pos cur_match); -#endif -#ifdef X86_SSE42_CMP_STR -extern uint32_t longest_match_unaligned_sse4(deflate_state *const s, Pos cur_match); -#endif -#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) -extern uint32_t longest_match_unaligned_avx2(deflate_state *const s, Pos cur_match); -#endif -#endif - -Z_INTERNAL Z_TLS struct functable_s functable; - -Z_INTERNAL void cpu_check_features(void) -{ - static int features_checked = 0; - if (features_checked) - return; -#if defined(X86_FEATURES) - x86_check_features(); -#elif defined(ARM_FEATURES) - arm_check_features(); -#elif defined(POWER_FEATURES) - power_check_features(); -#endif - features_checked = 1; -} - -/* stub functions */ -Z_INTERNAL void insert_string_stub(deflate_state *const s, const uint32_t str, uint32_t count) { - // Initialize default - - functable.insert_string = &insert_string_c; - cpu_check_features(); - -#ifdef X86_SSE42_CRC_HASH - if (x86_cpu_has_sse42) - functable.insert_string = &insert_string_sse4; -#elif defined(ARM_ACLE_CRC_HASH) - if (arm_cpu_has_crc32) - functable.insert_string = &insert_string_acle; -#endif - - functable.insert_string(s, str, count); -} - -Z_INTERNAL Pos quick_insert_string_stub(deflate_state *const s, const uint32_t str) { - functable.quick_insert_string = &quick_insert_string_c; - -#ifdef X86_SSE42_CRC_HASH - if (x86_cpu_has_sse42) - functable.quick_insert_string = &quick_insert_string_sse4; -#elif defined(ARM_ACLE_CRC_HASH) - if (arm_cpu_has_crc32) - functable.quick_insert_string = &quick_insert_string_acle; -#endif - - return functable.quick_insert_string(s, str); -} - -Z_INTERNAL void slide_hash_stub(deflate_state *s) { - - functable.slide_hash = &slide_hash_c; - cpu_check_features(); - -#ifdef X86_SSE2 -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.slide_hash = &slide_hash_sse2; -#elif defined(ARM_NEON_SLIDEHASH) -# ifndef ARM_NOCHECK_NEON - if (arm_cpu_has_neon) -# endif - functable.slide_hash = &slide_hash_neon; -#endif -#ifdef X86_AVX2 - if (x86_cpu_has_avx2) - functable.slide_hash = &slide_hash_avx2; -#endif -#ifdef POWER8_VSX_SLIDEHASH - if (power_cpu_has_arch_2_07) - functable.slide_hash = &slide_hash_power8; -#endif - - functable.slide_hash(s); -} - -Z_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, size_t len) { - // Initialize default - functable.adler32 = &adler32_c; - cpu_check_features(); - -#ifdef ARM_NEON_ADLER32 -# ifndef ARM_NOCHECK_NEON - if (arm_cpu_has_neon) -# endif - functable.adler32 = &adler32_neon; -#endif -#ifdef X86_SSSE3_ADLER32 - if (x86_cpu_has_ssse3) - functable.adler32 = &adler32_ssse3; -#endif -#ifdef X86_AVX2_ADLER32 - if (x86_cpu_has_avx2) - functable.adler32 = &adler32_avx2; -#endif -#ifdef POWER8_VSX_ADLER32 - if (power_cpu_has_arch_2_07) - functable.adler32 = &adler32_power8; -#endif - - return functable.adler32(adler, buf, len); -} - -Z_INTERNAL uint32_t chunksize_stub(void) { - // Initialize default - functable.chunksize = &chunksize_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunksize = &chunksize_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunksize = &chunksize_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunksize = &chunksize_neon; -#endif - - return functable.chunksize(); -} - -Z_INTERNAL uint8_t* chunkcopy_stub(uint8_t *out, uint8_t const *from, unsigned len) { - // Initialize default - functable.chunkcopy = &chunkcopy_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkcopy = &chunkcopy_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkcopy = &chunkcopy_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkcopy = &chunkcopy_neon; -#endif - - return functable.chunkcopy(out, from, len); -} - -Z_INTERNAL uint8_t* chunkcopy_safe_stub(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { - // Initialize default - functable.chunkcopy_safe = &chunkcopy_safe_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkcopy_safe = &chunkcopy_safe_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkcopy_safe = &chunkcopy_safe_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkcopy_safe = &chunkcopy_safe_neon; -#endif - - return functable.chunkcopy_safe(out, from, len, safe); -} - -Z_INTERNAL uint8_t* chunkunroll_stub(uint8_t *out, unsigned *dist, unsigned *len) { - // Initialize default - functable.chunkunroll = &chunkunroll_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkunroll = &chunkunroll_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkunroll = &chunkunroll_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkunroll = &chunkunroll_neon; -#endif - - return functable.chunkunroll(out, dist, len); -} - -Z_INTERNAL uint8_t* chunkmemset_stub(uint8_t *out, unsigned dist, unsigned len) { - // Initialize default - functable.chunkmemset = &chunkmemset_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkmemset = &chunkmemset_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkmemset = &chunkmemset_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkmemset = &chunkmemset_neon; -#endif - - return functable.chunkmemset(out, dist, len); -} - -Z_INTERNAL uint8_t* chunkmemset_safe_stub(uint8_t *out, unsigned dist, unsigned len, unsigned left) { - // Initialize default - functable.chunkmemset_safe = &chunkmemset_safe_c; - -#ifdef X86_SSE2_CHUNKSET -# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2) - if (x86_cpu_has_sse2) -# endif - functable.chunkmemset_safe = &chunkmemset_safe_sse2; -#endif -#ifdef X86_AVX_CHUNKSET - if (x86_cpu_has_avx2) - functable.chunkmemset_safe = &chunkmemset_safe_avx; -#endif -#ifdef ARM_NEON_CHUNKSET - if (arm_cpu_has_neon) - functable.chunkmemset_safe = &chunkmemset_safe_neon; -#endif - - return functable.chunkmemset_safe(out, dist, len, left); -} - -Z_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64_t len) { - int32_t use_byfour = sizeof(void *) == sizeof(ptrdiff_t); - - Assert(sizeof(uint64_t) >= sizeof(size_t), - "crc32_z takes size_t but internally we have a uint64_t len"); - /* return a function pointer for optimized arches here after a capability test */ - - cpu_check_features(); - - if (use_byfour) { -#if BYTE_ORDER == LITTLE_ENDIAN - functable.crc32 = crc32_little; -# if defined(ARM_ACLE_CRC_HASH) - if (arm_cpu_has_crc32) - functable.crc32 = crc32_acle; -# endif -#elif BYTE_ORDER == BIG_ENDIAN - functable.crc32 = crc32_big; -#else -# error No endian defined -#endif - } else { - functable.crc32 = crc32_generic; - } - - return functable.crc32(crc, buf, len); -} - -Z_INTERNAL uint32_t compare258_stub(const unsigned char *src0, const unsigned char *src1) { - - functable.compare258 = &compare258_c; - -#ifdef UNALIGNED_OK -# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) - functable.compare258 = &compare258_unaligned_64; -# elif defined(HAVE_BUILTIN_CTZ) - functable.compare258 = &compare258_unaligned_32; -# else - functable.compare258 = &compare258_unaligned_16; -# endif -# ifdef X86_SSE42_CMP_STR - if (x86_cpu_has_sse42) - functable.compare258 = &compare258_unaligned_sse4; -# endif -# if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) - if (x86_cpu_has_avx2) - functable.compare258 = &compare258_unaligned_avx2; -# endif -#endif - - return functable.compare258(src0, src1); -} - -Z_INTERNAL uint32_t longest_match_stub(deflate_state *const s, Pos cur_match) { - - functable.longest_match = &longest_match_c; - -#ifdef UNALIGNED_OK -# if defined(UNALIGNED64_OK) && defined(HAVE_BUILTIN_CTZLL) - functable.longest_match = &longest_match_unaligned_64; -# elif defined(HAVE_BUILTIN_CTZ) - functable.longest_match = &longest_match_unaligned_32; -# else - functable.longest_match = &longest_match_unaligned_16; -# endif -# ifdef X86_SSE42_CMP_STR - if (x86_cpu_has_sse42) - functable.longest_match = &longest_match_unaligned_sse4; -# endif -# if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ) - if (x86_cpu_has_avx2) - functable.longest_match = &longest_match_unaligned_avx2; -# endif -#endif - - return functable.longest_match(s, cur_match); -} - -/* functable init */ -Z_INTERNAL Z_TLS struct functable_s functable = { - insert_string_stub, - quick_insert_string_stub, - adler32_stub, - crc32_stub, - slide_hash_stub, - compare258_stub, - longest_match_stub, - chunksize_stub, - chunkcopy_stub, - chunkcopy_safe_stub, - chunkunroll_stub, - chunkmemset_stub, - chunkmemset_safe_stub -}; diff --git a/libs/zlibng/functable.h b/libs/zlibng/functable.h deleted file mode 100644 index 276c284a0..000000000 --- a/libs/zlibng/functable.h +++ /dev/null @@ -1,29 +0,0 @@ -/* functable.h -- Struct containing function pointers to optimized functions - * Copyright (C) 2017 Hans Kristian Rosbach - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef FUNCTABLE_H_ -#define FUNCTABLE_H_ - -#include "deflate.h" - -struct functable_s { - void (* insert_string) (deflate_state *const s, const uint32_t str, uint32_t count); - Pos (* quick_insert_string)(deflate_state *const s, const uint32_t str); - uint32_t (* adler32) (uint32_t adler, const unsigned char *buf, size_t len); - uint32_t (* crc32) (uint32_t crc, const unsigned char *buf, uint64_t len); - void (* slide_hash) (deflate_state *s); - uint32_t (* compare258) (const unsigned char *src0, const unsigned char *src1); - uint32_t (* longest_match) (deflate_state *const s, Pos cur_match); - uint32_t (* chunksize) (void); - uint8_t* (* chunkcopy) (uint8_t *out, uint8_t const *from, unsigned len); - uint8_t* (* chunkcopy_safe) (uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe); - uint8_t* (* chunkunroll) (uint8_t *out, unsigned *dist, unsigned *len); - uint8_t* (* chunkmemset) (uint8_t *out, unsigned dist, unsigned len); - uint8_t* (* chunkmemset_safe) (uint8_t *out, unsigned dist, unsigned len, unsigned left); -}; - -Z_INTERNAL extern Z_TLS struct functable_s functable; - -#endif diff --git a/libs/zlibng/gzguts.h b/libs/zlibng/gzguts.h deleted file mode 100644 index 16029607f..000000000 --- a/libs/zlibng/gzguts.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef GZGUTS_H_ -#define GZGUTS_H_ -/* 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 copyright notice in zlib.h - */ - -#ifdef _LARGEFILE64_SOURCE -# ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE 1 -# endif -# ifdef _FILE_OFFSET_BITS -# undef _FILE_OFFSET_BITS -# endif -#endif - -#if defined(HAVE_VISIBILITY_INTERNAL) -# define Z_INTERNAL __attribute__((visibility ("internal"))) -#elif defined(HAVE_VISIBILITY_HIDDEN) -# define Z_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define Z_INTERNAL -#endif - -#include -#include -#include -#include -#include - -#if defined(ZLIB_COMPAT) -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#ifdef _WIN32 -# include -#endif - -#if !defined(_MSC_VER) || defined(__MINGW__) -# include /* for lseek(), read(), close(), write(), unlink() */ -#endif - -#if defined(_WIN32) -# include -# define WIDECHAR -#endif - -#ifdef WINAPI_FAMILY -# define open _open -# define read _read -# define write _write -# define close _close -#endif - -/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -#if !defined(STDC99) && !defined(__CYGWIN__) && !defined(__MINGW__) && defined(_WIN32) -# if !defined(vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# define vsnprintf _vsnprintf -# endif -# endif -#endif - -/* unlike snprintf (which is required in C99), _snprintf does not guarantee - null termination of the result -- however this is only used in gzlib.c - where the result is assured to fit in the space provided */ -#if defined(_MSC_VER) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif - -/* get errno and strerror definition */ -#ifndef NO_STRERROR -# include -# define zstrerror() strerror(errno) -#else -# define zstrerror() "stdio error (consult errno)" -#endif - -/* default memLevel */ -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif - -/* default i/o buffer size -- double this for output when reading (this and - twice this must be able to fit in an unsigned type) */ -#ifndef GZBUFSIZE -# define GZBUFSIZE 8192 -#endif - -/* gzip modes, also provide a little integrity check on the passed structure */ -#define GZ_NONE 0 -#define GZ_READ 7247 -#define GZ_WRITE 31153 -#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ - -/* values for gz_state how */ -#define LOOK 0 /* look for a gzip header */ -#define COPY 1 /* copy input directly */ -#define GZIP 2 /* decompress a gzip stream */ - -/* internal gzip file state data structure */ -typedef struct { - /* exposed contents for gzgetc() macro */ - struct gzFile_s x; /* "x" for exposed */ - /* x.have: number of bytes available at x.next */ - /* x.next: next output data to deliver or write */ - /* x.pos: current position in uncompressed data */ - /* used for both reading and writing */ - int mode; /* see gzip modes above */ - int fd; /* file descriptor */ - char *path; /* path or fd for error messages */ - unsigned size; /* buffer size, zero if not allocated yet */ - unsigned want; /* requested buffer size, default is GZBUFSIZE */ - unsigned char *in; /* input buffer (double-sized when writing) */ - unsigned char *out; /* output buffer (double-sized when reading) */ - int direct; /* 0 if processing gzip, 1 if transparent */ - /* just for reading */ - int how; /* 0: get header, 1: copy, 2: decompress */ - z_off64_t start; /* where the gzip data started, for rewinding */ - int eof; /* true if end of input file reached */ - int past; /* true if read requested past end */ - /* 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 */ - /* error information */ - int err; /* error code */ - char *msg; /* error message */ - /* zlib inflate or deflate stream */ - PREFIX3(stream) strm; /* stream structure in-place (not a pointer) */ -} gz_state; -typedef gz_state *gz_statep; - -/* shared functions */ -void Z_INTERNAL gz_error(gz_state *, int, const char *); - -/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t - value -- needed when comparing unsigned to z_off64_t, which is signed - (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned Z_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif - -#endif /* GZGUTS_H_ */ diff --git a/libs/zlibng/gzlib.c b/libs/zlibng/gzlib.c deleted file mode 100644 index 490551667..000000000 --- a/libs/zlibng/gzlib.c +++ /dev/null @@ -1,543 +0,0 @@ -/* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil_p.h" -#include "gzguts.h" - -#if defined(_WIN32) -# define LSEEK _lseeki64 -#else -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 -# define LSEEK lseek64 -#else -# define LSEEK lseek -#endif -#endif - -/* Local functions */ -static void gz_reset(gz_state *); -static gzFile gz_open(const void *, int, const char *); - -/* Reset gzip file state */ -static void gz_reset(gz_state *state) { - state->x.have = 0; /* no output data available */ - if (state->mode == GZ_READ) { /* for reading ... */ - state->eof = 0; /* not at end of file */ - 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 */ - state->strm.avail_in = 0; /* no input data yet */ -} - -/* Open a gzip file either by name or file descriptor. */ -static gzFile gz_open(const void *path, int fd, const char *mode) { - gz_state *state; - size_t len; - int oflag; -#ifdef O_CLOEXEC - int cloexec = 0; -#endif -#ifdef O_EXCL - int exclusive = 0; -#endif - - /* check input */ - if (path == NULL) - return NULL; - - /* allocate gzFile structure to return */ - state = (gz_state *)zng_alloc(sizeof(gz_state)); - if (state == NULL) - return NULL; - state->size = 0; /* no buffers allocated yet */ - state->want = GZBUFSIZE; /* requested buffer size */ - state->msg = NULL; /* no error message yet */ - - /* interpret mode */ - state->mode = GZ_NONE; - state->level = Z_DEFAULT_COMPRESSION; - state->strategy = Z_DEFAULT_STRATEGY; - state->direct = 0; - while (*mode) { - if (*mode >= '0' && *mode <= '9') { - state->level = *mode - '0'; - } else { - switch (*mode) { - case 'r': - state->mode = GZ_READ; - break; -#ifndef NO_GZCOMPRESS - case 'w': - state->mode = GZ_WRITE; - break; - case 'a': - state->mode = GZ_APPEND; - break; -#endif - case '+': /* can't read and write at the same time */ - zng_free(state); - return NULL; - case 'b': /* ignore -- will request binary anyway */ - break; -#ifdef O_CLOEXEC - case 'e': - cloexec = 1; - break; -#endif -#ifdef O_EXCL - case 'x': - exclusive = 1; - break; -#endif - case 'f': - state->strategy = Z_FILTERED; - break; - case 'h': - state->strategy = Z_HUFFMAN_ONLY; - break; - case 'R': - state->strategy = Z_RLE; - break; - case 'F': - state->strategy = Z_FIXED; - break; - case 'T': - state->direct = 1; - break; - default: /* could consider as an error, but just ignore */ - {} - } - } - mode++; - } - - /* must provide an "r", "w", or "a" */ - if (state->mode == GZ_NONE) { - zng_free(state); - return NULL; - } - - /* can't force transparent read */ - if (state->mode == GZ_READ) { - if (state->direct) { - zng_free(state); - return NULL; - } - state->direct = 1; /* for empty file */ - } - - /* save the path name for error messages */ -#ifdef WIDECHAR - if (fd == -2) { - len = wcstombs(NULL, (const wchar_t *)path, 0); - if (len == (size_t)-1) - len = 0; - } else -#endif - len = strlen((const char *)path); - state->path = (char *)malloc(len + 1); - if (state->path == NULL) { - zng_free(state); - return NULL; - } -#ifdef WIDECHAR - if (fd == -2) - if (len) { - wcstombs(state->path, (const wchar_t *)path, len + 1); - } else { - *(state->path) = 0; - } - else -#endif - (void)snprintf(state->path, len + 1, "%s", (const char *)path); - - /* compute the flags for open() */ - oflag = -#ifdef O_LARGEFILE - O_LARGEFILE | -#endif -#ifdef O_BINARY - O_BINARY | -#endif -#ifdef O_CLOEXEC - (cloexec ? O_CLOEXEC : 0) | -#endif - (state->mode == GZ_READ ? - O_RDONLY : - (O_WRONLY | O_CREAT | -#ifdef O_EXCL - (exclusive ? O_EXCL : 0) | -#endif - (state->mode == GZ_WRITE ? - O_TRUNC : - O_APPEND))); - - /* open the file with the appropriate flags (or just use fd) */ - state->fd = fd > -1 ? fd : ( -#if defined(_WIN32) - fd == -2 ? _wopen((const wchar_t *)path, oflag, 0666) : -#elif __CYGWIN__ - fd == -2 ? open(state->path, oflag, 0666) : -#endif - open((const char *)path, oflag, 0666)); - if (state->fd == -1) { - free(state->path); - zng_free(state); - return NULL; - } - if (state->mode == GZ_APPEND) { - LSEEK(state->fd, 0, SEEK_END); /* so gzoffset() is correct */ - state->mode = GZ_WRITE; /* simplify later checks */ - } - - /* save the current position for rewinding (only if reading) */ - if (state->mode == GZ_READ) { - state->start = LSEEK(state->fd, 0, SEEK_CUR); - if (state->start == -1) state->start = 0; - } - - /* initialize stream */ - gz_reset(state); - - /* return stream */ - return (gzFile)state; -} - -/* -- see zlib.h -- */ -gzFile Z_EXPORT PREFIX(gzopen)(const char *path, const char *mode) { - return gz_open(path, -1, mode); -} - -#ifdef ZLIB_COMPAT -gzFile Z_EXPORT PREFIX4(gzopen)(const char *path, const char *mode) { - return gz_open(path, -1, mode); -} -#endif - -/* -- see zlib.h -- */ -gzFile Z_EXPORT PREFIX(gzdopen)(int fd, const char *mode) { - char *path; /* identifier for error messages */ - gzFile gz; - - if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) - return NULL; - (void)snprintf(path, 7 + 3 * sizeof(int), "", fd); /* for debugging */ - gz = gz_open(path, fd, mode); - free(path); - return gz; -} - -/* -- see zlib.h -- */ -#ifdef WIDECHAR -gzFile Z_EXPORT PREFIX(gzopen_w)(const wchar_t *path, const char *mode) { - return gz_open(path, -2, mode); -} -#endif - -int Z_EXPORT PREFIX(gzclose)(gzFile file) { -#ifndef NO_GZCOMPRESS - gz_state *state; - - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_state *)file; - - return state->mode == GZ_READ ? PREFIX(gzclose_r)(file) : PREFIX(gzclose_w)(file); -#else - return PREFIX(gzclose_r)(file); -#endif -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzbuffer)(gzFile file, unsigned size) { - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* make sure we haven't already allocated memory */ - if (state->size != 0) - return -1; - - /* check and set requested size */ - if ((size << 1) < size) - return -1; /* need to be able to double it */ - if (size < 2) - size = 2; /* need two bytes to check magic header */ - state->want = size; - return 0; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzrewind)(gzFile file) { - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_state *)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* back up and start over */ - if (LSEEK(state->fd, state->start, SEEK_SET) == -1) - return -1; - gz_reset(state); - return 0; -} - -/* -- see zlib.h -- */ -z_off64_t Z_EXPORT PREFIX4(gzseek)(gzFile file, z_off64_t offset, int whence) { - unsigned n; - z_off64_t ret; - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* check that there's no error */ - if (state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - - /* can only seek from start or relative to current position */ - if (whence != SEEK_SET && whence != SEEK_CUR) - return -1; - - /* normalize offset to a SEEK_CUR specification */ - if (whence == SEEK_SET) - offset -= state->x.pos; - else if (state->seek) - offset += state->skip; - state->seek = 0; - - /* 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 - (z_off64_t)state->x.have, SEEK_CUR); - if (ret == -1) - return -1; - state->x.have = 0; - state->eof = 0; - state->past = 0; - state->seek = 0; - gz_error(state, Z_OK, NULL); - state->strm.avail_in = 0; - state->x.pos += offset; - return state->x.pos; - } - - /* calculate skip amount, rewinding if needed for back seek when reading */ - if (offset < 0) { - if (state->mode != GZ_READ) /* writing -- can't go backwards */ - return -1; - offset += state->x.pos; - if (offset < 0) /* before start of file! */ - return -1; - if (PREFIX(gzrewind)(file) == -1) /* rewind, then skip to offset */ - return -1; - } - - /* if reading, skip what's in output buffer (one less gzgetc() check) */ - if (state->mode == GZ_READ) { - n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ? (unsigned)offset : state->x.have; - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - offset -= n; - } - - /* request skip (if not zero) */ - if (offset) { - state->seek = 1; - state->skip = offset; - } - return state->x.pos + offset; -} - -/* -- see zlib.h -- */ -#ifdef ZLIB_COMPAT -z_off_t Z_EXPORT PREFIX(gzseek)(gzFile file, z_off_t offset, int whence) { - z_off64_t ret; - - ret = PREFIX4(gzseek)(file, (z_off64_t)offset, whence); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} -#endif - -/* -- see zlib.h -- */ -z_off64_t Z_EXPORT PREFIX4(gztell)(gzFile file) { - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* return position */ - return state->x.pos + (state->seek ? state->skip : 0); -} - -/* -- see zlib.h -- */ -#ifdef ZLIB_COMPAT -z_off_t Z_EXPORT PREFIX(gztell)(gzFile file) { - - z_off64_t ret; - - ret = PREFIX4(gztell)(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} -#endif - -/* -- see zlib.h -- */ -z_off64_t Z_EXPORT PREFIX4(gzoffset)(gzFile file) { - z_off64_t offset; - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* compute and return effective offset in file */ - offset = LSEEK(state->fd, 0, SEEK_CUR); - if (offset == -1) - return -1; - if (state->mode == GZ_READ) /* reading */ - offset -= state->strm.avail_in; /* don't count buffered input */ - return offset; -} - -/* -- see zlib.h -- */ -#ifdef ZLIB_COMPAT -z_off_t Z_EXPORT PREFIX(gzoffset)(gzFile file) { - z_off64_t ret; - - ret = PREFIX4(gzoffset)(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} -#endif - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzeof)(gzFile file) { - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return 0; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return 0; - - /* return end-of-file state */ - return state->mode == GZ_READ ? state->past : 0; -} - -/* -- see zlib.h -- */ -const char * Z_EXPORT PREFIX(gzerror)(gzFile file, int *errnum) { - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return NULL; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return NULL; - - /* return error information */ - if (errnum != NULL) - *errnum = state->err; - return state->err == Z_MEM_ERROR ? "out of memory" : (state->msg == NULL ? "" : state->msg); -} - -/* -- see zlib.h -- */ -void Z_EXPORT PREFIX(gzclearerr)(gzFile file) { - gz_state *state; - - /* get internal structure and check integrity */ - if (file == NULL) - return; - state = (gz_state *)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return; - - /* clear error and end-of-file */ - if (state->mode == GZ_READ) { - state->eof = 0; - state->past = 0; - } - gz_error(state, Z_OK, NULL); -} - -/* Create an error message in allocated memory and set state->err and - state->msg accordingly. Free any previous error message already there. Do - not try to free or allocate space if the error is Z_MEM_ERROR (out of - memory). Simply save the error message as a static string. If there is an - allocation failure constructing the error message, then convert the error to - out of memory. */ -void Z_INTERNAL gz_error(gz_state *state, int err, const char *msg) { - /* free previously allocated message and clear */ - if (state->msg != NULL) { - if (state->err != Z_MEM_ERROR) - free(state->msg); - state->msg = NULL; - } - - /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */ - if (err != Z_OK && err != Z_BUF_ERROR) - state->x.have = 0; - - /* set error code, and if no message, then done */ - state->err = err; - if (msg == NULL) - return; - - /* for an out of memory error, return literal string when requested */ - if (err == Z_MEM_ERROR) - return; - - /* construct error message with path */ - if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) { - state->err = Z_MEM_ERROR; - return; - } - (void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, "%s%s%s", state->path, ": ", msg); -} - -#ifndef INT_MAX -/* portably return maximum value for an int (when limits.h presumed not - available) -- we need to do this to cover cases where 2's complement not - used, since C standard permits 1's complement and sign-bit representations, - otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned Z_INTERNAL gz_intmax() { - unsigned p, q; - - p = 1; - do { - q = p; - p <<= 1; - p++; - } while (p > q); - return q >> 1; -} -#endif diff --git a/libs/zlibng/gzread.c b/libs/zlibng/gzread.c deleted file mode 100644 index c3b3a035f..000000000 --- a/libs/zlibng/gzread.c +++ /dev/null @@ -1,602 +0,0 @@ -/* 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 copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil_p.h" -#include "gzguts.h" - -/* Local functions */ -static int gz_load(gz_state *, unsigned char *, unsigned, unsigned *); -static int gz_avail(gz_state *); -static int gz_look(gz_state *); -static int gz_decomp(gz_state *); -static int gz_fetch(gz_state *); -static int gz_skip(gz_state *, z_off64_t); -static size_t gz_read(gz_state *, void *, size_t); - -/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from - state->fd, and update state->eof, state->err, and state->msg as appropriate. - This function needs to loop on read(), since read() is not guaranteed to - read the number of bytes requested, depending on the type of descriptor. */ -static int gz_load(gz_state *state, unsigned char *buf, unsigned len, unsigned *have) { - ssize_t ret; - - *have = 0; - do { - ret = read(state->fd, buf + *have, len - *have); - if (ret <= 0) - break; - *have += (unsigned)ret; - } while (*have < len); - if (ret < 0) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (ret == 0) - state->eof = 1; - return 0; -} - -/* Load up input buffer and set eof flag if last data loaded -- return -1 on - error, 0 otherwise. Note that the eof flag is set when the end of the input - file is reached, even though there may be unused data in the buffer. Once - that data has been used, no more attempts will be made to read the file. - If strm->avail_in != 0, then the current data is moved to the beginning of - the input buffer, and then the remainder of the buffer is loaded with the - available data from the input file. */ -static int gz_avail(gz_state *state) { - unsigned got; - PREFIX3(stream) *strm = &(state->strm); - - if (state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - if (state->eof == 0) { - if (strm->avail_in) { /* copy what's there to the start */ - unsigned char *p = state->in; - unsigned const char *q = strm->next_in; - unsigned n = strm->avail_in; - do { - *p++ = *q++; - } while (--n); - } - if (gz_load(state, state->in + strm->avail_in, state->size - strm->avail_in, &got) == -1) - return -1; - strm->avail_in += got; - strm->next_in = state->in; - } - return 0; -} - -/* Look for gzip header, set up for inflate or copy. state->x.have must be 0. - If this is the first time in, allocate required memory. state->how will be - left unchanged if there is no more input data available, will be set to COPY - if there is no gzip header and direct copying will be performed, or it will - be set to GZIP for decompression. If direct copying, then leftover input - data from the input buffer will be copied to the output buffer. In that - case, all further file reads will be directly to either the output buffer or - a user buffer. If decompressing, the inflate state will be initialized. - gz_look() will return 0 on success or -1 on failure. */ -static int gz_look(gz_state *state) { - PREFIX3(stream) *strm = &(state->strm); - - /* allocate read buffers and inflate memory */ - if (state->size == 0) { - /* allocate buffers */ - state->in = (unsigned char *)zng_alloc(state->want); - state->out = (unsigned char *)zng_alloc(state->want << 1); - if (state->in == NULL || state->out == NULL) { - zng_free(state->out); - zng_free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - state->size = state->want; - - /* allocate inflate memory */ - state->strm.zalloc = NULL; - state->strm.zfree = NULL; - state->strm.opaque = NULL; - state->strm.avail_in = 0; - state->strm.next_in = NULL; - if (PREFIX(inflateInit2)(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */ - zng_free(state->out); - zng_free(state->in); - state->size = 0; - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - } - - /* get at least the magic bytes in the input buffer */ - if (strm->avail_in < 2) { - if (gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) - return 0; - } - - /* look for gzip magic bytes -- if there, do gzip decoding (note: there is - a logical dilemma here when considering the case of a partially written - gzip file, to wit, if a single 31 byte is written, then we cannot tell - whether this is a single-byte file, or just a partially written gzip - file -- for here we assume that if a gzip file is being written, then - the header will be written in a single operation, so that reading a - single byte is sufficient indication that it is not a gzip file) */ - if (strm->avail_in > 1 && - strm->next_in[0] == 31 && strm->next_in[1] == 139) { - PREFIX(inflateReset)(strm); - state->how = GZIP; - state->direct = 0; - return 0; - } - - /* no gzip header -- if we were decoding gzip before, then this is trailing - garbage. Ignore the trailing garbage and finish. */ - if (state->direct == 0) { - strm->avail_in = 0; - state->eof = 1; - state->x.have = 0; - return 0; - } - - /* doing raw i/o, copy any leftover input to output -- this assumes that - 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; - } - state->how = COPY; - state->direct = 1; - return 0; -} - -/* Decompress from input to the provided next_out and avail_out in the state. - On return, state->x.have and state->x.next point to the just decompressed - data. If the gzip stream completes, state->how is reset to LOOK to look for - the next gzip stream or raw data, once state->x.have is depleted. Returns 0 - on success, -1 on failure. */ -static int gz_decomp(gz_state *state) { - int ret = Z_OK; - unsigned had; - PREFIX3(stream) *strm = &(state->strm); - - /* fill output buffer up to end of deflate stream */ - had = strm->avail_out; - do { - /* get more input for inflate() */ - if (strm->avail_in == 0 && gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) { - gz_error(state, Z_BUF_ERROR, "unexpected end of file"); - break; - } - - /* decompress and handle errors */ - ret = PREFIX(inflate)(strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { - gz_error(state, Z_STREAM_ERROR, "internal error: inflate stream corrupt"); - return -1; - } - if (ret == Z_MEM_ERROR) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ - gz_error(state, Z_DATA_ERROR, strm->msg == NULL ? "compressed data error" : strm->msg); - return -1; - } - } while (strm->avail_out && ret != Z_STREAM_END); - - /* update available output */ - state->x.have = had - strm->avail_out; - state->x.next = strm->next_out - state->x.have; - - /* if the gzip stream completed successfully, look for another */ - if (ret == Z_STREAM_END) - state->how = LOOK; - - /* good decompression */ - return 0; -} - -/* Fetch data and put it in the output buffer. Assumes state->x.have is 0. - Data is either copied from the input file or decompressed from the input - file depending on state->how. If state->how is LOOK, then a gzip header is - looked for to determine whether to copy or decompress. Returns -1 on error, - otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the - end of the input file has been reached and all data has been processed. */ -static int gz_fetch(gz_state *state) { - PREFIX3(stream) *strm = &(state->strm); - - do { - switch (state->how) { - case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */ - if (gz_look(state) == -1) - return -1; - if (state->how == LOOK) - return 0; - break; - case COPY: /* -> COPY */ - if (gz_load(state, state->out, state->size << 1, &(state->x.have)) - == -1) - return -1; - state->x.next = state->out; - return 0; - case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */ - strm->avail_out = state->size << 1; - strm->next_out = state->out; - if (gz_decomp(state) == -1) - return -1; - } - } while (state->x.have == 0 && (!state->eof || strm->avail_in)); - return 0; -} - -/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ -static int gz_skip(gz_state *state, z_off64_t len) { - unsigned n; - - /* skip over len bytes or reach end-of-file, whichever comes first */ - while (len) - /* skip over whatever is in output buffer */ - if (state->x.have) { - n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ? - (unsigned)len : state->x.have; - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - len -= n; - } else if (state->eof && state->strm.avail_in == 0) { - /* output buffer empty -- return if we're at the end of the input */ - break; - } else { - /* need more data to skip -- load up output buffer */ - /* get more output, looking for header if required */ - if (gz_fetch(state) == -1) - return -1; - } - return 0; -} - -/* Read len bytes into buf from file, or less than len up to the end of the - input. Return the number of bytes read. If zero is returned, either the - end of file was reached, or there was an error. state->err must be - consulted in that case to determine which. */ -static size_t gz_read(gz_state *state, void *buf, size_t len) { - size_t got; - unsigned n; - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return 0; - } - - /* get len bytes to buf, or less than len if at the end */ - got = 0; - do { - /* set n to the maximum amount of len that fits in an unsigned int */ - n = (unsigned)-1; - if (n > len) - n = (unsigned)len; - - /* first just try copying data from the output buffer */ - if (state->x.have) { - if (state->x.have < n) - n = state->x.have; - memcpy(buf, state->x.next, n); - state->x.next += n; - state->x.have -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && state->strm.avail_in == 0) { - state->past = 1; /* tried to read past end */ - break; - } - - /* need output data -- for small len or new stream load up our output - buffer */ - else if (state->how == LOOK || n < (state->size << 1)) { - /* get more output, looking for header if required */ - if (gz_fetch(state) == -1) - return 0; - continue; /* no progress yet -- go back to copy above */ - /* the copy above assures that we will leave with space in the - output buffer, allowing at least one gzungetc() to succeed */ - } - - /* large len -- read directly into user buffer */ - else if (state->how == COPY) { /* read directly */ - if (gz_load(state, (unsigned char *)buf, n, &n) == -1) - return 0; - } - - /* large len -- decompress directly into user buffer */ - else { /* state->how == GZIP */ - state->strm.avail_out = n; - state->strm.next_out = (unsigned char *)buf; - if (gz_decomp(state) == -1) - return 0; - n = state->x.have; - state->x.have = 0; - } - - /* update progress */ - len -= n; - buf = (char *)buf + n; - got += n; - state->x.pos += n; - } while (len); - - /* return number of bytes read into user buffer */ - return got; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzread)(gzFile file, void *buf, unsigned len) { - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_state *)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids a flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_STREAM_ERROR, "request does not fit in an int"); - return -1; - } - - /* read len or fewer bytes to buf */ - len = (unsigned)gz_read(state, buf, len); - - /* check for an error */ - if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - - /* return the number of bytes read (this is assured to fit in an int) */ - return (int)len; -} - -/* -- see zlib.h -- */ -size_t Z_EXPORT PREFIX(gzfread)(void *buf, size_t size, size_t nitems, gzFile file) { - size_t len; - gz_state *state; - - /* Exit early if size is zero, also prevents potential division by zero */ - if (size == 0) - return 0; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_state *)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return 0; - - /* compute bytes to read -- error on overflow */ - if (size && SIZE_MAX / size < nitems) { - gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t"); - return 0; - } - len = nitems * size; - - /* read len or fewer bytes to buf, return the number of full items read */ - return len ? gz_read(state, buf, len) / size : 0; -} - -/* -- see zlib.h -- */ -#undef gzgetc -#undef zng_gzgetc -int Z_EXPORT PREFIX(gzgetc)(gzFile file) { - unsigned char buf[1]; - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_state *)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* try output buffer (no need to check for skip request) */ - if (state->x.have) { - state->x.have--; - state->x.pos++; - return *(state->x.next)++; - } - - /* nothing there -- try gz_read() */ - return gz_read(state, buf, 1) < 1 ? -1 : buf[0]; -} - -int Z_EXPORT PREFIX(gzgetc_)(gzFile file) { - return PREFIX(gzgetc)(file); -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzungetc)(int c, gzFile file) { - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_state *)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return -1; - } - - /* can't push EOF */ - if (c < 0) - return -1; - - /* if output buffer empty, put byte at end (allows more pushing) */ - if (state->x.have == 0) { - state->x.have = 1; - state->x.next = state->out + (state->size << 1) - 1; - state->x.next[0] = (unsigned char)c; - state->x.pos--; - state->past = 0; - return c; - } - - /* if no room, give up (must have already done a gzungetc()) */ - if (state->x.have == (state->size << 1)) { - gz_error(state, Z_DATA_ERROR, "out of room to push characters"); - return -1; - } - - /* slide output data if needed and insert byte before existing data */ - if (state->x.next == state->out) { - unsigned char *src = state->out + state->x.have; - unsigned char *dest = state->out + (state->size << 1); - while (src > state->out) - *--dest = *--src; - state->x.next = dest; - } - state->x.have++; - state->x.next--; - state->x.next[0] = (unsigned char)c; - state->x.pos--; - state->past = 0; - return c; -} - -/* -- see zlib.h -- */ -char * Z_EXPORT PREFIX(gzgets)(gzFile file, char *buf, int len) { - unsigned left, n; - char *str; - unsigned char *eol; - gz_state *state; - - /* check parameters and get internal structure */ - if (file == NULL || buf == NULL || len < 1) - return NULL; - state = (gz_state *)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return NULL; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return NULL; - } - - /* copy output bytes up to new line or len - 1, whichever comes first -- - append a terminating zero to the string (we don't check for a zero in - the contents, let the user worry about that) */ - str = buf; - left = (unsigned)len - 1; - if (left) { - do { - /* assure that something is in the output buffer */ - if (state->x.have == 0 && gz_fetch(state) == -1) - return NULL; /* error */ - if (state->x.have == 0) { /* end of file */ - state->past = 1; /* read past end */ - break; /* return what we have */ - } - - /* look for end-of-line in current output buffer */ - n = state->x.have > left ? left : state->x.have; - eol = (unsigned char *)memchr(state->x.next, '\n', n); - if (eol != NULL) - n = (unsigned)(eol - state->x.next) + 1; - - /* copy through end-of-line, or remainder if not found */ - memcpy(buf, state->x.next, n); - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - left -= n; - buf += n; - } while (left && eol == NULL); - } - - /* return terminated string, or if nothing, end of file */ - if (buf == str) - return NULL; - buf[0] = 0; - return str; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzdirect)(gzFile file) { - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return 0; - - state = (gz_state *)file; - - /* if the state is not known, but we can find out, then do so (this is - mainly for right after a gzopen() or gzdopen()) */ - if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) - (void)gz_look(state); - - /* return 1 if transparent, 0 if processing a gzip stream */ - return state->direct; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzclose_r)(gzFile file) { - int ret, err; - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - - state = (gz_state *)file; - - /* check that we're reading */ - if (state->mode != GZ_READ) - return Z_STREAM_ERROR; - - /* free memory and close file */ - if (state->size) { - PREFIX(inflateEnd)(&(state->strm)); - zng_free(state->out); - zng_free(state->in); - } - err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK; - gz_error(state, Z_OK, NULL); - free(state->path); - ret = close(state->fd); - zng_free(state); - return ret ? Z_ERRNO : err; -} diff --git a/libs/zlibng/gzwrite.c b/libs/zlibng/gzwrite.c deleted file mode 100644 index c4e178f9a..000000000 --- a/libs/zlibng/gzwrite.c +++ /dev/null @@ -1,526 +0,0 @@ -/* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil_p.h" -#include -#include "gzguts.h" - -/* Local functions */ -static int gz_init(gz_state *); -static int gz_comp(gz_state *, int); -static int gz_zero(gz_state *, z_off64_t); -static size_t gz_write(gz_state *, void const *, size_t); - -/* Initialize state for writing a gzip file. Mark initialization by setting - state->size to non-zero. Return -1 on a memory allocation failure, or 0 on - success. */ -static int gz_init(gz_state *state) { - int ret; - PREFIX3(stream) *strm = &(state->strm); - - /* allocate input buffer (double size for gzprintf) */ - state->in = (unsigned char *)zng_alloc(state->want << 1); - if (state->in == NULL) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - memset(state->in, 0, state->want << 1); - - /* only need output buffer and deflate state if compressing */ - if (!state->direct) { - /* allocate output buffer */ - state->out = (unsigned char *)zng_alloc(state->want); - if (state->out == NULL) { - zng_free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* allocate deflate memory, set up for gzip compression */ - strm->zalloc = NULL; - strm->zfree = NULL; - strm->opaque = NULL; - ret = PREFIX(deflateInit2)(strm, state->level, Z_DEFLATED, MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy); - if (ret != Z_OK) { - zng_free(state->out); - zng_free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - strm->next_in = NULL; - } - - /* mark state as initialized */ - state->size = state->want; - - /* initialize write buffer if compressing */ - if (!state->direct) { - strm->avail_out = state->size; - strm->next_out = state->out; - state->x.next = strm->next_out; - } - return 0; -} - -/* Compress whatever is at avail_in and next_in and write to the output file. - Return -1 if there is an error writing to the output file or if gz_init() - fails to allocate memory, otherwise 0. flush is assumed to be a valid - deflate() flush value. If flush is Z_FINISH, then the deflate() state is - reset to start a new gzip stream. If gz->direct is true, then simply write - to the output file without compressing, and ignore flush. */ -static int gz_comp(gz_state *state, int flush) { - int ret; - ssize_t got; - unsigned have; - PREFIX3(stream) *strm = &(state->strm); - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return -1; - - /* write directly if requested */ - if (state->direct) { - got = write(state->fd, strm->next_in, strm->avail_in); - if (got < 0 || (unsigned)got != strm->avail_in) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - strm->avail_in = 0; - 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; - PREFIX(deflateReset)(strm); - state->reset = 0; - } - - /* run deflate() on provided input until it produces no more output */ - ret = Z_OK; - do { - /* write out current buffer contents if full, or if flushing, but if - doing Z_FINISH then don't write until we get to Z_STREAM_END */ - if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && (flush != Z_FINISH || ret == Z_STREAM_END))) { - have = (unsigned)(strm->next_out - state->x.next); - if (have && ((got = write(state->fd, state->x.next, (unsigned long)have)) < 0 || (unsigned)got != have)) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (strm->avail_out == 0) { - strm->avail_out = state->size; - strm->next_out = state->out; - state->x.next = state->out; - } - state->x.next = strm->next_out; - } - - /* compress */ - have = strm->avail_out; - ret = PREFIX(deflate)(strm, flush); - if (ret == Z_STREAM_ERROR) { - gz_error(state, Z_STREAM_ERROR, "internal error: deflate stream corrupt"); - return -1; - } - have -= strm->avail_out; - } while (have); - - /* if that completed a deflate stream, allow another to start */ - if (flush == Z_FINISH) - state->reset = 1; - /* all done, no errors */ - return 0; -} - -/* Compress len zeros to output. Return -1 on a write error or memory - allocation failure by gz_comp(), or 0 on success. */ -static int gz_zero(gz_state *state, z_off64_t len) { - int first; - unsigned n; - PREFIX3(stream) *strm = &(state->strm); - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - - /* compress len zeros (len guaranteed > 0) */ - first = 1; - while (len) { - n = GT_OFF(state->size) || (z_off64_t)state->size > len ? (unsigned)len : state->size; - if (first) { - memset(state->in, 0, n); - first = 0; - } - strm->avail_in = n; - strm->next_in = state->in; - state->x.pos += n; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - len -= n; - } - return 0; -} - -/* Write len bytes from buf to file. Return the number of bytes written. If - the returned value is less than len, then there was an error. */ -static size_t gz_write(gz_state *state, void const *buf, size_t len) { - size_t put = len; - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* for small len, copy to input buffer, otherwise compress directly */ - if (len < state->size) { - /* copy to input buffer, compress when full */ - do { - unsigned have, copy; - - if (state->strm.avail_in == 0) - state->strm.next_in = state->in; - have = (unsigned)((state->strm.next_in + state->strm.avail_in) - - state->in); - copy = state->size - have; - if (copy > len) - copy = (unsigned)len; - memcpy(state->in + have, buf, copy); - state->strm.avail_in += copy; - state->x.pos += copy; - buf = (const char *)buf + copy; - len -= copy; - if (len && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - } while (len); - } else { - /* consume whatever's left in the input buffer */ - if (state->strm.avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* directly compress user buffer to file */ - state->strm.next_in = (z_const unsigned char *) buf; - do { - unsigned n = (unsigned)-1; - if (n > len) - n = (unsigned)len; - state->strm.avail_in = n; - state->x.pos += n; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - len -= n; - } while (len); - } - - /* input was all buffered or compressed */ - return put; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzwrite)(gzFile file, void const *buf, unsigned len) { - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_state *)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids a flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); - return 0; - } - - /* write len bytes from buf (the return value will fit in an int) */ - return (int)gz_write(state, buf, len); -} - -/* -- see zlib.h -- */ -size_t Z_EXPORT PREFIX(gzfwrite)(void const *buf, size_t size, size_t nitems, gzFile file) { - size_t len; - gz_state *state; - - /* Exit early if size is zero, also prevents potential division by zero */ - if (size == 0) - return 0; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_state *)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* compute bytes to read -- error on overflow */ - len = nitems * size; - if (size && len / size != nitems) { - gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t"); - return 0; - } - - /* write len bytes to buf, return the number of full items written */ - return len ? gz_write(state, buf, len) / size : 0; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzputc)(gzFile file, int c) { - unsigned have; - unsigned char buf[1]; - gz_state *state; - PREFIX3(stream) *strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_state *)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return -1; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* try writing to input buffer for speed (state->size == 0 if buffer not - initialized) */ - if (state->size) { - if (strm->avail_in == 0) - strm->next_in = state->in; - have = (unsigned)((strm->next_in + strm->avail_in) - state->in); - if (have < state->size) { - state->in[have] = (unsigned char)c; - strm->avail_in++; - state->x.pos++; - return c & 0xff; - } - } - - /* no room in buffer or not initialized, use gz_write() */ - buf[0] = (unsigned char)c; - if (gz_write(state, buf, 1) != 1) - return -1; - return c & 0xff; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzputs)(gzFile file, const char *s) { - size_t len, put; - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_state *)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return -1; - - /* write string */ - 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; -} - -/* -- see zlib.h -- */ -int Z_EXPORTVA PREFIX(gzvprintf)(gzFile file, const char *format, va_list va) { - int len; - unsigned left; - char *next; - gz_state *state; - PREFIX3(stream) *strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_state *)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return state->err; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->err; - } - - /* do the printf() into the input buffer, put length in len -- the input - buffer is double-sized just for this function, so there is guaranteed to - be state->size bytes available after the current contents */ - if (strm->avail_in == 0) - strm->next_in = state->in; - next = (char *)(state->in + (strm->next_in - state->in) + strm->avail_in); - next[state->size - 1] = 0; - len = vsnprintf(next, state->size, format, va); - - /* check that printf() results fit in buffer */ - if (len == 0 || (unsigned)len >= state->size || next[state->size - 1] != 0) - return 0; - - /* update buffer and position, compress first half if past that */ - strm->avail_in += (unsigned)len; - state->x.pos += len; - if (strm->avail_in >= state->size) { - left = strm->avail_in - state->size; - strm->avail_in = state->size; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return state->err; - memmove(state->in, state->in + state->size, left); - strm->next_in = state->in; - strm->avail_in = left; - } - return len; -} - -int Z_EXPORTVA PREFIX(gzprintf)(gzFile file, const char *format, ...) { - va_list va; - int ret; - - va_start(va, format); - ret = PREFIX(gzvprintf)(file, format, va); - va_end(va); - return ret; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzflush)(gzFile file, int flush) { - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_state *)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* check flush parameter */ - if (flush < 0 || flush > Z_FINISH) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->err; - } - - /* compress remaining data with requested flush */ - (void)gz_comp(state, flush); - return state->err; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzsetparams)(gzFile file, int level, int strategy) { - gz_state *state; - PREFIX3(stream) *strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_state *)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* if no change is requested, then do nothing */ - if (level == state->level && strategy == state->strategy) - return Z_OK; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->err; - } - - /* change compression parameters for subsequent input */ - if (state->size) { - /* flush previous input with previous parameters before changing */ - if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1) - return state->err; - PREFIX(deflateParams)(strm, level, strategy); - } - state->level = level; - state->strategy = strategy; - return Z_OK; -} - -/* -- see zlib.h -- */ -int Z_EXPORT PREFIX(gzclose_w)(gzFile file) { - int ret = Z_OK; - gz_state *state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_state *)file; - - /* check that we're writing */ - if (state->mode != GZ_WRITE) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - ret = state->err; - } - - /* flush, free memory, and close file */ - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; - if (state->size) { - if (!state->direct) { - (void)PREFIX(deflateEnd)(&(state->strm)); - zng_free(state->out); - } - zng_free(state->in); - } - gz_error(state, Z_OK, NULL); - free(state->path); - if (close(state->fd) == -1) - ret = Z_ERRNO; - zng_free(state); - return ret; -} diff --git a/libs/zlibng/infback.c b/libs/zlibng/infback.c deleted file mode 100644 index eecf03ada..000000000 --- a/libs/zlibng/infback.c +++ /dev/null @@ -1,510 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zbuild.h" -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" -#include "inflate_p.h" -#include "functable.h" - -/* - strm provides memory allocation functions in zalloc and zfree, or - NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int32_t Z_EXPORT PREFIX(inflateBackInit_)(PREFIX3(stream) *strm, int32_t windowBits, uint8_t *window, - const char *version, int32_t stream_size) { - struct inflate_state *state; - - if (version == NULL || version[0] != PREFIX2(VERSION)[0] || stream_size != (int)(sizeof(PREFIX3(stream)))) - return Z_VERSION_ERROR; - if (strm == NULL || window == NULL || windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = NULL; /* in case we return an error */ - if (strm->zalloc == NULL) { - strm->zalloc = zng_calloc; - strm->opaque = NULL; - } - if (strm->zfree == NULL) - strm->zfree = zng_cfree; - state = (struct inflate_state *) ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == NULL) - return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state *)state; - state->dmax = 32768U; - state->wbits = (unsigned int)windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->wnext = 0; - state->whave = 0; - state->chunksize = functable.chunksize(); - return Z_OK; -} - -/* - Private macros for inflateBack() - Look in inflate_p.h for macros shared with inflate() -*/ - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += ((unsigned)(*next++) << bits); \ - bits += 8; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is NULL or the state was not initialized. - */ -int32_t Z_EXPORT PREFIX(inflateBack)(PREFIX3(stream) *strm, in_func in, void *in_desc, out_func out, void *out_desc) { - struct inflate_state *state; - z_const unsigned char *next; /* next input */ - unsigned char *put; /* next output */ - unsigned have, left; /* available input and output */ - uint32_t hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int32_t ret; /* return code */ - static const uint16_t order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == NULL || strm->state == NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - - /* Reset the state */ - strm->msg = NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (uint16_t)hold; - Tracev((stderr, "inflate: stored length %u\n", state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - memcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - - /* get code length code lengths (not a typo) */ - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (uint16_t)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (const code *)(state->next); - state->lenbits = 7; - ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - - /* get length and distance code code lengths */ - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if (here.bits <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy) { - --copy; - state->lens[state->have++] = (uint16_t)len; - } - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) - break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (const code *)(state->next); - state->lenbits = 9; - ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (const code *)(state->next); - state->distbits = 6; - ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= INFLATE_FAST_MIN_HAVE && - left >= INFLATE_FAST_MIN_LEFT) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - zng_inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if (here.bits <= bits) - break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)last.bits + (unsigned)here.bits <= bits) - break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - state->length = here.val; - - /* process literal */ - if ((int)(here.op) == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (here.op & 15); - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if (here.bits <= bits) - break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)last.bits + (unsigned)here.bits <= bits) - break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = here.val; - state->extra = (here.op & 15); - - /* get distance extra bits, if any */ - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } -#ifdef INFLATE_STRICT - if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) - copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - 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 */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int32_t Z_EXPORT PREFIX(inflateBackEnd)(PREFIX3(stream) *strm) { - if (strm == NULL || strm->state == NULL || strm->zfree == NULL) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/libs/zlibng/inffast.c b/libs/zlibng/inffast.c deleted file mode 100644 index 18ce570e9..000000000 --- a/libs/zlibng/inffast.c +++ /dev/null @@ -1,325 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" -#include "inflate_p.h" -#include "functable.h" - - -/* Load 64 bits from IN and place the bytes at offset BITS in the result. */ -static inline uint64_t load_64_bits(const unsigned char *in, unsigned bits) { - uint64_t chunk; - memcpy(&chunk, in, sizeof(chunk)); - -#if BYTE_ORDER == LITTLE_ENDIAN - return chunk << bits; -#else - return ZSWAP64(chunk) << bits; -#endif -} -/* - 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 >= INFLATE_FAST_MIN_HAVE - strm->avail_out >= INFLATE_FAST_MIN_LEFT - 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. - - - On some architectures, it can be significantly faster (e.g. up to 1.2x - faster on x86_64) to load from strm->next_in 64 bits, or 8 bytes, at a - time, so INFLATE_FAST_MIN_HAVE == 8. - - - 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 Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) { - /* start: inflate()'s starting value for strm->avail_out */ - struct inflate_state *state; - z_const unsigned char *in; /* local strm->next_in */ - const unsigned char *last; /* have enough input while in < last */ - unsigned char *out; /* local strm->next_out */ - unsigned char *beg; /* inflate()'s initial strm->next_out */ - unsigned char *end; /* while out < end, enough space available */ - unsigned char *safe; /* can use chunkcopy provided out < safe */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char *window; /* allocated sliding window, if wsize != 0 */ - - /* hold is a local copy of strm->hold. By default, hold satisfies the same - invariants that strm->hold does, namely that (hold >> bits) == 0. This - invariant is kept by loading bits into hold one byte at a time, like: - - hold |= next_byte_of_input << bits; in++; bits += 8; - - If we need to ensure that bits >= 15 then this code snippet is simply - repeated. Over one iteration of the outermost do/while loop, this - happens up to six times (48 bits of input), as described in the NOTES - above. - - However, on some little endian architectures, it can be significantly - faster to load 64 bits once instead of 8 bits six times: - - if (bits <= 16) { - hold |= next_8_bytes_of_input << bits; in += 6; bits += 48; - } - - Unlike the simpler one byte load, shifting the next_8_bytes_of_input - by bits will overflow and lose those high bits, up to 2 bytes' worth. - The conservative estimate is therefore that we have read only 6 bytes - (48 bits). Again, as per the NOTES above, 48 bits is sufficient for the - rest of the iteration, and we will not need to load another 8 bytes. - - Inside this function, we no longer satisfy (hold >> bits) == 0, but - this is not problematic, even if that overflow does not land on an 8 bit - byte boundary. Those excess bits will eventually shift down lower as the - Huffman decoder consumes input, and when new input bits need to be loaded - into the bits variable, the same input bits will be or'ed over those - existing bits. A bitwise or is idempotent: (a | b | b) equals (a | b). - Note that we therefore write that load operation as "hold |= etc" and not - "hold += etc". - - Outside that loop, at the end of the function, hold is bitwise and'ed - with (1<hold >> state->bits) == 0. - */ - uint64_t hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const *lcode; /* local strm->lencode */ - code const *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - const code *here; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state *)strm->state; - in = strm->next_in; - last = in + (strm->avail_in - (INFLATE_FAST_MIN_HAVE - 1)); - out = strm->next_out; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - (INFLATE_FAST_MIN_LEFT - 1)); - safe = out + strm->avail_out; -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - wnext = state->wnext; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold |= load_64_bits(in, bits); - in += 6; - bits += 48; - } - here = lcode + (hold & lmask); - dolen: - DROPBITS(here->bits); - op = here->op; - if (op == 0) { /* literal */ - Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here->val)); - *out++ = (unsigned char)(here->val); - } else if (op & 16) { /* length base */ - len = here->val; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold |= load_64_bits(in, bits); - in += 6; - bits += 48; - } - len += BITS(op); - DROPBITS(op); - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold |= load_64_bits(in, bits); - in += 6; - bits += 48; - } - here = dcode + (hold & dmask); - dodist: - DROPBITS(here->bits); - op = here->op; - if (op & 16) { /* distance base */ - dist = here->val; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold |= load_64_bits(in, bits); - in += 6; - bits += 48; - } - dist += BITS(op); -#ifdef INFLATE_STRICT - if (dist > dmax) { - SET_BAD("invalid distance too far back"); - break; - } -#endif - DROPBITS(op); - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state->sane) { - SET_BAD("invalid distance too far back"); - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - if (len <= op - whave) { - do { - *out++ = 0; - } while (--len); - continue; - } - len -= op - whave; - do { - *out++ = 0; - } while (--op > whave); - if (op == 0) { - from = out - dist; - do { - *out++ = *from++; - } while (--len); - continue; - } -#endif - } - from = window; - if (wnext == 0) { /* very common case */ - from += wsize - op; - } else if (wnext >= op) { /* contiguous in window */ - from += wnext - op; - } else { /* wrap around window */ - op -= wnext; - from += wsize - op; - if (op < len) { /* some from end of window */ - len -= op; - out = functable.chunkcopy_safe(out, from, op, safe); - from = window; /* more from start of window */ - op = wnext; - /* This (rare) case can create a situation where - the first chunkcopy below must be checked. - */ - } - } - if (op < len) { /* still need some from output */ - len -= op; - out = functable.chunkcopy_safe(out, from, op, safe); - out = functable.chunkunroll(out, &dist, &len); - out = functable.chunkcopy_safe(out, out - dist, len, safe); - } else { - out = functable.chunkcopy_safe(out, from, len, safe); - } - } else { - /* Whole reference is in range of current output. No range checks are - necessary because we start with room for at least 258 bytes of output, - so unroll and roundoff operations can write beyond `out+len` so long - as they stay within 258 bytes of `out`. - */ - if (dist >= len || dist >= state->chunksize) - out = functable.chunkcopy(out, out - dist, len); - else - out = functable.chunkmemset(out, dist, len); - } - } else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode + here->val + BITS(op); - goto dodist; - } else { - SET_BAD("invalid distance code"); - break; - } - } else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode + here->val + BITS(op); - goto dolen; - } else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } else { - SET_BAD("invalid literal/length code"); - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (UINT64_C(1) << bits) - 1; - - /* update state and return */ - strm->next_in = in; - strm->next_out = out; - strm->avail_in = (unsigned)(in < last ? (INFLATE_FAST_MIN_HAVE - 1) + (last - in) - : (INFLATE_FAST_MIN_HAVE - 1) - (in - last)); - strm->avail_out = (unsigned)(out < end ? (INFLATE_FAST_MIN_LEFT - 1) + (end - out) - : (INFLATE_FAST_MIN_LEFT - 1) - (out - end)); - - Assert(bits <= 32, "Remaining bits greater than 32"); - state->hold = (uint32_t)hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and wnext == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ diff --git a/libs/zlibng/inffast.h b/libs/zlibng/inffast.h deleted file mode 100644 index 179a65da6..000000000 --- a/libs/zlibng/inffast.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef INFFAST_H_ -#define INFFAST_H_ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start); - -#define INFLATE_FAST_MIN_HAVE 8 -#define INFLATE_FAST_MIN_LEFT 258 - -#endif /* INFFAST_H_ */ diff --git a/libs/zlibng/inffixed_tbl.h b/libs/zlibng/inffixed_tbl.h deleted file mode 100644 index 7292fa06e..000000000 --- a/libs/zlibng/inffixed_tbl.h +++ /dev/null @@ -1,94 +0,0 @@ -/* inffixed_tbl.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - -/* WARNING: this file should *not* be used by applications. - * It is part of the implementation of this library and is - * subject to change. Applications should only use zlib.h. - */ - -static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} -}; - -static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} -}; diff --git a/libs/zlibng/inflate.c b/libs/zlibng/inflate.c deleted file mode 100644 index 5c30816dd..000000000 --- a/libs/zlibng/inflate.c +++ /dev/null @@ -1,1329 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" -#include "inflate_p.h" -#include "inffixed_tbl.h" -#include "functable.h" - -/* Architecture-specific hooks. */ -#ifdef S390_DFLTCC_INFLATE -# include "arch/s390/dfltcc_inflate.h" -#else -/* Memory management for the inflate state. Useful for allocating arch-specific extension blocks. */ -# define ZALLOC_STATE(strm, items, size) ZALLOC(strm, items, size) -# define ZFREE_STATE(strm, addr) ZFREE(strm, addr) -# define ZCOPY_STATE(dst, src, size) memcpy(dst, src, size) -/* Memory management for the window. Useful for allocation the aligned window. */ -# define ZALLOC_WINDOW(strm, items, size) ZALLOC(strm, items, size) -# define ZFREE_WINDOW(strm, addr) ZFREE(strm, addr) -/* Invoked at the end of inflateResetKeep(). Useful for initializing arch-specific extension blocks. */ -# define INFLATE_RESET_KEEP_HOOK(strm) do {} while (0) -/* Invoked at the beginning of inflatePrime(). Useful for updating arch-specific buffers. */ -# define INFLATE_PRIME_HOOK(strm, bits, value) do {} while (0) -/* Invoked at the beginning of each block. Useful for plugging arch-specific inflation code. */ -# define INFLATE_TYPEDO_HOOK(strm, flush) do {} while (0) -/* Returns whether zlib-ng should compute a checksum. Set to 0 if arch-specific inflation code already does that. */ -# define INFLATE_NEED_CHECKSUM(strm) 1 -/* Returns whether zlib-ng should update a window. Set to 0 if arch-specific inflation code already does that. */ -# define INFLATE_NEED_UPDATEWINDOW(strm) 1 -/* Invoked at the beginning of inflateMark(). Useful for updating arch-specific pointers and offsets. */ -# define INFLATE_MARK_HOOK(strm) do {} while (0) -/* Invoked at the beginning of inflateSyncPoint(). Useful for performing arch-specific state checks. */ -#define INFLATE_SYNC_POINT_HOOK(strm) do {} while (0) -#endif - -/* function prototypes */ -static int inflateStateCheck(PREFIX3(stream) *strm); -static int updatewindow(PREFIX3(stream) *strm, const unsigned char *end, uint32_t copy); -static uint32_t syncsearch(uint32_t *have, const unsigned char *buf, uint32_t len); - -static int inflateStateCheck(PREFIX3(stream) *strm) { - struct inflate_state *state; - if (strm == NULL || strm->zalloc == NULL || strm->zfree == NULL) - return 1; - state = (struct inflate_state *)strm->state; - if (state == NULL || state->strm != strm || state->mode < HEAD || state->mode > SYNC) - return 1; - return 0; -} - -int32_t Z_EXPORT PREFIX(inflateResetKeep)(PREFIX3(stream) *strm) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = NULL; - if (state->wrap) /* to support ill-conceived Java test suite */ - strm->adler = state->wrap & 1; - state->mode = HEAD; - state->check = ADLER32_INITIAL_VALUE; - state->last = 0; - state->havedict = 0; - state->flags = -1; - state->dmax = 32768U; - state->head = NULL; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - state->sane = 1; - state->back = -1; - INFLATE_RESET_KEEP_HOOK(strm); /* hook for IBM Z DFLTCC */ - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int32_t Z_EXPORT PREFIX(inflateReset)(PREFIX3(stream) *strm) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - state->wsize = 0; - state->whave = 0; - state->wnext = 0; - return PREFIX(inflateResetKeep)(strm); -} - -int32_t Z_EXPORT PREFIX(inflateReset2)(PREFIX3(stream) *strm, int32_t windowBits) { - int wrap; - struct inflate_state *state; - - /* get the state */ - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } else { - wrap = (windowBits >> 4) + 5; -#ifdef GUNZIP - if (windowBits < 48) - windowBits &= 15; -#endif - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) - return Z_STREAM_ERROR; - if (state->window != NULL && state->wbits != (unsigned)windowBits) { - ZFREE_WINDOW(strm, state->window); - state->window = NULL; - } - - /* update state and reset the rest of it */ - state->wrap = wrap; - state->wbits = (unsigned)windowBits; - return PREFIX(inflateReset)(strm); -} - -int32_t Z_EXPORT PREFIX(inflateInit2_)(PREFIX3(stream) *strm, int32_t windowBits, const char *version, int32_t stream_size) { - int32_t ret; - struct inflate_state *state; - -#if defined(X86_FEATURES) - x86_check_features(); -#elif defined(ARM_FEATURES) - arm_check_features(); -#endif - - if (version == NULL || version[0] != PREFIX2(VERSION)[0] || stream_size != (int)(sizeof(PREFIX3(stream)))) - return Z_VERSION_ERROR; - if (strm == NULL) - return Z_STREAM_ERROR; - strm->msg = NULL; /* in case we return an error */ - if (strm->zalloc == NULL) { - strm->zalloc = zng_calloc; - strm->opaque = NULL; - } - if (strm->zfree == NULL) - strm->zfree = zng_cfree; - state = (struct inflate_state *) ZALLOC_STATE(strm, 1, sizeof(struct inflate_state)); - if (state == NULL) - return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state *)state; - state->strm = strm; - state->window = NULL; - state->mode = HEAD; /* to pass state test in inflateReset2() */ - state->chunksize = functable.chunksize(); - ret = PREFIX(inflateReset2)(strm, windowBits); - if (ret != Z_OK) { - ZFREE_STATE(strm, state); - strm->state = NULL; - } - return ret; -} - -int32_t Z_EXPORT PREFIX(inflateInit_)(PREFIX3(stream) *strm, const char *version, int32_t stream_size) { - return PREFIX(inflateInit2_)(strm, DEF_WBITS, version, stream_size); -} - -int32_t Z_EXPORT PREFIX(inflatePrime)(PREFIX3(stream) *strm, int32_t bits, int32_t value) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - INFLATE_PRIME_HOOK(strm, bits, value); /* hook for IBM Z DFLTCC */ - state = (struct inflate_state *)strm->state; - if (bits < 0) { - state->hold = 0; - state->bits = 0; - return Z_OK; - } - if (bits > 16 || state->bits + (unsigned int)bits > 32) - return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += (unsigned)value << state->bits; - state->bits += (unsigned int)bits; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. This returns fixed tables from inffixed_tbl.h. - */ - -void Z_INTERNAL fixedtables(struct inflate_state *state) { - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -int Z_INTERNAL inflate_ensure_window(struct inflate_state *state) { - /* if it hasn't been done already, allocate space for the window */ - if (state->window == NULL) { - unsigned wsize = 1U << state->wbits; - state->window = (unsigned char *) ZALLOC_WINDOW(state->strm, wsize + state->chunksize, sizeof(unsigned char)); - if (state->window == Z_NULL) - return 1; - memset(state->window + wsize, 0, state->chunksize); - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->wnext = 0; - state->whave = 0; - } - - return 0; -} - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -static int32_t updatewindow(PREFIX3(stream) *strm, const uint8_t *end, uint32_t copy) { - struct inflate_state *state; - uint32_t dist; - - state = (struct inflate_state *)strm->state; - - if (inflate_ensure_window(state)) return 1; - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state->wsize) { - memcpy(state->window, end - state->wsize, state->wsize); - state->wnext = 0; - state->whave = state->wsize; - } else { - dist = state->wsize - state->wnext; - if (dist > copy) - dist = copy; - memcpy(state->window + state->wnext, end - copy, dist); - copy -= dist; - if (copy) { - memcpy(state->window, end - copy, copy); - state->wnext = copy; - state->whave = state->wsize; - } else { - state->wnext += dist; - if (state->wnext == state->wsize) - state->wnext = 0; - if (state->whave < state->wsize) - state->whave += dist; - } - } - return 0; -} - - -/* - Private macros for inflate() - Look in inflate_p.h for macros shared with inflateBack() -*/ - -/* Get a byte of input into the bit accumulator, or return from inflate() if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += ((unsigned)(*next++) << bits); \ - bits += 8; \ - } while (0) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int32_t Z_EXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int32_t flush) { - struct inflate_state *state; - const unsigned char *next; /* next input */ - unsigned char *put; /* next output */ - unsigned have, left; /* available input and output */ - uint32_t hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - uint32_t in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int32_t ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const uint16_t order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (inflateStateCheck(strm) || strm->next_out == NULL || - (strm->next_in == NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state *)strm->state; - if (state->mode == TYPE) /* skip check */ - state->mode = TYPEDO; - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - if (state->wbits == 0) - state->wbits = 15; - state->check = PREFIX(crc32)(0L, NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - if (state->head != NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - SET_BAD("incorrect header check"); - break; - } - if (BITS(4) != Z_DEFLATED) { - SET_BAD("unknown compression method"); - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (state->wbits == 0) - state->wbits = len; - if (len > 15 || len > state->wbits) { - SET_BAD("invalid window size"); - break; - } - state->dmax = 1U << len; - state->flags = 0; /* indicate zlib header */ - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = ADLER32_INITIAL_VALUE; - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - SET_BAD("unknown compression method"); - break; - } - if (state->flags & 0xe000) { - SET_BAD("unknown header flags set"); - break; - } - if (state->head != NULL) - state->head->text = (int)((hold >> 8) & 1); - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - - case TIME: - NEEDBITS(32); - if (state->head != NULL) - state->head->time = hold; - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - - case OS: - NEEDBITS(16); - if (state->head != NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (uint16_t)hold; - if (state->head != NULL) - state->head->extra_len = (uint16_t)hold; - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC2(state->check, hold); - INITBITS(); - } else if (state->head != NULL) { - state->head->extra = NULL; - } - state->mode = EXTRA; - - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) - copy = have; - if (copy) { - if (state->head != NULL && state->head->extra != NULL) { - len = state->head->extra_len - state->length; - memcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if ((state->flags & 0x0200) && (state->wrap & 4)) - state->check = PREFIX(crc32)(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) - goto inf_leave; - } - state->length = 0; - state->mode = NAME; - - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != NULL && state->head->name != NULL && state->length < state->head->name_max) - state->head->name[state->length++] = (unsigned char)len; - } while (len && copy < have); - if ((state->flags & 0x0200) && (state->wrap & 4)) - state->check = PREFIX(crc32)(state->check, next, copy); - have -= copy; - next += copy; - if (len) - goto inf_leave; - } else if (state->head != NULL) { - state->head->name = NULL; - } - state->length = 0; - state->mode = COMMENT; - - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != NULL && state->head->comment != NULL - && state->length < state->head->comm_max) - state->head->comment[state->length++] = (unsigned char)len; - } while (len && copy < have); - if ((state->flags & 0x0200) && (state->wrap & 4)) - state->check = PREFIX(crc32)(state->check, next, copy); - have -= copy; - next += copy; - if (len) - goto inf_leave; - } else if (state->head != NULL) { - state->head->comment = NULL; - } - state->mode = HCRC; - - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if ((state->wrap & 4) && hold != (state->check & 0xffff)) { - SET_BAD("header crc mismatch"); - break; - } - INITBITS(); - } - if (state->head != NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = PREFIX(crc32)(0L, NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = ZSWAP32(hold); - INITBITS(); - state->mode = DICT; - - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = ADLER32_INITIAL_VALUE; - state->mode = TYPE; - - case TYPE: - if (flush == Z_BLOCK || flush == Z_TREES) - goto inf_leave; - - case TYPEDO: - /* determine and dispatch block type */ - INFLATE_TYPEDO_HOOK(strm, flush); /* hook for IBM Z DFLTCC */ - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", state->last ? " (last)" : "")); - state->mode = LEN_; /* decode codes */ - if (flush == Z_TREES) { - DROPBITS(2); - goto inf_leave; - } - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - SET_BAD("invalid block type"); - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - SET_BAD("invalid stored block lengths"); - break; - } - state->length = (uint16_t)hold; - Tracev((stderr, "inflate: stored length %u\n", state->length)); - INITBITS(); - state->mode = COPY_; - if (flush == Z_TREES) - goto inf_leave; - - case COPY_: - state->mode = COPY; - - case COPY: - /* copy stored block from input to output */ - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - memcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - SET_BAD("too many length or distance symbols"); - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - - case LENLENS: - /* get code length code lengths (not a typo) */ - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (uint16_t)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (const code *)(state->next); - state->lenbits = 7; - ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); - if (ret) { - SET_BAD("invalid code lengths set"); - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - - case CODELENS: - /* get length and distance code code lengths */ - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if (here.bits <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - SET_BAD("invalid bit length repeat"); - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - SET_BAD("invalid bit length repeat"); - break; - } - while (copy) { - --copy; - state->lens[state->have++] = (uint16_t)len; - } - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) - break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - SET_BAD("invalid code -- missing end-of-block"); - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (const code *)(state->next); - state->lenbits = 9; - ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); - if (ret) { - SET_BAD("invalid literal/lengths set"); - break; - } - state->distcode = (const code *)(state->next); - state->distbits = 6; - ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - SET_BAD("invalid distances set"); - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN_; - if (flush == Z_TREES) - goto inf_leave; - - case LEN_: - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= INFLATE_FAST_MIN_HAVE && left >= INFLATE_FAST_MIN_LEFT) { - RESTORE(); - zng_inflate_fast(strm, out); - LOAD(); - if (state->mode == TYPE) - state->back = -1; - break; - } - state->back = 0; - - /* get a literal, length, or end-of-block code */ - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if (here.bits <= bits) - break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)last.bits + (unsigned)here.bits <= bits) - break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - state->length = here.val; - - /* process literal */ - if ((int)(here.op) == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - state->mode = LIT; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->back = -1; - state->mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - SET_BAD("invalid literal/length code"); - break; - } - - /* length code */ - state->extra = (here.op & 15); - state->mode = LENEXT; - - case LENEXT: - /* get extra bits, if any */ - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->was = state->length; - state->mode = DIST; - - case DIST: - /* get distance code */ - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if (here.bits <= bits) - break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)last.bits + (unsigned)here.bits <= bits) - break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - if (here.op & 64) { - SET_BAD("invalid distance code"); - break; - } - state->offset = here.val; - state->extra = (here.op & 15); - state->mode = DISTEXT; - - case DISTEXT: - /* get distance extra bits, if any */ - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - SET_BAD("invalid distance too far back"); - break; - } -#endif - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - - case MATCH: - /* copy match from window to output */ - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->whave) { - if (state->sane) { - SET_BAD("invalid distance too far back"); - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - Trace((stderr, "inflate.c too far\n")); - copy -= state->whave; - if (copy > state->length) - copy = state->length; - if (copy > left) - copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = 0; - } while (--copy); - if (state->length == 0) - state->mode = LEN; - break; -#endif - } - if (copy > state->wnext) { - copy -= state->wnext; - from = state->window + (state->wsize - copy); - } else { - from = state->window + (state->wnext - copy); - } - if (copy > state->length) - copy = state->length; - if (copy > left) - copy = left; - - put = functable.chunkcopy_safe(put, from, copy, put + left); - } else { /* copy from output */ - copy = state->length; - if (copy > left) - copy = left; - - put = functable.chunkmemset_safe(put, state->offset, copy, left); - } - left -= copy; - state->length -= copy; - if (state->length == 0) - state->mode = LEN; - break; - - case LIT: - if (left == 0) - goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (INFLATE_NEED_CHECKSUM(strm) && (state->wrap & 4) && out) - strm->adler = state->check = UPDATE(state->check, put - out, out); - out = left; - if ((state->wrap & 4) && ( -#ifdef GUNZIP - state->flags ? hold : -#endif - ZSWAP32(hold)) != state->check) { - SET_BAD("incorrect data check"); - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) { - SET_BAD("incorrect length check"); - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - - case DONE: - /* inflate stream terminated properly */ - ret = Z_STREAM_END; - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - case MEM: - return Z_MEM_ERROR; - - case SYNC: - - default: /* can't happen, but makes compilers happy */ - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (INFLATE_NEED_UPDATEWINDOW(strm) && - (state->wsize || (out != strm->avail_out && state->mode < BAD && - (state->mode < CHECK || flush != Z_FINISH)))) { - if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (INFLATE_NEED_CHECKSUM(strm) && (state->wrap & 4) && out) - strm->adler = state->check = UPDATE(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); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int32_t Z_EXPORT PREFIX(inflateEnd)(PREFIX3(stream) *strm) { - struct inflate_state *state; - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - if (state->window != NULL) - ZFREE_WINDOW(strm, state->window); - ZFREE_STATE(strm, strm->state); - strm->state = NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int32_t Z_EXPORT PREFIX(inflateGetDictionary)(PREFIX3(stream) *strm, uint8_t *dictionary, uint32_t *dictLength) { - struct inflate_state *state; - - /* check state */ - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - - /* copy dictionary */ - if (state->whave && dictionary != NULL) { - memcpy(dictionary, state->window + state->wnext, state->whave - state->wnext); - memcpy(dictionary + state->whave - state->wnext, state->window, state->wnext); - } - if (dictLength != NULL) - *dictLength = state->whave; - return Z_OK; -} - -int32_t Z_EXPORT PREFIX(inflateSetDictionary)(PREFIX3(stream) *strm, const uint8_t *dictionary, uint32_t dictLength) { - struct inflate_state *state; - unsigned long dictid; - int32_t ret; - - /* check state */ - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary identifier */ - if (state->mode == DICT) { - dictid = functable.adler32(ADLER32_INITIAL_VALUE, dictionary, dictLength); - if (dictid != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary + dictLength, dictLength); - if (ret) { - state->mode = MEM; - return Z_MEM_ERROR; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int32_t Z_EXPORT PREFIX(inflateGetHeader)(PREFIX3(stream) *strm, PREFIX(gz_headerp) head) { - struct inflate_state *state; - - /* check state */ - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - if ((state->wrap & 2) == 0) - return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -static uint32_t syncsearch(uint32_t *have, const uint8_t *buf, uint32_t len) { - uint32_t got, next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int32_t Z_EXPORT PREFIX(inflateSync)(PREFIX3(stream) *strm) { - unsigned len; /* number of bytes to look at or looked at */ - int flags; /* temporary to save header status */ - size_t in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state *state; - - /* check parameters */ - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) - return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* 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; - PREFIX(inflateReset)(strm); - strm->total_in = in; - strm->total_out = out; - state->flags = flags; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int32_t Z_EXPORT PREFIX(inflateSyncPoint)(PREFIX3(stream) *strm) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - INFLATE_SYNC_POINT_HOOK(strm); - state = (struct inflate_state *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int32_t Z_EXPORT PREFIX(inflateCopy)(PREFIX3(stream) *dest, PREFIX3(stream) *source) { - struct inflate_state *state; - struct inflate_state *copy; - unsigned char *window; - unsigned wsize; - - /* check input */ - if (inflateStateCheck(source) || dest == NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state *)source->state; - - /* allocate space */ - copy = (struct inflate_state *)ZALLOC_STATE(source, 1, sizeof(struct inflate_state)); - if (copy == NULL) - return Z_MEM_ERROR; - window = NULL; - if (state->window != NULL) { - window = (unsigned char *)ZALLOC_WINDOW(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == NULL) { - ZFREE_STATE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - memcpy((void *)dest, (void *)source, sizeof(PREFIX3(stream))); - ZCOPY_STATE((void *)copy, (void *)state, sizeof(struct inflate_state)); - copy->strm = dest; - if (state->lencode >= state->codes && state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != NULL) { - wsize = 1U << state->wbits; - memcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state *)copy; - return Z_OK; -} - -int32_t Z_EXPORT PREFIX(inflateUndermine)(PREFIX3(stream) *strm, int32_t subvert) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - state->sane = !subvert; - return Z_OK; -#else - (void)subvert; - state->sane = 1; - return Z_DATA_ERROR; -#endif -} - -int32_t Z_EXPORT PREFIX(inflateValidate)(PREFIX3(stream) *strm, int32_t check) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state *)strm->state; - if (check && state->wrap) - state->wrap |= 4; - else - state->wrap &= ~4; - return Z_OK; -} - -long Z_EXPORT PREFIX(inflateMark)(PREFIX3(stream) *strm) { - struct inflate_state *state; - - if (inflateStateCheck(strm)) - return -65536; - INFLATE_MARK_HOOK(strm); /* hook for IBM Z DFLTCC */ - state = (struct inflate_state *)strm->state; - return (long)(((unsigned long)((long)state->back)) << 16) + - (state->mode == COPY ? state->length : - (state->mode == MATCH ? state->was - state->length : 0)); -} - -unsigned long Z_EXPORT PREFIX(inflateCodesUsed)(PREFIX3(stream) *strm) { - struct inflate_state *state; - if (strm == NULL || strm->state == NULL) - return (unsigned long)-1; - state = (struct inflate_state *)strm->state; - return (unsigned long)(state->next - state->codes); -} diff --git a/libs/zlibng/inflate.h b/libs/zlibng/inflate.h deleted file mode 100644 index a42749465..000000000 --- a/libs/zlibng/inflate.h +++ /dev/null @@ -1,134 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -#ifndef INFLATE_H_ -#define INFLATE_H_ - -/* define NO_GZIP when compiling if you want to disable gzip header and trailer decoding by inflate(). - NO_GZIP would be used to avoid linking in the crc code when it is not needed. - For shared libraries, gzip decoding should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD = 16180, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY_, /* i/o: same as COPY below, but only first time in */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN_, /* i: same as LEN below, but only first time in */ - LEN, /* i: waiting for length/lit/eob code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to BAD or MEM on error -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) or (raw) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> - HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - (raw) -> TYPEDO - Read deflate blocks: - TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK - STORED -> COPY_ -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN_ - LEN_ -> LEN - Read deflate codes in fixed or dynamic block: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* State maintained between inflate() calls -- approximately 7K bytes, not - including the allocated sliding window, which is up to 32K bytes. */ -struct inflate_state { - PREFIX3(stream) *strm; /* pointer back to this zlib stream */ - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - 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, 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 */ - PREFIX(gz_headerp) head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - uint32_t wsize; /* window size or zero if not using window */ - uint32_t whave; /* valid bytes in the window */ - uint32_t wnext; /* window write index */ - unsigned char *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - uint32_t hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - uint32_t length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const *lencode; /* starting table for length/literal codes */ - code const *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - uint32_t have; /* number of code lengths in lens[] */ - code *next; /* next available space in codes[] */ - uint16_t lens[320]; /* temporary storage for code lengths */ - uint16_t work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ - int sane; /* if false, allow invalid distance too far */ - int back; /* bits back of last unprocessed length/lit */ - unsigned was; /* initial length of match */ - uint32_t chunksize; /* size of memory copying chunk */ -}; - -int Z_INTERNAL inflate_ensure_window(struct inflate_state *state); -void Z_INTERNAL fixedtables(struct inflate_state *state); - -#endif /* INFLATE_H_ */ diff --git a/libs/zlibng/inflate_p.h b/libs/zlibng/inflate_p.h deleted file mode 100644 index 76fe2dccb..000000000 --- a/libs/zlibng/inflate_p.h +++ /dev/null @@ -1,101 +0,0 @@ -/* inflate_p.h -- Private inline functions and macros shared with more than one deflate method - * - */ - -#ifndef INFLATE_P_H -#define INFLATE_P_H - -/* - * Macros shared by inflate() and inflateBack() - */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? PREFIX(crc32)(check, buf, len) : functable.adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) functable.adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = PREFIX(crc32)(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = PREFIX(crc32)(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = (z_const unsigned char *)next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Ensure that there is at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate()/inflateBack(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - (hold & ((1U << (unsigned)(n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -#endif - -/* Set mode=BAD and prepare error message */ -#define SET_BAD(errmsg) \ - do { \ - state->mode = BAD; \ - strm->msg = (char *)errmsg; \ - } while (0) diff --git a/libs/zlibng/inftrees.c b/libs/zlibng/inftrees.c deleted file mode 100644 index faf1d249d..000000000 --- a/libs/zlibng/inftrees.c +++ /dev/null @@ -1,297 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char PREFIX(inflate_copyright)[] = " inflate 1.2.11.f Copyright 1995-2016 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 - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int Z_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes, - code * *table, unsigned *bits, uint16_t *work) { - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code here; /* table entry for duplication */ - code *next; /* next available space in table */ - const uint16_t *base; /* base value table to use */ - const uint16_t *extra; /* extra bits table to use */ - unsigned match; /* use base and extra for symbol >= match */ - uint16_t count[MAXBITS+1]; /* number of codes of each length */ - uint16_t offs[MAXBITS+1]; /* offsets in table for each length */ - static const uint16_t lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const uint16_t 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}; - static const uint16_t 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, - 8193, 12289, 16385, 24577, 0, 0}; - static const uint16_t dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)1; - here.val = (uint16_t)0; - *(*table)++ = here; /* make a table to force an error */ - *(*table)++ = here; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (uint16_t)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - match = 20; - break; - case LENS: - base = lbase; - extra = lext; - match = 257; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - match = 0; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type == LENS && used > ENOUGH_LENS) || - (type == DISTS && used > ENOUGH_DISTS)) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here.bits = (unsigned char)(len - drop); - if (work[sym] + 1U < match) { - here.op = (unsigned char)0; - here.val = work[sym]; - } else if (work[sym] >= match) { - here.op = (unsigned char)(extra[work[sym] - match]); - here.val = base[work[sym] - match]; - } else { - here.op = (unsigned char)(32 + 64); /* end of block */ - here.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = here; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) - break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) - break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS)) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (uint16_t)(next - *table); - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff != 0) { - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)(len - drop); - here.val = (uint16_t)0; - next[huff] = here; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/libs/zlibng/inftrees.h b/libs/zlibng/inftrees.h deleted file mode 100644 index 7758737c2..000000000 --- a/libs/zlibng/inftrees.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef INFTREES_H_ -#define INFTREES_H_ - -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - uint16_t val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* 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 - 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. - The initial root table size (9 or 6) is found in the fifth argument of the - inflate_table() calls in inflate.c and infback.c. If the root table size is - changed, then these maximum sizes would be need to be recalculated and - updated. */ -#define ENOUGH_LENS 852 -#define ENOUGH_DISTS 592 -#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) - -/* Type of code to build for inflate_table() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -int Z_INTERNAL zng_inflate_table (codetype type, uint16_t *lens, unsigned codes, - code * *table, unsigned *bits, uint16_t *work); - -#endif /* INFTREES_H_ */ diff --git a/libs/zlibng/insert_string.c b/libs/zlibng/insert_string.c deleted file mode 100644 index 4ddf9ae5d..000000000 --- a/libs/zlibng/insert_string.c +++ /dev/null @@ -1,25 +0,0 @@ -/* insert_string_c -- insert_string variant for c - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -#include "zbuild.h" -#include "deflate.h" - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define HASH_SLIDE 16 // Number of bits to slide hash - -#define UPDATE_HASH(s, h, val) \ - h = ((val * 2654435761U) >> HASH_SLIDE); - -#define INSERT_STRING insert_string_c -#define QUICK_INSERT_STRING quick_insert_string_c - -#include "insert_string_tpl.h" diff --git a/libs/zlibng/insert_string_tpl.h b/libs/zlibng/insert_string_tpl.h deleted file mode 100644 index 9796e5196..000000000 --- a/libs/zlibng/insert_string_tpl.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef INSERT_STRING_H_ -#define INSERT_STRING_H_ - -/* insert_string.h -- Private insert_string functions shared with more than - * one insert string implementation - * - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * - * Copyright (C) 2013 Intel Corporation. All rights reserved. - * Authors: - * Wajdi Feghali - * Jim Guilford - * Vinodh Gopal - * Erdinc Ozturk - * Jim Kukunas - * - * Portions are Copyright (C) 2016 12Sided Technology, LLC. - * Author: - * Phil Vachon - * - * For conditions of distribution and use, see copyright notice in zlib.h - * - */ - -/* =========================================================================== - * Quick insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - */ -Z_INTERNAL Pos QUICK_INSERT_STRING(deflate_state *const s, const uint32_t str) { - Pos head; - uint8_t *strstart = s->window + str; - uint32_t val, hm, h = 0; - -#ifdef UNALIGNED_OK - val = *(uint32_t *)(strstart); -#else - val = ((uint32_t)(strstart[0])); - val |= ((uint32_t)(strstart[1]) << 8); - val |= ((uint32_t)(strstart[2]) << 16); - val |= ((uint32_t)(strstart[3]) << 24); -#endif - - UPDATE_HASH(s, h, val); - hm = h & HASH_MASK; - - head = s->head[hm]; - if (LIKELY(head != str)) { - s->prev[str & s->w_mask] = head; - s->head[hm] = (Pos)str; - } - return head; -} - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -Z_INTERNAL void INSERT_STRING(deflate_state *const s, const uint32_t str, uint32_t count) { - uint8_t *strstart = s->window + str; - uint8_t *strend = strstart + count - 1; /* last position */ - - for (Pos idx = (Pos)str; strstart <= strend; idx++, strstart++) { - uint32_t val, hm, h = 0; - -#ifdef UNALIGNED_OK - val = *(uint32_t *)(strstart); -#else - val = ((uint32_t)(strstart[0])); - val |= ((uint32_t)(strstart[1]) << 8); - val |= ((uint32_t)(strstart[2]) << 16); - val |= ((uint32_t)(strstart[3]) << 24); -#endif - - UPDATE_HASH(s, h, val); - hm = h & HASH_MASK; - - Pos head = s->head[hm]; - if (LIKELY(head != idx)) { - s->prev[idx & s->w_mask] = head; - s->head[hm] = idx; - } - } -} -#endif diff --git a/libs/zlibng/match_tpl.h b/libs/zlibng/match_tpl.h deleted file mode 100644 index b15ca17b9..000000000 --- a/libs/zlibng/match_tpl.h +++ /dev/null @@ -1,180 +0,0 @@ - -#include "zbuild.h" -#include "deflate.h" -#include "functable.h" - -#ifndef MATCH_TPL_H -#define MATCH_TPL_H - -#ifdef UNALIGNED_OK -# ifdef UNALIGNED64_OK -typedef uint64_t bestcmp_t; -# else -typedef uint32_t bestcmp_t; -# endif -#else -typedef uint8_t bestcmp_t; -#endif - -#define EARLY_EXIT_TRIGGER_LEVEL 5 - -#endif - -/* Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is garbage. - * - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >=1 - * OUT assertion: the match length is not greater than s->lookahead - */ -Z_INTERNAL uint32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) { - unsigned int strstart = s->strstart; - const unsigned wmask = s->w_mask; - unsigned char *window = s->window; - unsigned char *scan = window + strstart; - Z_REGISTER unsigned char *mbase_start = window; - Z_REGISTER unsigned char *mbase_end; - const Pos *prev = s->prev; - Pos limit; - int32_t early_exit; - uint32_t chain_length, nice_match, best_len, offset; - uint32_t lookahead = s->lookahead; - bestcmp_t scan_end; -#ifndef UNALIGNED_OK - bestcmp_t scan_end0; -#else - bestcmp_t scan_start; -#endif - -#define GOTO_NEXT_CHAIN \ - if (--chain_length && (cur_match = prev[cur_match & wmask]) > limit) \ - continue; \ - return best_len; - - /* The code is optimized for MAX_MATCH-2 multiple of 16. */ - Assert(MAX_MATCH == 258, "Code too clever"); - - best_len = s->prev_length ? s->prev_length : 1; - - /* Calculate read offset which should only extend an extra byte - * to find the next best match length. - */ - offset = best_len-1; -#ifdef UNALIGNED_OK - if (best_len >= sizeof(uint32_t)) { - offset -= 2; -#ifdef UNALIGNED64_OK - if (best_len >= sizeof(uint64_t)) - offset -= 4; -#endif - } -#endif - - scan_end = *(bestcmp_t *)(scan+offset); -#ifndef UNALIGNED_OK - scan_end0 = *(bestcmp_t *)(scan+offset+1); -#else - scan_start = *(bestcmp_t *)(scan); -#endif - mbase_end = (mbase_start+offset); - - /* Do not waste too much time if we already have a good match */ - chain_length = s->max_chain_length; - early_exit = s->level < EARLY_EXIT_TRIGGER_LEVEL; - if (best_len >= s->good_match) - chain_length >>= 2; - nice_match = (uint32_t)s->nice_match; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0 - */ - limit = strstart > MAX_DIST(s) ? (Pos)(strstart - MAX_DIST(s)) : 0; - - Assert((unsigned long)strstart <= s->window_size - MIN_LOOKAHEAD, "need lookahead"); - for (;;) { - if (cur_match >= strstart) - break; - - /* Skip to next match if the match length cannot increase or if the match length is - * less than 2. Note that the checks below for insufficient lookahead only occur - * occasionally for performance reasons. - * Therefore uninitialized memory will be accessed and conditional jumps will be made - * that depend on those values. However the length of the match is limited to the - * lookahead, so the output of deflate is not affected by the uninitialized values. - */ -#ifdef UNALIGNED_OK - if (best_len < sizeof(uint32_t)) { - for (;;) { - if (*(uint16_t *)(mbase_end+cur_match) == (uint16_t)scan_end && - *(uint16_t *)(mbase_start+cur_match) == (uint16_t)scan_start) - break; - GOTO_NEXT_CHAIN; - } -# ifdef UNALIGNED64_OK - } else if (best_len >= sizeof(uint64_t)) { - for (;;) { - if (*(uint64_t *)(mbase_end+cur_match) == (uint64_t)scan_end && - *(uint64_t *)(mbase_start+cur_match) == (uint64_t)scan_start) - break; - GOTO_NEXT_CHAIN; - } -# endif - } else { - for (;;) { - if (*(uint32_t *)(mbase_end+cur_match) == (uint32_t)scan_end && - *(uint32_t *)(mbase_start+cur_match) == (uint32_t)scan_start) - break; - GOTO_NEXT_CHAIN; - } - } -#else - for (;;) { - if (mbase_end[cur_match] == scan_end && mbase_end[cur_match+1] == scan_end0 && - mbase_start[cur_match] == scan[0] && mbase_start[cur_match+1] == scan[1]) - break; - GOTO_NEXT_CHAIN; - } -#endif - uint32_t len = COMPARE256(scan+2, mbase_start+cur_match+2) + 2; - Assert(scan+len <= window+(unsigned)(s->window_size-1), "wild scan"); - - if (len > best_len) { - s->match_start = cur_match; - /* Do not look for matches beyond the end of the input. */ - if (len > lookahead) - return lookahead; - best_len = len; - if (best_len >= nice_match) - return best_len; - - offset = best_len-1; -#ifdef UNALIGNED_OK - if (best_len >= sizeof(uint32_t)) { - offset -= 2; -#ifdef UNALIGNED64_OK - if (best_len >= sizeof(uint64_t)) - offset -= 4; -#endif - } -#endif - scan_end = *(bestcmp_t *)(scan+offset); -#ifndef UNALIGNED_OK - scan_end0 = *(bestcmp_t *)(scan+offset+1); -#endif - mbase_end = (mbase_start+offset); - } else if (UNLIKELY(early_exit)) { - /* The probability of finding a match later if we here is pretty low, so for - * performance it's best to outright stop here for the lower compression levels - */ - break; - } - GOTO_NEXT_CHAIN; - } - - return best_len; -} - -#undef LONGEST_MATCH -#undef COMPARE256 -#undef COMPARE258 diff --git a/libs/zlibng/test/.gitignore b/libs/zlibng/test/.gitignore deleted file mode 100644 index 96a3cad07..000000000 --- a/libs/zlibng/test/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# ignore Makefiles; they're all automatically generated -Makefile -/switchlevels -/switchlevels.dSYM/ -/switchlevels.exe diff --git a/libs/zlibng/test/CVE-2002-0059/test.gz b/libs/zlibng/test/CVE-2002-0059/test.gz deleted file mode 100644 index c5c3e184b1a90692f1c2dc729eb106476d231378..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4610 zcmb2|=3oE==C>CV8G$T;1@EN)&o6EfRlAUMpn;K@jYq;DVU#f%2%{-sG#8BKg3(+s vnhQpA!DucR%>|>mU^Ewu=7P~&Fq#WSbHQjX7-G5L2b -#include -#include -#include - -int main(void) { - gzFile f; - int ret; - - if(!(f = gzopen("/dev/null", "w"))) { - perror("/dev/null"); - exit(1); - } - - ret = gzprintf(f, "%10240s", ""); - printf("gzprintf -> %d\n", ret); - ret = gzclose(f); - printf("gzclose -> %d [%d]\n", ret, errno); - - exit(0); -} diff --git a/libs/zlibng/test/CVE-2004-0797/test.gz b/libs/zlibng/test/CVE-2004-0797/test.gz deleted file mode 100644 index 62dcf34bddbfe2c2e861c7929c21dc2f731dd000..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52 ocmb2|=3oE==C>CV85!7kBn%P`G%zxAfEl}iz!@q6kpjs906!lM=l}o! diff --git a/libs/zlibng/test/CVE-2005-1849/test.gz b/libs/zlibng/test/CVE-2005-1849/test.gz deleted file mode 100644 index b28f278263c0a3154faeb3c3dd7b083a3a593c8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52 kcmb2|=3oE==C@ZA85!7kBn%P`G%zxAz!-252m>Ss01LtkQvd(} diff --git a/libs/zlibng/test/CVE-2005-2096/test.gz b/libs/zlibng/test/CVE-2005-2096/test.gz deleted file mode 100644 index 11590aeab9ac844087776ab66eb2f5d2c9f6d013..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52 pcmb2|=3oE==C>CV84oltGP4!m+X9 diff --git a/libs/zlibng/test/GH-382/defneg3.dat b/libs/zlibng/test/GH-382/defneg3.dat deleted file mode 100644 index 5fa6a0804..000000000 --- a/libs/zlibng/test/GH-382/defneg3.dat +++ /dev/null @@ -1 +0,0 @@ -o̙?Oḩ>̝̹̘Es̗̍4̢̙̑6\5̪̲̕m̧̖̺̜̖m̵GO ̄;̔̒,̢A9̻̂s̼̭eUu̱w̕D̋̽t̞̣̹O̅pG̰(̤{̓M#̵̝d̷Ih_pJ̢ó;<̘ZoW̄̿}:̧̻̕eFt(Eop̢(;!̹̹̜43̋B̎uP6̓&̦̳̻̕Ţb{̡N9B \ No newline at end of file diff --git a/libs/zlibng/test/GH-751/test.txt b/libs/zlibng/test/GH-751/test.txt deleted file mode 100644 index ef2143ece..000000000 --- a/libs/zlibng/test/GH-751/test.txt +++ /dev/null @@ -1 +0,0 @@ -abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc diff --git a/libs/zlibng/test/Makefile.in b/libs/zlibng/test/Makefile.in deleted file mode 100644 index 97b8be753..000000000 --- a/libs/zlibng/test/Makefile.in +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler -# Copyright 2015, Daniel Axtens, IBM Corporation -# zlib license, see zlib.h - -CC= -CFLAGS= -EXE= -SRCDIR= -SRCTOP= -LIBNAME= -TEST_LDFLAGS=-L.. ../$(LIBNAME).a -WITH_FUZZERS= - -COMPATTESTS = -QEMU_RUN= -QEMU_VER:=$(shell command -v $(QEMU_RUN) --version 2> /dev/null) - -all: oldtests cvetests $(COMPATTESTS) fuzzer ghtests - -oldtests: #set by ../configure -check_cross_dep: -ifneq (,$(QEMU_RUN)) -ifeq (,$(QEMU_VER)) - $(error "You need QEMU to run tests on non-native platform") -endif -endif - -ALL_SRC_FILES := $(wildcard ../*) - -# Only check the fuzzer when it is a stand-alone executable. -ifneq (,$(LIB_FUZZING_ENGINE)) -fuzzer: -else - ifeq (0,$(WITH_FUZZERS)) -fuzzer: - else -fuzzer: - @${QEMU_RUN} ../checksum_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../compress_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_small_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_large_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_flush_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../example_dict_fuzzer$(EXE) $(ALL_SRC_FILES) && \ - ${QEMU_RUN} ../minigzip_fuzzer$(EXE) $(ALL_SRC_FILES) - endif -endif - -teststatic: check_cross_dep - @TMPST=tmpst_$$$$; \ - HELLOST=tmphellost_$$$$; \ - if echo hello world | ${QEMU_RUN} ../minigzip$(EXE) > $$HELLOST && ${QEMU_RUN} ../minigzip$(EXE) -d < $$HELLOST && ${QEMU_RUN} ../example$(EXE) $$TMPST && ${QEMU_RUN} ../adler32_test$(EXE); then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; exit 1; \ - fi; \ - rm -f $$TMPST $$HELLOST - -testshared: check_cross_dep - @LD_LIBRARY_PATH=`pwd`/..:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - LD_LIBRARYN32_PATH=`pwd`/..:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ - DYLD_LIBRARY_PATH=`pwd`/..:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ - SHLIB_PATH=`pwd`/..:$(SHLIB_PATH) ; export SHLIB_PATH; \ - TMPSH=tmpsh_$$$$; \ - HELLOSH=tmphellosh_$$$$; \ - if echo hello world | ${QEMU_RUN} ../minigzipsh$(EXE) > $$HELLOSH && ${QEMU_RUN} ../minigzipsh$(EXE) -d < $$HELLOSH && ${QEMU_RUN} ../examplesh$(EXE) $$TMPSH && ${QEMU_RUN} ../adler32_testsh$(EXE); then \ - echo ' *** zlib shared test OK ***'; \ - else \ - echo ' *** zlib shared test FAILED ***'; exit 1; \ - fi; \ - rm -f $$TMPSH $$HELLOSH - -cvetests: testCVEinputs - -# Tests requiring zlib-ng to be built with --zlib-compat -compattests: testCVE-2003-0107 - -testCVEinputs: check_cross_dep - @EXE=$(EXE) QEMU_RUN="${QEMU_RUN}" $(SRCDIR)/testCVEinputs.sh - -testCVE-2003-0107: CVE-2003-0107$(EXE) check_cross_dep - @if ${QEMU_RUN} ./CVE-2003-0107$(EXE); then \ - echo ' *** zlib not vulnerable to CVE-2003-0107 ***'; \ - else \ - echo ' *** zlib VULNERABLE to CVE-2003-0107 ***'; exit 1; \ - fi - -CVE-2003-0107.o: $(SRCDIR)/CVE-2003-0107.c - $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -c -o $@ $(SRCDIR)/CVE-2003-0107.c - -CVE-2003-0107$(EXE): CVE-2003-0107.o - $(CC) $(CFLAGS) -o $@ CVE-2003-0107.o $(TEST_LDFLAGS) - -.PHONY: ghtests -ghtests: testGH-361 testGH-364 testGH-751 - -.PHONY: testGH-361 -testGH-361: - $(QEMU_RUN) ../minigzip$(EXE) -4 <$(SRCDIR)/GH-361/test.txt >/dev/null - -switchlevels$(EXE): $(SRCDIR)/switchlevels.c - $(CC) $(CFLAGS) -I.. -I$(SRCTOP) -o $@ $< $(TEST_LDFLAGS) - -.PHONY: testGH-364 -testGH-364: switchlevels$(EXE) - $(QEMU_RUN) ./switchlevels$(EXE) 1 5 9 3 <$(SRCDIR)/GH-364/test.bin >/dev/null - -.PHONY: testGH-751 -testGH-751: - $(QEMU_RUN) ../minigzip$(EXE) <$(SRCDIR)/GH-751/test.txt | $(QEMU_RUN) ../minigzip$(EXE) -d >/dev/null - -clean: - rm -f *.o *.gcda *.gcno *.gcov - rm -f CVE-2003-0107$(EXE) switchlevels$(EXE) - -distclean: - rm -f Makefile diff --git a/libs/zlibng/test/README.md b/libs/zlibng/test/README.md deleted file mode 100644 index 247d5bac7..000000000 --- a/libs/zlibng/test/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Contents --------- - -|Name|Description| -|-|-| -|[CVE-2003-0107.c](https://nvd.nist.gov/vuln/detail/CVE-2003-0107)|Buffer overflow in the gzprintf function, requires ZLIB_COMPAT| -|[CVE-2002-0059](https://nvd.nist.gov/vuln/detail/CVE-2002-0059)|inflateEnd to release memory more than once| -|[CVE-2004-0797](https://nvd.nist.gov/vuln/detail/CVE-2004-0797)|Error handling in inflate and inflateBack causes crash| -|[CVE-2005-1849](https://nvd.nist.gov/vuln/detail/CVE-2005-1849)|inftrees.h bug causes crash| -|[CVE-2005-2096](https://nvd.nist.gov/vuln/detail/CVE-2005-2096)|Buffer overflow when incomplete code description -|[GH-361](https://github.com/zlib-ng/zlib-ng/issues/361)|Test case for overlapping matches| -|[GH-364](https://github.com/zlib-ng/zlib-ng/issues/364)|Test case for switching compression levels| -|[GH-382](https://github.com/zlib-ng/zlib-ng/issues/382)|Test case for deflateEnd returning -3 in deflate quick| - -Copying -------- - -Some of the files in _test_ are licensed differently: - - - test/data/fireworks.jpeg is Copyright 2013 Steinar H. Gunderson, and - is licensed under the Creative Commons Attribution 3.0 license - (CC-BY-3.0). See https://creativecommons.org/licenses/by/3.0/ - for more information. - - - test/data/paper-100k.pdf is an excerpt (bytes 92160 to 194560) from the paper - “Combinatorial Modeling of Chromatin Features Quantitatively Predicts DNA - Replication Timing in _Drosophila_” by Federico Comoglio and Renato Paro, - which is licensed under the CC-BY license. See - http://www.ploscompbiol.org/static/license for more information. - - - test/data/lcet10.txt is from Project Gutenberg. It does not have expired - copyright, but is still in the public domain according to the license information. - (http://www.gutenberg.org/ebooks/53). - - - test/GH-382/defneg3.dat was the smallest file generated by Nathan Moinvaziri - that reproduced GH-382. It is licensed under the terms of the zlib license. diff --git a/libs/zlibng/test/abi/ignore b/libs/zlibng/test/abi/ignore deleted file mode 100644 index dba3639cb..000000000 --- a/libs/zlibng/test/abi/ignore +++ /dev/null @@ -1,12 +0,0 @@ -# See https://sourceware.org/libabigail/manual/libabigail-concepts.html#suppression-specifications - -[suppress_type] - name = internal_state - -[suppress_type] - name_regexp = z_stream.* - -# Size varies with version number -[suppress_variable] - name = zlibng_string - diff --git a/libs/zlibng/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi b/libs/zlibng/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi deleted file mode 100644 index 152a742cf..000000000 --- a/libs/zlibng/test/abi/zlib-v1.2.11-arm-linux-gnueabihf.abi +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/zlibng/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi b/libs/zlibng/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi deleted file mode 100644 index 00a520c63..000000000 --- a/libs/zlibng/test/abi/zlib-v1.2.11-x86_64-linux-gnu.abi +++ /dev/null @@ -1,1037 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/zlibng/test/abicheck.md b/libs/zlibng/test/abicheck.md deleted file mode 100644 index 6e9e58aad..000000000 --- a/libs/zlibng/test/abicheck.md +++ /dev/null @@ -1,59 +0,0 @@ -ABI Compatibility test ----------------------- - -abicheck.sh uses libabigail to check ABI stability. -It will abort if the current source -tree has a change that breaks binary compatibility. - -This protects against the common scenario where: -- an app is compiled against the current zlib-ng -- the system package manager updates the zlib-ng shared library -- the app now crashes because some symbol is - missing or some public structure or parameter - has changed type or size - -If run with --zlib-compat, it verifies that the -current source tree generates a library that -is ABI-compatible with the reference release -of classic zlib. This ensures that building -zlib-ng with --zlib-compat does what it says on the tin. - -abicheck.sh is not perfect, but it can catch -many common compatibility issues. - -Cached files test/abi/*.abi ---------------------------- - -Comparing to the old version of zlib (or zlib-ng) -means someone has to check out and build -the previous source tree and extract its .abi -using abidw. This can be slow. - -If you don't mind the slowness, run abicheck.sh --refresh_if, -and it will download and build the reference version -and extract the .abi on the spot if needed. -(FIXME: should this be the default?) - -On the next run, the reference .abi file will already be -present, and that step will be skipped. -It's stored in the tests/abi directory, -in a file with the architecture and git hash in the name. - -If you're running continuous integration -which clear out the source tree on each run, -and you don't want your build machines -constantly downloading and building the old -version, you can check the .abi file into git. - -To make this easier, a helper script could be written to automatically build -all the configurations tested by .github/worflows/abicheck.yml -Then they could be checked into git en masse by a maintainer -when a new platform is added or a new major version (which -intentionally breaks backwards compatibility) is being prepared. - -Further reading ---------------- - -- https://sourceware.org/libabigail/manual/ -- https://developers.redhat.com/blog/2014/10/23/comparing-abis-for-compatibility-with-libabigail-part-1/ -- https://developers.redhat.com/blog/2020/04/02/how-to-write-an-abi-compliance-checker-using-libabigail/ diff --git a/libs/zlibng/test/abicheck.sh b/libs/zlibng/test/abicheck.sh deleted file mode 100644 index 89199a59a..000000000 --- a/libs/zlibng/test/abicheck.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -set -ex -TESTDIR="$(cd $(dirname "$0"); pwd)" - -usage() { - cat <<_EOF_ -Usage: $0 [--zlib-compat][--refresh][--refresh-if] - -Build shared library with -ggdb, then compare its ABI to the stable -ABI, and abort if differences found. - -Options: ---zlib-compat - check the ABI of the zlib-compatible flavor of zlib-ng. ---refresh - build the reference library and extract its ABI rather than using a stored ABI file. ---refresh-if - refresh only if ABI file not present. - -Obeys CHOST, CONFIGURE_ARGS, CFLAGS, and LDFLAGS. - -Requires libabigail (on Ubuntu, install package abigail-tools). -_EOF_ -} - -# Print the multiarch tuple for the current (non-cross) machine, -# or the empty string if unavailable. -detect_chost() { - dpkg-architecture -qDEB_HOST_MULTIARCH || - $CC -print-multiarch || - $CC -print-search-dirs | sed 's/:/\n/g' | grep -E '^/lib/[^/]+$' | sed 's%.*/%%' || - true -} - -if ! test -f "configure" -then - echo "Please run from top of source tree" - exit 1 -fi - -suffix="-ng" -CONFIGURE_ARGS_NG="$CONFIGURE_ARGS" -refresh=false -refresh_if=false -for arg -do - case "$arg" in - --zlib-compat) - suffix="" - CONFIGURE_ARGS_NG="$CONFIGURE_ARGS_NG --zlib-compat" - ;; - --refresh) - refresh=true - ;; - --refresh_if) - refresh_if=true - ;; - --help) - usage - exit 0 - ;; - *) - echo "Unknown arg '$arg'" - usage - exit 1 - ;; - esac -done - -# Choose reference repo and commit -if test "$suffix" = "" -then - # Reference is zlib 1.2.11 - ABI_GIT_REPO=https://github.com/madler/zlib.git - ABI_GIT_COMMIT=v1.2.11 -else - # Reference should be the tag for zlib-ng 2.0 - # but until that bright, shining day, use some - # random recent SHA. Annoyingly, can't shorten it. - ABI_GIT_REPO=https://github.com/zlib-ng/zlib-ng.git - ABI_GIT_COMMIT=56ce27343bf295ae9457f8e3d38ec96d2f949a1c -fi -# FIXME: even when using a tag, check the hash. - -# Test compat build for ABI compatibility with zlib -if test "$CHOST" = "" -then - # Note: don't export CHOST here, as we don't want configure seeing it - # when it's just the name for the build machine. - # Leave it as a plain shell variable, not an environment variable. - CHOST=$(detect_chost) - # Support -m32 for non-cross builds. - case "$CFLAGS" in - *-m32*) M32="-m32";; - *) M32="";; - esac -fi - -# Canonicalize CHOST to work around bug in original zlib's configure -export CHOST=$(sh $TESTDIR/../tools/config.sub $CHOST) - -if test "$CHOST" = "" -then - echo "abicheck: SKIP, as we don't know CHOST" - exit 0 -fi - -ABIFILE="test/abi/zlib$suffix-$ABI_GIT_COMMIT-$CHOST$M32.abi" -if ! $refresh && $refresh_if && ! test -f "$ABIFILE" -then - refresh=true -fi -abidw --version - -if $refresh -then - # Check out reference source - rm -rf btmp1 - mkdir -p btmp1/src.d - cd btmp1/src.d - git init - git remote add origin $ABI_GIT_REPO - git fetch origin $ABI_GIT_COMMIT - git reset --hard FETCH_HEAD - cd .. - # Build unstripped, uninstalled, very debug shared library - CFLAGS="$CFLAGS -ggdb" sh src.d/configure $CONFIGURE_ARGS - make -j2 - cd .. - # Find shared library, extract its abi - dylib1=$(find btmp1 -type f -name '*.dylib*' -print -o -type f -name '*.so.*' -print) - abidw $dylib1 > "$ABIFILE" - # Maintainers may wish to check $ABIFILE into git when a new - # target is added, or when a major release happens that is - # intended to change the ABI. Alternately, this script could - # just always rebuild the reference source, and dispense with - # caching abi files in git (but that would slow builds down). -fi - -if test -f "$ABIFILE" -then - ABIFILE="$ABIFILE" -else - echo "abicheck: SKIP: $ABIFILE not found; rerun with --refresh or --refresh_if" - exit 0 -fi - -# Build unstripped, uninstalled, very debug shared library -rm -rf btmp2 -mkdir btmp2 -cd btmp2 -CFLAGS="$CFLAGS -ggdb" ../configure $CONFIGURE_ARGS_NG -make -j2 -cd .. -# Find shared library, extract its abi -dylib2=$(find btmp2 -type f -name '*.dylib*' -print -o -type f -name '*.so.*' -print) -abidw $dylib2 > btmp2/zlib${suffix}-built.abi - -# Compare it to the reference -# FIXME: use --no-added-syms for now, but we probably want to be more strict. -if abidiff --no-added-syms --suppressions test/abi/ignore "$ABIFILE" btmp2/zlib${suffix}-built.abi -then - echo "abicheck: PASS" -else - echo "abicheck: FAIL" - exit 1 -fi diff --git a/libs/zlibng/test/adler32_test.c b/libs/zlibng/test/adler32_test.c deleted file mode 100644 index f681877d3..000000000 --- a/libs/zlibng/test/adler32_test.c +++ /dev/null @@ -1,365 +0,0 @@ -/* adler32_test.c -- unit test for adler32 in the zlib compression library - * Copyright (C) 2020 IBM Corporation - * Author: Rogerio Alves - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -typedef struct { - uint32_t line; - uint32_t adler; - const uint8_t *buf; - uint32_t len; - uint32_t expect; -} adler32_test; - -void test_adler32(uint32_t adler, const uint8_t *buf, uint32_t len, uint32_t chk, uint32_t line) { - uint32_t res = PREFIX(adler32)(adler, buf, len); - if (res != chk) { - fprintf(stderr, "FAIL [%d]: adler32 returned 0x%08X expected 0x%08X\n", - line, res, chk); - exit(1); - } -} - -static const uint8_t long_string[5552] = { - 'q','j','d','w','q','4','8','m','B','u','k','J','V','U','z','V','V','f','M','j','i','q','S','W','L','5','G','n','F','S','P','Q', - 'Q','D','i','6','m','E','9','Z','a','A','P','h','9','d','r','b','5','t','X','U','U','L','w','q','e','k','E','H','6','W','7','k', - 'A','x','N','Q','R','k','d','V','5','y','n','U','N','W','Q','Y','i','W','5','9','R','p','D','C','x','p','u','h','C','a','m','r', - 'z','n','z','A','d','J','6','u','N','e','r','x','7','Q','3','v','V','h','H','S','H','S','f','K','f','e','E','T','9','J','f','K', - 'w','t','x','J','2','y','7','B','x','X','X','p','G','b','T','g','3','k','U','6','E','Z','M','t','J','q','v','n','S','T','6','x', - '5','x','4','P','z','p','M','F','V','b','d','m','f','G','n','J','m','w','z','K','8','a','q','E','D','e','b','3','h','B','V','g', - 'y','3','P','L','5','8','r','z','X','b','Q','g','H','7','L','c','Z','B','3','C','4','y','t','u','k','z','h','v','C','Y','p','p', - '8','H','v','5','X','w','4','L','R','V','V','4','U','C','8','4','T','E','a','N','Z','S','7','U','u','z','f','H','p','P','J','u', - 'Y','Z','h','T','6','e','v','z','V','F','h','u','y','H','b','k','J','M','f','3','6','g','y','L','E','W','t','B','B','d','d','9', - 'u','M','Z','k','F','G','f','h','q','k','5','k','f','r','M','7','c','M','7','y','n','u','8','b','d','7','Q','f','E','m','F','K', - 'x','W','f','B','2','F','8','5','q','z','y','3','R','i','U','m','X','k','h','N','J','y','B','C','h','u','x','4','f','k','J','5', - '6','X','T','W','h','8','J','4','m','K','p','N','3','g','C','g','A','E','e','Z','x','A','P','2','E','4','t','Q','5','X','Y','j', - '6','m','b','h','G','a','v','6','t','v','6','C','M','G','P','u','B','C','A','V','b','2','9','d','2','c','5','a','b','X','w','V', - 'G','6','a','7','c','8','G','6','K','U','Q','m','w','P','V','5','N','x','b','v','x','E','N','C','A','N','t','v','N','B','z','X', - 'B','R','q','U','n','i','A','Q','d','m','a','D','7','Y','f','3','J','8','Y','m','w','Z','b','w','r','H','q','E','j','c','u','E', - 'i','i','S','b','n','G','P','a','F','j','c','R','D','D','G','F','v','i','a','i','M','7','B','e','w','m','L','E','F','2','Y','4', - '4','7','Y','C','t','y','q','7','2','V','G','m','m','E','e','V','u','m','L','p','R','X','W','z','V','K','E','k','p','V','r','J', - 'd','N','3','t','i','u','S','V','w','2','w','U','Q','3','F','q','4','h','q','k','B','7','R','X','B','F','Q','Z','b','b','4','E', - 'K','v','T','B','w','k','V','C','x','d','K','g','N','S','u','k','p','9','z','w','c','y','U','M','V','E','2','Y','P','F','h','9', - 'T','y','h','w','b','9','P','w','G','c','W','W','k','j','J','Q','N','B','U','G','6','9','U','b','v','a','N','9','N','C','G','n', - 'x','R','6','9','Q','C','h','e','j','P','U','h','U','R','i','4','T','B','W','5','w','m','J','p','e','7','r','9','t','c','9','Z', - 'j','p','r','F','C','e','U','P','x','T','A','N','7','6','a','i','y','e','w','F','C','X','H','Y','G','C','q','q','m','A','t','7', - 'z','u','D','S','L','U','C','f','7','e','t','G','V','F','u','c','x','5','M','7','N','i','M','6','h','2','n','H','S','h','K','M', - 'd','T','z','X','d','x','x','4','q','z','d','D','a','2','X','r','p','r','R','m','U','U','y','S','H','c','a','F','e','Z','a','U', - 'P','9','V','J','e','q','j','Y','M','x','e','v','K','7','M','P','N','2','b','6','f','P','h','H','4','U','X','k','n','f','Q','M', - '9','9','a','J','N','e','w','y','f','F','P','p','a','F','Y','a','M','L','W','i','T','M','B','3','U','v','X','v','G','p','7','a', - 'f','u','4','S','y','X','9','g','g','b','B','G','c','i','M','U','n','m','a','7','q','f','9','n','Q','2','V','L','6','e','T','R', - '2','4','9','d','6','Q','B','Y','q','2','4','9','G','Q','E','b','Y','5','u','2','T','Q','G','L','5','n','4','Y','2','y','G','F', - 'j','c','8','M','G','L','e','3','a','N','v','A','A','W','t','R','S','2','i','D','R','8','j','d','Q','3','6','C','V','M','e','w', - 'j','U','Z','w','M','4','b','m','8','J','P','Q','L','P','R','c','r','b','V','C','3','N','8','K','4','d','W','D','N','U','A','A', - '2','J','p','b','D','d','p','j','N','C','k','A','j','B','a','c','u','v','L','X','U','B','4','U','X','W','e','C','b','C','u','d', - 'A','v','U','z','P','t','D','e','5','y','Y','c','x','K','4','7','j','e','e','D','M','5','K','B','Q','6','d','p','T','T','R','j', - 'M','E','E','M','r','N','6','8','7','q','x','F','S','x','E','U','4','d','B','6','5','W','C','e','m','J','e','5','j','w','V','J', - 'w','v','d','7','v','f','K','u','m','8','h','W','T','e','Q','j','M','8','R','Y','d','B','R','2','r','F','j','7','d','E','q','V', - 'k','e','j','P','9','3','X','R','p','R','b','A','v','7','4','A','M','2','k','r','E','7','X','3','7','k','5','c','B','7','W','5', - 'u','J','B','Q','R','2','V','7','h','Q','h','9','g','G','y','c','c','x','M','z','7','G','2','J','w','v','j','5','9','E','b','k', - 'z','W','T','C','b','4','K','R','X','T','k','V','S','G','2','j','d','6','y','E','4','P','H','K','w','a','m','F','Z','x','9','j', - 'i','2','d','X','u','a','4','a','M','z','8','p','p','z','g','t','H','5','Y','L','Q','c','R','F','m','E','n','G','X','d','f','7', - 'x','8','j','g','J','z','D','S','a','S','h','y','5','h','Y','N','p','w','Y','W','h','E','N','v','8','Q','D','W','Z','k','f','e', - 'r','Z','D','7','R','D','T','2','H','X','z','G','X','f','v','E','z','P','v','U','H','e','4','R','W','U','x','t','t','4','w','p', - 'r','z','K','9','f','g','h','P','r','f','v','k','h','c','e','5','8','a','L','F','J','M','G','R','a','N','q','S','g','W','e','7', - 'R','K','R','A','B','z','6','v','S','p','w','n','e','x','k','E','r','j','f','Y','x','8','9','z','e','T','6','E','G','v','9','f', - 'D','A','N','v','y','U','7','D','M','2','E','5','W','G','6','b','9','q','g','Y','F','f','k','q','Q','E','x','Y','C','R','G','6', - 'R','h','4','J','d','U','D','b','9','b','8','r','f','V','d','g','b','2','z','Z','d','m','X','v','j','Y','d','w','K','8','G','r', - 'v','j','N','y','c','h','u','5','z','g','J','H','a','Z','b','z','G','C','r','P','f','y','P','6','F','P','h','7','9','w','7','y', - 'R','3','n','E','h','G','D','4','m','Y','E','q','k','a','f','a','R','B','q','t','W','E','T','p','H','7','k','X','2','d','X','6', - 'W','n','H','m','w','M','i','Y','M','E','F','5','R','p','p','y','c','b','q','R','9','Y','t','T','7','w','u','K','M','Q','z','n', - 'P','7','g','x','6','R','4','x','N','v','w','M','6','j','K','v','7','a','Y','4','a','M','6','n','z','3','E','2','V','N','4','i', - 'E','f','u','W','J','W','e','8','3','Q','e','a','F','P','c','3','P','k','i','z','d','q','m','q','M','a','d','8','D','3','F','M', - 'e','d','E','j','z','V','e','d','z','H','D','J','8','X','g','E','i','u','c','7','A','w','S','J','2','A','e','8','r','q','C','m', - '9','9','a','g','2','y','y','P','M','e','8','3','T','r','m','8','j','v','r','p','M','Z','Y','g','a','9','2','d','H','B','m','9', - '4','6','a','Z','V','u','S','H','g','3','X','h','i','N','3','B','S','E','k','9','k','2','9','R','A','i','3','L','X','M','B','S', - '4','S','F','F','F','w','u','d','M','T','9','K','B','7','R','U','R','8','D','8','T','5','U','t','E','R','x','n','x','h','v','k', - 'B','N','k','E','U','T','t','p','r','u','Z','h','t','E','4','i','P','z','f','z','q','M','p','f','A','K','2','D','t','j','f','c', - 'Y','E','N','M','x','k','g','7','T','U','2','c','d','V','g','2','z','L','i','j','Y','q','b','T','A','y','v','a','t','N','5','t', - 'Z','5','n','D','a','y','G','n','P','x','V','k','M','8','t','J','Z','G','g','5','9','R','h','P','P','J','N','X','p','G','J','p', - '2','y','A','v','d','G','U','z','3','V','M','y','q','U','N','M','Y','p','B','Z','U','h','j','q','z','q','x','w','7','d','J','Q', - 'u','F','q','3','m','9','c','Q','W','d','6','7','b','V','M','7','P','j','r','k','9','h','R','z','m','b','i','B','u','E','L','9', - 'k','v','h','h','W','2','K','e','M','U','Q','p','A','Q','Y','J','G','E','T','U','L','f','q','G','4','z','K','K','y','a','U','W', - 'K','D','P','c','N','D','V','S','Y','6','T','p','R','y','y','J','a','T','J','W','Q','9','p','F','P','X','y','k','9','z','z','4', - 'G','d','a','z','X','n','h','4','J','P','W','V','D','r','U','m','a','8','a','b','X','F','J','X','L','4','S','X','5','W','p','W', - 'h','y','x','B','f','d','C','X','w','7','r','g','V','T','H','a','i','4','N','v','c','w','n','2','3','A','i','A','J','9','N','c', - 'z','7','n','n','3','n','h','n','i','R','i','b','E','h','k','U','c','c','U','6','f','x','q','N','y','H','M','e','J','B','U','B', - 'r','g','a','8','V','a','G','V','y','u','c','c','v','C','H','W','y','g','z','Q','2','4','k','S','m','f','e','G','H','v','Q','3', - 'P','e','f','S','V','P','c','U','e','3','P','x','d','c','7','c','f','g','D','w','2','t','q','y','g','2','Q','V','4','K','a','Q', - 'g','B','b','L','x','9','m','a','K','4','i','x','g','Q','M','9','W','N','2','w','p','v','2','k','B','y','9','k','A','c','f','Z', - 'D','R','A','S','d','v','w','f','f','q','t','K','3','j','x','D','G','P','n','u','r','v','U','k','A','2','d','R','N','T','G','4', - 'B','g','k','t','h','7','J','k','F','A','C','g','W','g','J','F','z','S','Q','c','v','M','b','D','e','H','Q','S','j','v','G','E', - 'R','k','f','i','P','E','F','N','6','y','p','b','t','M','c','Q','B','7','g','w','J','7','3','d','V','E','m','z','6','6','P','P', - 'd','i','r','J','H','D','H','J','r','b','n','v','z','W','e','u','g','B','u','Z','2','m','D','5','h','F','X','B','2','r','6','w', - 'u','Y','4','N','X','K','a','v','V','3','j','B','r','r','C','c','w','R','g','S','8','V','b','F','2','N','M','c','K','8','Y','E', - 'E','N','K','X','K','V','B','x','n','Q','p','a','q','f','k','t','z','Y','E','P','Z','y','n','a','c','B','V','a','x','b','d','X', - 'r','d','8','P','H','F','v','r','V','5','g','J','w','6','i','h','d','d','p','J','c','c','Y','S','q','W','m','U','5','G','b','H', - 'N','z','E','Z','K','E','y','M','c','G','i','d','w','Z','D','N','N','w','S','t','g','y','a','Y','b','H','e','M','N','f','Y','Y', - '7','a','9','b','M','U','k','a','V','k','C','n','a','k','U','H','A','M','i','v','k','t','a','d','i','3','F','d','5','2','A','p', - 'U','c','J','U','R','h','G','d','A','Y','v','q','X','c','w','r','x','4','j','3','4','b','F','d','a','L','N','J','3','Z','g','6', - 'W','Q','R','u','P','t','M','A','3','F','6','y','K','Y','G','2','t','v','u','p','w','b','G','S','K','5','p','4','d','E','w','6', - 'g','t','V','4','b','2','n','b','Z','3','3','f','m','d','2','c','a','m','j','X','U','E','D','6','6','F','w','H','9','7','Z','Y', - 'd','X','C','K','i','g','p','F','Y','n','2','b','F','4','R','u','V','k','f','d','J','i','a','b','X','H','7','v','K','a','Q','i', - 'W','M','j','M','i','a','i','n','F','h','r','q','4','w','x','m','4','q','y','F','8','w','i','4','D','B','A','L','B','U','u','K', - 'v','K','n','a','Q','i','e','k','v','Q','U','5','w','Q','c','r','A','6','M','w','y','g','n','e','v','K','7','W','u','2','y','f', - 'Q','u','e','r','y','a','w','V','p','f','Q','z','C','u','i','i','9','S','P','q','L','r','C','H','S','3','E','p','8','S','m','Q', - 'S','K','r','V','b','J','R','m','w','c','n','Q','N','Q','4','M','u','f','X','S','f','U','Z','x','U','4','j','K','4','G','z','X', - '7','Q','j','R','h','i','G','m','q','c','V','T','x','U','a','E','b','Q','q','E','i','F','K','7','K','i','R','J','5','Y','F','V', - 'B','7','R','8','M','i','f','j','Z','w','j','b','B','u','p','N','Y','r','S','r','f','h','E','J','T','B','P','R','D','V','K','A', - 'Z','A','R','j','z','f','B','i','Y','L','F','G','V','Y','w','R','C','P','G','m','9','7','C','5','e','y','w','N','K','N','a','Q', - 'j','a','W','3','2','f','G','w','n','M','6','F','u','K','8','g','8','M','G','r','e','9','Z','z','y','2','G','U','k','G','6','m', - 'A','D','4','n','b','8','a','q','S','m','S','6','5','R','5','D','5','S','B','g','X','T','8','Q','V','d','A','n','g','y','8','a', - 'h','7','K','9','H','D','J','F','w','G','4','w','T','J','F','f','i','8','X','e','B','J','K','H','7','V','y','X','7','E','8','S', - 'A','d','b','w','S','8','Y','a','J','d','j','E','V','J','T','E','U','R','5','7','V','M','E','v','D','3','z','5','r','k','z','v', - 'e','m','A','7','P','8','j','X','E','f','Q','q','8','D','g','y','8','j','A','e','B','c','c','M','z','k','2','c','q','v','v','y', - 'Q','y','h','g','p','v','M','m','m','C','G','D','k','8','u','T','n','Q','H','G','H','f','b','J','j','5','X','c','i','7','7','q', - 'b','R','8','b','b','z','f','f','h','Y','Q','7','u','B','X','e','i','j','M','q','C','T','M','v','t','J','J','w','b','F','v','J', - 'm','e','2','u','e','8','L','V','G','q','A','j','m','7','m','g','m','5','i','r','p','p','U','y','F','6','f','b','u','6','q','L', - 'M','E','t','V','W','C','t','e','p','w','a','n','w','y','X','h','8','e','G','C','H','q','r','X','G','9','c','h','7','k','8','M', - 'G','b','a','m','Y','Q','w','8','J','z','a','F','r','4','W','M','j','P','q','a','z','U','y','u','3','b','Z','f','Y','5','7','g', - 'N','M','h','M','a','3','C','K','6','6','f','a','p','i','f','q','k','T','i','z','w','f','Z','c','H','L','X','g','6','m','g','r', - 'w','Y','u','K','8','L','p','8','P','R','A','R','A','b','Z','V','a','x','V','c','G','A','H','t','Y','6','P','T','L','W','N','z', - 'g','z','k','d','E','v','C','t','Z','M','Z','K','4','w','9','5','D','W','f','U','8','5','u','6','b','5','B','8','g','y','C','E', - 'Q','z','e','9','p','N','S','P','D','D','f','x','k','Z','4','R','v','X','V','k','p','b','n','t','c','F','R','e','x','9','C','D', - 'J','2','6','f','Z','D','w','J','R','j','j','9','b','w','N','N','p','R','f','Z','z','j','F','r','Q','e','F','x','f','t','V','V', - 'A','y','J','G','W','Z','H','r','D','5','M','u','H','V','L','N','U','V','X','z','j','9','r','v','e','d','R','c','u','V','x','r', - 'c','6','k','L','h','q','w','U','W','Q','g','G','F','C','t','E','a','D','h','x','9','5','P','R','Z','E','M','5','f','4','2','t', - 'A','6','f','r','X','G','X','Y','B','8','G','E','n','B','v','x','f','M','R','f','B','z','Y','3','2','q','z','G','t','P','C','6', - '6','r','z','J','r','c','n','d','6','h','e','w','D','D','h','V','L','u','i','b','5','K','d','S','y','9','N','p','E','r','D','k', - 'B','z','u','v','d','Q','p','K','5','m','J','r','b','Y','Z','7','p','M','J','F','E','q','x','f','E','K','U','U','4','f','a','6', - 'g','5','a','q','D','U','8','F','y','R','a','P','5','5','x','z','6','V','T','P','D','m','y','7','U','5','C','A','7','Q','h','w', - 'r','6','x','g','Q','i','b','K','F','p','B','X','Q','h','i','E','r','C','z','v','x','W','Q','6','p','6','b','M','K','V','x','u', - 'k','d','R','S','k','Q','p','n','h','d','Q','Y','x','n','x','5','K','t','5','w','A','5','p','k','F','z','W','p','j','U','y','V', - 'x','G','m','y','L','A','X','H','G','A','a','J','5','E','P','q','E','U','7','p','6','A','9','n','d','G','D','g','i','h','t','W', - 'b','c','E','2','P','d','y','J','M','u','4','g','P','S','X','J','v','w','3','v','D','q','U','i','U','T','q','E','Y','5','2','t', - 'b','j','P','2','j','D','9','y','i','B','5','Y','3','X','L','w','m','V','X','z','X','r','Z','d','H','L','A','H','k','R','X','5', - 'i','L','m','q','3','p','a','G','P','j','g','h','R','P','Y','U','z','M','5','R','M','A','E','Q','V','c','w','r','4','M','S','k', - 'N','D','i','R','R','x','t','q','T','i','u','N','K','R','x','Z','K','a','g','G','y','9','c','j','J','S','9','3','H','T','f','F', - 'q','6','D','W','F','K','h','e','p','p','b','q','N','k','A','C','m','y','u','B','J','v','q','D','e','j','e','b','2','w','R','t', - 'J','N','j','F','T','A','8','L','m','X','i','T','g','j','c','V','4','V','h','2','h','R','p','2','9','k','c','c','G','D','h','z', - 't','i','h','t','W','R','n','Y','i','8','u','6','G','9','T','P','9','9','J','P','Y','R','h','X','K','z','h','L','W','r','C','U', - '2','L','T','k','2','m','6','W','L','P','T','Z','z','t','i','H','5','G','w','t','E','v','z','k','b','H','b','b','W','W','u','b', - 'i','h','C','Q','n','H','N','u','5','u','K','X','r','M','W','U','3','Y','k','P','2','k','x','f','x','C','w','z','z','b','G','8', - 'y','W','e','j','v','2','v','r','t','q','z','p','Y','d','w','6','Z','D','J','L','9','F','z','G','U','4','a','8','H','6','U','a', - 'q','7','y','Q','J','v','m','D','P','S','j','q','v','t','n','t','g','j','3','t','8','f','K','K','7','b','W','d','F','i','N','K', - 'a','R','V','V','V','v','m','A','Q','2','y','j','c','t','f','k','j','7','X','y','j','b','U','F','w','W','3','9','6','A','S','J', - 'p','q','2','Z','7','L','p','b','7','b','5','i','p','r','r','h','P','M','h','j','c','y','e','u','h','B','d','9','9','u','f','d', - 'g','u','p','w','u','9','S','c','L','U','g','A','y','V','F','V','6','D','D','X','i','V','m','u','Y','P','J','v','L','T','A','F', - 'M','Q','H','Z','6','v','8','p','A','L','P','z','C','V','a','C','h','X','j','W','8','G','z','j','d','M','4','u','x','w','H','g', - 'V','q','K','z','b','g','2','3','D','N','y','G','X','F','T','v','T','L','y','v','L','9','g','c','C','R','8','L','A','7','Y','N', - 't','n','R','6','b','n','m','9','i','h','t','T','F','a','V','N','J','J','3','J','q','p','W','7','b','T','G','r','M','k','a','7', - 'D','H','v','y','T','A','C','U','P','u','q','L','R','Y','4','q','h','y','f','F','J','x','K','7','N','B','v','3','a','Z','M','t', - 'U','x','8','9','V','E','t','j','K','r','u','Y','Y','A','u','w','Y','2','y','Q','z','S','n','J','B','2','t','X','x','K','z','g', - '6','d','n','i','7','Z','N','F','Q','6','w','N','r','b','k','d','W','X','S','t','c','U','m','6','4','2','e','w','6','x','Z','a', - 'Q','A','7','4','h','H','z','r','e','J','q','j','w','4','q','c','i','R','4','x','n','r','j','r','P','g','E','7','t','k','b','Z', - 'r','A','b','d','g','i','G','V','D','E','U','L','b','J','U','q','2','S','K','m','A','U','L','k','Q','4','N','p','k','G','C','6', - 'R','Z','B','y','B','B','j','y','x','L','d','h','L','G','6','x','H','z','T','5','d','Y','4','2','m','q','Q','y','H','6','c','N', - 'u','m','U','v','i','Y','Z','7','4','L','K','F','b','v','2','Y','h','x','8','a','R','w','q','x','E','a','T','y','m','C','2','Q', - 'U','T','D','Q','v','u','M','9','D','8','r','8','b','m','p','E','7','C','T','9','B','A','G','k','b','G','z','Z','G','L','N','k', - 'h','3','k','J','e','f','d','x','F','8','W','K','7','T','6','h','H','V','C','h','P','u','H','e','v','w','z','P','K','r','D','G', - 'X','Z','B','X','f','H','Q','4','e','D','y','W','Z','6','4','K','A','e','a','F','S','N','h','x','S','W','J','c','E','P','g','j', - 'a','w','T','m','Z','X','E','P','Y','R','M','2','R','2','X','N','F','X','Y','W','x','z','p','J','g','n','D','4','i','p','6','N', - 'r','9','G','k','E','h','T','h','U','h','x','B','Q','9','H','7','w','U','P','Q','d','G','6','q','p','j','j','v','C','a','X','J', - 'N','G','Y','w','f','H','C','x','F','k','z','3','9','r','h','8','7','5','V','i','V','C','R','q','x','N','2','2','i','W','F','U', - '7','T','H','f','z','E','a','n','u','Q','t','U','Y','G','t','3','A','m','r','6','d','f','e','n','e','z','F','u','U','N','8','m', - 'h','p','R','N','S','H','6','6','V','M','S','t','q','P','E','i','u','y','g','8','L','Q','Y','Y','G','e','W','W','C','G','y','b', - 'y','t','u','P','R','P','5','m','N','K','B','Z','w','f','t','k','x','3','L','b','q','d','w','S','G','E','h','R','F','4','q','e', - '5','6','F','2','n','q','T','R','y','f','n','Y','h','2','F','u','x','M','i','i','h','w','G','C','Z','v','i','C','a','X','U','C', - 'Y','8','d','h','R','x','V','n','v','G','i','D','a','U','p','U','a','e','b','F','w','P','d','X','n','K','h','9','H','r','b','g', - '2','f','m','X','k','m','q','6','n','5','b','G','H','d','R','9','D','U','c','r','Z','Y','W','S','Z','x','p','t','x','y','4','k', - 'j','F','U','t','C','i','e','i','b','p','e','4','C','z','h','3','3','5','Q','P','n','G','i','A','8','c','Q','z','B','a','V','4', - '2','B','2','z','u','u','3','i','L','w','y','g','K','H','k','y','2','B','b','e','5','e','4','e','U','4','z','n','P','z','a','c', - 'E','f','u','M','G','C','g','z','j','4','E','7','R','t','D','K','c','t','p','g','W','H','C','H','J','Q','J','c','F','5','4','W', - 'K','7','j','h','A','T','K','z','t','S','f','f','j','C','c','8','n','7','c','T','U','R','Q','E','7','A','W','Z','z','K','5','j', - '2','H','k','a','j','g','g','W','w','4','T','A','9','J','U','e','S','N','P','K','d','k','L','Q','G','Z','e','W','i','H','u','j', - 'C','z','4','E','2','v','5','L','u','9','Z','a','9','A','b','C','M','G','X','B','C','2','Y','Z','e','U','n','E','5','Y','n','y', - 'F','h','H','p','9','j','Y','F','V','w','Y','r','8','Q','f','C','J','4','T','t','z','Q','N','M','e','7','4','3','y','E','M','m', - 'b','S','c','h','w','a','X','E','d','E','z','t','h','9','k','p','A','k','K','H','x','q','K','Z','B','u','a','9','3','U','U','u', - '8','E','D','v','y','k','W','Y','X','k','r','R','D','X','n','Q','V','d','e','D','g','x','E','V','Y','w','k','m','K','r','H','D', - 't','2','6','N','U','g','3','t','B','9','t','u','M','D','z','Y','K','z','K','r','V','5','i','e','p','M','d','t','w','6','a','f', - 'f','W','k','L','i','g','M','V','M','Y','b','x','e','4','h','h','Y','g','w','Z','m','e','e','6','R','W','M','x','G','y','V','n', - '6','e','g','A','g','K','a','N','7','p','a','u','E','4','6','M','t','X','h','g','b','j','p','5','x','x','B','P','3','J','M','7', - 'j','Z','P','y','e','Q','Z','e','t','j','3','t','F','V','x','m','b','b','B','y','J','L','L','9','3','R','a','5','j','S','V','t', - 'e','2','6','m','H','w','r','w','r','6','Q','3','x','z','m','A','d','x','t','E','H','c','Z','x','c','P','j','r','u','U','W','k', - '6','g','X','g','n','f','n','7','H','M','B','t','v','6','v','x','g','M','f','e','2','w','m','y','d','H','S','q','c','K','U','H', - '2','X','h','d','p','Q','7','J','X','i','X','f','a','z','V','A','F','2','8','z','v','h','C','h','e','4','g','z','w','z','h','q', - 'p','6','B','n','m','8','h','W','U','7','z','h','T','6','J','f','4','Z','n','Q','W','z','2','N','4','t','g','7','u','4','X','2', - 'C','F','L','n','J','n','m','j','3','P','3','Y','e','J','R','A','H','e','R','D','z','7','u','X','Y','y','D','w','J','m','G','U', - 'P','H','5','S','d','a','F','F','Y','c','M','f','3','3','L','v','V','B','U','C','A','d','N','H','Q','h','7','8','4','r','p','G', - 'v','M','D','H','7','e','E','r','i','K','Q','i','B','D','M','Z','p','c','R','G','u','c','H','a','N','k','E','f','9','R','7','x', - '6','3','5','u','x','3','h','v','p','6','q','r','j','u','f','W','T','q','P','n','Y','L','B','6','U','w','P','2','T','W','R','g', - '2','3','3','e','N','V','a','j','b','e','4','T','u','J','u','u','F','B','D','G','H','x','x','k','5','G','e','3','4','B','m','L', - 'S','b','i','t','T','p','M','D','Z','A','A','i','r','J','p','4','H','U','A','G','y','d','Q','5','U','R','F','8','q','a','S','H', - 'n','5','z','9','g','3','u','R','H','m','G','m','b','p','c','L','Z','Y','u','m','i','K','A','Q','R','T','X','G','t','b','8','7', - '7','6','w','M','N','f','R','G','r','L','m','q','n','7','5','k','X','8','g','u','K','7','Y','w','K','q','U','e','W','A','r','i', - 'Z','a','p','q','L','5','P','u','n','t','y','G','x','C','N','X','q','P','r','U','v','A','r','r','q','e','f','c','z','M','7','N', - '6','a','z','Z','a','t','f','p','4','v','J','Y','j','h','M','D','t','k','A','B','p','Q','A','y','x','X','7','p','S','8','m','M', - 'y','K','B','A','5','2','7','b','y','R','K','q','A','u','3','J'}; - -static const adler32_test tests[] = { - {__LINE__, 0x1, (const uint8_t *)0x0, 0, 0x1}, - {__LINE__, 0x1, (const uint8_t *)"", 1, 0x10001}, - {__LINE__, 0x1, (const uint8_t *)"a", 1, 0x620062}, - {__LINE__, 0x1, (const uint8_t *)"abacus", 6, 0x8400270}, - {__LINE__, 0x1, (const uint8_t *)"backlog", 7, 0xb1f02d4}, - {__LINE__, 0x1, (const uint8_t *)"campfire", 8, 0xea10348}, - {__LINE__, 0x1, (const uint8_t *)"delta", 5, 0x61a020b}, - {__LINE__, 0x1, (const uint8_t *)"executable", 10, 0x16fa0423}, - {__LINE__, 0x1, (const uint8_t *)"file", 4, 0x41401a1}, - {__LINE__, 0x1, (const uint8_t *)"greatest", 8, 0xefa0360}, - {__LINE__, 0x1, (const uint8_t *)"inverter", 8, 0xf6f0370}, - {__LINE__, 0x1, (const uint8_t *)"jigsaw", 6, 0x8bd0286}, - {__LINE__, 0x1, (const uint8_t *)"karate", 6, 0x8a50279}, - {__LINE__, 0x1, (const uint8_t *)"landscape", 9, 0x126a03ac}, - {__LINE__, 0x1, (const uint8_t *)"machine", 7, 0xb5302d6}, - {__LINE__, 0x1, (const uint8_t *)"nanometer", 9, 0x12d803ca}, - {__LINE__, 0x1, (const uint8_t *)"oblivion", 8, 0xf220363}, - {__LINE__, 0x1, (const uint8_t *)"panama", 6, 0x8a1026f}, - {__LINE__, 0x1, (const uint8_t *)"quest", 5, 0x6970233}, - {__LINE__, 0x1, (const uint8_t *)"resource", 8, 0xf8d0369}, - {__LINE__, 0x1, (const uint8_t *)"secret", 6, 0x8d10287}, - {__LINE__, 0x1, (const uint8_t *)"ultimate", 8, 0xf8d0366}, - {__LINE__, 0x1, (const uint8_t *)"vector", 6, 0x8fb0294}, - {__LINE__, 0x1, (const uint8_t *)"walrus", 6, 0x918029f}, - {__LINE__, 0x1, (const uint8_t *)"xeno", 4, 0x45e01bb}, - {__LINE__, 0x1, (const uint8_t *)"yelling", 7, 0xbfe02f5}, - {__LINE__, 0x1, (const uint8_t *)"zero", 4, 0x46e01c1}, - {__LINE__, 0x1, (const uint8_t *)"4BJD7PocN1VqX0jXVpWB", 20, 0x3eef064d}, - {__LINE__, 0x1, (const uint8_t *)"F1rPWI7XvDs6nAIRx41l", 20, 0x425d065f}, - {__LINE__, 0x1, (const uint8_t *)"ldhKlsVkPFOveXgkGtC2", 20, 0x4f1a073e}, - {__LINE__, 0x1, (const uint8_t *)"5KKnGOOrs8BvJ35iKTOS", 20, 0x42290650}, - {__LINE__, 0x1, (const uint8_t *)"0l1tw7GOcem06Ddu7yn4", 20, 0x43fd0690}, - {__LINE__, 0x1, (const uint8_t *)"MCr47CjPIn9R1IvE1Tm5", 20, 0x3f770609}, - {__LINE__, 0x1, (const uint8_t *)"UcixbzPKTIv0SvILHVdO", 20, 0x4c7c0703}, - {__LINE__, 0x1, (const uint8_t *)"dGnAyAhRQDsWw0ESou24", 20, 0x48ac06b7}, - {__LINE__, 0x1, (const uint8_t *)"di0nvmY9UYMYDh0r45XT", 20, 0x489a0698}, - {__LINE__, 0x1, (const uint8_t *)"2XKDwHfAhFsV0RhbqtvH", 20, 0x44a906e6}, - {__LINE__, 0x1, (const uint8_t *)"ZhrANFIiIvRnqClIVyeD", 20, 0x4a29071c}, - {__LINE__, 0x1, (const uint8_t *)"v7Q9ehzioTOVeDIZioT1", 20, 0x4a7706f9}, - {__LINE__, 0x1, (const uint8_t *)"Yod5hEeKcYqyhfXbhxj2", 20, 0x4ce60769}, - {__LINE__, 0x1, (const uint8_t *)"GehSWY2ay4uUKhehXYb0", 20, 0x48ae06e5}, - {__LINE__, 0x1, (const uint8_t *)"kwytJmq6UqpflV8Y8GoE", 20, 0x51d60750}, - {__LINE__, 0x1, (const uint8_t *)"70684206568419061514", 20, 0x2b100414}, - {__LINE__, 0x1, (const uint8_t *)"42015093765128581010", 20, 0x2a550405}, - {__LINE__, 0x1, (const uint8_t *)"88214814356148806939", 20, 0x2b450423}, - {__LINE__, 0x1, (const uint8_t *)"43472694284527343838", 20, 0x2b460421}, - {__LINE__, 0x1, (const uint8_t *)"49769333513942933689", 20, 0x2bc1042b}, - {__LINE__, 0x1, (const uint8_t *)"54979784887993251199", 20, 0x2ccd043d}, - {__LINE__, 0x1, (const uint8_t *)"58360544869206793220", 20, 0x2b68041a}, - {__LINE__, 0x1, (const uint8_t *)"27347953487840714234", 20, 0x2b84041d}, - {__LINE__, 0x1, (const uint8_t *)"07650690295365319082", 20, 0x2afa0417}, - {__LINE__, 0x1, (const uint8_t *)"42655507906821911703", 20, 0x2aff0412}, - {__LINE__, 0x1, (const uint8_t *)"29977409200786225655", 20, 0x2b8d0420}, - {__LINE__, 0x1, (const uint8_t *)"85181542907229116674", 20, 0x2b140419}, - {__LINE__, 0x1, (const uint8_t *)"87963594337989416799", 20, 0x2c8e043f}, - {__LINE__, 0x1, (const uint8_t *)"21395988329504168551", 20, 0x2b68041f}, - {__LINE__, 0x1, (const uint8_t *)"51991013580943379423", 20, 0x2af10417}, - {__LINE__, 0x1, (const uint8_t *)"*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x7c9d0841}, - {__LINE__, 0x1, (const uint8_t *)"_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0x71060751}, - {__LINE__, 0x1, (const uint8_t *)"&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0x7095070a}, - {__LINE__, 0x1, (const uint8_t *)"]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0x82530815}, - {__LINE__, 0x1, (const uint8_t *)"-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0x61250661}, - {__LINE__, 0x1, (const uint8_t *)"+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x642006a3}, - {__LINE__, 0x1, (const uint8_t *)")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0x674206cb}, - {__LINE__, 0x1, (const uint8_t *)":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x67670680}, - {__LINE__, 0x1, (const uint8_t *)"{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0x7547070f}, - {__LINE__, 0x1, (const uint8_t *)"_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0x69ea06ee}, - {__LINE__, 0x1, (const uint8_t *)"e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0x1b01e92}, - {__LINE__, 0x1, (const uint8_t *)"r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 100, 0xfbdb1e96}, - {__LINE__, 0x1, (const uint8_t *)"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0x47a61ec8}, - {__LINE__, 0x1, (const uint8_t *)long_string, 5552, 0x8b81718f}, - {__LINE__, 0x7a30360d, (const uint8_t *)0x0, 0, 0x1}, - {__LINE__, 0x6fd767ee, (const uint8_t *)"", 1, 0xd7c567ee}, - {__LINE__, 0xefeb7589, (const uint8_t *)"a", 1, 0x65e475ea}, - {__LINE__, 0x61cf7e6b, (const uint8_t *)"abacus", 6, 0x60b880da}, - {__LINE__, 0xdc712e2, (const uint8_t *)"backlog", 7, 0x9d0d15b5}, - {__LINE__, 0xad23c7fd, (const uint8_t *)"campfire", 8, 0xfbfecb44}, - {__LINE__, 0x85cb2317, (const uint8_t *)"delta", 5, 0x3b622521}, - {__LINE__, 0x9eed31b0, (const uint8_t *)"executable", 10, 0xa6db35d2}, - {__LINE__, 0xb94f34ca, (const uint8_t *)"file", 4, 0x9096366a}, - {__LINE__, 0xab058a2, (const uint8_t *)"greatest", 8, 0xded05c01}, - {__LINE__, 0x5bff2b7a, (const uint8_t *)"inverter", 8, 0xc7452ee9}, - {__LINE__, 0x605c9a5f, (const uint8_t *)"jigsaw", 6, 0x7899ce4}, - {__LINE__, 0x51bdeea5, (const uint8_t *)"karate", 6, 0xf285f11d}, - {__LINE__, 0x85c21c79, (const uint8_t *)"landscape", 9, 0x98732024}, - {__LINE__, 0x97216f56, (const uint8_t *)"machine", 7, 0xadf4722b}, - {__LINE__, 0x18444af2, (const uint8_t *)"nanometer", 9, 0xcdb34ebb}, - {__LINE__, 0xbe6ce359, (const uint8_t *)"oblivion", 8, 0xe8b7e6bb}, - {__LINE__, 0x843071f1, (const uint8_t *)"panama", 6, 0x389e745f}, - {__LINE__, 0xf2480c60, (const uint8_t *)"quest", 5, 0x36c90e92}, - {__LINE__, 0x2d2feb3d, (const uint8_t *)"resource", 8, 0x9705eea5}, - {__LINE__, 0x7490310a, (const uint8_t *)"secret", 6, 0xa3a63390}, - {__LINE__, 0x97d247d4, (const uint8_t *)"ultimate", 8, 0xe6154b39}, - {__LINE__, 0x93cf7599, (const uint8_t *)"vector", 6, 0x5e87782c}, - {__LINE__, 0x73c84278, (const uint8_t *)"walrus", 6, 0xbc84516}, - {__LINE__, 0x228a87d1, (const uint8_t *)"xeno", 4, 0x4646898b}, - {__LINE__, 0xa7a048d0, (const uint8_t *)"yelling", 7, 0xb1654bc4}, - {__LINE__, 0x1f0ded40, (const uint8_t *)"zero", 4, 0xd8a4ef00}, - {__LINE__, 0xa804a62f, (const uint8_t *)"4BJD7PocN1VqX0jXVpWB", 20, 0xe34eac7b}, - {__LINE__, 0x508fae6a, (const uint8_t *)"F1rPWI7XvDs6nAIRx41l", 20, 0x33f2b4c8}, - {__LINE__, 0xe5adaf4f, (const uint8_t *)"ldhKlsVkPFOveXgkGtC2", 20, 0xe7b1b68c}, - {__LINE__, 0x67136a40, (const uint8_t *)"5KKnGOOrs8BvJ35iKTOS", 20, 0xf6a0708f}, - {__LINE__, 0xb00c4a10, (const uint8_t *)"0l1tw7GOcem06Ddu7yn4", 20, 0xbd8f509f}, - {__LINE__, 0x2e0c84b5, (const uint8_t *)"MCr47CjPIn9R1IvE1Tm5", 20, 0xcc298abd}, - {__LINE__, 0x81238d44, (const uint8_t *)"UcixbzPKTIv0SvILHVdO", 20, 0xd7809446}, - {__LINE__, 0xf853aa92, (const uint8_t *)"dGnAyAhRQDsWw0ESou24", 20, 0x9525b148}, - {__LINE__, 0x5a692325, (const uint8_t *)"di0nvmY9UYMYDh0r45XT", 20, 0x620029bc}, - {__LINE__, 0x3275b9f, (const uint8_t *)"2XKDwHfAhFsV0RhbqtvH", 20, 0x70916284}, - {__LINE__, 0x38371feb, (const uint8_t *)"ZhrANFIiIvRnqClIVyeD", 20, 0xd52706}, - {__LINE__, 0xafc8bf62, (const uint8_t *)"v7Q9ehzioTOVeDIZioT1", 20, 0xeeb4c65a}, - {__LINE__, 0x9b07db73, (const uint8_t *)"Yod5hEeKcYqyhfXbhxj2", 20, 0xde3e2db}, - {__LINE__, 0xe75b214, (const uint8_t *)"GehSWY2ay4uUKhehXYb0", 20, 0x4171b8f8}, - {__LINE__, 0x72d0fe6f, (const uint8_t *)"kwytJmq6UqpflV8Y8GoE", 20, 0xa66a05cd}, - {__LINE__, 0xf857a4b1, (const uint8_t *)"70684206568419061514", 20, 0x1f9a8c4}, - {__LINE__, 0x54b8e14, (const uint8_t *)"42015093765128581010", 20, 0x49c19218}, - {__LINE__, 0xd6aa5616, (const uint8_t *)"88214814356148806939", 20, 0xbbfc5a38}, - {__LINE__, 0x11e63098, (const uint8_t *)"43472694284527343838", 20, 0x93434b8}, - {__LINE__, 0xbe92385, (const uint8_t *)"49769333513942933689", 20, 0xfe1827af}, - {__LINE__, 0x49511de0, (const uint8_t *)"54979784887993251199", 20, 0xcba8221c}, - {__LINE__, 0x3db13bc1, (const uint8_t *)"58360544869206793220", 20, 0x14643fda}, - {__LINE__, 0xbb899bea, (const uint8_t *)"27347953487840714234", 20, 0x1604a006}, - {__LINE__, 0xf6cd9436, (const uint8_t *)"07650690295365319082", 20, 0xb69f984c}, - {__LINE__, 0x9109e6c3, (const uint8_t *)"42655507906821911703", 20, 0xc43eead4}, - {__LINE__, 0x75770fc, (const uint8_t *)"29977409200786225655", 20, 0x707751b}, - {__LINE__, 0x69b1d19b, (const uint8_t *)"85181542907229116674", 20, 0xf5bdd5b3}, - {__LINE__, 0xc6132975, (const uint8_t *)"87963594337989416799", 20, 0x2fed2db3}, - {__LINE__, 0xd58cb00c, (const uint8_t *)"21395988329504168551", 20, 0xc2a2b42a}, - {__LINE__, 0xb63b8caa, (const uint8_t *)"51991013580943379423", 20, 0xdf0590c0}, - {__LINE__, 0x8a45a2b8, (const uint8_t *)"*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x1980aaf8}, - {__LINE__, 0xcbe95b78, (const uint8_t *)"_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0xf58662c8}, - {__LINE__, 0x4ef8a54b, (const uint8_t *)"&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0x1f65ac54}, - {__LINE__, 0x76ad267a, (const uint8_t *)"]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0x7b792e8e}, - {__LINE__, 0x569e613c, (const uint8_t *)"-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0x1d61679c}, - {__LINE__, 0x36aa61da, (const uint8_t *)"+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x12ec687c}, - {__LINE__, 0xf67222df, (const uint8_t *)")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0x740329a9}, - {__LINE__, 0x74b34fd3, (const uint8_t *)":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x374c5652}, - {__LINE__, 0x351fd770, (const uint8_t *)"{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0xeadfde7e}, - {__LINE__, 0xc45aef77, (const uint8_t *)"_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0x3fcbf664}, - {__LINE__, 0xd034ea71, (const uint8_t *)"e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0x6b080911}, - {__LINE__, 0xdeadc0de, (const uint8_t *)"r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 100, 0x355fdf73}, - {__LINE__, 0xba5eba11, (const uint8_t *)"h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0xb48bd8d8}, - {__LINE__, 0x7712aa45, (const uint8_t *)long_string, 5552, 0x7dc51be2}, -}; - -static const int test_size = sizeof(tests) / sizeof(tests[0]); - -int main(void) { - int i; - for (i = 0; i < test_size; i++) { - test_adler32(tests[i].adler, tests[i].buf, tests[i].len, tests[i].expect, tests[i].line); - } - - return 0; -} diff --git a/libs/zlibng/test/data/fireworks.jpg b/libs/zlibng/test/data/fireworks.jpg deleted file mode 100644 index 078cf1755dc0853e97ad30fc7af4d6af0b67047e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 123093 zcmb5Vc~leG7cE>FNq|5q%pjN)Ac9Q}7zT&=&+u3*1}BG?ll$*QASw_E1bKp-oIFWh zUO`c2azrI%lA_Xo@Bh2Wf0zGvm26ie$Pxbg#{ZlB+X;XK^l3~d1_c6W5QPCz|4IP8 z|G%p!oUFh9$4~&8fWhMBh&XxK`MqQSg~tA87&$Z+hXPbkXb`|)X*fK^TF%)!jGzL= z6VnQ7RBam7^jY_%Qw!>g@^o7t4VUnQbi2IcThZyghxBDbb(zt>m{|I(}=@g)3s zSjiax&ETj)(fGdr@3GCE6oM!8d~O0wPpcbta*tFz@bKg47M*`Qv#xA=lfMJOA}un_*6b#DSE6pDTK#IpC1SXC-9tU-aiu-rJN;uS zfi|}O+T&GWhc_ma{l1LfXCTMX)!!2z`=~p0IWJAk)^0z%^|p(I>b`@g*)%j0r>iO%u2ppRjM1fG*UE4<>GOIY~j<+Mh2Q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p%93)MtXrw;AqiYmg@-+y0 zh>`^zkIEt)UYE2&Any<|3>&;Gfhj*o3WsQf9GHkri*ks7rstRu0FPHY#8iL(+4)gF AYXATM diff --git a/libs/zlibng/test/data/lcet10.txt b/libs/zlibng/test/data/lcet10.txt deleted file mode 100644 index 26b187d04..000000000 --- a/libs/zlibng/test/data/lcet10.txt +++ /dev/null @@ -1,7519 +0,0 @@ - - -The Project Gutenberg Etext of LOC WORKSHOP ON ELECTRONIC TEXTS - - - - - WORKSHOP ON ELECTRONIC TEXTS - - PROCEEDINGS - - - - Edited by James Daly - - - - - - - - 9-10 June 1992 - - - Library of Congress - Washington, D.C. - - - - Supported by a Grant from the David and Lucile Packard Foundation - - - *** *** *** ****** *** *** *** - - - TABLE OF CONTENTS - - -Acknowledgements - -Introduction - -Proceedings - Welcome - Prosser Gifford and Carl Fleischhauer - - Session I. Content in a New Form: Who Will Use It and What Will They Do? - James Daly (Moderator) - Avra Michelson, Overview - Susan H. Veccia, User Evaluation - Joanne Freeman, Beyond the Scholar - Discussion - - Session II. Show and Tell - Jacqueline Hess (Moderator) - Elli Mylonas, Perseus Project - Discussion - Eric M. Calaluca, Patrologia Latina Database - Carl Fleischhauer and Ricky Erway, American Memory - Discussion - Dorothy Twohig, The Papers of George Washington - Discussion - Maria L. Lebron, The Online Journal of Current Clinical Trials - Discussion - Lynne K. Personius, Cornell mathematics books - Discussion - - Session III. Distribution, Networks, and Networking: - Options for Dissemination - Robert G. Zich (Moderator) - Clifford A. Lynch - Discussion - Howard Besser - Discussion - Ronald L. Larsen - Edwin B. Brownrigg - Discussion - - Session IV. Image Capture, Text Capture, Overview of Text and - Image Storage Formats - William L. Hooton (Moderator) - A) Principal Methods for Image Capture of Text: - direct scanning, use of microform - Anne R. Kenney - Pamela Q.J. Andre - Judith A. Zidar - Donald J. Waters - Discussion - B) Special Problems: bound volumes, conservation, - reproducing printed halftones - George Thoma - Carl Fleischhauer - Discussion - C) Image Standards and Implications for Preservation - Jean Baronas - Patricia Battin - Discussion - D) Text Conversion: OCR vs. rekeying, standards of accuracy - and use of imperfect texts, service bureaus - Michael Lesk - Ricky Erway - Judith A. Zidar - Discussion - - Session V. Approaches to Preparing Electronic Texts - Susan Hockey (Moderator) - Stuart Weibel - Discussion - C.M. Sperberg-McQueen - Discussion - Eric M. Calaluca - Discussion - - Session VI. Copyright Issues - Marybeth Peters - - Session VII. Conclusion - Prosser Gifford (Moderator) - General discussion - -Appendix I: Program - -Appendix II: Abstracts - -Appendix III: Directory of Participants - - - *** *** *** ****** *** *** *** - - - Acknowledgements - -I would like to thank Carl Fleischhauer and Prosser Gifford for the -opportunity to learn about areas of human activity unknown to me a scant -ten months ago, and the David and Lucile Packard Foundation for -supporting that opportunity. The help given by others is acknowledged on -a separate page. - - 19 October 1992 - - - *** *** *** ****** *** *** *** - - - INTRODUCTION - -The Workshop on Electronic Texts (1) drew together representatives of -various projects and interest groups to compare ideas, beliefs, -experiences, and, in particular, methods of placing and presenting -historical textual materials in computerized form. Most attendees gained -much in insight and outlook from the event. But the assembly did not -form a new nation, or, to put it another way, the diversity of projects -and interests was too great to draw the representatives into a cohesive, -action-oriented body.(2) - -Everyone attending the Workshop shared an interest in preserving and -providing access to historical texts. But within this broad field the -attendees represented a variety of formal, informal, figurative, and -literal groups, with many individuals belonging to more than one. These -groups may be defined roughly according to the following topics or -activities: - -* Imaging -* Searchable coded texts -* National and international computer networks -* CD-ROM production and dissemination -* Methods and technology for converting older paper materials into -electronic form -* Study of the use of digital materials by scholars and others - -This summary is arranged thematically and does not follow the actual -sequence of presentations. - -NOTES: - (1) In this document, the phrase electronic text is used to mean - any computerized reproduction or version of a document, book, - article, or manuscript (including images), and not merely a machine- - readable or machine-searchable text. - - (2) The Workshop was held at the Library of Congress on 9-10 June - 1992, with funding from the David and Lucile Packard Foundation. - The document that follows represents a summary of the presentations - made at the Workshop and was compiled by James DALY. This - introduction was written by DALY and Carl FLEISCHHAUER. - - -PRESERVATION AND IMAGING - -Preservation, as that term is used by archivists,(3) was most explicitly -discussed in the context of imaging. Anne KENNEY and Lynne PERSONIUS -explained how the concept of a faithful copy and the user-friendliness of -the traditional book have guided their project at Cornell University.(4) -Although interested in computerized dissemination, participants in the -Cornell project are creating digital image sets of older books in the -public domain as a source for a fresh paper facsimile or, in a future -phase, microfilm. The books returned to the library shelves are -high-quality and useful replacements on acid-free paper that should last -a long time. To date, the Cornell project has placed little or no -emphasis on creating searchable texts; one would not be surprised to find -that the project participants view such texts as new editions, and thus -not as faithful reproductions. - -In her talk on preservation, Patricia BATTIN struck an ecumenical and -flexible note as she endorsed the creation and dissemination of a variety -of types of digital copies. Do not be too narrow in defining what counts -as a preservation element, BATTIN counseled; for the present, at least, -digital copies made with preservation in mind cannot be as narrowly -standardized as, say, microfilm copies with the same objective. Setting -standards precipitously can inhibit creativity, but delay can result in -chaos, she advised. - -In part, BATTIN's position reflected the unsettled nature of image-format -standards, and attendees could hear echoes of this unsettledness in the -comments of various speakers. For example, Jean BARONAS reviewed the -status of several formal standards moving through committees of experts; -and Clifford LYNCH encouraged the use of a new guideline for transmitting -document images on Internet. Testimony from participants in the National -Agricultural Library's (NAL) Text Digitization Program and LC's American -Memory project highlighted some of the challenges to the actual creation -or interchange of images, including difficulties in converting -preservation microfilm to digital form. Donald WATERS reported on the -progress of a master plan for a project at Yale University to convert -books on microfilm to digital image sets, Project Open Book (POB). - -The Workshop offered rather less of an imaging practicum than planned, -but "how-to" hints emerge at various points, for example, throughout -KENNEY's presentation and in the discussion of arcana such as -thresholding and dithering offered by George THOMA and FLEISCHHAUER. - -NOTES: - (3) Although there is a sense in which any reproductions of - historical materials preserve the human record, specialists in the - field have developed particular guidelines for the creation of - acceptable preservation copies. - - (4) Titles and affiliations of presenters are given at the - beginning of their respective talks and in the Directory of - Participants (Appendix III). - - -THE MACHINE-READABLE TEXT: MARKUP AND USE - -The sections of the Workshop that dealt with machine-readable text tended -to be more concerned with access and use than with preservation, at least -in the narrow technical sense. Michael SPERBERG-McQUEEN made a forceful -presentation on the Text Encoding Initiative's (TEI) implementation of -the Standard Generalized Markup Language (SGML). His ideas were echoed -by Susan HOCKEY, Elli MYLONAS, and Stuart WEIBEL. While the -presentations made by the TEI advocates contained no practicum, their -discussion focused on the value of the finished product, what the -European Community calls reusability, but what may also be termed -durability. They argued that marking up--that is, coding--a text in a -well-conceived way will permit it to be moved from one computer -environment to another, as well as to be used by various users. Two -kinds of markup were distinguished: 1) procedural markup, which -describes the features of a text (e.g., dots on a page), and 2) -descriptive markup, which describes the structure or elements of a -document (e.g., chapters, paragraphs, and front matter). - -The TEI proponents emphasized the importance of texts to scholarship. -They explained how heavily coded (and thus analyzed and annotated) texts -can underlie research, play a role in scholarly communication, and -facilitate classroom teaching. SPERBERG-McQUEEN reminded listeners that -a written or printed item (e.g., a particular edition of a book) is -merely a representation of the abstraction we call a text. To concern -ourselves with faithfully reproducing a printed instance of the text, -SPERBERG-McQUEEN argued, is to concern ourselves with the representation -of a representation ("images as simulacra for the text"). The TEI proponents' -interest in images tends to focus on corollary materials for use in teaching, -for example, photographs of the Acropolis to accompany a Greek text. - -By the end of the Workshop, SPERBERG-McQUEEN confessed to having been -converted to a limited extent to the view that electronic images -constitute a promising alternative to microfilming; indeed, an -alternative probably superior to microfilming. But he was not convinced -that electronic images constitute a serious attempt to represent text in -electronic form. HOCKEY and MYLONAS also conceded that their experience -at the Pierce Symposium the previous week at Georgetown University and -the present conference at the Library of Congress had compelled them to -reevaluate their perspective on the usefulness of text as images. -Attendees could see that the text and image advocates were in -constructive tension, so to say. - -Three nonTEI presentations described approaches to preparing -machine-readable text that are less rigorous and thus less expensive. In -the case of the Papers of George Washington, Dorothy TWOHIG explained -that the digital version will provide a not-quite-perfect rendering of -the transcribed text--some 135,000 documents, available for research -during the decades while the perfect or print version is completed. -Members of the American Memory team and the staff of NAL's Text -Digitization Program (see below) also outlined a middle ground concerning -searchable texts. In the case of American Memory, contractors produce -texts with about 99-percent accuracy that serve as "browse" or -"reference" versions of written or printed originals. End users who need -faithful copies or perfect renditions must refer to accompanying sets of -digital facsimile images or consult copies of the originals in a nearby -library or archive. American Memory staff argued that the high cost of -producing 100-percent accurate copies would prevent LC from offering -access to large parts of its collections. - - -THE MACHINE-READABLE TEXT: METHODS OF CONVERSION - -Although the Workshop did not include a systematic examination of the -methods for converting texts from paper (or from facsimile images) into -machine-readable form, nevertheless, various speakers touched upon this -matter. For example, WEIBEL reported that OCLC has experimented with a -merging of multiple optical character recognition systems that will -reduce errors from an unacceptable rate of 5 characters out of every -l,000 to an unacceptable rate of 2 characters out of every l,000. - -Pamela ANDRE presented an overview of NAL's Text Digitization Program and -Judith ZIDAR discussed the technical details. ZIDAR explained how NAL -purchased hardware and software capable of performing optical character -recognition (OCR) and text conversion and used its own staff to convert -texts. The process, ZIDAR said, required extensive editing and project -staff found themselves considering alternatives, including rekeying -and/or creating abstracts or summaries of texts. NAL reckoned costs at -$7 per page. By way of contrast, Ricky ERWAY explained that American -Memory had decided from the start to contract out conversion to external -service bureaus. The criteria used to select these contractors were cost -and quality of results, as opposed to methods of conversion. ERWAY noted -that historical documents or books often do not lend themselves to OCR. -Bound materials represent a special problem. In her experience, quality -control--inspecting incoming materials, counting errors in samples--posed -the most time-consuming aspect of contracting out conversion. ERWAY -reckoned American Memory's costs at $4 per page, but cautioned that fewer -cost-elements had been included than in NAL's figure. - - -OPTIONS FOR DISSEMINATION - -The topic of dissemination proper emerged at various points during the -Workshop. At the session devoted to national and international computer -networks, LYNCH, Howard BESSER, Ronald LARSEN, and Edwin BROWNRIGG -highlighted the virtues of Internet today and of the network that will -evolve from Internet. Listeners could discern in these narratives a -vision of an information democracy in which millions of citizens freely -find and use what they need. LYNCH noted that a lack of standards -inhibits disseminating multimedia on the network, a topic also discussed -by BESSER. LARSEN addressed the issues of network scalability and -modularity and commented upon the difficulty of anticipating the effects -of growth in orders of magnitude. BROWNRIGG talked about the ability of -packet radio to provide certain links in a network without the need for -wiring. However, the presenters also called attention to the -shortcomings and incongruities of present-day computer networks. For -example: 1) Network use is growing dramatically, but much network -traffic consists of personal communication (E-mail). 2) Large bodies of -information are available, but a user's ability to search across their -entirety is limited. 3) There are significant resources for science and -technology, but few network sources provide content in the humanities. -4) Machine-readable texts are commonplace, but the capability of the -system to deal with images (let alone other media formats) lags behind. -A glimpse of a multimedia future for networks, however, was provided by -Maria LEBRON in her overview of the Online Journal of Current Clinical -Trials (OJCCT), and the process of scholarly publishing on-line. - -The contrasting form of the CD-ROM disk was never systematically -analyzed, but attendees could glean an impression from several of the -show-and-tell presentations. The Perseus and American Memory examples -demonstrated recently published disks, while the descriptions of the -IBYCUS version of the Papers of George Washington and Chadwyck-Healey's -Patrologia Latina Database (PLD) told of disks to come. According to -Eric CALALUCA, PLD's principal focus has been on converting Jacques-Paul -Migne's definitive collection of Latin texts to machine-readable form. -Although everyone could share the network advocates' enthusiasm for an -on-line future, the possibility of rolling up one's sleeves for a session -with a CD-ROM containing both textual materials and a powerful retrieval -engine made the disk seem an appealing vessel indeed. The overall -discussion suggested that the transition from CD-ROM to on-line networked -access may prove far slower and more difficult than has been anticipated. - - -WHO ARE THE USERS AND WHAT DO THEY DO? - -Although concerned with the technicalities of production, the Workshop -never lost sight of the purposes and uses of electronic versions of -textual materials. As noted above, those interested in imaging discussed -the problematical matter of digital preservation, while the TEI proponents -described how machine-readable texts can be used in research. This latter -topic received thorough treatment in the paper read by Avra MICHELSON. -She placed the phenomenon of electronic texts within the context of -broader trends in information technology and scholarly communication. - -Among other things, MICHELSON described on-line conferences that -represent a vigorous and important intellectual forum for certain -disciplines. Internet now carries more than 700 conferences, with about -80 percent of these devoted to topics in the social sciences and the -humanities. Other scholars use on-line networks for "distance learning." -Meanwhile, there has been a tremendous growth in end-user computing; -professors today are less likely than their predecessors to ask the -campus computer center to process their data. Electronic texts are one -key to these sophisticated applications, MICHELSON reported, and more and -more scholars in the humanities now work in an on-line environment. -Toward the end of the Workshop, Michael LESK presented a corollary to -MICHELSON's talk, reporting the results of an experiment that compared -the work of one group of chemistry students using traditional printed -texts and two groups using electronic sources. The experiment -demonstrated that in the event one does not know what to read, one needs -the electronic systems; the electronic systems hold no advantage at the -moment if one knows what to read, but neither do they impose a penalty. - -DALY provided an anecdotal account of the revolutionizing impact of the -new technology on his previous methods of research in the field of classics. -His account, by extrapolation, served to illustrate in part the arguments -made by MICHELSON concerning the positive effects of the sudden and radical -transformation being wrought in the ways scholars work. - -Susan VECCIA and Joanne FREEMAN delineated the use of electronic -materials outside the university. The most interesting aspect of their -use, FREEMAN said, could be seen as a paradox: teachers in elementary -and secondary schools requested access to primary source materials but, -at the same time, found that "primariness" itself made these materials -difficult for their students to use. - - -OTHER TOPICS - -Marybeth PETERS reviewed copyright law in the United States and offered -advice during a lively discussion of this subject. But uncertainty -remains concerning the price of copyright in a digital medium, because a -solution remains to be worked out concerning management and synthesis of -copyrighted and out-of-copyright pieces of a database. - -As moderator of the final session of the Workshop, Prosser GIFFORD directed -discussion to future courses of action and the potential role of LC in -advancing them. Among the recommendations that emerged were the following: - - * Workshop participants should 1) begin to think about working - with image material, but structure and digitize it in such a - way that at a later stage it can be interpreted into text, and - 2) find a common way to build text and images together so that - they can be used jointly at some stage in the future, with - appropriate network support, because that is how users will want - to access these materials. The Library might encourage attempts - to bring together people who are working on texts and images. - - * A network version of American Memory should be developed or - consideration should be given to making the data in it - available to people interested in doing network multimedia. - Given the current dearth of digital data that is appealing and - unencumbered by extremely complex rights problems, developing a - network version of American Memory could do much to help make - network multimedia a reality. - - * Concerning the thorny issue of electronic deposit, LC should - initiate a catalytic process in terms of distributed - responsibility, that is, bring together the distributed - organizations and set up a study group to look at all the - issues related to electronic deposit and see where we as a - nation should move. For example, LC might attempt to persuade - one major library in each state to deal with its state - equivalent publisher, which might produce a cooperative project - that would be equitably distributed around the country, and one - in which LC would be dealing with a minimal number of publishers - and minimal copyright problems. LC must also deal with the - concept of on-line publishing, determining, among other things, - how serials such as OJCCT might be deposited for copyright. - - * Since a number of projects are planning to carry out - preservation by creating digital images that will end up in - on-line or near-line storage at some institution, LC might play - a helpful role, at least in the near term, by accelerating how - to catalog that information into the Research Library Information - Network (RLIN) and then into OCLC, so that it would be accessible. - This would reduce the possibility of multiple institutions digitizing - the same work. - - -CONCLUSION - -The Workshop was valuable because it brought together partisans from -various groups and provided an occasion to compare goals and methods. -The more committed partisans frequently communicate with others in their -groups, but less often across group boundaries. The Workshop was also -valuable to attendees--including those involved with American Memory--who -came less committed to particular approaches or concepts. These -attendees learned a great deal, and plan to select and employ elements of -imaging, text-coding, and networked distribution that suit their -respective projects and purposes. - -Still, reality rears its ugly head: no breakthrough has been achieved. -On the imaging side, one confronts a proliferation of competing -data-interchange standards and a lack of consensus on the role of digital -facsimiles in preservation. In the realm of machine-readable texts, one -encounters a reasonably mature standard but methodological difficulties -and high costs. These latter problems, of course, represent a special -impediment to the desire, as it is sometimes expressed in the popular -press, "to put the [contents of the] Library of Congress on line." In -the words of one participant, there was "no solution to the economic -problems--the projects that are out there are surviving, but it is going -to be a lot of work to transform the information industry, and so far the -investment to do that is not forthcoming" (LESK, per litteras). - - - *** *** *** ****** *** *** *** - - - PROCEEDINGS - - -WELCOME - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -GIFFORD * Origin of Workshop in current Librarian's desire to make LC's -collections more widely available * Desiderata arising from the prospect -of greater interconnectedness * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -After welcoming participants on behalf of the Library of Congress, -American Memory (AM), and the National Demonstration Lab, Prosser -GIFFORD, director for scholarly programs, Library of Congress, located -the origin of the Workshop on Electronic Texts in a conversation he had -had considerably more than a year ago with Carl FLEISCHHAUER concerning -some of the issues faced by AM. On the assumption that numerous other -people were asking the same questions, the decision was made to bring -together as many of these people as possible to ask the same questions -together. In a deeper sense, GIFFORD said, the origin of the Workshop -lay in the desire of the current Librarian of Congress, James H. -Billington, to make the collections of the Library, especially those -offering unique or unusual testimony on aspects of the American -experience, available to a much wider circle of users than those few -people who can come to Washington to use them. This meant that the -emphasis of AM, from the outset, has been on archival collections of the -basic material, and on making these collections themselves available, -rather than selected or heavily edited products. - -From AM's emphasis followed the questions with which the Workshop began: -who will use these materials, and in what form will they wish to use -them. But an even larger issue deserving mention, in GIFFORD's view, was -the phenomenal growth in Internet connectivity. He expressed the hope -that the prospect of greater interconnectedness than ever before would -lead to: 1) much more cooperative and mutually supportive endeavors; 2) -development of systems of shared and distributed responsibilities to -avoid duplication and to ensure accuracy and preservation of unique -materials; and 3) agreement on the necessary standards and development of -the appropriate directories and indices to make navigation -straightforward among the varied resources that are, and increasingly -will be, available. In this connection, GIFFORD requested that -participants reflect from the outset upon the sorts of outcomes they -thought the Workshop might have. Did those present constitute a group -with sufficient common interests to propose a next step or next steps, -and if so, what might those be? They would return to these questions the -following afternoon. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -FLEISCHHAUER * Core of Workshop concerns preparation and production of -materials * Special challenge in conversion of textual materials * -Quality versus quantity * Do the several groups represented share common -interests? * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Carl FLEISCHHAUER, coordinator, American Memory, Library of Congress, -emphasized that he would attempt to represent the people who perform some -of the work of converting or preparing materials and that the core of -the Workshop had to do with preparation and production. FLEISCHHAUER -then drew a distinction between the long term, when many things would be -available and connected in the ways that GIFFORD described, and the short -term, in which AM not only has wrestled with the issue of what is the -best course to pursue but also has faced a variety of technical -challenges. - -FLEISCHHAUER remarked AM's endeavors to deal with a wide range of library -formats, such as motion picture collections, sound-recording collections, -and pictorial collections of various sorts, especially collections of -photographs. In the course of these efforts, AM kept coming back to -textual materials--manuscripts or rare printed matter, bound materials, -etc. Text posed the greatest conversion challenge of all. Thus, the -genesis of the Workshop, which reflects the problems faced by AM. These -problems include physical problems. For example, those in the library -and archive business deal with collections made up of fragile and rare -manuscript items, bound materials, especially the notoriously brittle -bound materials of the late nineteenth century. These are precious -cultural artifacts, however, as well as interesting sources of -information, and LC desires to retain and conserve them. AM needs to -handle things without damaging them. Guillotining a book to run it -through a sheet feeder must be avoided at all costs. - -Beyond physical problems, issues pertaining to quality arose. For -example, the desire to provide users with a searchable text is affected -by the question of acceptable level of accuracy. One hundred percent -accuracy is tremendously expensive. On the other hand, the output of -optical character recognition (OCR) can be tremendously inaccurate. -Although AM has attempted to find a middle ground, uncertainty persists -as to whether or not it has discovered the right solution. - -Questions of quality arose concerning images as well. FLEISCHHAUER -contrasted the extremely high level of quality of the digital images in -the Cornell Xerox Project with AM's efforts to provide a browse-quality -or access-quality image, as opposed to an archival or preservation image. -FLEISCHHAUER therefore welcomed the opportunity to compare notes. - -FLEISCHHAUER observed in passing that conversations he had had about -networks have begun to signal that for various forms of media a -determination may be made that there is a browse-quality item, or a -distribution-and-access-quality item that may coexist in some systems -with a higher quality archival item that would be inconvenient to send -through the network because of its size. FLEISCHHAUER referred, of -course, to images more than to searchable text. - -As AM considered those questions, several conceptual issues arose: ought -AM occasionally to reproduce materials entirely through an image set, at -other times, entirely through a text set, and in some cases, a mix? -There probably would be times when the historical authenticity of an -artifact would require that its image be used. An image might be -desirable as a recourse for users if one could not provide 100-percent -accurate text. Again, AM wondered, as a practical matter, if a -distinction could be drawn between rare printed matter that might exist -in multiple collections--that is, in ten or fifteen libraries. In such -cases, the need for perfect reproduction would be less than for unique -items. Implicit in his remarks, FLEISCHHAUER conceded, was the admission -that AM has been tilting strongly towards quantity and drawing back a -little from perfect quality. That is, it seemed to AM that society would -be better served if more things were distributed by LC--even if they were -not quite perfect--than if fewer things, perfectly represented, were -distributed. This was stated as a proposition to be tested, with -responses to be gathered from users. - -In thinking about issues related to reproduction of materials and seeing -other people engaged in parallel activities, AM deemed it useful to -convene a conference. Hence, the Workshop. FLEISCHHAUER thereupon -surveyed the several groups represented: 1) the world of images (image -users and image makers); 2) the world of text and scholarship and, within -this group, those concerned with language--FLEISCHHAUER confessed to finding -delightful irony in the fact that some of the most advanced thinkers on -computerized texts are those dealing with ancient Greek and Roman materials; -3) the network world; and 4) the general world of library science, which -includes people interested in preservation and cataloging. - -FLEISCHHAUER concluded his remarks with special thanks to the David and -Lucile Packard Foundation for its support of the meeting, the American -Memory group, the Office for Scholarly Programs, the National -Demonstration Lab, and the Office of Special Events. He expressed the -hope that David Woodley Packard might be able to attend, noting that -Packard's work and the work of the foundation had sponsored a number of -projects in the text area. - - ****** - -SESSION I. CONTENT IN A NEW FORM: WHO WILL USE IT AND WHAT WILL THEY DO? - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DALY * Acknowledgements * A new Latin authors disk * Effects of the new -technology on previous methods of research * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Serving as moderator, James DALY acknowledged the generosity of all the -presenters for giving of their time, counsel, and patience in planning -the Workshop, as well as of members of the American Memory project and -other Library of Congress staff, and the David and Lucile Packard -Foundation and its executive director, Colburn S. Wilbur. - -DALY then recounted his visit in March to the Center for Electronic Texts -in the Humanities (CETH) and the Department of Classics at Rutgers -University, where an old friend, Lowell Edmunds, introduced him to the -department's IBYCUS scholarly personal computer, and, in particular, the -new Latin CD-ROM, containing, among other things, almost all classical -Latin literary texts through A.D. 200. Packard Humanities Institute -(PHI), Los Altos, California, released this disk late in 1991, with a -nominal triennial licensing fee. - -Playing with the disk for an hour or so at Rutgers brought home to DALY -at once the revolutionizing impact of the new technology on his previous -methods of research. Had this disk been available two or three years -earlier, DALY contended, when he was engaged in preparing a commentary on -Book 10 of Virgil's Aeneid for Cambridge University Press, he would not -have required a forty-eight-square-foot table on which to spread the -numerous, most frequently consulted items, including some ten or twelve -concordances to key Latin authors, an almost equal number of lexica to -authors who lacked concordances, and where either lexica or concordances -were lacking, numerous editions of authors antedating and postdating Virgil. - -Nor, when checking each of the average six to seven words contained in -the Virgilian hexameter for its usage elsewhere in Virgil's works or -other Latin authors, would DALY have had to maintain the laborious -mechanical process of flipping through these concordances, lexica, and -editions each time. Nor would he have had to frequent as often the -Milton S. Eisenhower Library at the Johns Hopkins University to consult -the Thesaurus Linguae Latinae. Instead of devoting countless hours, or -the bulk of his research time, to gathering data concerning Virgil's use -of words, DALY--now freed by PHI's Latin authors disk from the -tyrannical, yet in some ways paradoxically happy scholarly drudgery-- -would have been able to devote that same bulk of time to analyzing and -interpreting Virgilian verbal usage. - -Citing Theodore Brunner, Gregory Crane, Elli MYLONAS, and Avra MICHELSON, -DALY argued that this reversal in his style of work, made possible by the -new technology, would perhaps have resulted in better, more productive -research. Indeed, even in the course of his browsing the Latin authors -disk at Rutgers, its powerful search, retrieval, and highlighting -capabilities suggested to him several new avenues of research into -Virgil's use of sound effects. This anecdotal account, DALY maintained, -may serve to illustrate in part the sudden and radical transformation -being wrought in the ways scholars work. - - ****** - -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -MICHELSON * Elements related to scholarship and technology * Electronic -texts within the context of broader trends within information technology -and scholarly communication * Evaluation of the prospects for the use of -electronic texts * Relationship of electronic texts to processes of -scholarly communication in humanities research * New exchange formats -created by scholars * Projects initiated to increase scholarly access to -converted text * Trend toward making electronic resources available -through research and education networks * Changes taking place in -scholarly communication among humanities scholars * Network-mediated -scholarship transforming traditional scholarly practices * Key -information technology trends affecting the conduct of scholarly -communication over the next decade * The trend toward end-user computing -* The trend toward greater connectivity * Effects of these trends * Key -transformations taking place * Summary of principal arguments * -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Avra MICHELSON, Archival Research and Evaluation Staff, National Archives -and Records Administration (NARA), argued that establishing who will use -electronic texts and what they will use them for involves a consideration -of both information technology and scholarship trends. This -consideration includes several elements related to scholarship and -technology: 1) the key trends in information technology that are most -relevant to scholarship; 2) the key trends in the use of currently -available technology by scholars in the nonscientific community; and 3) -the relationship between these two very distinct but interrelated trends. -The investment in understanding this relationship being made by -information providers, technologists, and public policy developers, as -well as by scholars themselves, seems to be pervasive and growing, -MICHELSON contended. She drew on collaborative work with Jeff Rothenberg -on the scholarly use of technology. - -MICHELSON sought to place the phenomenon of electronic texts within the -context of broader trends within information technology and scholarly -communication. She argued that electronic texts are of most use to -researchers to the extent that the researchers' working context (i.e., -their relevant bibliographic sources, collegial feedback, analytic tools, -notes, drafts, etc.), along with their field's primary and secondary -sources, also is accessible in electronic form and can be integrated in -ways that are unique to the on-line environment. - -Evaluation of the prospects for the use of electronic texts includes two -elements: 1) an examination of the ways in which researchers currently -are using electronic texts along with other electronic resources, and 2) -an analysis of key information technology trends that are affecting the -long-term conduct of scholarly communication. MICHELSON limited her -discussion of the use of electronic texts to the practices of humanists -and noted that the scientific community was outside the panel's overview. - -MICHELSON examined the nature of the current relationship of electronic -texts in particular, and electronic resources in general, to what she -maintained were, essentially, five processes of scholarly communication -in humanities research. Researchers 1) identify sources, 2) communicate -with their colleagues, 3) interpret and analyze data, 4) disseminate -their research findings, and 5) prepare curricula to instruct the next -generation of scholars and students. This examination would produce a -clearer understanding of the synergy among these five processes that -fuels the tendency of the use of electronic resources for one process to -stimulate its use for other processes of scholarly communication. - -For the first process of scholarly communication, the identification of -sources, MICHELSON remarked the opportunity scholars now enjoy to -supplement traditional word-of-mouth searches for sources among their -colleagues with new forms of electronic searching. So, for example, -instead of having to visit the library, researchers are able to explore -descriptions of holdings in their offices. Furthermore, if their own -institutions' holdings prove insufficient, scholars can access more than -200 major American library catalogues over Internet, including the -universities of California, Michigan, Pennsylvania, and Wisconsin. -Direct access to the bibliographic databases offers intellectual -empowerment to scholars by presenting a comprehensive means of browsing -through libraries from their homes and offices at their convenience. - -The second process of communication involves communication among -scholars. Beyond the most common methods of communication, scholars are -using E-mail and a variety of new electronic communications formats -derived from it for further academic interchange. E-mail exchanges are -growing at an astonishing rate, reportedly 15 percent a month. They -currently constitute approximately half the traffic on research and -education networks. Moreover, the global spread of E-mail has been so -rapid that it is now possible for American scholars to use it to -communicate with colleagues in close to 140 other countries. - -Other new exchange formats created by scholars and operating on Internet -include more than 700 conferences, with about 80 percent of these devoted -to topics in the social sciences and humanities. The rate of growth of -these scholarly electronic conferences also is astonishing. From l990 to -l991, 200 new conferences were identified on Internet. From October 1991 -to June 1992, an additional 150 conferences in the social sciences and -humanities were added to this directory of listings. Scholars have -established conferences in virtually every field, within every different -discipline. For example, there are currently close to 600 active social -science and humanities conferences on topics such as art and -architecture, ethnomusicology, folklore, Japanese culture, medical -education, and gifted and talented education. The appeal to scholars of -communicating through these conferences is that, unlike any other medium, -electronic conferences today provide a forum for global communication -with peers at the front end of the research process. - -Interpretation and analysis of sources constitutes the third process of -scholarly communication that MICHELSON discussed in terms of texts and -textual resources. The methods used to analyze sources fall somewhere on -a continuum from quantitative analysis to qualitative analysis. -Typically, evidence is culled and evaluated using methods drawn from both -ends of this continuum. At one end, quantitative analysis involves the -use of mathematical processes such as a count of frequencies and -distributions of occurrences or, on a higher level, regression analysis. -At the other end of the continuum, qualitative analysis typically -involves nonmathematical processes oriented toward language -interpretation or the building of theory. Aspects of this work involve -the processing--either manual or computational--of large and sometimes -massive amounts of textual sources, although the use of nontextual -sources as evidence, such as photographs, sound recordings, film footage, -and artifacts, is significant as well. - -Scholars have discovered that many of the methods of interpretation and -analysis that are related to both quantitative and qualitative methods -are processes that can be performed by computers. For example, computers -can count. They can count brush strokes used in a Rembrandt painting or -perform regression analysis for understanding cause and effect. By means -of advanced technologies, computers can recognize patterns, analyze text, -and model concepts. Furthermore, computers can complete these processes -faster with more sources and with greater precision than scholars who -must rely on manual interpretation of data. But if scholars are to use -computers for these processes, source materials must be in a form -amenable to computer-assisted analysis. For this reason many scholars, -once they have identified the sources that are key to their research, are -converting them to machine-readable form. Thus, a representative example -of the numerous textual conversion projects organized by scholars around -the world in recent years to support computational text analysis is the -TLG, the Thesaurus Linguae Graecae. This project is devoted to -converting the extant ancient texts of classical Greece. (Editor's note: -according to the TLG Newsletter of May l992, TLG was in use in thirty-two -different countries. This figure updates MICHELSON's previous count by one.) - -The scholars performing these conversions have been asked to recognize -that the electronic sources they are converting for one use possess value -for other research purposes as well. As a result, during the past few -years, humanities scholars have initiated a number of projects to -increase scholarly access to converted text. So, for example, the Text -Encoding Initiative (TEI), about which more is said later in the program, -was established as an effort by scholars to determine standard elements -and methods for encoding machine-readable text for electronic exchange. -In a second effort to facilitate the sharing of converted text, scholars -have created a new institution, the Center for Electronic Texts in the -Humanities (CETH). The center estimates that there are 8,000 series of -source texts in the humanities that have been converted to -machine-readable form worldwide. CETH is undertaking an international -search for converted text in the humanities, compiling it into an -electronic library, and preparing bibliographic descriptions of the -sources for the Research Libraries Information Network's (RLIN) -machine-readable data file. The library profession has begun to initiate -large conversion projects as well, such as American Memory. - -While scholars have been making converted text available to one another, -typically on disk or on CD-ROM, the clear trend is toward making these -resources available through research and education networks. Thus, the -American and French Research on the Treasury of the French Language -(ARTFL) and the Dante Project are already available on Internet. -MICHELSON summarized this section on interpretation and analysis by -noting that: 1) increasing numbers of humanities scholars in the library -community are recognizing the importance to the advancement of -scholarship of retrospective conversion of source materials in the arts -and humanities; and 2) there is a growing realization that making the -sources available on research and education networks maximizes their -usefulness for the analysis performed by humanities scholars. - -The fourth process of scholarly communication is dissemination of -research findings, that is, publication. Scholars are using existing -research and education networks to engineer a new type of publication: -scholarly-controlled journals that are electronically produced and -disseminated. Although such journals are still emerging as a -communication format, their number has grown, from approximately twelve -to thirty-six during the past year (July 1991 to June 1992). Most of -these electronic scholarly journals are devoted to topics in the -humanities. As with network conferences, scholarly enthusiasm for these -electronic journals stems from the medium's unique ability to advance -scholarship in a way that no other medium can do by supporting global -feedback and interchange, practically in real time, early in the research -process. Beyond scholarly journals, MICHELSON remarked the delivery of -commercial full-text products, such as articles in professional journals, -newsletters, magazines, wire services, and reference sources. These are -being delivered via on-line local library catalogues, especially through -CD-ROMs. Furthermore, according to MICHELSON, there is general optimism -that the copyright and fees issues impeding the delivery of full text on -existing research and education networks soon will be resolved. - -The final process of scholarly communication is curriculum development -and instruction, and this involves the use of computer information -technologies in two areas. The first is the development of -computer-oriented instructional tools, which includes simulations, -multimedia applications, and computer tools that are used to assist in -the analysis of sources in the classroom, etc. The Perseus Project, a -database that provides a multimedia curriculum on classical Greek -civilization, is a good example of the way in which entire curricula are -being recast using information technologies. It is anticipated that the -current difficulty in exchanging electronically computer-based -instructional software, which in turn makes it difficult for one scholar -to build upon the work of others, will be resolved before too long. -Stand-alone curricular applications that involve electronic text will be -sharable through networks, reinforcing their significance as intellectual -products as well as instructional tools. - -The second aspect of electronic learning involves the use of research and -education networks for distance education programs. Such programs -interactively link teachers with students in geographically scattered -locations and rely on the availability of electronic instructional -resources. Distance education programs are gaining wide appeal among -state departments of education because of their demonstrated capacity to -bring advanced specialized course work and an array of experts to many -classrooms. A recent report found that at least 32 states operated at -least one statewide network for education in 1991, with networks under -development in many of the remaining states. - -MICHELSON summarized this section by noting two striking changes taking -place in scholarly communication among humanities scholars. First is the -extent to which electronic text in particular, and electronic resources -in general, are being infused into each of the five processes described -above. As mentioned earlier, there is a certain synergy at work here. -The use of electronic resources for one process tends to stimulate its -use for other processes, because the chief course of movement is toward a -comprehensive on-line working context for humanities scholars that -includes on-line availability of key bibliographies, scholarly feedback, -sources, analytical tools, and publications. MICHELSON noted further -that the movement toward a comprehensive on-line working context for -humanities scholars is not new. In fact, it has been underway for more -than forty years in the humanities, since Father Roberto Busa began -developing an electronic concordance of the works of Saint Thomas Aquinas -in 1949. What we are witnessing today, MICHELSON contended, is not the -beginning of this on-line transition but, for at least some humanities -scholars, the turning point in the transition from a print to an -electronic working context. Coinciding with the on-line transition, the -second striking change is the extent to which research and education -networks are becoming the new medium of scholarly communication. The -existing Internet and the pending National Education and Research Network -(NREN) represent the new meeting ground where scholars are going for -bibliographic information, scholarly dialogue and feedback, the most -current publications in their field, and high-level educational -offerings. Traditional scholarly practices are undergoing tremendous -transformations as a result of the emergence and growing prominence of -what is called network-mediated scholarship. - -MICHELSON next turned to the second element of the framework she proposed -at the outset of her talk for evaluating the prospects for electronic -text, namely the key information technology trends affecting the conduct -of scholarly communication over the next decade: 1) end-user computing -and 2) connectivity. - -End-user computing means that the person touching the keyboard, or -performing computations, is the same as the person who initiates or -consumes the computation. The emergence of personal computers, along -with a host of other forces, such as ubiquitous computing, advances in -interface design, and the on-line transition, is prompting the consumers -of computation to do their own computing, and is thus rendering obsolete -the traditional distinction between end users and ultimate users. - -The trend toward end-user computing is significant to consideration of -the prospects for electronic texts because it means that researchers are -becoming more adept at doing their own computations and, thus, more -competent in the use of electronic media. By avoiding programmer -intermediaries, computation is becoming central to the researcher's -thought process. This direct involvement in computing is changing the -researcher's perspective on the nature of research itself, that is, the -kinds of questions that can be posed, the analytical methodologies that -can be used, the types and amount of sources that are appropriate for -analyses, and the form in which findings are presented. The trend toward -end-user computing means that, increasingly, electronic media and -computation are being infused into all processes of humanities -scholarship, inspiring remarkable transformations in scholarly -communication. - -The trend toward greater connectivity suggests that researchers are using -computation increasingly in network environments. Connectivity is -important to scholarship because it erases the distance that separates -students from teachers and scholars from their colleagues, while allowing -users to access remote databases, share information in many different -media, connect to their working context wherever they are, and -collaborate in all phases of research. - -The combination of the trend toward end-user computing and the trend -toward connectivity suggests that the scholarly use of electronic -resources, already evident among some researchers, will soon become an -established feature of scholarship. The effects of these trends, along -with ongoing changes in scholarly practices, point to a future in which -humanities researchers will use computation and electronic communication -to help them formulate ideas, access sources, perform research, -collaborate with colleagues, seek peer review, publish and disseminate -results, and engage in many other professional and educational activities. - -In summary, MICHELSON emphasized four points: 1) A portion of humanities -scholars already consider electronic texts the preferred format for -analysis and dissemination. 2) Scholars are using these electronic -texts, in conjunction with other electronic resources, in all the -processes of scholarly communication. 3) The humanities scholars' -working context is in the process of changing from print technology to -electronic technology, in many ways mirroring transformations that have -occurred or are occurring within the scientific community. 4) These -changes are occurring in conjunction with the development of a new -communication medium: research and education networks that are -characterized by their capacity to advance scholarship in a wholly unique -way. - -MICHELSON also reiterated her three principal arguments: l) Electronic -texts are best understood in terms of the relationship to other -electronic resources and the growing prominence of network-mediated -scholarship. 2) The prospects for electronic texts lie in their capacity -to be integrated into the on-line network of electronic resources that -comprise the new working context for scholars. 3) Retrospective conversion -of portions of the scholarly record should be a key strategy as information -providers respond to changes in scholarly communication practices. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -VECCIA * AM's evaluation project and public users of electronic resources -* AM and its design * Site selection and evaluating the Macintosh -implementation of AM * Characteristics of the six public libraries -selected * Characteristics of AM's users in these libraries * Principal -ways AM is being used * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Susan VECCIA, team leader, and Joanne FREEMAN, associate coordinator, -American Memory, Library of Congress, gave a joint presentation. First, -by way of introduction, VECCIA explained her and FREEMAN's roles in -American Memory (AM). Serving principally as an observer, VECCIA has -assisted with the evaluation project of AM, placing AM collections in a -variety of different sites around the country and helping to organize and -implement that project. FREEMAN has been an associate coordinator of AM -and has been involved principally with the interpretative materials, -preparing some of the electronic exhibits and printed historical -information that accompanies AM and that is requested by users. VECCIA -and FREEMAN shared anecdotal observations concerning AM with public users -of electronic resources. Notwithstanding a fairly structured evaluation -in progress, both VECCIA and FREEMAN chose not to report on specifics in -terms of numbers, etc., because they felt it was too early in the -evaluation project to do so. - -AM is an electronic archive of primary source materials from the Library -of Congress, selected collections representing a variety of formats-- -photographs, graphic arts, recorded sound, motion pictures, broadsides, -and soon, pamphlets and books. In terms of the design of this system, -the interpretative exhibits have been kept separate from the primary -resources, with good reason. Accompanying this collection are printed -documentation and user guides, as well as guides that FREEMAN prepared for -teachers so that they may begin using the content of the system at once. - -VECCIA described the evaluation project before talking about the public -users of AM, limiting her remarks to public libraries, because FREEMAN -would talk more specifically about schools from kindergarten to twelfth -grade (K-12). Having started in spring 1991, the evaluation currently -involves testing of the Macintosh implementation of AM. Since the -primary goal of this evaluation is to determine the most appropriate -audience or audiences for AM, very different sites were selected. This -makes evaluation difficult because of the varying degrees of technology -literacy among the sites. AM is situated in forty-four locations, of -which six are public libraries and sixteen are schools. Represented -among the schools are elementary, junior high, and high schools. -District offices also are involved in the evaluation, which will -conclude in summer 1993. - -VECCIA focused the remainder of her talk on the six public libraries, one -of which doubles as a state library. They represent a range of -geographic areas and a range of demographic characteristics. For -example, three are located in urban settings, two in rural settings, and -one in a suburban setting. A range of technical expertise is to be found -among these facilities as well. For example, one is an "Apple library of -the future," while two others are rural one-room libraries--in one, AM -sits at the front desk next to a tractor manual. - -All public libraries have been extremely enthusiastic, supportive, and -appreciative of the work that AM has been doing. VECCIA characterized -various users: Most users in public libraries describe themselves as -general readers; of the students who use AM in the public libraries, -those in fourth grade and above seem most interested. Public libraries -in rural sites tend to attract retired people, who have been highly -receptive to AM. Users tend to fall into two additional categories: -people interested in the content and historical connotations of these -primary resources, and those fascinated by the technology. The format -receiving the most comments has been motion pictures. The adult users in -public libraries are more comfortable with IBM computers, whereas young -people seem comfortable with either IBM or Macintosh, although most of -them seem to come from a Macintosh background. This same tendency is -found in the schools. - -What kinds of things do users do with AM? In a public library there are -two main goals or ways that AM is being used: as an individual learning -tool, and as a leisure activity. Adult learning was one area that VECCIA -would highlight as a possible application for a tool such as AM. She -described a patron of a rural public library who comes in every day on -his lunch hour and literally reads AM, methodically going through the -collection image by image. At the end of his hour he makes an electronic -bookmark, puts it in his pocket, and returns to work. The next day he -comes in and resumes where he left off. Interestingly, this man had -never been in the library before he used AM. In another small, rural -library, the coordinator reports that AM is a popular activity for some -of the older, retired people in the community, who ordinarily would not -use "those things,"--computers. Another example of adult learning in -public libraries is book groups, one of which, in particular, is using AM -as part of its reading on industrialization, integration, and urbanization -in the early 1900s. - -One library reports that a family is using AM to help educate their -children. In another instance, individuals from a local museum came in -to use AM to prepare an exhibit on toys of the past. These two examples -emphasize the mission of the public library as a cultural institution, -reaching out to people who do not have the same resources available to -those who live in a metropolitan area or have access to a major library. -One rural library reports that junior high school students in large -numbers came in one afternoon to use AM for entertainment. A number of -public libraries reported great interest among postcard collectors in the -Detroit collection, which was essentially a collection of images used on -postcards around the turn of the century. Train buffs are similarly -interested because that was a time of great interest in railroading. -People, it was found, relate to things that they know of firsthand. For -example, in both rural public libraries where AM was made available, -observers reported that the older people with personal remembrances of -the turn of the century were gravitating to the Detroit collection. -These examples served to underscore MICHELSON's observation re the -integration of electronic tools and ideas--that people learn best when -the material relates to something they know. - -VECCIA made the final point that in many cases AM serves as a -public-relations tool for the public libraries that are testing it. In -one case, AM is being used as a vehicle to secure additional funding for -the library. In another case, AM has served as an inspiration to the -staff of a major local public library in the South to think about ways to -make its own collection of photographs more accessible to the public. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -FREEMAN * AM and archival electronic resources in a school environment * -Questions concerning context * Questions concerning the electronic format -itself * Computer anxiety * Access and availability of the system * -Hardware * Strengths gained through the use of archival resources in -schools * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Reiterating an observation made by VECCIA, that AM is an archival -resource made up of primary materials with very little interpretation, -FREEMAN stated that the project has attempted to bridge the gap between -these bare primary materials and a school environment, and in that cause -has created guided introductions to AM collections. Loud demand from the -educational community, chiefly from teachers working with the upper -grades of elementary school through high school, greeted the announcement -that AM would be tested around the country. - -FREEMAN reported not only on what was learned about AM in a school -environment, but also on several universal questions that were raised -concerning archival electronic resources in schools. She discussed -several strengths of this type of material in a school environment as -opposed to a highly structured resource that offers a limited number of -paths to follow. - -FREEMAN first raised several questions about using AM in a school -environment. There is often some difficulty in developing a sense of -what the system contains. Many students sit down at a computer resource -and assume that, because AM comes from the Library of Congress, all of -American history is now at their fingertips. As a result of that sort of -mistaken judgment, some students are known to conclude that AM contains -nothing of use to them when they look for one or two things and do not -find them. It is difficult to discover that middle ground where one has -a sense of what the system contains. Some students grope toward the idea -of an archive, a new idea to them, since they have not previously -experienced what it means to have access to a vast body of somewhat -random information. - -Other questions raised by FREEMAN concerned the electronic format itself. -For instance, in a school environment it is often difficult both for -teachers and students to gain a sense of what it is they are viewing. -They understand that it is a visual image, but they do not necessarily -know that it is a postcard from the turn of the century, a panoramic -photograph, or even machine-readable text of an eighteenth-century -broadside, a twentieth-century printed book, or a nineteenth-century -diary. That distinction is often difficult for people in a school -environment to grasp. Because of that, it occasionally becomes difficult -to draw conclusions from what one is viewing. - -FREEMAN also noted the obvious fear of the computer, which constitutes a -difficulty in using an electronic resource. Though students in general -did not suffer from this anxiety, several older students feared that they -were computer-illiterate, an assumption that became self-fulfilling when -they searched for something but failed to find it. FREEMAN said she -believed that some teachers also fear computer resources, because they -believe they lack complete control. FREEMAN related the example of -teachers shooing away students because it was not their time to use the -system. This was a case in which the situation had to be extremely -structured so that the teachers would not feel that they had lost their -grasp on what the system contained. - -A final question raised by FREEMAN concerned access and availability of -the system. She noted the occasional existence of a gap in communication -between school librarians and teachers. Often AM sits in a school -library and the librarian is the person responsible for monitoring the -system. Teachers do not always take into their world new library -resources about which the librarian is excited. Indeed, at the sites -where AM had been used most effectively within a library, the librarian -was required to go to specific teachers and instruct them in its use. As -a result, several AM sites will have in-service sessions over a summer, -in the hope that perhaps, with a more individualized link, teachers will -be more likely to use the resource. - -A related issue in the school context concerned the number of -workstations available at any one location. Centralization of equipment -at the district level, with teachers invited to download things and walk -away with them, proved unsuccessful because the hours these offices were -open were also school hours. - -Another issue was hardware. As VECCIA observed, a range of sites exists, -some technologically advanced and others essentially acquiring their -first computer for the primary purpose of using it in conjunction with -AM's testing. Users at technologically sophisticated sites want even -more sophisticated hardware, so that they can perform even more -sophisticated tasks with the materials in AM. But once they acquire a -newer piece of hardware, they must learn how to use that also; at an -unsophisticated site it takes an extremely long time simply to become -accustomed to the computer, not to mention the program offered with the -computer. All of these small issues raise one large question, namely, -are systems like AM truly rewarding in a school environment, or do they -simply act as innovative toys that do little more than spark interest? - -FREEMAN contended that the evaluation project has revealed several strengths -that were gained through the use of archival resources in schools, including: - - * Psychic rewards from using AM as a vast, rich database, with - teachers assigning various projects to students--oral presentations, - written reports, a documentary, a turn-of-the-century newspaper-- - projects that start with the materials in AM but are completed using - other resources; AM thus is used as a research tool in conjunction - with other electronic resources, as well as with books and items in - the library where the system is set up. - - * Students are acquiring computer literacy in a humanities context. - - * This sort of system is overcoming the isolation between disciplines - that often exists in schools. For example, many English teachers are - requiring their students to write papers on historical topics - represented in AM. Numerous teachers have reported that their - students are learning critical thinking skills using the system. - - * On a broader level, AM is introducing primary materials, not only - to students but also to teachers, in an environment where often - simply none exist--an exciting thing for the students because it - helps them learn to conduct research, to interpret, and to draw - their own conclusions. In learning to conduct research and what it - means, students are motivated to seek knowledge. That relates to - another positive outcome--a high level of personal involvement of - students with the materials in this system and greater motivation to - conduct their own research and draw their own conclusions. - - * Perhaps the most ironic strength of these kinds of archival - electronic resources is that many of the teachers AM interviewed - were desperate, it is no exaggeration to say, not only for primary - materials but for unstructured primary materials. These would, they - thought, foster personally motivated research, exploration, and - excitement in their students. Indeed, these materials have done - just that. Ironically, however, this lack of structure produces - some of the confusion to which the newness of these kinds of - resources may also contribute. The key to effective use of archival - products in a school environment is a clear, effective introduction - to the system and to what it contains. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Nothing known, quantitatively, about the number of -humanities scholars who must see the original versus those who would -settle for an edited transcript, or about the ways in which humanities -scholars are using information technology * Firm conclusions concerning -the manner and extent of the use of supporting materials in print -provided by AM to await completion of evaluative study * A listener's -reflections on additional applications of electronic texts * Role of -electronic resources in teaching elementary research skills to students * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the discussion that followed the presentations by MICHELSON, -VECCIA, and FREEMAN, additional points emerged. - -LESK asked if MICHELSON could give any quantitative estimate of the -number of humanities scholars who must see or want to see the original, -or the best possible version of the material, versus those who typically -would settle for an edited transcript. While unable to provide a figure, -she offered her impressions as an archivist who has done some reference -work and has discussed this issue with other archivists who perform -reference, that those who use archives and those who use primary sources -for what would be considered very high-level scholarly research, as -opposed to, say, undergraduate papers, were few in number, especially -given the public interest in using primary sources to conduct -genealogical or avocational research and the kind of professional -research done by people in private industry or the federal government. -More important in MICHELSON's view was that, quantitatively, nothing is -known about the ways in which, for example, humanities scholars are using -information technology. No studies exist to offer guidance in creating -strategies. The most recent study was conducted in 1985 by the American -Council of Learned Societies (ACLS), and what it showed was that 50 -percent of humanities scholars at that time were using computers. That -constitutes the extent of our knowledge. - -Concerning AM's strategy for orienting people toward the scope of -electronic resources, FREEMAN could offer no hard conclusions at this -point, because she and her colleagues were still waiting to see, -particularly in the schools, what has been made of their efforts. Within -the system, however, AM has provided what are called electronic exhibits- --such as introductions to time periods and materials--and these are -intended to offer a student user a sense of what a broadside is and what -it might tell her or him. But FREEMAN conceded that the project staff -would have to talk with students next year, after teachers have had a -summer to use the materials, and attempt to discover what the students -were learning from the materials. In addition, FREEMAN described -supporting materials in print provided by AM at the request of local -teachers during a meeting held at LC. These included time lines, -bibliographies, and other materials that could be reproduced on a -photocopier in a classroom. Teachers could walk away with and use these, -and in this way gain a better understanding of the contents. But again, -reaching firm conclusions concerning the manner and extent of their use -would have to wait until next year. - -As to the changes she saw occurring at the National Archives and Records -Administration (NARA) as a result of the increasing emphasis on -technology in scholarly research, MICHELSON stated that NARA at this -point was absorbing the report by her and Jeff Rothenberg addressing -strategies for the archival profession in general, although not for the -National Archives specifically. NARA is just beginning to establish its -role and what it can do. In terms of changes and initiatives that NARA -can take, no clear response could be given at this time. - -GREENFIELD remarked two trends mentioned in the session. Reflecting on -DALY's opening comments on how he could have used a Latin collection of -text in an electronic form, he said that at first he thought most scholars -would be unwilling to do that. But as he thought of that in terms of the -original meaning of research--that is, having already mastered these texts, -researching them for critical and comparative purposes--for the first time, -the electronic format made a lot of sense. GREENFIELD could envision -growing numbers of scholars learning the new technologies for that very -aspect of their scholarship and for convenience's sake. - -Listening to VECCIA and FREEMAN, GREENFIELD thought of an additional -application of electronic texts. He realized that AM could be used as a -guide to lead someone to original sources. Students cannot be expected -to have mastered these sources, things they have never known about -before. Thus, AM is leading them, in theory, to a vast body of -information and giving them a superficial overview of it, enabling them -to select parts of it. GREENFIELD asked if any evidence exists that this -resource will indeed teach the new user, the K-12 students, how to do -research. Scholars already know how to do research and are applying -these new tools. But he wondered why students would go beyond picking -out things that were most exciting to them. - -FREEMAN conceded the correctness of GREENFIELD's observation as applied -to a school environment. The risk is that a student would sit down at a -system, play with it, find some things of interest, and then walk away. -But in the relatively controlled situation of a school library, much will -depend on the instructions a teacher or a librarian gives a student. She -viewed the situation not as one of fine-tuning research skills but of -involving students at a personal level in understanding and researching -things. Given the guidance one can receive at school, it then becomes -possible to teach elementary research skills to students, which in fact -one particular librarian said she was teaching her fifth graders. -FREEMAN concluded that introducing the idea of following one's own path -of inquiry, which is essentially what research entails, involves more -than teaching specific skills. To these comments VECCIA added the -observation that the individual teacher and the use of a creative -resource, rather than AM itself, seemed to make the key difference. -Some schools and some teachers are making excellent use of the nature -of critical thinking and teaching skills, she said. - -Concurring with these remarks, DALY closed the session with the thought that -the more that producers produced for teachers and for scholars to use with -their students, the more successful their electronic products would prove. - - ****** - -SESSION II. SHOW AND TELL - -Jacqueline HESS, director, National Demonstration Laboratory, served as -moderator of the "show-and-tell" session. She noted that a -question-and-answer period would follow each presentation. - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -MYLONAS * Overview and content of Perseus * Perseus' primary materials -exist in a system-independent, archival form * A concession * Textual -aspects of Perseus * Tools to use with the Greek text * Prepared indices -and full-text searches in Perseus * English-Greek word search leads to -close study of words and concepts * Navigating Perseus by tracing down -indices * Using the iconography to perform research * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Elli MYLONAS, managing editor, Perseus Project, Harvard University, first -gave an overview of Perseus, a large, collaborative effort based at -Harvard University but with contributors and collaborators located at -numerous universities and colleges in the United States (e.g., Bowdoin, -Maryland, Pomona, Chicago, Virginia). Funded primarily by the -Annenberg/CPB Project, with additional funding from Apple, Harvard, and -the Packard Humanities Institute, among others, Perseus is a multimedia, -hypertextual database for teaching and research on classical Greek -civilization, which was released in February 1992 in version 1.0 and -distributed by Yale University Press. - -Consisting entirely of primary materials, Perseus includes ancient Greek -texts and translations of those texts; catalog entries--that is, museum -catalog entries, not library catalog entries--on vases, sites, coins, -sculpture, and archaeological objects; maps; and a dictionary, among -other sources. The number of objects and the objects for which catalog -entries exist are accompanied by thousands of color images, which -constitute a major feature of the database. Perseus contains -approximately 30 megabytes of text, an amount that will double in -subsequent versions. In addition to these primary materials, the Perseus -Project has been building tools for using them, making access and -navigation easier, the goal being to build part of the electronic -environment discussed earlier in the morning in which students or -scholars can work with their sources. - -The demonstration of Perseus will show only a fraction of the real work -that has gone into it, because the project had to face the dilemma of -what to enter when putting something into machine-readable form: should -one aim for very high quality or make concessions in order to get the -material in? Since Perseus decided to opt for very high quality, all of -its primary materials exist in a system-independent--insofar as it is -possible to be system-independent--archival form. Deciding what that -archival form would be and attaining it required much work and thought. -For example, all the texts are marked up in SGML, which will be made -compatible with the guidelines of the Text Encoding Initiative (TEI) when -they are issued. - -Drawings are postscript files, not meeting international standards, but -at least designed to go across platforms. Images, or rather the real -archival forms, consist of the best available slides, which are being -digitized. Much of the catalog material exists in database form--a form -that the average user could use, manipulate, and display on a personal -computer, but only at great cost. Thus, this is where the concession -comes in: All of this rich, well-marked-up information is stripped of -much of its content; the images are converted into bit-maps and the text -into small formatted chunks. All this information can then be imported -into HyperCard and run on a mid-range Macintosh, which is what Perseus -users have. This fact has made it possible for Perseus to attain wide -use fairly rapidly. Without those archival forms the HyperCard version -being demonstrated could not be made easily, and the project could not -have the potential to move to other forms and machines and software as -they appear, none of which information is in Perseus on the CD. - -Of the numerous multimedia aspects of Perseus, MYLONAS focused on the -textual. Part of what makes Perseus such a pleasure to use, MYLONAS -said, is this effort at seamless integration and the ability to move -around both visual and textual material. Perseus also made the decision -not to attempt to interpret its material any more than one interprets by -selecting. But, MYLONAS emphasized, Perseus is not courseware: No -syllabus exists. There is no effort to define how one teaches a topic -using Perseus, although the project may eventually collect papers by -people who have used it to teach. Rather, Perseus aims to provide -primary material in a kind of electronic library, an electronic sandbox, -so to say, in which students and scholars who are working on this -material can explore by themselves. With that, MYLONAS demonstrated -Perseus, beginning with the Perseus gateway, the first thing one sees -upon opening Perseus--an effort in part to solve the contextualizing -problem--which tells the user what the system contains. - -MYLONAS demonstrated only a very small portion, beginning with primary -texts and running off the CD-ROM. Having selected Aeschylus' Prometheus -Bound, which was viewable in Greek and English pretty much in the same -segments together, MYLONAS demonstrated tools to use with the Greek text, -something not possible with a book: looking up the dictionary entry form -of an unfamiliar word in Greek after subjecting it to Perseus' -morphological analysis for all the texts. After finding out about a -word, a user may then decide to see if it is used anywhere else in Greek. -Because vast amounts of indexing support all of the primary material, one -can find out where else all forms of a particular Greek word appear-- -often not a trivial matter because Greek is highly inflected. Further, -since the story of Prometheus has to do with the origins of sacrifice, a -user may wish to study and explore sacrifice in Greek literature; by -typing sacrifice into a small window, a user goes to the English-Greek -word list--something one cannot do without the computer (Perseus has -indexed the definitions of its dictionary)--the string sacrifice appears -in the definitions of these sixty-five words. One may then find out -where any of those words is used in the work(s) of a particular author. -The English definitions are not lemmatized. - -All of the indices driving this kind of usage were originally devised for -speed, MYLONAS observed; in other words, all that kind of information-- -all forms of all words, where they exist, the dictionary form they belong -to--were collected into databases, which will expedite searching. Then -it was discovered that one can do things searching in these databases -that could not be done searching in the full texts. Thus, although there -are full-text searches in Perseus, much of the work is done behind the -scenes, using prepared indices. Re the indexing that is done behind the -scenes, MYLONAS pointed out that without the SGML forms of the text, it -could not be done effectively. Much of this indexing is based on the -structures that are made explicit by the SGML tagging. - -It was found that one of the things many of Perseus' non-Greek-reading -users do is start from the dictionary and then move into the close study -of words and concepts via this kind of English-Greek word search, by which -means they might select a concept. This exercise has been assigned to -students in core courses at Harvard--to study a concept by looking for the -English word in the dictionary, finding the Greek words, and then finding -the words in the Greek but, of course, reading across in the English. -That tells them a great deal about what a translation means as well. - -Should one also wish to see images that have to do with sacrifice, that -person would go to the object key word search, which allows one to -perform a similar kind of index retrieval on the database of -archaeological objects. Without words, pictures are useless; Perseus has -not reached the point where it can do much with images that are not -cataloged. Thus, although it is possible in Perseus with text and images -to navigate by knowing where one wants to end up--for example, a -red-figure vase from the Boston Museum of Fine Arts--one can perform this -kind of navigation very easily by tracing down indices. MYLONAS -illustrated several generic scenes of sacrifice on vases. The features -demonstrated derived from Perseus 1.0; version 2.0 will implement even -better means of retrieval. - -MYLONAS closed by looking at one of the pictures and noting again that -one can do a great deal of research using the iconography as well as the -texts. For instance, students in a core course at Harvard this year were -highly interested in Greek concepts of foreigners and representations of -non-Greeks. So they performed a great deal of research, both with texts -(e.g., Herodotus) and with iconography on vases and coins, on how the -Greeks portrayed non-Greeks. At the same time, art historians who study -iconography were also interested, and were able to use this material. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Indexing and searchability of all English words in Perseus * -Several features of Perseus 1.0 * Several levels of customization -possible * Perseus used for general education * Perseus' effects on -education * Contextual information in Perseus * Main challenge and -emphasis of Perseus * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Several points emerged in the discussion that followed MYLONAS's presentation. - -Although MYLONAS had not demonstrated Perseus' ability to cross-search -documents, she confirmed that all English words in Perseus are indexed -and can be searched. So, for example, sacrifice could have been searched -in all texts, the historical essay, and all the catalogue entries with -their descriptions--in short, in all of Perseus. - -Boolean logic is not in Perseus 1.0 but will be added to the next -version, although an effort is being made not to restrict Perseus to a -database in which one just performs searching, Boolean or otherwise. It -is possible to move laterally through the documents by selecting a word -one is interested in and selecting an area of information one is -interested in and trying to look that word up in that area. - -Since Perseus was developed in HyperCard, several levels of customization -are possible. Simple authoring tools exist that allow one to create -annotated paths through the information, which are useful for note-taking -and for guided tours for teaching purposes and for expository writing. -With a little more ingenuity it is possible to begin to add or substitute -material in Perseus. - -Perseus has not been used so much for classics education as for general -education, where it seemed to have an impact on the students in the core -course at Harvard (a general required course that students must take in -certain areas). Students were able to use primary material much more. - -The Perseus Project has an evaluation team at the University of Maryland -that has been documenting Perseus' effects on education. Perseus is very -popular, and anecdotal evidence indicates that it is having an effect at -places other than Harvard, for example, test sites at Ball State -University, Drury College, and numerous small places where opportunities -to use vast amounts of primary data may not exist. One documented effect -is that archaeological, anthropological, and philological research is -being done by the same person instead of by three different people. - -The contextual information in Perseus includes an overview essay, a -fairly linear historical essay on the fifth century B.C. that provides -links into the primary material (e.g., Herodotus, Thucydides, and -Plutarch), via small gray underscoring (on the screen) of linked -passages. These are handmade links into other material. - -To different extents, most of the production work was done at Harvard, -where the people and the equipment are located. Much of the -collaborative activity involved data collection and structuring, because -the main challenge and the emphasis of Perseus is the gathering of -primary material, that is, building a useful environment for studying -classical Greece, collecting data, and making it useful. -Systems-building is definitely not the main concern. Thus, much of the -work has involved writing essays, collecting information, rewriting it, -and tagging it. That can be done off site. The creative link for the -overview essay as well as for both systems and data was collaborative, -and was forged via E-mail and paper mail with professors at Pomona and -Bowdoin. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -CALALUCA * PLD's principal focus and contribution to scholarship * -Various questions preparatory to beginning the project * Basis for -project * Basic rule in converting PLD * Concerning the images in PLD * -Running PLD under a variety of retrieval softwares * Encoding the -database a hard-fought issue * Various features demonstrated * Importance -of user documentation * Limitations of the CD-ROM version * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Eric CALALUCA, vice president, Chadwyck-Healey, Inc., demonstrated a -software interpretation of the Patrologia Latina Database (PLD). PLD's -principal focus from the beginning of the project about three-and-a-half -years ago was on converting Migne's Latin series, and in the end, -CALALUCA suggested, conversion of the text will be the major contribution -to scholarship. CALALUCA stressed that, as possibly the only private -publishing organization at the Workshop, Chadwyck-Healey had sought no -federal funds or national foundation support before embarking upon the -project, but instead had relied upon a great deal of homework and -marketing to accomplish the task of conversion. - -Ever since the possibilities of computer-searching have emerged, scholars -in the field of late ancient and early medieval studies (philosophers, -theologians, classicists, and those studying the history of natural law -and the history of the legal development of Western civilization) have -been longing for a fully searchable version of Western literature, for -example, all the texts of Augustine and Bernard of Clairvaux and -Boethius, not to mention all the secondary and tertiary authors. - -Various questions arose, CALALUCA said. Should one convert Migne? -Should the database be encoded? Is it necessary to do that? How should -it be delivered? What about CD-ROM? Since this is a transitional -medium, why even bother to create software to run on a CD-ROM? Since -everybody knows people will be networking information, why go to the -trouble--which is far greater with CD-ROM than with the production of -magnetic data? Finally, how does one make the data available? Can many -of the hurdles to using electronic information that some publishers have -imposed upon databases be eliminated? - -The PLD project was based on the principle that computer-searching of -texts is most effective when it is done with a large database. Because -PLD represented a collection that serves so many disciplines across so -many periods, it was irresistible. - -The basic rule in converting PLD was to do no harm, to avoid the sins of -intrusion in such a database: no introduction of newer editions, no -on-the-spot changes, no eradicating of all possible falsehoods from an -edition. Thus, PLD is not the final act in electronic publishing for -this discipline, but simply the beginning. The conversion of PLD has -evoked numerous unanticipated questions: How will information be used? -What about networking? Can the rights of a database be protected? -Should one protect the rights of a database? How can it be made -available? - -Those converting PLD also tried to avoid the sins of omission, that is, -excluding portions of the collections or whole sections. What about the -images? PLD is full of images, some are extremely pious -nineteenth-century representations of the Fathers, while others contain -highly interesting elements. The goal was to cover all the text of Migne -(including notes, in Greek and in Hebrew, the latter of which, in -particular, causes problems in creating a search structure), all the -indices, and even the images, which are being scanned in separately -searchable files. - -Several North American institutions that have placed acquisition requests -for the PLD database have requested it in magnetic form without software, -which means they are already running it without software, without -anything demonstrated at the Workshop. - -What cannot practically be done is go back and reconvert and re-encode -data, a time-consuming and extremely costly enterprise. CALALUCA sees -PLD as a database that can, and should, be run under a variety of -retrieval softwares. This will permit the widest possible searches. -Consequently, the need to produce a CD-ROM of PLD, as well as to develop -software that could handle some 1.3 gigabyte of heavily encoded text, -developed out of conversations with collection development and reference -librarians who wanted software both compassionate enough for the -pedestrian but also capable of incorporating the most detailed -lexicographical studies that a user desires to conduct. In the end, the -encoding and conversion of the data will prove the most enduring -testament to the value of the project. - -The encoding of the database was also a hard-fought issue: Did the -database need to be encoded? Were there normative structures for encoding -humanist texts? Should it be SGML? What about the TEI--will it last, -will it prove useful? CALALUCA expressed some minor doubts as to whether -a data bank can be fully TEI-conformant. Every effort can be made, but -in the end to be TEI-conformant means to accept the need to make some -firm encoding decisions that can, indeed, be disputed. The TEI points -the publisher in a proper direction but does not presume to make all the -decisions for him or her. Essentially, the goal of encoding was to -eliminate, as much as possible, the hindrances to information-networking, -so that if an institution acquires a database, everybody associated with -the institution can have access to it. - -CALALUCA demonstrated a portion of Volume 160, because it had the most -anomalies in it. The software was created by Electronic Book -Technologies of Providence, RI, and is called Dynatext. The software -works only with SGML-coded data. - -Viewing a table of contents on the screen, the audience saw how Dynatext -treats each element as a book and attempts to simplify movement through a -volume. Familiarity with the Patrologia in print (i.e., the text, its -source, and the editions) will make the machine-readable versions highly -useful. (Software with a Windows application was sought for PLD, -CALALUCA said, because this was the main trend for scholarly use.) - -CALALUCA also demonstrated how a user can perform a variety of searches -and quickly move to any part of a volume; the look-up screen provides -some basic, simple word-searching. - -CALALUCA argued that one of the major difficulties is not the software. -Rather, in creating a product that will be used by scholars representing -a broad spectrum of computer sophistication, user documentation proves -to be the most important service one can provide. - -CALALUCA next illustrated a truncated search under mysterium within ten -words of virtus and how one would be able to find its contents throughout -the entire database. He said that the exciting thing about PLD is that -many of the applications in the retrieval software being written for it -will exceed the capabilities of the software employed now for the CD-ROM -version. The CD-ROM faces genuine limitations, in terms of speed and -comprehensiveness, in the creation of a retrieval software to run it. -CALALUCA said he hoped that individual scholars will download the data, -if they wish, to their personal computers, and have ready access to -important texts on a constant basis, which they will be able to use in -their research and from which they might even be able to publish. - -(CALALUCA explained that the blue numbers represented Migne's column numbers, -which are the standard scholarly references. Pulling up a note, he stated -that these texts were heavily edited and the image files would appear simply -as a note as well, so that one could quickly access an image.) - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -FLEISCHHAUER/ERWAY * Several problems with which AM is still wrestling * -Various search and retrieval capabilities * Illustration of automatic -stemming and a truncated search * AM's attempt to find ways to connect -cataloging to the texts * AM's gravitation towards SGML * Striking a -balance between quantity and quality * How AM furnishes users recourse to -images * Conducting a search in a full-text environment * Macintosh and -IBM prototypes of AM * Multimedia aspects of AM * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -A demonstration of American Memory by its coordinator, Carl FLEISCHHAUER, -and Ricky ERWAY, associate coordinator, Library of Congress, concluded -the morning session. Beginning with a collection of broadsides from the -Continental Congress and the Constitutional Convention, the only text -collection in a presentable form at the time of the Workshop, FLEISCHHAUER -highlighted several of the problems with which AM is still wrestling. -(In its final form, the disk will contain two collections, not only the -broadsides but also the full text with illustrations of a set of -approximately 300 African-American pamphlets from the period 1870 to 1910.) - -As FREEMAN had explained earlier, AM has attempted to use a small amount -of interpretation to introduce collections. In the present case, the -contractor, a company named Quick Source, in Silver Spring, MD., used -software called Toolbook and put together a modestly interactive -introduction to the collection. Like the two preceding speakers, -FLEISCHHAUER argued that the real asset was the underlying collection. - -FLEISCHHAUER proceeded to describe various search and retrieval -capabilities while ERWAY worked the computer. In this particular package -the "go to" pull-down allowed the user in effect to jump out of Toolbook, -where the interactive program was located, and enter the third-party -software used by AM for this text collection, which is called Personal -Librarian. This was the Windows version of Personal Librarian, a -software application put together by a company in Rockville, Md. - -Since the broadsides came from the Revolutionary War period, a search was -conducted using the words British or war, with the default operator reset -as or. FLEISCHHAUER demonstrated both automatic stemming (which finds -other forms of the same root) and a truncated search. One of Personal -Librarian's strongest features, the relevance ranking, was represented by -a chart that indicated how often words being sought appeared in -documents, with the one receiving the most "hits" obtaining the highest -score. The "hit list" that is supplied takes the relevance ranking into -account, making the first hit, in effect, the one the software has -selected as the most relevant example. - -While in the text of one of the broadside documents, FLEISCHHAUER -remarked AM's attempt to find ways to connect cataloging to the texts, -which it does in different ways in different manifestations. In the case -shown, the cataloging was pasted on: AM took MARC records that were -written as on-line records right into one of the Library's mainframe -retrieval programs, pulled them out, and handed them off to the contractor, -who massaged them somewhat to display them in the manner shown. One of -AM's questions is, Does the cataloguing normally performed in the mainframe -work in this context, or had AM ought to think through adjustments? - -FLEISCHHAUER made the additional point that, as far as the text goes, AM -has gravitated towards SGML (he pointed to the boldface in the upper part -of the screen). Although extremely limited in its ability to translate -or interpret SGML, Personal Librarian will furnish both bold and italics -on screen; a fairly easy thing to do, but it is one of the ways in which -SGML is useful. - -Striking a balance between quantity and quality has been a major concern -of AM, with accuracy being one of the places where project staff have -felt that less than 100-percent accuracy was not unacceptable. -FLEISCHHAUER cited the example of the standard of the rekeying industry, -namely 99.95 percent; as one service bureau informed him, to go from -99.95 to 100 percent would double the cost. - -FLEISCHHAUER next demonstrated how AM furnishes users recourse to images, -and at the same time recalled LESK's pointed question concerning the -number of people who would look at those images and the number who would -work only with the text. If the implication of LESK's question was -sound, FLEISCHHAUER said, it raised the stakes for text accuracy and -reduced the value of the strategy for images. - -Contending that preservation is always a bugaboo, FLEISCHHAUER -demonstrated several images derived from a scan of a preservation -microfilm that AM had made. He awarded a grade of C at best, perhaps a -C minus or a C plus, for how well it worked out. Indeed, the matter of -learning if other people had better ideas about scanning in general, and, -in particular, scanning from microfilm, was one of the factors that drove -AM to attempt to think through the agenda for the Workshop. Skew, for -example, was one of the issues that AM in its ignorance had not reckoned -would prove so difficult. - -Further, the handling of images of the sort shown, in a desktop computer -environment, involved a considerable amount of zooming and scrolling. -Ultimately, AM staff feel that perhaps the paper copy that is printed out -might be the most useful one, but they remain uncertain as to how much -on-screen reading users will do. - -Returning to the text, FLEISCHHAUER asked viewers to imagine a person who -might be conducting a search in a full-text environment. With this -scenario, he proceeded to illustrate other features of Personal Librarian -that he considered helpful; for example, it provides the ability to -notice words as one reads. Clicking the "include" button on the bottom -of the search window pops the words that have been highlighted into the -search. Thus, a user can refine the search as he or she reads, -re-executing the search and continuing to find things in the quest for -materials. This software not only contains relevance ranking, Boolean -operators, and truncation, it also permits one to perform word algebra, -so to say, where one puts two or three words in parentheses and links -them with one Boolean operator and then a couple of words in another set -of parentheses and asks for things within so many words of others. - -Until they became acquainted recently with some of the work being done in -classics, the AM staff had not realized that a large number of the -projects that involve electronic texts were being done by people with a -profound interest in language and linguistics. Their search strategies -and thinking are oriented to those fields, as is shown in particular by -the Perseus example. As amateur historians, the AM staff were thinking -more of searching for concepts and ideas than for particular words. -Obviously, FLEISCHHAUER conceded, searching for concepts and ideas and -searching for words may be two rather closely related things. - -While displaying several images, FLEISCHHAUER observed that the Macintosh -prototype built by AM contains a greater diversity of formats. Echoing a -previous speaker, he said that it was easier to stitch things together in -the Macintosh, though it tended to be a little more anemic in search and -retrieval. AM, therefore, increasingly has been investigating -sophisticated retrieval engines in the IBM format. - -FLEISCHHAUER demonstrated several additional examples of the prototype -interfaces: One was AM's metaphor for the network future, in which a -kind of reading-room graphic suggests how one would be able to go around -to different materials. AM contains a large number of photographs in -analog video form worked up from a videodisc, which enable users to make -copies to print or incorporate in digital documents. A frame-grabber is -built into the system, making it possible to bring an image into a window -and digitize or print it out. - -FLEISCHHAUER next demonstrated sound recording, which included texts. -Recycled from a previous project, the collection included sixty 78-rpm -phonograph records of political speeches that were made during and -immediately after World War I. These constituted approximately three -hours of audio, as AM has digitized it, which occupy 150 megabytes on a -CD. Thus, they are considerably compressed. From the catalogue card, -FLEISCHHAUER proceeded to a transcript of a speech with the audio -available and with highlighted text following it as it played. -A photograph has been added and a transcription made. - -Considerable value has been added beyond what the Library of Congress -normally would do in cataloguing a sound recording, which raises several -questions for AM concerning where to draw lines about how much value it can -afford to add and at what point, perhaps, this becomes more than AM could -reasonably do or reasonably wish to do. FLEISCHHAUER also demonstrated -a motion picture. As FREEMAN had reported earlier, the motion picture -materials have proved the most popular, not surprisingly. This says more -about the medium, he thought, than about AM's presentation of it. - -Because AM's goal was to bring together things that could be used by -historians or by people who were curious about history, -turn-of-the-century footage seemed to represent the most appropriate -collections from the Library of Congress in motion pictures. These were -the very first films made by Thomas Edison's company and some others at -that time. The particular example illustrated was a Biograph film, -brought in with a frame-grabber into a window. A single videodisc -contains about fifty titles and pieces of film from that period, all of -New York City. Taken together, AM believes, they provide an interesting -documentary resource. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Using the frame-grabber in AM * Volume of material processed -and to be processed * Purpose of AM within LC * Cataloguing and the -nature of AM's material * SGML coding and the question of quality versus -quantity * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the question-and-answer period that followed FLEISCHHAUER's -presentation, several clarifications were made. - -AM is bringing in motion pictures from a videodisc. The frame-grabber -devices create a window on a computer screen, which permits users to -digitize a single frame of the movie or one of the photographs. It -produces a crude, rough-and-ready image that high school students can -incorporate into papers, and that has worked very nicely in this way. - -Commenting on FLEISCHHAUER's assertion that AM was looking more at -searching ideas than words, MYLONAS argued that without words an idea -does not exist. FLEISCHHAUER conceded that he ought to have articulated -his point more clearly. MYLONAS stated that they were in fact both -talking about the same thing. By searching for words and by forcing -people to focus on the word, the Perseus Project felt that they would get -them to the idea. The way one reviews results is tailored more to one -kind of user than another. - -Concerning the total volume of material that has been processed in this -way, AM at this point has in retrievable form seven or eight collections, -all of them photographic. In the Macintosh environment, for example, -there probably are 35,000-40,000 photographs. The sound recordings -number sixty items. The broadsides number about 300 items. There are -500 political cartoons in the form of drawings. The motion pictures, as -individual items, number sixty to seventy. - -AM also has a manuscript collection, the life history portion of one of -the federal project series, which will contain 2,900 individual -documents, all first-person narratives. AM has in process about 350 -African-American pamphlets, or about 12,000 printed pages for the period -1870-1910. Also in the works are some 4,000 panoramic photographs. AM -has recycled a fair amount of the work done by LC's Prints and -Photographs Division during the Library's optical disk pilot project in -the 1980s. For example, a special division of LC has tooled up and -thought through all the ramifications of electronic presentation of -photographs. Indeed, they are wheeling them out in great barrel loads. -The purpose of AM within the Library, it is hoped, is to catalyze several -of the other special collection divisions which have no particular -experience with, in some cases, mixed feelings about, an activity such as -AM. Moreover, in many cases the divisions may be characterized as not -only lacking experience in "electronifying" things but also in automated -cataloguing. MARC cataloguing as practiced in the United States is -heavily weighted toward the description of monograph and serial -materials, but is much thinner when one enters the world of manuscripts -and things that are held in the Library's music collection and other -units. In response to a comment by LESK, that AM's material is very -heavily photographic, and is so primarily because individual records have -been made for each photograph, FLEISCHHAUER observed that an item-level -catalog record exists, for example, for each photograph in the Detroit -Publishing collection of 25,000 pictures. In the case of the Federal -Writers Project, for which nearly 3,000 documents exist, representing -information from twenty-six different states, AM with the assistance of -Karen STUART of the Manuscript Division will attempt to find some way not -only to have a collection-level record but perhaps a MARC record for each -state, which will then serve as an umbrella for the 100-200 documents -that come under it. But that drama remains to be enacted. The AM staff -is conservative and clings to cataloguing, though of course visitors tout -artificial intelligence and neural networks in a manner that suggests that -perhaps one need not have cataloguing or that much of it could be put aside. - -The matter of SGML coding, FLEISCHHAUER conceded, returned the discussion -to the earlier treated question of quality versus quantity in the Library -of Congress. Of course, text conversion can be done with 100-percent -accuracy, but it means that when one's holdings are as vast as LC's only -a tiny amount will be exposed, whereas permitting lower levels of -accuracy can lead to exposing or sharing larger amounts, but with the -quality correspondingly impaired. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -TWOHIG * A contrary experience concerning electronic options * Volume of -material in the Washington papers and a suggestion of David Packard * -Implications of Packard's suggestion * Transcribing the documents for the -CD-ROM * Accuracy of transcriptions * The CD-ROM edition of the Founding -Fathers documents * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Finding encouragement in a comment of MICHELSON's from the morning -session--that numerous people in the humanities were choosing electronic -options to do their work--Dorothy TWOHIG, editor, The Papers of George -Washington, opened her illustrated talk by noting that her experience -with literary scholars and numerous people in editing was contrary to -MICHELSON's. TWOHIG emphasized literary scholars' complete ignorance of -the technological options available to them or their reluctance or, in -some cases, their downright hostility toward these options. - -After providing an overview of the five Founding Fathers projects -(Jefferson at Princeton, Franklin at Yale, John Adams at the -Massachusetts Historical Society, and Madison down the hall from her at -the University of Virginia), TWOHIG observed that the Washington papers, -like all of the projects, include both sides of the Washington -correspondence and deal with some 135,000 documents to be published with -extensive annotation in eighty to eighty-five volumes, a project that -will not be completed until well into the next century. Thus, it was -with considerable enthusiasm several years ago that the Washington Papers -Project (WPP) greeted David Packard's suggestion that the papers of the -Founding Fathers could be published easily and inexpensively, and to the -great benefit of American scholarship, via CD-ROM. - -In pragmatic terms, funding from the Packard Foundation would expedite -the transcription of thousands of documents waiting to be put on disk in -the WPP offices. Further, since the costs of collecting, editing, and -converting the Founding Fathers documents into letterpress editions were -running into the millions of dollars, and the considerable staffs -involved in all of these projects were devoting their careers to -producing the work, the Packard Foundation's suggestion had a -revolutionary aspect: Transcriptions of the entire corpus of the -Founding Fathers papers would be available on CD-ROM to public and -college libraries, even high schools, at a fraction of the cost-- -$100-$150 for the annual license fee--to produce a limited university -press run of 1,000 of each volume of the published papers at $45-$150 per -printed volume. Given the current budget crunch in educational systems -and the corresponding constraints on librarians in smaller institutions -who wish to add these volumes to their collections, producing the -documents on CD-ROM would likely open a greatly expanded audience for the -papers. TWOHIG stressed, however, that development of the Founding -Fathers CD-ROM is still in its infancy. Serious software problems remain -to be resolved before the material can be put into readable form. - -Funding from the Packard Foundation resulted in a major push to -transcribe the 75,000 or so documents of the Washington papers remaining -to be transcribed onto computer disks. Slides illustrated several of the -problems encountered, for example, the present inability of CD-ROM to -indicate the cross-outs (deleted material) in eighteenth century -documents. TWOHIG next described documents from various periods in the -eighteenth century that have been transcribed in chronological order and -delivered to the Packard offices in California, where they are converted -to the CD-ROM, a process that is expected to consume five years to -complete (that is, reckoning from David Packard's suggestion made several -years ago, until about July 1994). TWOHIG found an encouraging -indication of the project's benefits in the ongoing use made by scholars -of the search functions of the CD-ROM, particularly in reducing the time -spent in manually turning the pages of the Washington papers. - -TWOHIG next furnished details concerning the accuracy of transcriptions. -For instance, the insertion of thousands of documents on the CD-ROM -currently does not permit each document to be verified against the -original manuscript several times as in the case of documents that appear -in the published edition. However, the transcriptions receive a cursory -check for obvious typos, the misspellings of proper names, and other -errors from the WPP CD-ROM editor. Eventually, all documents that appear -in the electronic version will be checked by project editors. Although -this process has met with opposition from some of the editors on the -grounds that imperfect work may leave their offices, the advantages in -making this material available as a research tool outweigh fears about the -misspelling of proper names and other relatively minor editorial matters. - -Completion of all five Founding Fathers projects (i.e., retrievability -and searchability of all of the documents by proper names, alternate -spellings, or varieties of subjects) will provide one of the richest -sources of this size for the history of the United States in the latter -part of the eighteenth century. Further, publication on CD-ROM will -allow editors to include even minutiae, such as laundry lists, not -included in the printed volumes. - -It seems possible that the extensive annotation provided in the printed -volumes eventually will be added to the CD-ROM edition, pending -negotiations with the publishers of the papers. At the moment, the -Founding Fathers CD-ROM is accessible only on the IBYCUS, a computer -developed out of the Thesaurus Linguae Graecae project and designed for -the use of classical scholars. There are perhaps 400 IBYCUS computers in -the country, most of which are in university classics departments. -Ultimately, it is anticipated that the CD-ROM edition of the Founding -Fathers documents will run on any IBM-compatible or Macintosh computer -with a CD-ROM drive. Numerous changes in the software will also occur -before the project is completed. (Editor's note: an IBYCUS was -unavailable to demonstrate the CD-ROM.) - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Several additional features of WPP clarified * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Discussion following TWOHIG's presentation served to clarify several -additional features, including (1) that the project's primary -intellectual product consists in the electronic transcription of the -material; (2) that the text transmitted to the CD-ROM people is not -marked up; (3) that cataloging and subject-indexing of the material -remain to be worked out (though at this point material can be retrieved -by name); and (4) that because all the searching is done in the hardware, -the IBYCUS is designed to read a CD-ROM which contains only sequential -text files. Technically, it then becomes very easy to read the material -off and put it on another device. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -LEBRON * Overview of the history of the joint project between AAAS and -OCLC * Several practices the on-line environment shares with traditional -publishing on hard copy * Several technical and behavioral barriers to -electronic publishing * How AAAS and OCLC arrived at the subject of -clinical trials * Advantages of the electronic format and other features -of OJCCT * An illustrated tour of the journal * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Maria LEBRON, managing editor, The Online Journal of Current Clinical -Trials (OJCCT), presented an illustrated overview of the history of the -joint project between the American Association for the Advancement of -Science (AAAS) and the Online Computer Library Center, Inc. (OCLC). The -joint venture between AAAS and OCLC owes its beginning to a -reorganization launched by the new chief executive officer at OCLC about -three years ago and combines the strengths of these two disparate -organizations. In short, OJCCT represents the process of scholarly -publishing on line. - -LEBRON next discussed several practices the on-line environment shares -with traditional publishing on hard copy--for example, peer review of -manuscripts--that are highly important in the academic world. LEBRON -noted in particular the implications of citation counts for tenure -committees and grants committees. In the traditional hard-copy -environment, citation counts are readily demonstrable, whereas the -on-line environment represents an ethereal medium to most academics. - -LEBRON remarked several technical and behavioral barriers to electronic -publishing, for instance, the problems in transmission created by special -characters or by complex graphics and halftones. In addition, she noted -economic limitations such as the storage costs of maintaining back issues -and market or audience education. - -Manuscripts cannot be uploaded to OJCCT, LEBRON explained, because it is -not a bulletin board or E-mail, forms of electronic transmission of -information that have created an ambience clouding people's understanding -of what the journal is attempting to do. OJCCT, which publishes -peer-reviewed medical articles dealing with the subject of clinical -trials, includes text, tabular material, and graphics, although at this -time it can transmit only line illustrations. - -Next, LEBRON described how AAAS and OCLC arrived at the subject of -clinical trials: It is 1) a highly statistical discipline that 2) does -not require halftones but can satisfy the needs of its audience with line -illustrations and graphic material, and 3) there is a need for the speedy -dissemination of high-quality research results. Clinical trials are -research activities that involve the administration of a test treatment -to some experimental unit in order to test its usefulness before it is -made available to the general population. LEBRON proceeded to give -additional information on OJCCT concerning its editor-in-chief, editorial -board, editorial content, and the types of articles it publishes -(including peer-reviewed research reports and reviews), as well as -features shared by other traditional hard-copy journals. - -Among the advantages of the electronic format are faster dissemination of -information, including raw data, and the absence of space constraints -because pages do not exist. (This latter fact creates an interesting -situation when it comes to citations.) Nor are there any issues. AAAS's -capacity to download materials directly from the journal to a -subscriber's printer, hard drive, or floppy disk helps ensure highly -accurate transcription. Other features of OJCCT include on-screen alerts -that allow linkage of subsequently published documents to the original -documents; on-line searching by subject, author, title, etc.; indexing of -every single word that appears in an article; viewing access to an -article by component (abstract, full text, or graphs); numbered -paragraphs to replace page counts; publication in Science every thirty -days of indexing of all articles published in the journal; -typeset-quality screens; and Hypertext links that enable subscribers to -bring up Medline abstracts directly without leaving the journal. - -After detailing the two primary ways to gain access to the journal, -through the OCLC network and Compuserv if one desires graphics or through -the Internet if just an ASCII file is desired, LEBRON illustrated the -speedy editorial process and the coding of the document using SGML tags -after it has been accepted for publication. She also gave an illustrated -tour of the journal, its search-and-retrieval capabilities in particular, -but also including problems associated with scanning in illustrations, -and the importance of on-screen alerts to the medical profession re -retractions or corrections, or more frequently, editorials, letters to -the editors, or follow-up reports. She closed by inviting the audience -to join AAAS on 1 July, when OJCCT was scheduled to go on-line. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Additional features of OJCCT * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -In the lengthy discussion that followed LEBRON's presentation, these -points emerged: - - * The SGML text can be tailored as users wish. - - * All these articles have a fairly simple document definition. - - * Document-type definitions (DTDs) were developed and given to OJCCT - for coding. - - * No articles will be removed from the journal. (Because there are - no back issues, there are no lost issues either. Once a subscriber - logs onto the journal he or she has access not only to the currently - published materials, but retrospectively to everything that has been - published in it. Thus the table of contents grows bigger. The date - of publication serves to distinguish between currently published - materials and older materials.) - - * The pricing system for the journal resembles that for most medical - journals: for 1992, $95 for a year, plus telecommunications charges - (there are no connect time charges); for 1993, $110 for the - entire year for single users, though the journal can be put on a - local area network (LAN). However, only one person can access the - journal at a time. Site licenses may come in the future. - - * AAAS is working closely with colleagues at OCLC to display - mathematical equations on screen. - - * Without compromising any steps in the editorial process, the - technology has reduced the time lag between when a manuscript is - originally submitted and the time it is accepted; the review process - does not differ greatly from the standard six-to-eight weeks - employed by many of the hard-copy journals. The process still - depends on people. - - * As far as a preservation copy is concerned, articles will be - maintained on the computer permanently and subscribers, as part of - their subscription, will receive a microfiche-quality archival copy - of everything published during that year; in addition, reprints can - be purchased in much the same way as in a hard-copy environment. - Hard copies are prepared but are not the primary medium for the - dissemination of the information. - - * Because OJCCT is not yet on line, it is difficult to know how many - people would simply browse through the journal on the screen as - opposed to downloading the whole thing and printing it out; a mix of - both types of users likely will result. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -PERSONIUS * Developments in technology over the past decade * The CLASS -Project * Advantages for technology and for the CLASS Project * -Developing a network application an underlying assumption of the project -* Details of the scanning process * Print-on-demand copies of books * -Future plans include development of a browsing tool * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Lynne PERSONIUS, assistant director, Cornell Information Technologies for -Scholarly Information Services, Cornell University, first commented on -the tremendous impact that developments in technology over the past ten -years--networking, in particular--have had on the way information is -handled, and how, in her own case, these developments have counterbalanced -Cornell's relative geographical isolation. Other significant technologies -include scanners, which are much more sophisticated than they were ten years -ago; mass storage and the dramatic savings that result from it in terms of -both space and money relative to twenty or thirty years ago; new and -improved printing technologies, which have greatly affected the distribution -of information; and, of course, digital technologies, whose applicability to -library preservation remains at issue. - -Given that context, PERSONIUS described the College Library Access and -Storage System (CLASS) Project, a library preservation project, -primarily, and what has been accomplished. Directly funded by the -Commission on Preservation and Access and by the Xerox Corporation, which -has provided a significant amount of hardware, the CLASS Project has been -working with a development team at Xerox to develop a software -application tailored to library preservation requirements. Within -Cornell, participants in the project have been working jointly with both -library and information technologies. The focus of the project has been -on reformatting and saving books that are in brittle condition. -PERSONIUS showed Workshop participants a brittle book, and described how -such books were the result of developments in papermaking around the -beginning of the Industrial Revolution. The papermaking process was -changed so that a significant amount of acid was introduced into the -actual paper itself, which deteriorates as it sits on library shelves. - -One of the advantages for technology and for the CLASS Project is that -the information in brittle books is mostly out of copyright and thus -offers an opportunity to work with material that requires library -preservation, and to create and work on an infrastructure to save the -material. Acknowledging the familiarity of those working in preservation -with this information, PERSONIUS noted that several things are being -done: the primary preservation technology used today is photocopying of -brittle material. Saving the intellectual content of the material is the -main goal. With microfilm copy, the intellectual content is preserved on -the assumption that in the future the image can be reformatted in any -other way that then exists. - -An underlying assumption of the CLASS Project from the beginning was -that it would develop a network application. Project staff scan books -at a workstation located in the library, near the brittle material. -An image-server filing system is located at a distance from that -workstation, and a printer is located in another building. All of the -materials digitized and stored on the image-filing system are cataloged -in the on-line catalogue. In fact, a record for each of these electronic -books is stored in the RLIN database so that a record exists of what is -in the digital library throughout standard catalogue procedures. In the -future, researchers working from their own workstations in their offices, -or their networks, will have access--wherever they might be--through a -request server being built into the new digital library. A second -assumption is that the preferred means of finding the material will be by -looking through a catalogue. PERSONIUS described the scanning process, -which uses a prototype scanner being developed by Xerox and which scans a -very high resolution image at great speed. Another significant feature, -because this is a preservation application, is the placing of the pages -that fall apart one for one on the platen. Ordinarily, a scanner could -be used with some sort of a document feeder, but because of this -application that is not feasible. Further, because CLASS is a -preservation application, after the paper replacement is made there, a -very careful quality control check is performed. An original book is -compared to the printed copy and verification is made, before proceeding, -that all of the image, all of the information, has been captured. Then, -a new library book is produced: The printed images are rebound by a -commercial binder and a new book is returned to the shelf. -Significantly, the books returned to the library shelves are beautiful -and useful replacements on acid-free paper that should last a long time, -in effect, the equivalent of preservation photocopies. Thus, the project -has a library of digital books. In essence, CLASS is scanning and -storing books as 600 dot-per-inch bit-mapped images, compressed using -Group 4 CCITT (i.e., the French acronym for International Consultative -Committee for Telegraph and Telephone) compression. They are stored as -TIFF files on an optical filing system that is composed of a database -used for searching and locating the books and an optical jukebox that -stores 64 twelve-inch platters. A very-high-resolution printed copy of -these books at 600 dots per inch is created, using a Xerox DocuTech -printer to make the paper replacements on acid-free paper. - -PERSONIUS maintained that the CLASS Project presents an opportunity to -introduce people to books as digital images by using a paper medium. -Books are returned to the shelves while people are also given the ability -to print on demand--to make their own copies of books. (PERSONIUS -distributed copies of an engineering journal published by engineering -students at Cornell around 1900 as an example of what a print-on-demand -copy of material might be like. This very cheap copy would be available -to people to use for their own research purposes and would bridge the gap -between an electronic work and the paper that readers like to have.) -PERSONIUS then attempted to illustrate a very early prototype of -networked access to this digital library. Xerox Corporation has -developed a prototype of a view station that can send images across the -network to be viewed. - -The particular library brought down for demonstration contained two -mathematics books. CLASS is developing and will spend the next year -developing an application that allows people at workstations to browse -the books. Thus, CLASS is developing a browsing tool, on the assumption -that users do not want to read an entire book from a workstation, but -would prefer to be able to look through and decide if they would like to -have a printed copy of it. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Re retrieval software * "Digital file copyright" * Scanning -rate during production * Autosegmentation * Criteria employed in -selecting books for scanning * Compression and decompression of images * -OCR not precluded * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the question-and-answer period that followed her presentation, -PERSONIUS made these additional points: - - * Re retrieval software, Cornell is developing a Unix-based server - as well as clients for the server that support multiple platforms - (Macintosh, IBM and Sun workstations), in the hope that people from - any of those platforms will retrieve books; a further operating - assumption is that standard interfaces will be used as much as - possible, where standards can be put in place, because CLASS - considers this retrieval software a library application and would - like to be able to look at material not only at Cornell but at other - institutions. - - * The phrase "digital file copyright by Cornell University" was - added at the advice of Cornell's legal staff with the caveat that it - probably would not hold up in court. Cornell does not want people - to copy its books and sell them but would like to keep them - available for use in a library environment for library purposes. - - * In production the scanner can scan about 300 pages per hour, - capturing 600 dots per inch. - - * The Xerox software has filters to scan halftone material and avoid - the moire patterns that occur when halftone material is scanned. - Xerox has been working on hardware and software that would enable - the scanner itself to recognize this situation and deal with it - appropriately--a kind of autosegmentation that would enable the - scanner to handle halftone material as well as text on a single page. - - * The books subjected to the elaborate process described above were - selected because CLASS is a preservation project, with the first 500 - books selected coming from Cornell's mathematics collection, because - they were still being heavily used and because, although they were - in need of preservation, the mathematics library and the mathematics - faculty were uncomfortable having them microfilmed. (They wanted a - printed copy.) Thus, these books became a logical choice for this - project. Other books were chosen by the project's selection committees - for experiments with the technology, as well as to meet a demand or need. - - * Images will be decompressed before they are sent over the line; at - this time they are compressed and sent to the image filing system - and then sent to the printer as compressed images; they are returned - to the workstation as compressed 600-dpi images and the workstation - decompresses and scales them for display--an inefficient way to - access the material though it works quite well for printing and - other purposes. - - * CLASS is also decompressing on Macintosh and IBM, a slow process - right now. Eventually, compression and decompression will take - place on an image conversion server. Trade-offs will be made, based - on future performance testing, concerning where the file is - compressed and what resolution image is sent. - - * OCR has not been precluded; images are being stored that have been - scanned at a high resolution, which presumably would suit them well - to an OCR process. Because the material being scanned is about 100 - years old and was printed with less-than-ideal technologies, very - early and preliminary tests have not produced good results. But the - project is capturing an image that is of sufficient resolution to be - subjected to OCR in the future. Moreover, the system architecture - and the system plan have a logical place to store an OCR image if it - has been captured. But that is not being done now. - - ****** - -SESSION III. DISTRIBUTION, NETWORKS, AND NETWORKING: OPTIONS FOR -DISSEMINATION - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -ZICH * Issues pertaining to CD-ROMs * Options for publishing in CD-ROM * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Robert ZICH, special assistant to the associate librarian for special -projects, Library of Congress, and moderator of this session, first noted -the blessed but somewhat awkward circumstance of having four very -distinguished people representing networks and networking or at least -leaning in that direction, while lacking anyone to speak from the -strongest possible background in CD-ROMs. ZICH expressed the hope that -members of the audience would join the discussion. He stressed the -subtitle of this particular session, "Options for Dissemination," and, -concerning CD-ROMs, the importance of determining when it would be wise -to consider dissemination in CD-ROM versus networks. A shopping list of -issues pertaining to CD-ROMs included: the grounds for selecting -commercial publishers, and in-house publication where possible versus -nonprofit or government publication. A similar list for networks -included: determining when one should consider dissemination through a -network, identifying the mechanisms or entities that exist to place items -on networks, identifying the pool of existing networks, determining how a -producer would choose between networks, and identifying the elements of -a business arrangement in a network. - -Options for publishing in CD-ROM: an outside publisher versus -self-publication. If an outside publisher is used, it can be nonprofit, -such as the Government Printing Office (GPO) or the National Technical -Information Service (NTIS), in the case of government. The pros and cons -associated with employing an outside publisher are obvious. Among the -pros, there is no trouble getting accepted. One pays the bill and, in -effect, goes one's way. Among the cons, when one pays an outside -publisher to perform the work, that publisher will perform the work it is -obliged to do, but perhaps without the production expertise and skill in -marketing and dissemination that some would seek. There is the body of -commercial publishers that do possess that kind of expertise in -distribution and marketing but that obviously are selective. In -self-publication, one exercises full control, but then one must handle -matters such as distribution and marketing. Such are some of the options -for publishing in the case of CD-ROM. - -In the case of technical and design issues, which are also important, -there are many matters which many at the Workshop already knew a good -deal about: retrieval system requirements and costs, what to do about -images, the various capabilities and platforms, the trade-offs between -cost and performance, concerns about local-area networkability, -interoperability, etc. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -LYNCH * Creating networked information is different from using networks -as an access or dissemination vehicle * Networked multimedia on a large -scale does not yet work * Typical CD-ROM publication model a two-edged -sword * Publishing information on a CD-ROM in the present world of -immature standards * Contrast between CD-ROM and network pricing * -Examples demonstrated earlier in the day as a set of insular information -gems * Paramount need to link databases * Layering to become increasingly -necessary * Project NEEDS and the issues of information reuse and active -versus passive use * X-Windows as a way of differentiating between -network access and networked information * Barriers to the distribution -of networked multimedia information * Need for good, real-time delivery -protocols * The question of presentation integrity in client-server -computing in the academic world * Recommendations for producing multimedia -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Clifford LYNCH, director, Library Automation, University of California, -opened his talk with the general observation that networked information -constituted a difficult and elusive topic because it is something just -starting to develop and not yet fully understood. LYNCH contended that -creating genuinely networked information was different from using -networks as an access or dissemination vehicle and was more sophisticated -and more subtle. He invited the members of the audience to extrapolate, -from what they heard about the preceding demonstration projects, to what -sort of a world of electronics information--scholarly, archival, -cultural, etc.--they wished to end up with ten or fifteen years from now. -LYNCH suggested that to extrapolate directly from these projects would -produce unpleasant results. - -Putting the issue of CD-ROM in perspective before getting into -generalities on networked information, LYNCH observed that those engaged -in multimedia today who wish to ship a product, so to say, probably do -not have much choice except to use CD-ROM: networked multimedia on a -large scale basically does not yet work because the technology does not -exist. For example, anybody who has tried moving images around over the -Internet knows that this is an exciting touch-and-go process, a -fascinating and fertile area for experimentation, research, and -development, but not something that one can become deeply enthusiastic -about committing to production systems at this time. - -This situation will change, LYNCH said. He differentiated CD-ROM from -the practices that have been followed up to now in distributing data on -CD-ROM. For LYNCH the problem with CD-ROM is not its portability or its -slowness but the two-edged sword of having the retrieval application and -the user interface inextricably bound up with the data, which is the -typical CD-ROM publication model. It is not a case of publishing data -but of distributing a typically stand-alone, typically closed system, -all--software, user interface, and data--on a little disk. Hence, all -the between-disk navigational issues as well as the impossibility in most -cases of integrating data on one disk with that on another. Most CD-ROM -retrieval software does not network very gracefully at present. However, -in the present world of immature standards and lack of understanding of -what network information is or what the ground rules are for creating or -using it, publishing information on a CD-ROM does add value in a very -real sense. - -LYNCH drew a contrast between CD-ROM and network pricing and in doing so -highlighted something bizarre in information pricing. A large -institution such as the University of California has vendors who will -offer to sell information on CD-ROM for a price per year in four digits, -but for the same data (e.g., an abstracting and indexing database) on -magnetic tape, regardless of how many people may use it concurrently, -will quote a price in six digits. - -What is packaged with the CD-ROM in one sense adds value--a complete -access system, not just raw, unrefined information--although it is not -generally perceived that way. This is because the access software, -although it adds value, is viewed by some people, particularly in the -university environment where there is a very heavy commitment to -networking, as being developed in the wrong direction. - -Given that context, LYNCH described the examples demonstrated as a set of -insular information gems--Perseus, for example, offers nicely linked -information, but would be very difficult to integrate with other -databases, that is, to link together seamlessly with other source files -from other sources. It resembles an island, and in this respect is -similar to numerous stand-alone projects that are based on videodiscs, -that is, on the single-workstation concept. - -As scholarship evolves in a network environment, the paramount need will -be to link databases. We must link personal databases to public -databases, to group databases, in fairly seamless ways--which is -extremely difficult in the environments under discussion with copies of -databases proliferating all over the place. - -The notion of layering also struck LYNCH as lurking in several of the -projects demonstrated. Several databases in a sense constitute -information archives without a significant amount of navigation built in. -Educators, critics, and others will want a layered structure--one that -defines or links paths through the layers to allow users to reach -specific points. In LYNCH's view, layering will become increasingly -necessary, and not just within a single resource but across resources -(e.g., tracing mythology and cultural themes across several classics -databases as well as a database of Renaissance culture). This ability to -organize resources, to build things out of multiple other things on the -network or select pieces of it, represented for LYNCH one of the key -aspects of network information. - -Contending that information reuse constituted another significant issue, -LYNCH commended to the audience's attention Project NEEDS (i.e., National -Engineering Education Delivery System). This project's objective is to -produce a database of engineering courseware as well as the components -that can be used to develop new courseware. In a number of the existing -applications, LYNCH said, the issue of reuse (how much one can take apart -and reuse in other applications) was not being well considered. He also -raised the issue of active versus passive use, one aspect of which is -how much information will be manipulated locally by users. Most people, -he argued, may do a little browsing and then will wish to print. LYNCH -was uncertain how these resources would be used by the vast majority of -users in the network environment. - -LYNCH next said a few words about X-Windows as a way of differentiating -between network access and networked information. A number of the -applications demonstrated at the Workshop could be rewritten to use X -across the network, so that one could run them from any X-capable device- --a workstation, an X terminal--and transact with a database across the -network. Although this opens up access a little, assuming one has enough -network to handle it, it does not provide an interface to develop a -program that conveniently integrates information from multiple databases. -X is a viewing technology that has limits. In a real sense, it is just a -graphical version of remote log-in across the network. X-type applications -represent only one step in the progression towards real access. - -LYNCH next discussed barriers to the distribution of networked multimedia -information. The heart of the problem is a lack of standards to provide -the ability for computers to talk to each other, retrieve information, -and shuffle it around fairly casually. At the moment, little progress is -being made on standards for networked information; for example, present -standards do not cover images, digital voice, and digital video. A -useful tool kit of exchange formats for basic texts is only now being -assembled. The synchronization of content streams (i.e., synchronizing a -voice track to a video track, establishing temporal relations between -different components in a multimedia object) constitutes another issue -for networked multimedia that is just beginning to receive attention. - -Underlying network protocols also need some work; good, real-time -delivery protocols on the Internet do not yet exist. In LYNCH's view, -highly important in this context is the notion of networked digital -object IDs, the ability of one object on the network to point to another -object (or component thereof) on the network. Serious bandwidth issues -also exist. LYNCH was uncertain if billion-bit-per-second networks would -prove sufficient if numerous people ran video in parallel. - -LYNCH concluded by offering an issue for database creators to consider, -as well as several comments about what might constitute good trial -multimedia experiments. In a networked information world the database -builder or service builder (publisher) does not exercise the same -extensive control over the integrity of the presentation; strange -programs "munge" with one's data before the user sees it. Serious -thought must be given to what guarantees integrity of presentation. Part -of that is related to where one draws the boundaries around a networked -information service. This question of presentation integrity in -client-server computing has not been stressed enough in the academic -world, LYNCH argued, though commercial service providers deal with it -regularly. - -Concerning multimedia, LYNCH observed that good multimedia at the moment -is hideously expensive to produce. He recommended producing multimedia -with either very high sale value, or multimedia with a very long life -span, or multimedia that will have a very broad usage base and whose -costs therefore can be amortized among large numbers of users. In this -connection, historical and humanistically oriented material may be a good -place to start, because it tends to have a longer life span than much of -the scientific material, as well as a wider user base. LYNCH noted, for -example, that American Memory fits many of the criteria outlined. He -remarked the extensive discussion about bringing the Internet or the -National Research and Education Network (NREN) into the K-12 environment -as a way of helping the American educational system. - -LYNCH closed by noting that the kinds of applications demonstrated struck -him as excellent justifications of broad-scale networking for K-12, but -that at this time no "killer" application exists to mobilize the K-12 -community to obtain connectivity. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Dearth of genuinely interesting applications on the network -a slow-changing situation * The issue of the integrity of presentation in -a networked environment * Several reasons why CD-ROM software does not -network * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the discussion period that followed LYNCH's presentation, several -additional points were made. - -LYNCH reiterated even more strongly his contention that, historically, -once one goes outside high-end science and the group of those who need -access to supercomputers, there is a great dearth of genuinely -interesting applications on the network. He saw this situation changing -slowly, with some of the scientific databases and scholarly discussion -groups and electronic journals coming on as well as with the availability -of Wide Area Information Servers (WAIS) and some of the databases that -are being mounted there. However, many of those things do not seem to -have piqued great popular interest. For instance, most high school -students of LYNCH's acquaintance would not qualify as devotees of serious -molecular biology. - -Concerning the issue of the integrity of presentation, LYNCH believed -that a couple of information providers have laid down the law at least on -certain things. For example, his recollection was that the National -Library of Medicine feels strongly that one needs to employ the -identifier field if he or she is to mount a database commercially. The -problem with a real networked environment is that one does not know who -is reformatting and reprocessing one's data when one enters a client -server mode. It becomes anybody's guess, for example, if the network -uses a Z39.50 server, or what clients are doing with one's data. A data -provider can say that his contract will only permit clients to have -access to his data after he vets them and their presentation and makes -certain it suits him. But LYNCH held out little expectation that the -network marketplace would evolve in that way, because it required too -much prior negotiation. - -CD-ROM software does not network for a variety of reasons, LYNCH said. -He speculated that CD-ROM publishers are not eager to have their products -really hook into wide area networks, because they fear it will make their -data suppliers nervous. Moreover, until relatively recently, one had to -be rather adroit to run a full TCP/IP stack plus applications on a -PC-size machine, whereas nowadays it is becoming easier as PCs grow -bigger and faster. LYNCH also speculated that software providers had not -heard from their customers until the last year or so, or had not heard -from enough of their customers. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -BESSER * Implications of disseminating images on the network; planning -the distribution of multimedia documents poses two critical -implementation problems * Layered approach represents the way to deal -with users' capabilities * Problems in platform design; file size and its -implications for networking * Transmission of megabyte size images -impractical * Compression and decompression at the user's end * Promising -trends for compression * A disadvantage of using X-Windows * A project at -the Smithsonian that mounts images on several networks * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Howard BESSER, School of Library and Information Science, University of -Pittsburgh, spoke primarily about multimedia, focusing on images and the -broad implications of disseminating them on the network. He argued that -planning the distribution of multimedia documents posed two critical -implementation problems, which he framed in the form of two questions: -1) What platform will one use and what hardware and software will users -have for viewing of the material? and 2) How can one deliver a -sufficiently robust set of information in an accessible format in a -reasonable amount of time? Depending on whether network or CD-ROM is the -medium used, this question raises different issues of storage, -compression, and transmission. - -Concerning the design of platforms (e.g., sound, gray scale, simple -color, etc.) and the various capabilities users may have, BESSER -maintained that a layered approach was the way to deal with users' -capabilities. A result would be that users with less powerful -workstations would simply have less functionality. He urged members of -the audience to advocate standards and accompanying software that handle -layered functionality across a wide variety of platforms. - -BESSER also addressed problems in platform design, namely, deciding how -large a machine to design for situations when the largest number of users -have the lowest level of the machine, and one desires higher -functionality. BESSER then proceeded to the question of file size and -its implications for networking. He discussed still images in the main. -For example, a digital color image that fills the screen of a standard -mega-pel workstation (Sun or Next) will require one megabyte of storage -for an eight-bit image or three megabytes of storage for a true color or -twenty-four-bit image. Lossless compression algorithms (that is, -computational procedures in which no data is lost in the process of -compressing [and decompressing] an image--the exact bit-representation is -maintained) might bring storage down to a third of a megabyte per image, -but not much further than that. The question of size makes it difficult -to fit an appropriately sized set of these images on a single disk or to -transmit them quickly enough on a network. - -With these full screen mega-pel images that constitute a third of a -megabyte, one gets 1,000-3,000 full-screen images on a one-gigabyte disk; -a standard CD-ROM represents approximately 60 percent of that. Storing -images the size of a PC screen (just 8 bit color) increases storage -capacity to 4,000-12,000 images per gigabyte; 60 percent of that gives -one the size of a CD-ROM, which in turn creates a major problem. One -cannot have full-screen, full-color images with lossless compression; one -must compress them or use a lower resolution. For megabyte-size images, -anything slower than a T-1 speed is impractical. For example, on a -fifty-six-kilobaud line, it takes three minutes to transfer a -one-megabyte file, if it is not compressed; and this speed assumes ideal -circumstances (no other user contending for network bandwidth). Thus, -questions of disk access, remote display, and current telephone -connection speed make transmission of megabyte-size images impractical. - -BESSER then discussed ways to deal with these large images, for example, -compression and decompression at the user's end. In this connection, the -issues of how much one is willing to lose in the compression process and -what image quality one needs in the first place are unknown. But what is -known is that compression entails some loss of data. BESSER urged that -more studies be conducted on image quality in different situations, for -example, what kind of images are needed for what kind of disciplines, and -what kind of image quality is needed for a browsing tool, an intermediate -viewing tool, and archiving. - -BESSER remarked two promising trends for compression: from a technical -perspective, algorithms that use what is called subjective redundancy -employ principles from visual psycho-physics to identify and remove -information from the image that the human eye cannot perceive; from an -interchange and interoperability perspective, the JPEG (i.e., Joint -Photographic Experts Group, an ISO standard) compression algorithms also -offer promise. These issues of compression and decompression, BESSER -argued, resembled those raised earlier concerning the design of different -platforms. Gauging the capabilities of potential users constitutes a -primary goal. BESSER advocated layering or separating the images from -the applications that retrieve and display them, to avoid tying them to -particular software. - -BESSER detailed several lessons learned from his work at Berkeley with -Imagequery, especially the advantages and disadvantages of using -X-Windows. In the latter category, for example, retrieval is tied -directly to one's data, an intolerable situation in the long run on a -networked system. Finally, BESSER described a project of Jim Wallace at -the Smithsonian Institution, who is mounting images in a extremely -rudimentary way on the Compuserv and Genie networks and is preparing to -mount them on America On Line. Although the average user takes over -thirty minutes to download these images (assuming a fairly fast modem), -nevertheless, images have been downloaded 25,000 times. - -BESSER concluded his talk with several comments on the business -arrangement between the Smithsonian and Compuserv. He contended that not -enough is known concerning the value of images. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Creating digitized photographic collections nearly -impossible except with large organizations like museums * Need for study -to determine quality of images users will tolerate * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the brief exchange between LESK and BESSER that followed, several -clarifications emerged. - -LESK argued that the photographers were far ahead of BESSER: It is -almost impossible to create such digitized photographic collections -except with large organizations like museums, because all the -photographic agencies have been going crazy about this and will not sign -licensing agreements on any sort of reasonable terms. LESK had heard -that National Geographic, for example, had tried to buy the right to use -some image in some kind of educational production for $100 per image, but -the photographers will not touch it. They want accounting and payment -for each use, which cannot be accomplished within the system. BESSER -responded that a consortium of photographers, headed by a former National -Geographic photographer, had started assembling its own collection of -electronic reproductions of images, with the money going back to the -cooperative. - -LESK contended that BESSER was unnecessarily pessimistic about multimedia -images, because people are accustomed to low-quality images, particularly -from video. BESSER urged the launching of a study to determine what -users would tolerate, what they would feel comfortable with, and what -absolutely is the highest quality they would ever need. Conceding that -he had adopted a dire tone in order to arouse people about the issue, -BESSER closed on a sanguine note by saying that he would not be in this -business if he did not think that things could be accomplished. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -LARSEN * Issues of scalability and modularity * Geometric growth of the -Internet and the role played by layering * Basic functions sustaining -this growth * A library's roles and functions in a network environment * -Effects of implementation of the Z39.50 protocol for information -retrieval on the library system * The trade-off between volumes of data -and its potential usage * A snapshot of current trends * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Ronald LARSEN, associate director for information technology, University -of Maryland at College Park, first addressed the issues of scalability -and modularity. He noted the difficulty of anticipating the effects of -orders-of-magnitude growth, reflecting on the twenty years of experience -with the Arpanet and Internet. Recalling the day's demonstrations of -CD-ROM and optical disk material, he went on to ask if the field has yet -learned how to scale new systems to enable delivery and dissemination -across large-scale networks. - -LARSEN focused on the geometric growth of the Internet from its inception -circa 1969 to the present, and the adjustments required to respond to -that rapid growth. To illustrate the issue of scalability, LARSEN -considered computer networks as including three generic components: -computers, network communication nodes, and communication media. Each -component scales (e.g., computers range from PCs to supercomputers; -network nodes scale from interface cards in a PC through sophisticated -routers and gateways; and communication media range from 2,400-baud -dial-up facilities through 4.5-Mbps backbone links, and eventually to -multigigabit-per-second communication lines), and architecturally, the -components are organized to scale hierarchically from local area networks -to international-scale networks. Such growth is made possible by -building layers of communication protocols, as BESSER pointed out. -By layering both physically and logically, a sense of scalability is -maintained from local area networks in offices, across campuses, through -bridges, routers, campus backbones, fiber-optic links, etc., up into -regional networks and ultimately into national and international -networks. - -LARSEN then illustrated the geometric growth over a two-year period-- -through September 1991--of the number of networks that comprise the -Internet. This growth has been sustained largely by the availability of -three basic functions: electronic mail, file transfer (ftp), and remote -log-on (telnet). LARSEN also reviewed the growth in the kind of traffic -that occurs on the network. Network traffic reflects the joint contributions -of a larger population of users and increasing use per user. Today one sees -serious applications involving moving images across the network--a rarity -ten years ago. LARSEN recalled and concurred with BESSER's main point -that the interesting problems occur at the application level. - -LARSEN then illustrated a model of a library's roles and functions in a -network environment. He noted, in particular, the placement of on-line -catalogues onto the network and patrons obtaining access to the library -increasingly through local networks, campus networks, and the Internet. -LARSEN supported LYNCH's earlier suggestion that we need to address -fundamental questions of networked information in order to build -environments that scale in the information sense as well as in the -physical sense. - -LARSEN supported the role of the library system as the access point into -the nation's electronic collections. Implementation of the Z39.50 -protocol for information retrieval would make such access practical and -feasible. For example, this would enable patrons in Maryland to search -California libraries, or other libraries around the world that are -conformant with Z39.50 in a manner that is familiar to University of -Maryland patrons. This client-server model also supports moving beyond -secondary content into primary content. (The notion of how one links -from secondary content to primary content, LARSEN said, represents a -fundamental problem that requires rigorous thought.) After noting -numerous network experiments in accessing full-text materials, including -projects supporting the ordering of materials across the network, LARSEN -revisited the issue of transmitting high-density, high-resolution color -images across the network and the large amounts of bandwidth they -require. He went on to address the bandwidth and synchronization -problems inherent in sending full-motion video across the network. - -LARSEN illustrated the trade-off between volumes of data in bytes or -orders of magnitude and the potential usage of that data. He discussed -transmission rates (particularly, the time it takes to move various forms -of information), and what one could do with a network supporting -multigigabit-per-second transmission. At the moment, the network -environment includes a composite of data-transmission requirements, -volumes and forms, going from steady to bursty (high-volume) and from -very slow to very fast. This aggregate must be considered in the design, -construction, and operation of multigigabyte networks. - -LARSEN's objective is to use the networks and library systems now being -constructed to increase access to resources wherever they exist, and -thus, to evolve toward an on-line electronic virtual library. - -LARSEN concluded by offering a snapshot of current trends: continuing -geometric growth in network capacity and number of users; slower -development of applications; and glacial development and adoption of -standards. The challenge is to design and develop each new application -system with network access and scalability in mind. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -BROWNRIGG * Access to the Internet cannot be taken for granted * Packet -radio and the development of MELVYL in 1980-81 in the Division of Library -Automation at the University of California * Design criteria for packet -radio * A demonstration project in San Diego and future plans * Spread -spectrum * Frequencies at which the radios will run and plans to -reimplement the WAIS server software in the public domain * Need for an -infrastructure of radios that do not move around * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Edwin BROWNRIGG, executive director, Memex Research Institute, first -polled the audience in order to seek out regular users of the Internet as -well as those planning to use it some time in the future. With nearly -everybody in the room falling into one category or the other, BROWNRIGG -made a point re access, namely that numerous individuals, especially those -who use the Internet every day, take for granted their access to it, the -speeds with which they are connected, and how well it all works. -However, as BROWNRIGG discovered between 1987 and 1989 in Australia, -if one wants access to the Internet but cannot afford it or has some -physical boundary that prevents her or him from gaining access, it can -be extremely frustrating. He suggested that because of economics and -physical barriers we were beginning to create a world of haves and have-nots -in the process of scholarly communication, even in the United States. - -BROWNRIGG detailed the development of MELVYL in academic year 1980-81 in -the Division of Library Automation at the University of California, in -order to underscore the issue of access to the system, which at the -outset was extremely limited. In short, the project needed to build a -network, which at that time entailed use of satellite technology, that is, -putting earth stations on campus and also acquiring some terrestrial links -from the State of California's microwave system. The installation of -satellite links, however, did not solve the problem (which actually -formed part of a larger problem involving politics and financial resources). -For while the project team could get a signal onto a campus, it had no means -of distributing the signal throughout the campus. The solution involved -adopting a recent development in wireless communication called packet radio, -which combined the basic notion of packet-switching with radio. The project -used this technology to get the signal from a point on campus where it -came down, an earth station for example, into the libraries, because it -found that wiring the libraries, especially the older marble buildings, -would cost $2,000-$5,000 per terminal. - -BROWNRIGG noted that, ten years ago, the project had neither the public -policy nor the technology that would have allowed it to use packet radio -in any meaningful way. Since then much had changed. He proceeded to -detail research and development of the technology, how it is being -deployed in California, and what direction he thought it would take. -The design criteria are to produce a high-speed, one-time, low-cost, -high-quality, secure, license-free device (packet radio) that one can -plug in and play today, forget about it, and have access to the Internet. -By high speed, BROWNRIGG meant 1 megabyte and 1.5 megabytes. Those units -have been built, he continued, and are in the process of being -type-certified by an independent underwriting laboratory so that they can -be type-licensed by the Federal Communications Commission. As is the -case with citizens band, one will be able to purchase a unit and not have -to worry about applying for a license. - -The basic idea, BROWNRIGG elaborated, is to take high-speed radio data -transmission and create a backbone network that at certain strategic -points in the network will "gateway" into a medium-speed packet radio -(i.e., one that runs at 38.4 kilobytes), so that perhaps by 1994-1995 -people, like those in the audience for the price of a VCR could purchase -a medium-speed radio for the office or home, have full network connectivity -to the Internet, and partake of all its services, with no need for an FCC -license and no regular bill from the local common carrier. BROWNRIGG -presented several details of a demonstration project currently taking -place in San Diego and described plans, pending funding, to install a -full-bore network in the San Francisco area. This network will have 600 -nodes running at backbone speeds, and 100 of these nodes will be libraries, -which in turn will be the gateway ports to the 38.4 kilobyte radios that -will give coverage for the neighborhoods surrounding the libraries. - -BROWNRIGG next explained Part 15.247, a new rule within Title 47 of the -Code of Federal Regulations enacted by the FCC in 1985. This rule -challenged the industry, which has only now risen to the occasion, to -build a radio that would run at no more than one watt of output power and -use a fairly exotic method of modulating the radio wave called spread -spectrum. Spread spectrum in fact permits the building of networks so -that numerous data communications can occur simultaneously, without -interfering with each other, within the same wide radio channel. - -BROWNRIGG explained that the frequencies at which the radios would run -are very short wave signals. They are well above standard microwave and -radar. With a radio wave that small, one watt becomes a tremendous punch -per bit and thus makes transmission at reasonable speed possible. In -order to minimize the potential for congestion, the project is -undertaking to reimplement software which has been available in the -networking business and is taken for granted now, for example, TCP/IP, -routing algorithms, bridges, and gateways. In addition, the project -plans to take the WAIS server software in the public domain and -reimplement it so that one can have a WAIS server on a Mac instead of a -Unix machine. The Memex Research Institute believes that libraries, in -particular, will want to use the WAIS servers with packet radio. This -project, which has a team of about twelve people, will run through 1993 -and will include the 100 libraries already mentioned as well as other -professionals such as those in the medical profession, engineering, and -law. Thus, the need is to create an infrastructure of radios that do not -move around, which, BROWNRIGG hopes, will solve a problem not only for -libraries but for individuals who, by and large today, do not have access -to the Internet from their homes and offices. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Project operating frequencies * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During a brief discussion period, which also concluded the day's -proceedings, BROWNRIGG stated that the project was operating in four -frequencies. The slow speed is operating at 435 megahertz, and it would -later go up to 920 megahertz. With the high-speed frequency, the -one-megabyte radios will run at 2.4 gigabits, and 1.5 will run at 5.7. -At 5.7, rain can be a factor, but it would have to be tropical rain, -unlike what falls in most parts of the United States. - - ****** - -SESSION IV. IMAGE CAPTURE, TEXT CAPTURE, OVERVIEW OF TEXT AND - IMAGE STORAGE FORMATS - -William HOOTON, vice president of operations, I-NET, moderated this session. - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -KENNEY * Factors influencing development of CXP * Advantages of using -digital technology versus photocopy and microfilm * A primary goal of -CXP; publishing challenges * Characteristics of copies printed * Quality -of samples achieved in image capture * Several factors to be considered -in choosing scanning * Emphasis of CXP on timely and cost-effective -production of black-and-white printed facsimiles * Results of producing -microfilm from digital files * Advantages of creating microfilm * Details -concerning production * Costs * Role of digital technology in library -preservation * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Anne KENNEY, associate director, Department of Preservation and -Conservation, Cornell University, opened her talk by observing that the -Cornell Xerox Project (CXP) has been guided by the assumption that the -ability to produce printed facsimiles or to replace paper with paper -would be important, at least for the present generation of users and -equipment. She described three factors that influenced development of -the project: 1) Because the project has emphasized the preservation of -deteriorating brittle books, the quality of what was produced had to be -sufficiently high to return a paper replacement to the shelf. CXP was -only interested in using: 2) a system that was cost-effective, which -meant that it had to be cost-competitive with the processes currently -available, principally photocopy and microfilm, and 3) new or currently -available product hardware and software. - -KENNEY described the advantages that using digital technology offers over -both photocopy and microfilm: 1) The potential exists to create a higher -quality reproduction of a deteriorating original than conventional -light-lens technology. 2) Because a digital image is an encoded -representation, it can be reproduced again and again with no resulting -loss of quality, as opposed to the situation with light-lens processes, -in which there is discernible difference between a second and a -subsequent generation of an image. 3) A digital image can be manipulated -in a number of ways to improve image capture; for example, Xerox has -developed a windowing application that enables one to capture a page -containing both text and illustrations in a manner that optimizes the -reproduction of both. (With light-lens technology, one must choose which -to optimize, text or the illustration; in preservation microfilming, the -current practice is to shoot an illustrated page twice, once to highlight -the text and the second time to provide the best capture for the -illustration.) 4) A digital image can also be edited, density levels -adjusted to remove underlining and stains, and to increase legibility for -faint documents. 5) On-screen inspection can take place at the time of -initial setup and adjustments made prior to scanning, factors that -substantially reduce the number of retakes required in quality control. - -A primary goal of CXP has been to evaluate the paper output printed on -the Xerox DocuTech, a high-speed printer that produces 600-dpi pages from -scanned images at a rate of 135 pages a minute. KENNEY recounted several -publishing challenges to represent faithful and legible reproductions of -the originals that the 600-dpi copy for the most part successfully -captured. For example, many of the deteriorating volumes in the project -were heavily illustrated with fine line drawings or halftones or came in -languages such as Japanese, in which the buildup of characters comprised -of varying strokes is difficult to reproduce at lower resolutions; a -surprising number of them came with annotations and mathematical -formulas, which it was critical to be able to duplicate exactly. - -KENNEY noted that 1) the copies are being printed on paper that meets the -ANSI standards for performance, 2) the DocuTech printer meets the machine -and toner requirements for proper adhesion of print to page, as described -by the National Archives, and thus 3) paper product is considered to be -the archival equivalent of preservation photocopy. - -KENNEY then discussed several samples of the quality achieved in the -project that had been distributed in a handout, for example, a copy of a -print-on-demand version of the 1911 Reed lecture on the steam turbine, -which contains halftones, line drawings, and illustrations embedded in -text; the first four loose pages in the volume compared the capture -capabilities of scanning to photocopy for a standard test target, the -IEEE standard 167A 1987 test chart. In all instances scanning proved -superior to photocopy, though only slightly more so in one. - -Conceding the simplistic nature of her review of the quality of scanning -to photocopy, KENNEY described it as one representation of the kinds of -settings that could be used with scanning capabilities on the equipment -CXP uses. KENNEY also pointed out that CXP investigated the quality -achieved with binary scanning only, and noted the great promise in gray -scale and color scanning, whose advantages and disadvantages need to be -examined. She argued further that scanning resolutions and file formats -can represent a complex trade-off between the time it takes to capture -material, file size, fidelity to the original, and on-screen display; and -printing and equipment availability. All these factors must be taken -into consideration. - -CXP placed primary emphasis on the production in a timely and -cost-effective manner of printed facsimiles that consisted largely of -black-and-white text. With binary scanning, large files may be -compressed efficiently and in a lossless manner (i.e., no data is lost in -the process of compressing [and decompressing] an image--the exact -bit-representation is maintained) using Group 4 CCITT (i.e., the French -acronym for International Consultative Committee for Telegraph and -Telephone) compression. CXP was getting compression ratios of about -forty to one. Gray-scale compression, which primarily uses JPEG, is much -less economical and can represent a lossy compression (i.e., not -lossless), so that as one compresses and decompresses, the illustration -is subtly changed. While binary files produce a high-quality printed -version, it appears 1) that other combinations of spatial resolution with -gray and/or color hold great promise as well, and 2) that gray scale can -represent a tremendous advantage for on-screen viewing. The quality -associated with binary and gray scale also depends on the equipment used. -For instance, binary scanning produces a much better copy on a binary -printer. - -Among CXP's findings concerning the production of microfilm from digital -files, KENNEY reported that the digital files for the same Reed lecture -were used to produce sample film using an electron beam recorder. The -resulting film was faithful to the image capture of the digital files, -and while CXP felt that the text and image pages represented in the Reed -lecture were superior to that of the light-lens film, the resolution -readings for the 600 dpi were not as high as standard microfilming. -KENNEY argued that the standards defined for light-lens technology are -not totally transferable to a digital environment. Moreover, they are -based on definition of quality for a preservation copy. Although making -this case will prove to be a long, uphill struggle, CXP plans to continue -to investigate the issue over the course of the next year. - -KENNEY concluded this portion of her talk with a discussion of the -advantages of creating film: it can serve as a primary backup and as a -preservation master to the digital file; it could then become the print -or production master and service copies could be paper, film, optical -disks, magnetic media, or on-screen display. - -Finally, KENNEY presented details re production: - - * Development and testing of a moderately-high resolution production - scanning workstation represented a third goal of CXP; to date, 1,000 - volumes have been scanned, or about 300,000 images. - - * The resulting digital files are stored and used to produce - hard-copy replacements for the originals and additional prints on - demand; although the initial costs are high, scanning technology - offers an affordable means for reformatting brittle material. - - * A technician in production mode can scan 300 pages per hour when - performing single-sheet scanning, which is a necessity when working - with truly brittle paper; this figure is expected to increase - significantly with subsequent iterations of the software from Xerox; - a three-month time-and-cost study of scanning found that the average - 300-page book would take about an hour and forty minutes to scan - (this figure included the time for setup, which involves keying in - primary bibliographic data, going into quality control mode to - define page size, establishing front-to-back registration, and - scanning sample pages to identify a default range of settings for - the entire book--functions not dissimilar to those performed by - filmers or those preparing a book for photocopy). - - * The final step in the scanning process involved rescans, which - happily were few and far between, representing well under 1 percent - of the total pages scanned. - -In addition to technician time, CXP costed out equipment, amortized over -four years, the cost of storing and refreshing the digital files every -four years, and the cost of printing and binding, book-cloth binding, a -paper reproduction. The total amounted to a little under $65 per single -300-page volume, with 30 percent overhead included--a figure competitive -with the prices currently charged by photocopy vendors. - -Of course, with scanning, in addition to the paper facsimile, one is left -with a digital file from which subsequent copies of the book can be -produced for a fraction of the cost of photocopy, with readers afforded -choices in the form of these copies. - -KENNEY concluded that digital technology offers an electronic means for a -library preservation effort to pay for itself. If a brittle-book program -included the means of disseminating reprints of books that are in demand -by libraries and researchers alike, the initial investment in capture -could be recovered and used to preserve additional but less popular -books. She disclosed that an economic model for a self-sustaining -program could be developed for CXP's report to the Commission on -Preservation and Access (CPA). - -KENNEY stressed that the focus of CXP has been on obtaining high quality -in a production environment. The use of digital technology is viewed as -an affordable alternative to other reformatting options. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -ANDRE * Overview and history of NATDP * Various agricultural CD-ROM -products created inhouse and by service bureaus * Pilot project on -Internet transmission * Additional products in progress * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Pamela ANDRE, associate director for automation, National Agricultural -Text Digitizing Program (NATDP), National Agricultural Library (NAL), -presented an overview of NATDP, which has been underway at NAL the last -four years, before Judith ZIDAR discussed the technical details. ANDRE -defined agricultural information as a broad range of material going from -basic and applied research in the hard sciences to the one-page pamphlets -that are distributed by the cooperative state extension services on such -things as how to grow blueberries. - -NATDP began in late 1986 with a meeting of representatives from the -land-grant library community to deal with the issue of electronic -information. NAL and forty-five of these libraries banded together to -establish this project--to evaluate the technology for converting what -were then source documents in paper form into electronic form, to provide -access to that digital information, and then to distribute it. -Distributing that material to the community--the university community as -well as the extension service community, potentially down to the county -level--constituted the group's chief concern. - -Since January 1988 (when the microcomputer-based scanning system was -installed at NAL), NATDP has done a variety of things, concerning which -ZIDAR would provide further details. For example, the first technology -considered in the project's discussion phase was digital videodisc, which -indicates how long ago it was conceived. - -Over the four years of this project, four separate CD-ROM products on -four different agricultural topics were created, two at a -scanning-and-OCR station installed at NAL, and two by service bureaus. -Thus, NATDP has gained comparative information in terms of those relative -costs. Each of these products contained the full ASCII text as well as -page images of the material, or between 4,000 and 6,000 pages of material -on these disks. Topics included aquaculture, food, agriculture and -science (i.e., international agriculture and research), acid rain, and -Agent Orange, which was the final product distributed (approximately -eighteen months before the Workshop). - -The third phase of NATDP focused on delivery mechanisms other than -CD-ROM. At the suggestion of Clifford LYNCH, who was a technical -consultant to the project at this point, NATDP became involved with the -Internet and initiated a project with the help of North Carolina State -University, in which fourteen of the land-grant university libraries are -transmitting digital images over the Internet in response to interlibrary -loan requests--a topic for another meeting. At this point, the pilot -project had been completed for about a year and the final report would be -available shortly after the Workshop. In the meantime, the project's -success had led to its extension. (ANDRE noted that one of the first -things done under the program title was to select a retrieval package to -use with subsequent products; Windows Personal Librarian was the package -of choice after a lengthy evaluation.) - -Three additional products had been planned and were in progress: - - 1) An arrangement with the American Society of Agronomy--a - professional society that has published the Agronomy Journal since - about 1908--to scan and create bit-mapped images of its journal. - ASA granted permission first to put and then to distribute this - material in electronic form, to hold it at NAL, and to use these - electronic images as a mechanism to deliver documents or print out - material for patrons, among other uses. Effectively, NAL has the - right to use this material in support of its program. - (Significantly, this arrangement offers a potential cooperative - model for working with other professional societies in agriculture - to try to do the same thing--put the journals of particular interest - to agriculture research into electronic form.) - - 2) An extension of the earlier product on aquaculture. - - 3) The George Washington Carver Papers--a joint project with - Tuskegee University to scan and convert from microfilm some 3,500 - images of Carver's papers, letters, and drawings. - -It was anticipated that all of these products would appear no more than -six months after the Workshop. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -ZIDAR * (A separate arena for scanning) * Steps in creating a database * -Image capture, with and without performing OCR * Keying in tracking data -* Scanning, with electronic and manual tracking * Adjustments during -scanning process * Scanning resolutions * Compression * De-skewing and -filtering * Image capture from microform: the papers and letters of -George Washington Carver * Equipment used for a scanning system * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Judith ZIDAR, coordinator, National Agricultural Text Digitizing Program -(NATDP), National Agricultural Library (NAL), illustrated the technical -details of NATDP, including her primary responsibility, scanning and -creating databases on a topic and putting them on CD-ROM. - -(ZIDAR remarked a separate arena from the CD-ROM projects, although the -processing of the material is nearly identical, in which NATDP is also -scanning material and loading it on a Next microcomputer, which in turn -is linked to NAL's integrated library system. Thus, searches in NAL's -bibliographic database will enable people to pull up actual page images -and text for any documents that have been entered.) - -In accordance with the session's topic, ZIDAR focused her illustrated -talk on image capture, offering a primer on the three main steps in the -process: 1) assemble the printed publications; 2) design the database -(database design occurs in the process of preparing the material for -scanning; this step entails reviewing and organizing the material, -defining the contents--what will constitute a record, what kinds of -fields will be captured in terms of author, title, etc.); 3) perform a -certain amount of markup on the paper publications. NAL performs this -task record by record, preparing work sheets or some other sort of -tracking material and designing descriptors and other enhancements to be -added to the data that will not be captured from the printed publication. -Part of this process also involves determining NATDP's file and directory -structure: NATDP attempts to avoid putting more than approximately 100 -images in a directory, because placing more than that on a CD-ROM would -reduce the access speed. - -This up-front process takes approximately two weeks for a -6,000-7,000-page database. The next step is to capture the page images. -How long this process takes is determined by the decision whether or not -to perform OCR. Not performing OCR speeds the process, whereas text -capture requires greater care because of the quality of the image: it -has to be straighter and allowance must be made for text on a page, not -just for the capture of photographs. - -NATDP keys in tracking data, that is, a standard bibliographic record -including the title of the book and the title of the chapter, which will -later either become the access information or will be attached to the -front of a full-text record so that it is searchable. - -Images are scanned from a bound or unbound publication, chiefly from -bound publications in the case of NATDP, however, because often they are -the only copies and the publications are returned to the shelves. NATDP -usually scans one record at a time, because its database tracking system -tracks the document in that way and does not require further logical -separating of the images. After performing optical character -recognition, NATDP moves the images off the hard disk and maintains a -volume sheet. Though the system tracks electronically, all the -processing steps are also tracked manually with a log sheet. - -ZIDAR next illustrated the kinds of adjustments that one can make when -scanning from paper and microfilm, for example, redoing images that need -special handling, setting for dithering or gray scale, and adjusting for -brightness or for the whole book at one time. - -NATDP is scanning at 300 dots per inch, a standard scanning resolution. -Though adequate for capturing text that is all of a standard size, 300 -dpi is unsuitable for any kind of photographic material or for very small -text. Many scanners allow for different image formats, TIFF, of course, -being a de facto standard. But if one intends to exchange images with -other people, the ability to scan other image formats, even if they are -less common, becomes highly desirable. - -CCITT Group 4 is the standard compression for normal black-and-white -images, JPEG for gray scale or color. ZIDAR recommended 1) using the -standard compressions, particularly if one attempts to make material -available and to allow users to download images and reuse them from -CD-ROMs; and 2) maintaining the ability to output an uncompressed image, -because in image exchange uncompressed images are more likely to be able -to cross platforms. - -ZIDAR emphasized the importance of de-skewing and filtering as -requirements on NATDP's upgraded system. For instance, scanning bound -books, particularly books published by the federal government whose pages -are skewed, and trying to scan them straight if OCR is to be performed, -is extremely time-consuming. The same holds for filtering of -poor-quality or older materials. - -ZIDAR described image capture from microform, using as an example three -reels from a sixty-seven-reel set of the papers and letters of George -Washington Carver that had been produced by Tuskegee University. These -resulted in approximately 3,500 images, which NATDP had had scanned by -its service contractor, Science Applications International Corporation -(SAIC). NATDP also created bibliographic records for access. (NATDP did -not have such specialized equipment as a microfilm scanner. - -Unfortunately, the process of scanning from microfilm was not an -unqualified success, ZIDAR reported: because microfilm frame sizes vary, -occasionally some frames were missed, which without spending much time -and money could not be recaptured. - -OCR could not be performed from the scanned images of the frames. The -bleeding in the text simply output text, when OCR was run, that could not -even be edited. NATDP tested for negative versus positive images, -landscape versus portrait orientation, and single- versus dual-page -microfilm, none of which seemed to affect the quality of the image; but -also on none of them could OCR be performed. - -In selecting the microfilm they would use, therefore, NATDP had other -factors in mind. ZIDAR noted two factors that influenced the quality of -the images: 1) the inherent quality of the original and 2) the amount of -size reduction on the pages. - -The Carver papers were selected because they are informative and visually -interesting, treat a single subject, and are valuable in their own right. -The images were scanned and divided into logical records by SAIC, then -delivered, and loaded onto NATDP's system, where bibliographic -information taken directly from the images was added. Scanning was -completed in summer 1991 and by the end of summer 1992 the disk was -scheduled to be published. - -Problems encountered during processing included the following: Because -the microfilm scanning had to be done in a batch, adjustment for -individual page variations was not possible. The frame size varied on -account of the nature of the material, and therefore some of the frames -were missed while others were just partial frames. The only way to go -back and capture this material was to print out the page with the -microfilm reader from the missing frame and then scan it in from the -page, which was extremely time-consuming. The quality of the images -scanned from the printout of the microfilm compared unfavorably with that -of the original images captured directly from the microfilm. The -inability to perform OCR also was a major disappointment. At the time, -computer output microfilm was unavailable to test. - -The equipment used for a scanning system was the last topic addressed by -ZIDAR. The type of equipment that one would purchase for a scanning -system included: a microcomputer, at least a 386, but preferably a 486; -a large hard disk, 380 megabyte at minimum; a multi-tasking operating -system that allows one to run some things in batch in the background -while scanning or doing text editing, for example, Unix or OS/2 and, -theoretically, Windows; a high-speed scanner and scanning software that -allows one to make the various adjustments mentioned earlier; a -high-resolution monitor (150 dpi ); OCR software and hardware to perform -text recognition; an optical disk subsystem on which to archive all the -images as the processing is done; file management and tracking software. - -ZIDAR opined that the software one purchases was more important than the -hardware and might also cost more than the hardware, but it was likely to -prove critical to the success or failure of one's system. In addition to -a stand-alone scanning workstation for image capture, then, text capture -requires one or two editing stations networked to this scanning station -to perform editing. Editing the text takes two or three times as long as -capturing the images. - -Finally, ZIDAR stressed the importance of buying an open system that allows -for more than one vendor, complies with standards, and can be upgraded. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -WATERS *Yale University Library's master plan to convert microfilm to -digital imagery (POB) * The place of electronic tools in the library of -the future * The uses of images and an image library * Primary input from -preservation microfilm * Features distinguishing POB from CXP and key -hypotheses guiding POB * Use of vendor selection process to facilitate -organizational work * Criteria for selecting vendor * Finalists and -results of process for Yale * Key factor distinguishing vendors * -Components, design principles, and some estimated costs of POB * Role of -preservation materials in developing imaging market * Factors affecting -quality and cost * Factors affecting the usability of complex documents -in image form * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Donald WATERS, head of the Systems Office, Yale University Library, -reported on the progress of a master plan for a project at Yale to -convert microfilm to digital imagery, Project Open Book (POB). Stating -that POB was in an advanced stage of planning, WATERS detailed, in -particular, the process of selecting a vendor partner and several key -issues under discussion as Yale prepares to move into the project itself. -He commented first on the vision that serves as the context of POB and -then described its purpose and scope. - -WATERS sees the library of the future not necessarily as an electronic -library but as a place that generates, preserves, and improves for its -clients ready access to both intellectual and physical recorded -knowledge. Electronic tools must find a place in the library in the -context of this vision. Several roles for electronic tools include -serving as: indirect sources of electronic knowledge or as "finding" -aids (the on-line catalogues, the article-level indices, registers for -documents and archives); direct sources of recorded knowledge; full-text -images; and various kinds of compound sources of recorded knowledge (the -so-called compound documents of Hypertext, mixed text and image, -mixed-text image format, and multimedia). - -POB is looking particularly at images and an image library, the uses to -which images will be put (e.g., storage, printing, browsing, and then use -as input for other processes), OCR as a subsequent process to image -capture, or creating an image library, and also possibly generating -microfilm. - -While input will come from a variety of sources, POB is considering -especially input from preservation microfilm. A possible outcome is that -the film and paper which provide the input for the image library -eventually may go off into remote storage, and that the image library may -be the primary access tool. - -The purpose and scope of POB focus on imaging. Though related to CXP, -POB has two features which distinguish it: 1) scale--conversion of -10,000 volumes into digital image form; and 2) source--conversion from -microfilm. Given these features, several key working hypotheses guide -POB, including: 1) Since POB is using microfilm, it is not concerned with -the image library as a preservation medium. 2) Digital imagery can improve -access to recorded knowledge through printing and network distribution at -a modest incremental cost of microfilm. 3) Capturing and storing documents -in a digital image form is necessary to further improvements in access. -(POB distinguishes between the imaging, digitizing process and OCR, -which at this stage it does not plan to perform.) - -Currently in its first or organizational phase, POB found that it could -use a vendor selection process to facilitate a good deal of the -organizational work (e.g., creating a project team and advisory board, -confirming the validity of the plan, establishing the cost of the project -and a budget, selecting the materials to convert, and then raising the -necessary funds). - -POB developed numerous selection criteria, including: a firm committed -to image-document management, the ability to serve as systems integrator -in a large-scale project over several years, interest in developing the -requisite software as a standard rather than a custom product, and a -willingness to invest substantial resources in the project itself. - -Two vendors, DEC and Xerox, were selected as finalists in October 1991, -and with the support of the Commission on Preservation and Access, each -was commissioned to generate a detailed requirements analysis for the -project and then to submit a formal proposal for the completion of the -project, which included a budget and costs. The terms were that POB would -pay the loser. The results for Yale of involving a vendor included: -broad involvement of Yale staff across the board at a relatively low -cost, which may have long-term significance in carrying out the project -(twenty-five to thirty university people are engaged in POB); better -understanding of the factors that affect corporate response to markets -for imaging products; a competitive proposal; and a more sophisticated -view of the imaging markets. - -The most important factor that distinguished the vendors under -consideration was their identification with the customer. The size and -internal complexity of the company also was an important factor. POB was -looking at large companies that had substantial resources. In the end, -the process generated for Yale two competitive proposals, with Xerox's -the clear winner. WATERS then described the components of the proposal, -the design principles, and some of the costs estimated for the process. - -Components are essentially four: a conversion subsystem, a -network-accessible storage subsystem for 10,000 books (and POB expects -200 to 600 dpi storage), browsing stations distributed on the campus -network, and network access to the image printers. - -Among the design principles, POB wanted conversion at the highest -possible resolution. Assuming TIFF files, TIFF files with Group 4 -compression, TCP/IP, and ethernet network on campus, POB wanted a -client-server approach with image documents distributed to the -workstations and made accessible through native workstation interfaces -such as Windows. POB also insisted on a phased approach to -implementation: 1) a stand-alone, single-user, low-cost entry into the -business with a workstation focused on conversion and allowing POB to -explore user access; 2) movement into a higher-volume conversion with -network-accessible storage and multiple access stations; and 3) a -high-volume conversion, full-capacity storage, and multiple browsing -stations distributed throughout the campus. - -The costs proposed for start-up assumed the existence of the Yale network -and its two DocuTech image printers. Other start-up costs are estimated -at $1 million over the three phases. At the end of the project, the annual -operating costs estimated primarily for the software and hardware proposed -come to about $60,000, but these exclude costs for labor needed in the -conversion process, network and printer usage, and facilities management. - -Finally, the selection process produced for Yale a more sophisticated -view of the imaging markets: the management of complex documents in -image form is not a preservation problem, not a library problem, but a -general problem in a broad, general industry. Preservation materials are -useful for developing that market because of the qualities of the -material. For example, much of it is out of copyright. The resolution -of key issues such as the quality of scanning and image browsing also -will affect development of that market. - -The technology is readily available but changing rapidly. In this -context of rapid change, several factors affect quality and cost, to -which POB intends to pay particular attention, for example, the various -levels of resolution that can be achieved. POB believes it can bring -resolution up to 600 dpi, but an interpolation process from 400 to 600 is -more likely. The variation quality in microfilm will prove to be a -highly important factor. POB may reexamine the standards used to film in -the first place by looking at this process as a follow-on to microfilming. - -Other important factors include: the techniques available to the -operator for handling material, the ways of integrating quality control -into the digitizing work flow, and a work flow that includes indexing and -storage. POB's requirement was to be able to deal with quality control -at the point of scanning. Thus, thanks to Xerox, POB anticipates having -a mechanism which will allow it not only to scan in batch form, but to -review the material as it goes through the scanner and control quality -from the outset. - -The standards for measuring quality and costs depend greatly on the uses -of the material, including subsequent OCR, storage, printing, and -browsing. But especially at issue for POB is the facility for browsing. -This facility, WATERS said, is perhaps the weakest aspect of imaging -technology and the most in need of development. - -A variety of factors affect the usability of complex documents in image -form, among them: 1) the ability of the system to handle the full range -of document types, not just monographs but serials, multi-part -monographs, and manuscripts; 2) the location of the database of record -for bibliographic information about the image document, which POB wants -to enter once and in the most useful place, the on-line catalog; 3) a -document identifier for referencing the bibliographic information in one -place and the images in another; 4) the technique for making the basic -internal structure of the document accessible to the reader; and finally, -5) the physical presentation on the CRT of those documents. POB is ready -to complete this phase now. One last decision involves deciding which -material to scan. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * TIFF files constitute de facto standard * NARA's experience -with image conversion software and text conversion * RFC 1314 * -Considerable flux concerning available hardware and software solutions * -NAL through-put rate during scanning * Window management questions * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -In the question-and-answer period that followed WATERS's presentation, -the following points emerged: - - * ZIDAR's statement about using TIFF files as a standard meant de - facto standard. This is what most people use and typically exchange - with other groups, across platforms, or even occasionally across - display software. - - * HOLMES commented on the unsuccessful experience of NARA in - attempting to run image-conversion software or to exchange between - applications: What are supposedly TIFF files go into other software - that is supposed to be able to accept TIFF but cannot recognize the - format and cannot deal with it, and thus renders the exchange - useless. Re text conversion, he noted the different recognition - rates obtained by substituting the make and model of scanners in - NARA's recent test of an "intelligent" character-recognition product - for a new company. In the selection of hardware and software, - HOLMES argued, software no longer constitutes the overriding factor - it did until about a year ago; rather it is perhaps important to - look at both now. - - * Danny Cohen and Alan Katz of the University of Southern California - Information Sciences Institute began circulating as an Internet RFC - (RFC 1314) about a month ago a standard for a TIFF interchange - format for Internet distribution of monochrome bit-mapped images, - which LYNCH said he believed would be used as a de facto standard. - - * FLEISCHHAUER's impression from hearing these reports and thinking - about AM's experience was that there is considerable flux concerning - available hardware and software solutions. HOOTON agreed and - commented at the same time on ZIDAR's statement that the equipment - employed affects the results produced. One cannot draw a complete - conclusion by saying it is difficult or impossible to perform OCR - from scanning microfilm, for example, with that device, that set of - parameters, and system requirements, because numerous other people - are accomplishing just that, using other components, perhaps. - HOOTON opined that both the hardware and the software were highly - important. Most of the problems discussed today have been solved in - numerous different ways by other people. Though it is good to be - cognizant of various experiences, this is not to say that it will - always be thus. - - * At NAL, the through-put rate of the scanning process for paper, - page by page, performing OCR, ranges from 300 to 600 pages per day; - not performing OCR is considerably faster, although how much faster - is not known. This is for scanning from bound books, which is much - slower. - - * WATERS commented on window management questions: DEC proposed an - X-Windows solution which was problematical for two reasons. One was - POB's requirement to be able to manipulate images on the workstation - and bring them down to the workstation itself and the other was - network usage. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -THOMA * Illustration of deficiencies in scanning and storage process * -Image quality in this process * Different costs entailed by better image -quality * Techniques for overcoming various de-ficiencies: fixed -thresholding, dynamic thresholding, dithering, image merge * Page edge -effects * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -George THOMA, chief, Communications Engineering Branch, National Library -of Medicine (NLM), illustrated several of the deficiencies discussed by -the previous speakers. He introduced the topic of special problems by -noting the advantages of electronic imaging. For example, it is regenerable -because it is a coded file, and real-time quality control is possible with -electronic capture, whereas in photographic capture it is not. - -One of the difficulties discussed in the scanning and storage process was -image quality which, without belaboring the obvious, means different -things for maps, medical X-rays, or broadcast television. In the case of -documents, THOMA said, image quality boils down to legibility of the -textual parts, and fidelity in the case of gray or color photo print-type -material. Legibility boils down to scan density, the standard in most -cases being 300 dpi. Increasing the resolution with scanners that -perform 600 or 1200 dpi, however, comes at a cost. - -Better image quality entails at least four different kinds of costs: 1) -equipment costs, because the CCD (i.e., charge-couple device) with -greater number of elements costs more; 2) time costs that translate to -the actual capture costs, because manual labor is involved (the time is -also dependent on the fact that more data has to be moved around in the -machine in the scanning or network devices that perform the scanning as -well as the storage); 3) media costs, because at high resolutions larger -files have to be stored; and 4) transmission costs, because there is just -more data to be transmitted. - -But while resolution takes care of the issue of legibility in image -quality, other deficiencies have to do with contrast and elements on the -page scanned or the image that needed to be removed or clarified. Thus, -THOMA proceeded to illustrate various deficiencies, how they are -manifested, and several techniques to overcome them. - -Fixed thresholding was the first technique described, suitable for -black-and-white text, when the contrast does not vary over the page. One -can have many different threshold levels in scanning devices. Thus, -THOMA offered an example of extremely poor contrast, which resulted from -the fact that the stock was a heavy red. This is the sort of image that -when microfilmed fails to provide any legibility whatsoever. Fixed -thresholding is the way to change the black-to-red contrast to the -desired black-to-white contrast. - -Other examples included material that had been browned or yellowed by -age. This was also a case of contrast deficiency, and correction was -done by fixed thresholding. A final example boils down to the same -thing, slight variability, but it is not significant. Fixed thresholding -solves this problem as well. The microfilm equivalent is certainly legible, -but it comes with dark areas. Though THOMA did not have a slide of the -microfilm in this case, he did show the reproduced electronic image. - -When one has variable contrast over a page or the lighting over the page -area varies, especially in the case where a bound volume has light -shining on it, the image must be processed by a dynamic thresholding -scheme. One scheme, dynamic averaging, allows the threshold level not to -be fixed but to be recomputed for every pixel from the neighboring -characteristics. The neighbors of a pixel determine where the threshold -should be set for that pixel. - -THOMA showed an example of a page that had been made deficient by a -variety of techniques, including a burn mark, coffee stains, and a yellow -marker. Application of a fixed-thresholding scheme, THOMA argued, might -take care of several deficiencies on the page but not all of them. -Performing the calculation for a dynamic threshold setting, however, -removes most of the deficiencies so that at least the text is legible. - -Another problem is representing a gray level with black-and-white pixels -by a process known as dithering or electronic screening. But dithering -does not provide good image quality for pure black-and-white textual -material. THOMA illustrated this point with examples. Although its -suitability for photoprint is the reason for electronic screening or -dithering, it cannot be used for every compound image. In the document -that was distributed by CXP, THOMA noticed that the dithered image of the -IEEE test chart evinced some deterioration in the text. He presented an -extreme example of deterioration in the text in which compounded -documents had to be set right by other techniques. The technique -illustrated by the present example was an image merge in which the page -is scanned twice and the settings go from fixed threshold to the -dithering matrix; the resulting images are merged to give the best -results with each technique. - -THOMA illustrated how dithering is also used in nonphotographic or -nonprint materials with an example of a grayish page from a medical text, -which was reproduced to show all of the gray that appeared in the -original. Dithering provided a reproduction of all the gray in the -original of another example from the same text. - -THOMA finally illustrated the problem of bordering, or page-edge, -effects. Books and bound volumes that are placed on a photocopy machine -or a scanner produce page-edge effects that are undesirable for two -reasons: 1) the aesthetics of the image; after all, if the image is to -be preserved, one does not necessarily want to keep all of its -deficiencies; 2) compression (with the bordering problem THOMA -illustrated, the compression ratio deteriorated tremendously). One way -to eliminate this more serious problem is to have the operator at the -point of scanning window the part of the image that is desirable and -automatically turn all of the pixels out of that picture to white. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -FLEISCHHAUER * AM's experience with scanning bound materials * Dithering -* -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Carl FLEISCHHAUER, coordinator, American Memory, Library of Congress, -reported AM's experience with scanning bound materials, which he likened -to the problems involved in using photocopying machines. Very few -devices in the industry offer book-edge scanning, let alone book cradles. -The problem may be unsolvable, FLEISCHHAUER said, because a large enough -market does not exist for a preservation-quality scanner. AM is using a -Kurzweil scanner, which is a book-edge scanner now sold by Xerox. - -Devoting the remainder of his brief presentation to dithering, -FLEISCHHAUER related AM's experience with a contractor who was using -unsophisticated equipment and software to reduce moire patterns from -printed halftones. AM took the same image and used the dithering -algorithm that forms part of the same Kurzweil Xerox scanner; it -disguised moire patterns much more effectively. - -FLEISCHHAUER also observed that dithering produces a binary file which is -useful for numerous purposes, for example, printing it on a laser printer -without having to "re-halftone" it. But it tends to defeat efficient -compression, because the very thing that dithers to reduce moire patterns -also tends to work against compression schemes. AM thought the -difference in image quality was worth it. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Relative use as a criterion for POB's selection of books to -be converted into digital form * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the discussion period, WATERS noted that one of the criteria for -selecting books among the 10,000 to be converted into digital image form -would be how much relative use they would receive--a subject still -requiring evaluation. The challenge will be to understand whether -coherent bodies of material will increase usage or whether POB should -seek material that is being used, scan that, and make it more accessible. -POB might decide to digitize materials that are already heavily used, in -order to make them more accessible and decrease wear on them. Another -approach would be to provide a large body of intellectually coherent -material that may be used more in digital form than it is currently used -in microfilm. POB would seek material that was out of copyright. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -BARONAS * Origin and scope of AIIM * Types of documents produced in -AIIM's standards program * Domain of AIIM's standardization work * AIIM's -structure * TC 171 and MS23 * Electronic image management standards * -Categories of EIM standardization where AIIM standards are being -developed * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Jean BARONAS, senior manager, Department of Standards and Technology, -Association for Information and Image Management (AIIM), described the -not-for-profit association and the national and international programs -for standardization in which AIIM is active. - -Accredited for twenty-five years as the nation's standards development -organization for document image management, AIIM began life in a library -community developing microfilm standards. Today the association -maintains both its library and business-image management standardization -activities--and has moved into electronic image-management -standardization (EIM). - -BARONAS defined the program's scope. AIIM deals with: 1) the -terminology of standards and of the technology it uses; 2) methods of -measurement for the systems, as well as quality; 3) methodologies for -users to evaluate and measure quality; 4) the features of apparatus used -to manage and edit images; and 5) the procedures used to manage images. - -BARONAS noted that three types of documents are produced in the AIIM -standards program: the first two, accredited by the American National -Standards Institute (ANSI), are standards and standard recommended -practices. Recommended practices differ from standards in that they -contain more tutorial information. A technical report is not an ANSI -standard. Because AIIM's policies and procedures for developing -standards are approved by ANSI, its standards are labeled ANSI/AIIM, -followed by the number and title of the standard. - -BARONAS then illustrated the domain of AIIM's standardization work. For -example, AIIM is the administrator of the U.S. Technical Advisory Group -(TAG) to the International Standards Organization's (ISO) technical -committee, TC l7l Micrographics and Optical Memories for Document and -Image Recording, Storage, and Use. AIIM officially works through ANSI in -the international standardization process. - -BARONAS described AIIM's structure, including its board of directors, its -standards board of twelve individuals active in the image-management -industry, its strategic planning and legal admissibility task forces, and -its National Standards Council, which is comprised of the members of a -number of organizations who vote on every AIIM standard before it is -published. BARONAS pointed out that AIIM's liaisons deal with numerous -other standards developers, including the optical disk community, office -and publishing systems, image-codes-and-character set committees, and the -National Information Standards Organization (NISO). - -BARONAS illustrated the procedures of TC l7l, which covers all aspects of -image management. When AIIM's national program has conceptualized a new -project, it is usually submitted to the international level, so that the -member countries of TC l7l can simultaneously work on the development of -the standard or the technical report. BARONAS also illustrated a classic -microfilm standard, MS23, which deals with numerous imaging concepts that -apply to electronic imaging. Originally developed in the l970s, revised -in the l980s, and revised again in l991, this standard is scheduled for -another revision. MS23 is an active standard whereby users may propose -new density ranges and new methods of evaluating film images in the -standard's revision. - -BARONAS detailed several electronic image-management standards, for -instance, ANSI/AIIM MS44, a quality-control guideline for scanning 8.5" -by 11" black-and-white office documents. This standard is used with the -IEEE fax image--a continuous tone photographic image with gray scales, -text, and several continuous tone pictures--and AIIM test target number -2, a representative document used in office document management. - -BARONAS next outlined the four categories of EIM standardization in which -AIIM standards are being developed: transfer and retrieval, evaluation, -optical disc and document scanning applications, and design and -conversion of documents. She detailed several of the main projects of -each: 1) in the category of image transfer and retrieval, a bi-level -image transfer format, ANSI/AIIM MS53, which is a proposed standard that -describes a file header for image transfer between unlike systems when -the images are compressed using G3 and G4 compression; 2) the category of -image evaluation, which includes the AIIM-proposed TR26 tutorial on image -resolution (this technical report will treat the differences and -similarities between classical or photographic and electronic imaging); -3) design and conversion, which includes a proposed technical report -called "Forms Design Optimization for EIM" (this report considers how -general-purpose business forms can be best designed so that scanning is -optimized; reprographic characteristics such as type, rules, background, -tint, and color will likewise be treated in the technical report); 4) -disk and document scanning applications includes a project a) on planning -platters and disk management, b) on generating an application profile for -EIM when images are stored and distributed on CD-ROM, and c) on -evaluating SCSI2, and how a common command set can be generated for SCSI2 -so that document scanners are more easily integrated. (ANSI/AIIM MS53 -will also apply to compressed images.) - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -BATTIN * The implications of standards for preservation * A major -obstacle to successful cooperation * A hindrance to access in the digital -environment * Standards a double-edged sword for those concerned with the -preservation of the human record * Near-term prognosis for reliable -archival standards * Preservation concerns for electronic media * Need -for reconceptualizing our preservation principles * Standards in the real -world and the politics of reproduction * Need to redefine the concept of -archival and to begin to think in terms of life cycles * Cooperation and -the La Guardia Eight * Concerns generated by discussions on the problems -of preserving text and image * General principles to be adopted in a -world without standards * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Patricia BATTIN, president, the Commission on Preservation and Access -(CPA), addressed the implications of standards for preservation. She -listed several areas where the library profession and the analog world of -the printed book had made enormous contributions over the past hundred -years--for example, in bibliographic formats, binding standards, and, most -important, in determining what constitutes longevity or archival quality. - -Although standards have lightened the preservation burden through the -development of national and international collaborative programs, -nevertheless, a pervasive mistrust of other people's standards remains a -major obstacle to successful cooperation, BATTIN said. - -The zeal to achieve perfection, regardless of the cost, has hindered -rather than facilitated access in some instances, and in the digital -environment, where no real standards exist, has brought an ironically -just reward. - -BATTIN argued that standards are a double-edged sword for those concerned -with the preservation of the human record, that is, the provision of -access to recorded knowledge in a multitude of media as far into the -future as possible. Standards are essential to facilitate -interconnectivity and access, but, BATTIN said, as LYNCH pointed out -yesterday, if set too soon they can hinder creativity, expansion of -capability, and the broadening of access. The characteristics of -standards for digital imagery differ radically from those for analog -imagery. And the nature of digital technology implies continuing -volatility and change. To reiterate, precipitous standard-setting can -inhibit creativity, but delayed standard-setting results in chaos. - -Since in BATTIN'S opinion the near-term prognosis for reliable archival -standards, as defined by librarians in the analog world, is poor, two -alternatives remain: standing pat with the old technology, or -reconceptualizing. - -Preservation concerns for electronic media fall into two general domains. -One is the continuing assurance of access to knowledge originally -generated, stored, disseminated, and used in electronic form. This -domain contains several subdivisions, including 1) the closed, -proprietary systems discussed the previous day, bundled information such -as electronic journals and government agency records, and electronically -produced or captured raw data; and 2) the application of digital -technologies to the reformatting of materials originally published on a -deteriorating analog medium such as acid paper or videotape. - -The preservation of electronic media requires a reconceptualizing of our -preservation principles during a volatile, standardless transition which -may last far longer than any of us envision today. BATTIN urged the -necessity of shifting focus from assessing, measuring, and setting -standards for the permanence of the medium to the concept of managing -continuing access to information stored on a variety of media and -requiring a variety of ever-changing hardware and software for access--a -fundamental shift for the library profession. - -BATTIN offered a primer on how to move forward with reasonable confidence -in a world without standards. Her comments fell roughly into two sections: -1) standards in the real world and 2) the politics of reproduction. - -In regard to real-world standards, BATTIN argued the need to redefine the -concept of archive and to begin to think in terms of life cycles. In -the past, the naive assumption that paper would last forever produced a -cavalier attitude toward life cycles. The transient nature of the -electronic media has compelled people to recognize and accept upfront the -concept of life cycles in place of permanency. - -Digital standards have to be developed and set in a cooperative context -to ensure efficient exchange of information. Moreover, during this -transition period, greater flexibility concerning how concepts such as -backup copies and archival copies in the CXP are defined is necessary, -or the opportunity to move forward will be lost. - -In terms of cooperation, particularly in the university setting, BATTIN -also argued the need to avoid going off in a hundred different -directions. The CPA has catalyzed a small group of universities called -the La Guardia Eight--because La Guardia Airport is where meetings take -place--Harvard, Yale, Cornell, Princeton, Penn State, Tennessee, -Stanford, and USC, to develop a digital preservation consortium to look -at all these issues and develop de facto standards as we move along, -instead of waiting for something that is officially blessed. Continuing -to apply analog values and definitions of standards to the digital -environment, BATTIN said, will effectively lead to forfeiture of the -benefits of digital technology to research and scholarship. - -Under the second rubric, the politics of reproduction, BATTIN reiterated -an oft-made argument concerning the electronic library, namely, that it -is more difficult to transform than to create, and nowhere is that belief -expressed more dramatically than in the conversion of brittle books to -new media. Preserving information published in electronic media involves -making sure the information remains accessible and that digital -information is not lost through reproduction. In the analog world of -photocopies and microfilm, the issue of fidelity to the original becomes -paramount, as do issues of "Whose fidelity?" and "Whose original?" - -BATTIN elaborated these arguments with a few examples from a recent study -conducted by the CPA on the problems of preserving text and image. -Discussions with scholars, librarians, and curators in a variety of -disciplines dependent on text and image generated a variety of concerns, -for example: 1) Copy what is, not what the technology is capable of. -This is very important for the history of ideas. Scholars wish to know -what the author saw and worked from. And make available at the -workstation the opportunity to erase all the defects and enhance the -presentation. 2) The fidelity of reproduction--what is good enough, what -can we afford, and the difference it makes--issues of subjective versus -objective resolution. 3) The differences between primary and secondary -users. Restricting the definition of primary user to the one in whose -discipline the material has been published runs one headlong into the -reality that these printed books have had a host of other users from a -host of other disciplines, who not only were looking for very different -things, but who also shared values very different from those of the -primary user. 4) The relationship of the standard of reproduction to new -capabilities of scholarship--the browsing standard versus an archival -standard. How good must the archival standard be? Can a distinction be -drawn between potential users in setting standards for reproduction? -Archival storage, use copies, browsing copies--ought an attempt to set -standards even be made? 5) Finally, costs. How much are we prepared to -pay to capture absolute fidelity? What are the trade-offs between vastly -enhanced access, degrees of fidelity, and costs? - -These standards, BATTIN concluded, serve to complicate further the -reproduction process, and add to the long list of technical standards -that are necessary to ensure widespread access. Ways to articulate and -analyze the costs that are attached to the different levels of standards -must be found. - -Given the chaos concerning standards, which promises to linger for the -foreseeable future, BATTIN urged adoption of the following general -principles: - - * Strive to understand the changing information requirements of - scholarly disciplines as more and more technology is integrated into - the process of research and scholarly communication in order to meet - future scholarly needs, not to build for the past. Capture - deteriorating information at the highest affordable resolution, even - though the dissemination and display technologies will lag. - - * Develop cooperative mechanisms to foster agreement on protocols - for document structure and other interchange mechanisms necessary - for widespread dissemination and use before official standards are - set. - - * Accept that, in a transition period, de facto standards will have - to be developed. - - * Capture information in a way that keeps all options open and - provides for total convertibility: OCR, scanning of microfilm, - producing microfilm from scanned documents, etc. - - * Work closely with the generators of information and the builders - of networks and databases to ensure that continuing accessibility is - a primary concern from the beginning. - - * Piggyback on standards under development for the broad market, and - avoid library-specific standards; work with the vendors, in order to - take advantage of that which is being standardized for the rest of - the world. - - * Concentrate efforts on managing permanence in the digital world, - rather than perfecting the longevity of a particular medium. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Additional comments on TIFF * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the brief discussion period that followed BATTIN's presentation, -BARONAS explained that TIFF was not developed in collaboration with or -under the auspices of AIIM. TIFF is a company product, not a standard, -is owned by two corporations, and is always changing. BARONAS also -observed that ANSI/AIIM MS53, a bi-level image file transfer format that -allows unlike systems to exchange images, is compatible with TIFF as well -as with DEC's architecture and IBM's MODCA/IOCA. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -HOOTON * Several questions to be considered in discussing text conversion -* -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -HOOTON introduced the final topic, text conversion, by noting that it is -becoming an increasingly important part of the imaging business. Many -people now realize that it enhances their system to be able to have more -and more character data as part of their imaging system. Re the issue of -OCR versus rekeying, HOOTON posed several questions: How does one get -text into computer-readable form? Does one use automated processes? -Does one attempt to eliminate the use of operators where possible? -Standards for accuracy, he said, are extremely important: it makes a -major difference in cost and time whether one sets as a standard 98.5 -percent acceptance or 99.5 percent. He mentioned outsourcing as a -possibility for converting text. Finally, what one does with the image -to prepare it for the recognition process is also important, he said, -because such preparation changes how recognition is viewed, as well as -facilitates recognition itself. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -LESK * Roles of participants in CORE * Data flow * The scanning process * -The image interface * Results of experiments involving the use of -electronic resources and traditional paper copies * Testing the issue of -serendipity * Conclusions * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Michael LESK, executive director, Computer Science Research, Bell -Communications Research, Inc. (Bellcore), discussed the Chemical Online -Retrieval Experiment (CORE), a cooperative project involving Cornell -University, OCLC, Bellcore, and the American Chemical Society (ACS). - -LESK spoke on 1) how the scanning was performed, including the unusual -feature of page segmentation, and 2) the use made of the text and the -image in experiments. - -Working with the chemistry journals (because ACS has been saving its -typesetting tapes since the mid-1970s and thus has a significant back-run -of the most important chemistry journals in the United States), CORE is -attempting to create an automated chemical library. Approximately a -quarter of the pages by square inch are made up of images of -quasi-pictorial material; dealing with the graphic components of the -pages is extremely important. LESK described the roles of participants -in CORE: 1) ACS provides copyright permission, journals on paper, -journals on microfilm, and some of the definitions of the files; 2) at -Bellcore, LESK chiefly performs the data preparation, while Dennis Egan -performs experiments on the users of chemical abstracts, and supplies the -indexing and numerous magnetic tapes; 3) Cornell provides the site of the -experiment; 4) OCLC develops retrieval software and other user interfaces. -Various manufacturers and publishers have furnished other help. - -Concerning data flow, Bellcore receives microfilm and paper from ACS; the -microfilm is scanned by outside vendors, while the paper is scanned -inhouse on an Improvision scanner, twenty pages per minute at 300 dpi, -which provides sufficient quality for all practical uses. LESK would -prefer to have more gray level, because one of the ACS journals prints on -some colored pages, which creates a problem. - -Bellcore performs all this scanning, creates a page-image file, and also -selects from the pages the graphics, to mix with the text file (which is -discussed later in the Workshop). The user is always searching the ASCII -file, but she or he may see a display based on the ASCII or a display -based on the images. - -LESK illustrated how the program performs page analysis, and the image -interface. (The user types several words, is presented with a list-- -usually of the titles of articles contained in an issue--that derives -from the ASCII, clicks on an icon and receives an image that mirrors an -ACS page.) LESK also illustrated an alternative interface, based on text -on the ASCII, the so-called SuperBook interface from Bellcore. - -LESK next presented the results of an experiment conducted by Dennis Egan -and involving thirty-six students at Cornell, one third of them -undergraduate chemistry majors, one third senior undergraduate chemistry -majors, and one third graduate chemistry students. A third of them -received the paper journals, the traditional paper copies and chemical -abstracts on paper. A third received image displays of the pictures of -the pages, and a third received the text display with pop-up graphics. - -The students were given several questions made up by some chemistry -professors. The questions fell into five classes, ranging from very easy -to very difficult, and included questions designed to simulate browsing -as well as a traditional information retrieval-type task. - -LESK furnished the following results. In the straightforward question -search--the question being, what is the phosphorus oxygen bond distance -and hydroxy phosphate?--the students were told that they could take -fifteen minutes and, then, if they wished, give up. The students with -paper took more than fifteen minutes on average, and yet most of them -gave up. The students with either electronic format, text or image, -received good scores in reasonable time, hardly ever had to give up, and -usually found the right answer. - -In the browsing study, the students were given a list of eight topics, -told to imagine that an issue of the Journal of the American Chemical -Society had just appeared on their desks, and were also told to flip -through it and to find topics mentioned in the issue. The average scores -were about the same. (The students were told to answer yes or no about -whether or not particular topics appeared.) The errors, however, were -quite different. The students with paper rarely said that something -appeared when it had not. But they often failed to find something -actually mentioned in the issue. The computer people found numerous -things, but they also frequently said that a topic was mentioned when it -was not. (The reason, of course, was that they were performing word -searches. They were finding that words were mentioned and they were -concluding that they had accomplished their task.) - -This question also contained a trick to test the issue of serendipity. -The students were given another list of eight topics and instructed, -without taking a second look at the journal, to recall how many of this -new list of eight topics were in this particular issue. This was an -attempt to see if they performed better at remembering what they were not -looking for. They all performed about the same, paper or electronics, -about 62 percent accurate. In short, LESK said, people were not very -good when it came to serendipity, but they were no worse at it with -computers than they were with paper. - -(LESK gave a parenthetical illustration of the learning curve of students -who used SuperBook.) - -The students using the electronic systems started off worse than the ones -using print, but by the third of the three sessions in the series had -caught up to print. As one might expect, electronics provide a much -better means of finding what one wants to read; reading speeds, once the -object of the search has been found, are about the same. - -Almost none of the students could perform the hard task--the analogous -transformation. (It would require the expertise of organic chemists to -complete.) But an interesting result was that the students using the text -search performed terribly, while those using the image system did best. -That the text search system is driven by text offers the explanation. -Everything is focused on the text; to see the pictures, one must press -on an icon. Many students found the right article containing the answer -to the question, but they did not click on the icon to bring up the right -figure and see it. They did not know that they had found the right place, -and thus got it wrong. - -The short answer demonstrated by this experiment was that in the event -one does not know what to read, one needs the electronic systems; the -electronic systems hold no advantage at the moment if one knows what to -read, but neither do they impose a penalty. - -LESK concluded by commenting that, on one hand, the image system was easy -to use. On the other hand, the text display system, which represented -twenty man-years of work in programming and polishing, was not winning, -because the text was not being read, just searched. The much easier -system is highly competitive as well as remarkably effective for the -actual chemists. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -ERWAY * Most challenging aspect of working on AM * Assumptions guiding -AM's approach * Testing different types of service bureaus * AM's -requirement for 99.95 percent accuracy * Requirements for text-coding * -Additional factors influencing AM's approach to coding * Results of AM's -experience with rekeying * Other problems in dealing with service bureaus -* Quality control the most time-consuming aspect of contracting out -conversion * Long-term outlook uncertain * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -To Ricky ERWAY, associate coordinator, American Memory, Library of -Congress, the constant variety of conversion projects taking place -simultaneously represented perhaps the most challenging aspect of working -on AM. Thus, the challenge was not to find a solution for text -conversion but a tool kit of solutions to apply to LC's varied -collections that need to be converted. ERWAY limited her remarks to the -process of converting text to machine-readable form, and the variety of -LC's text collections, for example, bound volumes, microfilm, and -handwritten manuscripts. - -Two assumptions have guided AM's approach, ERWAY said: 1) A desire not -to perform the conversion inhouse. Because of the variety of formats and -types of texts, to capitalize the equipment and have the talents and -skills to operate them at LC would be extremely expensive. Further, the -natural inclination to upgrade to newer and better equipment each year -made it reasonable for AM to focus on what it did best and seek external -conversion services. Using service bureaus also allowed AM to have -several types of operations take place at the same time. 2) AM was not a -technology project, but an effort to improve access to library -collections. Hence, whether text was converted using OCR or rekeying -mattered little to AM. What mattered were cost and accuracy of results. - -AM considered different types of service bureaus and selected three to -perform several small tests in order to acquire a sense of the field. -The sample collections with which they worked included handwritten -correspondence, typewritten manuscripts from the 1940s, and -eighteenth-century printed broadsides on microfilm. On none of these -samples was OCR performed; they were all rekeyed. AM had several special -requirements for the three service bureaus it had engaged. For instance, -any errors in the original text were to be retained. Working from bound -volumes or anything that could not be sheet-fed also constituted a factor -eliminating companies that would have performed OCR. - -AM requires 99.95 percent accuracy, which, though it sounds high, often -means one or two errors per page. The initial batch of test samples -contained several handwritten materials for which AM did not require -text-coding. The results, ERWAY reported, were in all cases fairly -comparable: for the most part, all three service bureaus achieved 99.95 -percent accuracy. AM was satisfied with the work but surprised at the cost. - -As AM began converting whole collections, it retained the requirement for -99.95 percent accuracy and added requirements for text-coding. AM needed -to begin performing work more than three years ago before LC requirements -for SGML applications had been established. Since AM's goal was simply -to retain any of the intellectual content represented by the formatting -of the document (which would be lost if one performed a straight ASCII -conversion), AM used "SGML-like" codes. These codes resembled SGML tags -but were used without the benefit of document-type definitions. AM found -that many service bureaus were not yet SGML-proficient. - -Additional factors influencing the approach AM took with respect to -coding included: 1) the inability of any known microcomputer-based -user-retrieval software to take advantage of SGML coding; and 2) the -multiple inconsistencies in format of the older documents, which -confirmed AM in its desire not to attempt to force the different formats -to conform to a single document-type definition (DTD) and thus create the -need for a separate DTD for each document. - -The five text collections that AM has converted or is in the process of -converting include a collection of eighteenth-century broadsides, a -collection of pamphlets, two typescript document collections, and a -collection of 150 books. - -ERWAY next reviewed the results of AM's experience with rekeying, noting -again that because the bulk of AM's materials are historical, the quality -of the text often does not lend itself to OCR. While non-English -speakers are less likely to guess or elaborate or correct typos in the -original text, they are also less able to infer what we would; they also -are nearly incapable of converting handwritten text. Another -disadvantage of working with overseas keyers is that they are much less -likely to telephone with questions, especially on the coding, with the -result that they develop their own rules as they encounter new -situations. - -Government contracting procedures and time frames posed a major challenge -to performing the conversion. Many service bureaus are not accustomed to -retaining the image, even if they perform OCR. Thus, questions of image -format and storage media were somewhat novel to many of them. ERWAY also -remarked other problems in dealing with service bureaus, for example, -their inability to perform text conversion from the kind of microfilm -that LC uses for preservation purposes. - -But quality control, in ERWAY's experience, was the most time-consuming -aspect of contracting out conversion. AM has been attempting to perform -a 10-percent quality review, looking at either every tenth document or -every tenth page to make certain that the service bureaus are maintaining -99.95 percent accuracy. But even if they are complying with the -requirement for accuracy, finding errors produces a desire to correct -them and, in turn, to clean up the whole collection, which defeats the -purpose to some extent. Even a double entry requires a -character-by-character comparison to the original to meet the accuracy -requirement. LC is not accustomed to publish imperfect texts, which -makes attempting to deal with the industry standard an emotionally -fraught issue for AM. As was mentioned in the previous day's discussion, -going from 99.95 to 99.99 percent accuracy usually doubles costs and -means a third keying or another complete run-through of the text. - -Although AM has learned much from its experiences with various collections -and various service bureaus, ERWAY concluded pessimistically that no -breakthrough has been achieved. Incremental improvements have occurred -in some of the OCR technology, some of the processes, and some of the -standards acceptances, which, though they may lead to somewhat lower costs, -do not offer much encouragement to many people who are anxiously awaiting -the day that the entire contents of LC are available on-line. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -ZIDAR * Several answers to why one attempts to perform full-text -conversion * Per page cost of performing OCR * Typical problems -encountered during editing * Editing poor copy OCR vs. rekeying * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Judith ZIDAR, coordinator, National Agricultural Text Digitizing Program -(NATDP), National Agricultural Library (NAL), offered several answers to -the question of why one attempts to perform full-text conversion: 1) -Text in an image can be read by a human but not by a computer, so of -course it is not searchable and there is not much one can do with it. 2) -Some material simply requires word-level access. For instance, the legal -profession insists on full-text access to its material; with taxonomic or -geographic material, which entails numerous names, one virtually requires -word-level access. 3) Full text permits rapid browsing and searching, -something that cannot be achieved in an image with today's technology. -4) Text stored as ASCII and delivered in ASCII is standardized and highly -portable. 5) People just want full-text searching, even those who do not -know how to do it. NAL, for the most part, is performing OCR at an -actual cost per average-size page of approximately $7. NAL scans the -page to create the electronic image and passes it through the OCR device. - -ZIDAR next rehearsed several typical problems encountered during editing. -Praising the celerity of her student workers, ZIDAR observed that editing -requires approximately five to ten minutes per page, assuming that there -are no large tables to audit. Confusion among the three characters I, 1, -and l, constitutes perhaps the most common problem encountered. Zeroes -and O's also are frequently confused. Double M's create a particular -problem, even on clean pages. They are so wide in most fonts that they -touch, and the system simply cannot tell where one letter ends and the -other begins. Complex page formats occasionally fail to columnate -properly, which entails rescanning as though one were working with a -single column, entering the ASCII, and decolumnating for better -searching. With proportionally spaced text, OCR can have difficulty -discerning what is a space and what are merely spaces between letters, as -opposed to spaces between words, and therefore will merge text or break -up words where it should not. - -ZIDAR said that it can often take longer to edit a poor-copy OCR than to -key it from scratch. NAL has also experimented with partial editing of -text, whereby project workers go into and clean up the format, removing -stray characters but not running a spell-check. NAL corrects typos in -the title and authors' names, which provides a foothold for searching and -browsing. Even extremely poor-quality OCR (e.g., 60-percent accuracy) -can still be searched, because numerous words are correct, while the -important words are probably repeated often enough that they are likely -to be found correct somewhere. Librarians, however, cannot tolerate this -situation, though end users seem more willing to use this text for -searching, provided that NAL indicates that it is unedited. ZIDAR -concluded that rekeying of text may be the best route to take, in spite -of numerous problems with quality control and cost. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Modifying an image before performing OCR * NAL's costs per -page *AM's costs per page and experience with Federal Prison Industries * -Elements comprising NATDP's costs per page * OCR and structured markup * -Distinction between the structure of a document and its representation -when put on the screen or printed * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -HOOTON prefaced the lengthy discussion that followed with several -comments about modifying an image before one reaches the point of -performing OCR. For example, in regard to an application containing a -significant amount of redundant data, such as form-type data, numerous -companies today are working on various kinds of form renewal, prior to -going through a recognition process, by using dropout colors. Thus, -acquiring access to form design or using electronic means are worth -considering. HOOTON also noted that conversion usually makes or breaks -one's imaging system. It is extremely important, extremely costly in -terms of either capital investment or service, and determines the quality -of the remainder of one's system, because it determines the character of -the raw material used by the system. - -Concerning the four projects undertaken by NAL, two inside and two -performed by outside contractors, ZIDAR revealed that an in-house service -bureau executed the first at a cost between $8 and $10 per page for -everything, including building of the database. The project undertaken -by the Consultative Group on International Agricultural Research (CGIAR) -cost approximately $10 per page for the conversion, plus some expenses -for the software and building of the database. The Acid Rain Project--a -two-disk set produced by the University of Vermont, consisting of -Canadian publications on acid rain--cost $6.70 per page for everything, -including keying of the text, which was double keyed, scanning of the -images, and building of the database. The in-house project offered -considerable ease of convenience and greater control of the process. On -the other hand, the service bureaus know their job and perform it -expeditiously, because they have more people. - -As a useful comparison, ERWAY revealed AM's costs as follows: $0.75 -cents to $0.85 cents per thousand characters, with an average page -containing 2,700 characters. Requirements for coding and imaging -increase the costs. Thus, conversion of the text, including the coding, -costs approximately $3 per page. (This figure does not include the -imaging and database-building included in the NAL costs.) AM also -enjoyed a happy experience with Federal Prison Industries, which -precluded the necessity of going through the request-for-proposal process -to award a contract, because it is another government agency. The -prisoners performed AM's rekeying just as well as other service bureaus -and proved handy as well. AM shipped them the books, which they would -photocopy on a book-edge scanner. They would perform the markup on -photocopies, return the books as soon as they were done with them, -perform the keying, and return the material to AM on WORM disks. - -ZIDAR detailed the elements that constitute the previously noted cost of -approximately $7 per page. Most significant is the editing, correction -of errors, and spell-checkings, which though they may sound easy to -perform require, in fact, a great deal of time. Reformatting text also -takes a while, but a significant amount of NAL's expenses are for equipment, -which was extremely expensive when purchased because it was one of the few -systems on the market. The costs of equipment are being amortized over -five years but are still quite high, nearly $2,000 per month. - -HOCKEY raised a general question concerning OCR and the amount of editing -required (substantial in her experience) to generate the kind of -structured markup necessary for manipulating the text on the computer or -loading it into any retrieval system. She wondered if the speakers could -extend the previous question about the cost-benefit of adding or exerting -structured markup. ERWAY noted that several OCR systems retain italics, -bolding, and other spatial formatting. While the material may not be in -the format desired, these systems possess the ability to remove the -original materials quickly from the hands of the people performing the -conversion, as well as to retain that information so that users can work -with it. HOCKEY rejoined that the current thinking on markup is that one -should not say that something is italic or bold so much as why it is that -way. To be sure, one needs to know that something was italicized, but -how can one get from one to the other? One can map from the structure to -the typographic representation. - -FLEISCHHAUER suggested that, given the 100 million items the Library -holds, it may not be possible for LC to do more than report that a thing -was in italics as opposed to why it was italics, although that may be -desirable in some contexts. Promising to talk a bit during the afternoon -session about several experiments OCLC performed on automatic recognition -of document elements, and which they hoped to extend, WEIBEL said that in -fact one can recognize the major elements of a document with a fairly -high degree of reliability, at least as good as OCR. STEVENS drew a -useful distinction between standard, generalized markup (i.e., defining -for a document-type definition the structure of the document), and what -he termed a style sheet, which had to do with italics, bolding, and other -forms of emphasis. Thus, two different components are at work, one being -the structure of the document itself (its logic), and the other being its -representation when it is put on the screen or printed. - - ****** - -SESSION V. APPROACHES TO PREPARING ELECTRONIC TEXTS - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -HOCKEY * Text in ASCII and the representation of electronic text versus -an image * The need to look at ways of using markup to assist retrieval * -The need for an encoding format that will be reusable and multifunctional -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Susan HOCKEY, director, Center for Electronic Texts in the Humanities -(CETH), Rutgers and Princeton Universities, announced that one talk -(WEIBEL's) was moved into this session from the morning and that David -Packard was unable to attend. The session would attempt to focus more on -what one can do with a text in ASCII and the representation of electronic -text rather than just an image, what one can do with a computer that -cannot be done with a book or an image. It would be argued that one can -do much more than just read a text, and from that starting point one can -use markup and methods of preparing the text to take full advantage of -the capability of the computer. That would lead to a discussion of what -the European Community calls REUSABILITY, what may better be termed -DURABILITY, that is, how to prepare or make a text that will last a long -time and that can be used for as many applications as possible, which -would lead to issues of improving intellectual access. - -HOCKEY urged the need to look at ways of using markup to facilitate retrieval, -not just for referencing or to help locate an item that is retrieved, but also to put markup tags in -a text to help retrieve the thing sought either with linguistic tagging or -interpretation. HOCKEY also argued that little advancement had occurred in -the software tools currently available for retrieving and searching text. -She pressed the desideratum of going beyond Boolean searches and performing -more sophisticated searching, which the insertion of more markup in the text -would facilitate. Thinking about electronic texts as opposed to images means -considering material that will never appear in print form, or print will not -be its primary form, that is, material which only appears in electronic form. -HOCKEY alluded to the history and the need for markup and tagging and -electronic text, which was developed through the use of computers in the -humanities; as MICHELSON had observed, Father Busa had started in 1949 -to prepare the first-ever text on the computer. - -HOCKEY remarked several large projects, particularly in Europe, for the -compilation of dictionaries, language studies, and language analysis, in -which people have built up archives of text and have begun to recognize -the need for an encoding format that will be reusable and multifunctional, -that can be used not just to print the text, which may be assumed to be a -byproduct of what one wants to do, but to structure it inside the computer -so that it can be searched, built into a Hypertext system, etc. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -WEIBEL * OCLC's approach to preparing electronic text: retroconversion, -keying of texts, more automated ways of developing data * Project ADAPT -and the CORE Project * Intelligent character recognition does not exist * -Advantages of SGML * Data should be free of procedural markup; -descriptive markup strongly advocated * OCLC's interface illustrated * -Storage requirements and costs for putting a lot of information on line * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Stuart WEIBEL, senior research scientist, Online Computer Library Center, -Inc. (OCLC), described OCLC's approach to preparing electronic text. He -argued that the electronic world into which we are moving must -accommodate not only the future but the past as well, and to some degree -even the present. Thus, starting out at one end with retroconversion and -keying of texts, one would like to move toward much more automated ways -of developing data. - -For example, Project ADAPT had to do with automatically converting -document images into a structured document database with OCR text as -indexing and also a little bit of automatic formatting and tagging of -that text. The CORE project hosted by Cornell University, Bellcore, -OCLC, the American Chemical Society, and Chemical Abstracts, constitutes -WEIBEL's principal concern at the moment. This project is an example of -converting text for which one already has a machine-readable version into -a format more suitable for electronic delivery and database searching. -(Since Michael LESK had previously described CORE, WEIBEL would say -little concerning it.) Borrowing a chemical phrase, de novo synthesis, -WEIBEL cited the Online Journal of Current Clinical Trials as an example -of de novo electronic publishing, that is, a form in which the primary -form of the information is electronic. - -Project ADAPT, then, which OCLC completed a couple of years ago and in -fact is about to resume, is a model in which one takes page images either -in paper or microfilm and converts them automatically to a searchable -electronic database, either on-line or local. The operating assumption -is that accepting some blemishes in the data, especially for -retroconversion of materials, will make it possible to accomplish more. -Not enough money is available to support perfect conversion. - -WEIBEL related several steps taken to perform image preprocessing -(processing on the image before performing optical character -recognition), as well as image postprocessing. He denied the existence -of intelligent character recognition and asserted that what is wanted is -page recognition, which is a long way off. OCLC has experimented with -merging of multiple optical character recognition systems that will -reduce errors from an unacceptable rate of 5 characters out of every -l,000 to an unacceptable rate of 2 characters out of every l,000, but it -is not good enough. It will never be perfect. - -Concerning the CORE Project, WEIBEL observed that Bellcore is taking the -topography files, extracting the page images, and converting those -topography files to SGML markup. LESK hands that data off to OCLC, which -builds that data into a Newton database, the same system that underlies -the on-line system in virtually all of the reference products at OCLC. -The long-term goal is to make the systems interoperable so that not just -Bellcore's system and OCLC's system can access this data, but other -systems can as well, and the key to that is the Z39.50 common command -language and the full-text extension. Z39.50 is fine for MARC records, -but is not enough to do it for full text (that is, make full texts -interoperable). - -WEIBEL next outlined the critical role of SGML for a variety of purposes, -for example, as noted by HOCKEY, in the world of extremely large -databases, using highly structured data to perform field searches. -WEIBEL argued that by building the structure of the data in (i.e., the -structure of the data originally on a printed page), it becomes easy to -look at a journal article even if one cannot read the characters and know -where the title or author is, or what the sections of that document would be. -OCLC wants to make that structure explicit in the database, because it will -be important for retrieval purposes. - -The second big advantage of SGML is that it gives one the ability to -build structure into the database that can be used for display purposes -without contaminating the data with instructions about how to format -things. The distinction lies between procedural markup, which tells one -where to put dots on the page, and descriptive markup, which describes -the elements of a document. - -WEIBEL believes that there should be no procedural markup in the data at -all, that the data should be completely unsullied by information about -italics or boldness. That should be left up to the display device, -whether that display device is a page printer or a screen display device. -By keeping one's database free of that kind of contamination, one can -make decisions down the road, for example, reorganize the data in ways -that are not cramped by built-in notions of what should be italic and -what should be bold. WEIBEL strongly advocated descriptive markup. As -an example, he illustrated the index structure in the CORE data. With -subsequent illustrated examples of markup, WEIBEL acknowledged the common -complaint that SGML is hard to read in its native form, although markup -decreases considerably once one gets into the body. Without the markup, -however, one would not have the structure in the data. One can pass -markup through a LaTeX processor and convert it relatively easily to a -printed version of the document. - -WEIBEL next illustrated an extremely cluttered screen dump of OCLC's -system, in order to show as much as possible the inherent capability on -the screen. (He noted parenthetically that he had become a supporter of -X-Windows as a result of the progress of the CORE Project.) WEIBEL also -illustrated the two major parts of the interface: l) a control box that -allows one to generate lists of items, which resembles a small table of -contents based on key words one wishes to search, and 2) a document -viewer, which is a separate process in and of itself. He demonstrated -how to follow links through the electronic database simply by selecting -the appropriate button and bringing them up. He also noted problems that -remain to be accommodated in the interface (e.g., as pointed out by LESK, -what happens when users do not click on the icon for the figure). - -Given the constraints of time, WEIBEL omitted a large number of ancillary -items in order to say a few words concerning storage requirements and -what will be required to put a lot of things on line. Since it is -extremely expensive to reconvert all of this data, especially if it is -just in paper form (and even if it is in electronic form in typesetting -tapes), he advocated building journals electronically from the start. In -that case, if one only has text graphics and indexing (which is all that -one needs with de novo electronic publishing, because there is no need to -go back and look at bit-maps of pages), one can get 10,000 journals of -full text, or almost 6 million pages per year. These pages can be put in -approximately 135 gigabytes of storage, which is not all that much, -WEIBEL said. For twenty years, something less than three terabytes would -be required. WEIBEL calculated the costs of storing this information as -follows: If a gigabyte costs approximately $1,000, then a terabyte costs -approximately $1 million to buy in terms of hardware. One also needs a -building to put it in and a staff like OCLC to handle that information. -So, to support a terabyte, multiply by five, which gives $5 million per -year for a supported terabyte of data. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Tapes saved by ACS are the typography files originally -supporting publication of the journal * Cost of building tagged text into -the database * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the question-and-answer period that followed WEIBEL's -presentation, these clarifications emerged. The tapes saved by the -American Chemical Society are the typography files that originally -supported the publication of the journal. Although they are not tagged -in SGML, they are tagged in very fine detail. Every single sentence is -marked, all the registry numbers, all the publications issues, dates, and -volumes. No cost figures on tagging material on a per-megabyte basis -were available. Because ACS's typesetting system runs from tagged text, -there is no extra cost per article. It was unknown what it costs ACS to -keyboard the tagged text rather than just keyboard the text in the -cheapest process. In other words, since one intends to publish things -and will need to build tagged text into a typography system in any case, -if one does that in such a way that it can drive not only typography but -an electronic system (which is what ACS intends to do--move to SGML -publishing), the marginal cost is zero. The marginal cost represents the -cost of building tagged text into the database, which is small. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -SPERBERG-McQUEEN * Distinction between texts and computers * Implications -of recognizing that all representation is encoding * Dealing with -complicated representations of text entails the need for a grammar of -documents * Variety of forms of formal grammars * Text as a bit-mapped -image does not represent a serious attempt to represent text in -electronic form * SGML, the TEI, document-type declarations, and the -reusability and longevity of data * TEI conformance explicitly allows -extension or modification of the TEI tag set * Administrative background -of the TEI * Several design goals for the TEI tag set * An absolutely -fixed requirement of the TEI Guidelines * Challenges the TEI has -attempted to face * Good texts not beyond economic feasibility * The -issue of reproducibility or processability * The issue of mages as -simulacra for the text redux * One's model of text determines what one's -software can do with a text and has economic consequences * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Prior to speaking about SGML and markup, Michael SPERBERG-McQUEEN, editor, -Text Encoding Initiative (TEI), University of Illinois-Chicago, first drew -a distinction between texts and computers: Texts are abstract cultural -and linguistic objects while computers are complicated physical devices, -he said. Abstract objects cannot be placed inside physical devices; with -computers one can only represent text and act upon those representations. - -The recognition that all representation is encoding, SPERBERG-McQUEEN -argued, leads to the recognition of two things: 1) The topic description -for this session is slightly misleading, because there can be no discussion -of pros and cons of text-coding unless what one means is pros and cons of -working with text with computers. 2) No text can be represented in a -computer without some sort of encoding; images are one way of encoding text, -ASCII is another, SGML yet another. There is no encoding without some -information loss, that is, there is no perfect reproduction of a text that -allows one to do away with the original. Thus, the question becomes, -What is the most useful representation of text for a serious work? -This depends on what kind of serious work one is talking about. - -The projects demonstrated the previous day all involved highly complex -information and fairly complex manipulation of the textual material. -In order to use that complicated information, one has to calculate it -slowly or manually and store the result. It needs to be stored, therefore, -as part of one's representation of the text. Thus, one needs to store the -structure in the text. To deal with complicated representations of text, -one needs somehow to control the complexity of the representation of a text; -that means one needs a way of finding out whether a document and an -electronic representation of a document is legal or not; and that -means one needs a grammar of documents. - -SPERBERG-McQUEEN discussed the variety of forms of formal grammars, -implicit and explicit, as applied to text, and their capabilities. He -argued that these grammars correspond to different models of text that -different developers have. For example, one implicit model of the text -is that there is no internal structure, but just one thing after another, -a few characters and then perhaps a start-title command, and then a few -more characters and an end-title command. SPERBERG-McQUEEN also -distinguished several kinds of text that have a sort of hierarchical -structure that is not very well defined, which, typically, corresponds -to grammars that are not very well defined, as well as hierarchies that -are very well defined (e.g., the Thesaurus Linguae Graecae) and extremely -complicated things such as SGML, which handle strictly hierarchical data -very nicely. - -SPERBERG-McQUEEN conceded that one other model not illustrated on his two -displays was the model of text as a bit-mapped image, an image of a page, -and confessed to having been converted to a limited extent by the -Workshop to the view that electronic images constitute a promising, -probably superior alternative to microfilming. But he was not convinced -that electronic images represent a serious attempt to represent text in -electronic form. Many of their problems stem from the fact that they are -not direct attempts to represent the text but attempts to represent the -page, thus making them representations of representations. - -In this situation of increasingly complicated textual information and the -need to control that complexity in a useful way (which begs the question -of the need for good textual grammars), one has the introduction of SGML. -With SGML, one can develop specific document-type declarations -for specific text types or, as with the TEI, attempts to generate -general document-type declarations that can handle all sorts of text. -The TEI is an attempt to develop formats for text representation that -will ensure the kind of reusability and longevity of data discussed earlier. -It offers a way to stay alive in the state of permanent technological -revolution. - -It has been a continuing challenge in the TEI to create document grammars -that do some work in controlling the complexity of the textual object but -also allowing one to represent the real text that one will find. -Fundamental to the notion of the TEI is that TEI conformance allows one -the ability to extend or modify the TEI tag set so that it fits the text -that one is attempting to represent. - -SPERBERG-McQUEEN next outlined the administrative background of the TEI. -The TEI is an international project to develop and disseminate guidelines -for the encoding and interchange of machine-readable text. It is -sponsored by the Association for Computers in the Humanities, the -Association for Computational Linguistics, and the Association for -Literary and Linguistic Computing. Representatives of numerous other -professional societies sit on its advisory board. The TEI has a number -of affiliated projects that have provided assistance by testing drafts of -the guidelines. - -Among the design goals for the TEI tag set, the scheme first of all must -meet the needs of research, because the TEI came out of the research -community, which did not feel adequately served by existing tag sets. -The tag set must be extensive as well as compatible with existing and -emerging standards. In 1990, version 1.0 of the Guidelines was released -(SPERBERG-McQUEEN illustrated their contents). - -SPERBERG-McQUEEN noted that one problem besetting electronic text has -been the lack of adequate internal or external documentation for many -existing electronic texts. The TEI guidelines as currently formulated -contain few fixed requirements, but one of them is this: There must -always be a document header, an in-file SGML tag that provides -1) a bibliographic description of the electronic object one is talking -about (that is, who included it, when, what for, and under which title); -and 2) the copy text from which it was derived, if any. If there was -no copy text or if the copy text is unknown, then one states as much. -Version 2.0 of the Guidelines was scheduled to be completed in fall 1992 -and a revised third version is to be presented to the TEI advisory board -for its endorsement this coming winter. The TEI itself exists to provide -a markup language, not a marked-up text. - -Among the challenges the TEI has attempted to face is the need for a -markup language that will work for existing projects, that is, handle the -level of markup that people are using now to tag only chapter, section, -and paragraph divisions and not much else. At the same time, such a -language also will be able to scale up gracefully to handle the highly -detailed markup which many people foresee as the future destination of -much electronic text, and which is not the future destination but the -present home of numerous electronic texts in specialized areas. - -SPERBERG-McQUEEN dismissed the lowest-common-denominator approach as -unable to support the kind of applications that draw people who have -never been in the public library regularly before, and make them come -back. He advocated more interesting text and more intelligent text. -Asserting that it is not beyond economic feasibility to have good texts, -SPERBERG-McQUEEN noted that the TEI Guidelines listing 200-odd tags -contains tags that one is expected to enter every time the relevant -textual feature occurs. It contains all the tags that people need now, -and it is not expected that everyone will tag things in the same way. - -The question of how people will tag the text is in large part a function -of their reaction to what SPERBERG-McQUEEN termed the issue of -reproducibility. What one needs to be able to reproduce are the things -one wants to work with. Perhaps a more useful concept than that of -reproducibility or recoverability is that of processability, that is, -what can one get from an electronic text without reading it again -in the original. He illustrated this contention with a page from -Jan Comenius's bilingual Introduction to Latin. - -SPERBERG-McQUEEN returned at length to the issue of images as simulacra -for the text, in order to reiterate his belief that in the long run more -than images of pages of particular editions of the text are needed, -because just as second-generation photocopies and second-generation -microfilm degenerate, so second-generation representations tend to -degenerate, and one tends to overstress some relatively trivial aspects -of the text such as its layout on the page, which is not always -significant, despite what the text critics might say, and slight other -pieces of information such as the very important lexical ties between the -English and Latin versions of Comenius's bilingual text, for example. -Moreover, in many crucial respects it is easy to fool oneself concerning -what a scanned image of the text will accomplish. For example, in order -to study the transmission of texts, information concerning the text -carrier is necessary, which scanned images simply do not always handle. -Further, even the high-quality materials being produced at Cornell use -much of the information that one would need if studying those books as -physical objects. It is a choice that has been made. It is an arguably -justifiable choice, but one does not know what color those pen strokes in -the margin are or whether there was a stain on the page, because it has -been filtered out. One does not know whether there were rips in the page -because they do not show up, and on a couple of the marginal marks one -loses half of the mark because the pen is very light and the scanner -failed to pick it up, and so what is clearly a checkmark in the margin of -the original becomes a little scoop in the margin of the facsimile. -Standard problems for facsimile editions, not new to electronics, but -also true of light-lens photography, and are remarked here because it is -important that we not fool ourselves that even if we produce a very nice -image of this page with good contrast, we are not replacing the -manuscript any more than microfilm has replaced the manuscript. - -The TEI comes from the research community, where its first allegiance -lies, but it is not just an academic exercise. It has relevance far -beyond those who spend all of their time studying text, because one's -model of text determines what one's software can do with a text. Good -models lead to good software. Bad models lead to bad software. That has -economic consequences, and it is these economic consequences that have -led the European Community to help support the TEI, and that will lead, -SPERBERG-McQUEEN hoped, some software vendors to realize that if they -provide software with a better model of the text they can make a killing. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Implications of different DTDs and tag sets * ODA versus SGML * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -During the discussion that followed, several additional points were made. -Neither AAP (i.e., Association of American Publishers) nor CALS (i.e., -Computer-aided Acquisition and Logistics Support) has a document-type -definition for ancient Greek drama, although the TEI will be able to -handle that. Given this state of affairs and assuming that the -technical-journal producers and the commercial vendors decide to use the -other two types, then an institution like the Library of Congress, which -might receive all of their publications, would have to be able to handle -three different types of document definitions and tag sets and be able to -distinguish among them. - -Office Document Architecture (ODA) has some advantages that flow from its -tight focus on office documents and clear directions for implementation. -Much of the ODA standard is easier to read and clearer at first reading -than the SGML standard, which is extremely general. What that means is -that if one wants to use graphics in TIFF and ODA, one is stuck, because -ODA defines graphics formats while TIFF does not, whereas SGML says the -world is not waiting for this work group to create another graphics format. -What is needed is an ability to use whatever graphics format one wants. - -The TEI provides a socket that allows one to connect the SGML document to -the graphics. The notation that the graphics are in is clearly a choice -that one needs to make based on her or his environment, and that is one -advantage. SGML is less megalomaniacal in attempting to define formats -for all kinds of information, though more megalomaniacal in attempting to -cover all sorts of documents. The other advantage is that the model of -text represented by SGML is simply an order of magnitude richer and more -flexible than the model of text offered by ODA. Both offer hierarchical -structures, but SGML recognizes that the hierarchical model of the text -that one is looking at may not have been in the minds of the designers, -whereas ODA does not. - -ODA is not really aiming for the kind of document that the TEI wants to -encompass. The TEI can handle the kind of material ODA has, as well as a -significantly broader range of material. ODA seems to be very much -focused on office documents, which is what it started out being called-- -office document architecture. - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -CALALUCA * Text-encoding from a publisher's perspective * -Responsibilities of a publisher * Reproduction of Migne's Latin series -whole and complete with SGML tags based on perceived need and expected -use * Particular decisions arising from the general decision to produce -and publish PLD * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -The final speaker in this session, Eric CALALUCA, vice president, -Chadwyck-Healey, Inc., spoke from the perspective of a publisher re -text-encoding, rather than as one qualified to discuss methods of -encoding data, and observed that the presenters sitting in the room, -whether they had chosen to or not, were acting as publishers: making -choices, gathering data, gathering information, and making assessments. -CALALUCA offered the hard-won conviction that in publishing very large -text files (such as PLD), one cannot avoid making personal judgments of -appropriateness and structure. - -In CALALUCA's view, encoding decisions stem from prior judgments. Two -notions have become axioms for him in the consideration of future sources -for electronic publication: 1) electronic text publishing is as personal -as any other kind of publishing, and questions of if and how to encode -the data are simply a consequence of that prior decision; 2) all -personal decisions are open to criticism, which is unavoidable. - -CALALUCA rehearsed his role as a publisher or, better, as an intermediary -between what is viewed as a sound idea and the people who would make use -of it. Finding the specialist to advise in this process is the core of -that function. The publisher must monitor and hug the fine line between -giving users what they want and suggesting what they might need. One -responsibility of a publisher is to represent the desires of scholars and -research librarians as opposed to bullheadedly forcing them into areas -they would not choose to enter. - -CALALUCA likened the questions being raised today about data structure -and standards to the decisions faced by the Abbe Migne himself during -production of the Patrologia series in the mid-nineteenth century. -Chadwyck-Healey's decision to reproduce Migne's Latin series whole and -complete with SGML tags was also based upon a perceived need and an -expected use. In the same way that Migne's work came to be far more than -a simple handbook for clerics, PLD is already far more than a database -for theologians. It is a bedrock source for the study of Western -civilization, CALALUCA asserted. - -In regard to the decision to produce and publish PLD, the editorial board -offered direct judgments on the question of appropriateness of these -texts for conversion, their encoding and their distribution, and -concluded that the best possible project was one that avoided overt -intrusions or exclusions in so important a resource. Thus, the general -decision to transmit the original collection as clearly as possible with -the widest possible avenues for use led to other decisions: 1) To encode -the data or not, SGML or not, TEI or not. Again, the expected user -community asserted the need for normative tagging structures of important -humanities texts, and the TEI seemed the most appropriate structure for -that purpose. Research librarians, who are trained to view the larger -impact of electronic text sources on 80 or 90 or 100 doctoral -disciplines, loudly approved the decision to include tagging. They see -what is coming better than the specialist who is completely focused on -one edition of Ambrose's De Anima, and they also understand that the -potential uses exceed present expectations. 2) What will be tagged and -what will not. Once again, the board realized that one must tag the -obvious. But in no way should one attempt to identify through encoding -schemes every single discrete area of a text that might someday be -searched. That was another decision. Searching by a column number, an -author, a word, a volume, permitting combination searches, and tagging -notations seemed logical choices as core elements. 3) How does one make -the data available? Tieing it to a CD-ROM edition creates limitations, -but a magnetic tape file that is very large, is accompanied by the -encoding specifications, and that allows one to make local modifications -also allows one to incorporate any changes one may desire within the -bounds of private research, though exporting tag files from a CD-ROM -could serve just as well. Since no one on the board could possibly -anticipate each and every way in which a scholar might choose to mine -this data bank, it was decided to satisfy the basics and make some -provisions for what might come. 4) Not to encode the database would rob -it of the interchangeability and portability these important texts should -accommodate. For CALALUCA, the extensive options presented by full-text -searching require care in text selection and strongly support encoding of -data to facilitate the widest possible search strategies. Better -software can always be created, but summoning the resources, the people, -and the energy to reconvert the text is another matter. - -PLD is being encoded, captured, and distributed, because to -Chadwyck-Healey and the board it offers the widest possible array of -future research applications that can be seen today. CALALUCA concluded -by urging the encoding of all important text sources in whatever way -seems most appropriate and durable at the time, without blanching at the -thought that one's work may require emendation in the future. (Thus, -Chadwyck-Healey produced a very large humanities text database before the -final release of the TEI Guidelines.) - - ****** - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -DISCUSSION * Creating texts with markup advocated * Trends in encoding * -The TEI and the issue of interchangeability of standards * A -misconception concerning the TEI * Implications for an institution like -LC in the event that a multiplicity of DTDs develops * Producing images -as a first step towards possible conversion to full text through -character recognition * The AAP tag sets as a common starting point and -the need for caution * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -HOCKEY prefaced the discussion that followed with several comments in -favor of creating texts with markup and on trends in encoding. In the -future, when many more texts are available for on-line searching, real -problems in finding what is wanted will develop, if one is faced with -millions of words of data. It therefore becomes important to consider -putting markup in texts to help searchers home in on the actual things -they wish to retrieve. Various approaches to refining retrieval methods -toward this end include building on a computer version of a dictionary -and letting the computer look up words in it to obtain more information -about the semantic structure or semantic field of a word, its grammatical -structure, and syntactic structure. - -HOCKEY commented on the present keen interest in the encoding world -in creating: 1) machine-readable versions of dictionaries that can be -initially tagged in SGML, which gives a structure to the dictionary entry; -these entries can then be converted into a more rigid or otherwise -different database structure inside the computer, which can be treated as -a dynamic tool for searching mechanisms; 2) large bodies of text to study -the language. In order to incorporate more sophisticated mechanisms, -more about how words behave needs to be known, which can be learned in -part from information in dictionaries. However, the last ten years have -seen much interest in studying the structure of printed dictionaries -converted into computer-readable form. The information one derives about -many words from those is only partial, one or two definitions of the -common or the usual meaning of a word, and then numerous definitions of -unusual usages. If the computer is using a dictionary to help retrieve -words in a text, it needs much more information about the common usages, -because those are the ones that occur over and over again. Hence the -current interest in developing large bodies of text in computer-readable -form in order to study the language. Several projects are engaged in -compiling, for example, 100 million words. HOCKEY described one with -which she was associated briefly at Oxford University involving -compilation of 100 million words of British English: about 10 percent of -that will contain detailed linguistic tagging encoded in SGML; it will -have word class taggings, with words identified as nouns, verbs, -adjectives, or other parts of speech. This tagging can then be used by -programs which will begin to learn a bit more about the structure of the -language, and then, can go to tag more text. - -HOCKEY said that the more that is tagged accurately, the more one can -refine the tagging process and thus the bigger body of text one can build -up with linguistic tagging incorporated into it. Hence, the more tagging -or annotation there is in the text, the more one may begin to learn about -language and the more it will help accomplish more intelligent OCR. She -recommended the development of software tools that will help one begin to -understand more about a text, which can then be applied to scanning -images of that text in that format and to using more intelligence to help -one interpret or understand the text. - -HOCKEY posited the need to think about common methods of text-encoding -for a long time to come, because building these large bodies of text is -extremely expensive and will only be done once. - -In the more general discussion on approaches to encoding that followed, -these points were made: - -BESSER identified the underlying problem with standards that all have to -struggle with in adopting a standard, namely, the tension between a very -highly defined standard that is very interchangeable but does not work -for everyone because something is lacking, and a standard that is less -defined, more open, more adaptable, but less interchangeable. Contending -that the way in which people use SGML is not sufficiently defined, BESSER -wondered 1) if people resist the TEI because they think it is too defined -in certain things they do not fit into, and 2) how progress with -interchangeability can be made without frightening people away. - -SPERBERG-McQUEEN replied that the published drafts of the TEI had met -with surprisingly little objection on the grounds that they do not allow -one to handle X or Y or Z. Particular concerns of the affiliated -projects have led, in practice, to discussions of how extensions are to -be made; the primary concern of any project has to be how it can be -represented locally, thus making interchange secondary. The TEI has -received much criticism based on the notion that everything in it is -required or even recommended, which, as it happens, is a misconception -from the beginning, because none of it is required and very little is -actually actively recommended for all cases, except that one document -one's source. - -SPERBERG-McQUEEN agreed with BESSER about this trade-off: all the -projects in a set of twenty TEI-conformant projects will not necessarily -tag the material in the same way. One result of the TEI will be that the -easiest problems will be solved--those dealing with the external form of -the information; but the problem that is hardest in interchange is that -one is not encoding what another wants, and vice versa. Thus, after -the adoption of a common notation, the differences in the underlying -conceptions of what is interesting about texts become more visible. -The success of a standard like the TEI will lie in the ability of -the recipient of interchanged texts to use some of what it contains -and to add the information that was not encoded that one wants, in a -layered way, so that texts can be gradually enriched and one does not -have to put in everything all at once. Hence, having a well-behaved -markup scheme is important. - -STEVENS followed up on the paradoxical analogy that BESSER alluded to in -the example of the MARC records, namely, the formats that are the same -except that they are different. STEVENS drew a parallel between -document-type definitions and MARC records for books and serials and maps, -where one has a tagging structure and there is a text-interchange. -STEVENS opined that the producers of the information will set the terms -for the standard (i.e., develop document-type definitions for the users -of their products), creating a situation that will be problematical for -an institution like the Library of Congress, which will have to deal with -the DTDs in the event that a multiplicity of them develops. Thus, -numerous people are seeking a standard but cannot find the tag set that -will be acceptable to them and their clients. SPERBERG-McQUEEN agreed -with this view, and said that the situation was in a way worse: attempting -to unify arbitrary DTDs resembled attempting to unify a MARC record with a -bibliographic record done according to the Prussian instructions. -According to STEVENS, this situation occurred very early in the process. - -WATERS recalled from early discussions on Project Open Book the concern -of many people that merely by producing images, POB was not really -enhancing intellectual access to the material. Nevertheless, not wishing -to overemphasize the opposition between imaging and full text, WATERS -stated that POB views getting the images as a first step toward possibly -converting to full text through character recognition, if the technology -is appropriate. WATERS also emphasized that encoding is involved even -with a set of images. - -SPERBERG-McQUEEN agreed with WATERS that one can create an SGML document -consisting wholly of images. At first sight, organizing graphic images -with an SGML document may not seem to offer great advantages, but the -advantages of the scheme WATERS described would be precisely that -ability to move into something that is more of a multimedia document: -a combination of transcribed text and page images. WEIBEL concurred in -this judgment, offering evidence from Project ADAPT, where a page is -divided into text elements and graphic elements, and in fact the text -elements are organized by columns and lines. These lines may be used as -the basis for distributing documents in a network environment. As one -develops software intelligent enough to recognize what those elements -are, it makes sense to apply SGML to an image initially, that may, in -fact, ultimately become more and more text, either through OCR or edited -OCR or even just through keying. For WATERS, the labor of composing the -document and saying this set of documents or this set of images belongs -to this document constitutes a significant investment. - -WEIBEL also made the point that the AAP tag sets, while not excessively -prescriptive, offer a common starting point; they do not define the -structure of the documents, though. They have some recommendations about -DTDs one could use as examples, but they do just suggest tag sets. For -example, the CORE project attempts to use the AAP markup as much as -possible, but there are clearly areas where structure must be added. -That in no way contradicts the use of AAP tag sets. - -SPERBERG-McQUEEN noted that the TEI prepared a long working paper early -on about the AAP tag set and what it lacked that the TEI thought it -needed, and a fairly long critique of the naming conventions, which has -led to a very different style of naming in the TEI. He stressed the -importance of the opposition between prescriptive markup, the kind that a -publisher or anybody can do when producing documents de novo, and -descriptive markup, in which one has to take what the text carrier -provides. In these particular tag sets it is easy to overemphasize this -opposition, because the AAP tag set is extremely flexible. Even if one -just used the DTDs, they allow almost anything to appear almost anywhere. - - ****** - -SESSION VI. COPYRIGHT ISSUES - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -PETERS * Several cautions concerning copyright in an electronic -environment * Review of copyright law in the United States * The notion -of the public good and the desirability of incentives to promote it * -What copyright protects * Works not protected by copyright * The rights -of copyright holders * Publishers' concerns in today's electronic -environment * Compulsory licenses * The price of copyright in a digital -medium and the need for cooperation * Additional clarifications * Rough -justice oftentimes the outcome in numerous copyright matters * Copyright -in an electronic society * Copyright law always only sets up the -boundaries; anything can be changed by contract * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Marybeth PETERS, policy planning adviser to the Register of Copyrights, -Library of Congress, made several general comments and then opened the -floor to discussion of subjects of interest to the audience. - -Having attended several sessions in an effort to gain a sense of what -people did and where copyright would affect their lives, PETERS expressed -the following cautions: - - * If one takes and converts materials and puts them in new forms, - then, from a copyright point of view, one is creating something and - will receive some rights. - - * However, if what one is converting already exists, a question - immediately arises about the status of the materials in question. - - * Putting something in the public domain in the United States offers - some freedom from anxiety, but distributing it throughout the world - on a network is another matter, even if one has put it in the public - domain in the United States. Re foreign laws, very frequently a - work can be in the public domain in the United States but protected - in other countries. Thus, one must consider all of the places a - work may reach, lest one unwittingly become liable to being faced - with a suit for copyright infringement, or at least a letter - demanding discussion of what one is doing. - -PETERS reviewed copyright law in the United States. The U.S. -Constitution effectively states that Congress has the power to enact -copyright laws for two purposes: 1) to encourage the creation and -dissemination of intellectual works for the good of society as a whole; -and, significantly, 2) to give creators and those who package and -disseminate materials the economic rewards that are due them. - -Congress strives to strike a balance, which at times can become an -emotional issue. The United States has never accepted the notion of the -natural right of an author so much as it has accepted the notion of the -public good and the desirability of incentives to promote it. This state -of affairs, however, has created strains on the international level and -is the reason for several of the differences in the laws that we have. -Today the United States protects almost every kind of work that can be -called an expression of an author. The standard for gaining copyright -protection is simply originality. This is a low standard and means that -a work is not copied from something else, as well as shows a certain -minimal amount of authorship. One can also acquire copyright protection -for making a new version of preexisting material, provided it manifests -some spark of creativity. - -However, copyright does not protect ideas, methods, systems--only the way -that one expresses those things. Nor does copyright protect anything -that is mechanical, anything that does not involve choice, or criteria -concerning whether or not one should do a thing. For example, the -results of a process called declicking, in which one mechanically removes -impure sounds from old recordings, are not copyrightable. On the other -hand, the choice to record a song digitally and to increase the sound of -violins or to bring up the tympani constitutes the results of conversion -that are copyrightable. Moreover, if a work is protected by copyright in -the United States, one generally needs the permission of the copyright -owner to convert it. Normally, who will own the new--that is, converted- --material is a matter of contract. In the absence of a contract, the -person who creates the new material is the author and owner. But people -do not generally think about the copyright implications until after the -fact. PETERS stressed the need when dealing with copyrighted works to -think about copyright in advance. One's bargaining power is much greater -up front than it is down the road. - -PETERS next discussed works not protected by copyright, for example, any -work done by a federal employee as part of his or her official duties is -in the public domain in the United States. The issue is not wholly free -of doubt concerning whether or not the work is in the public domain -outside the United States. Other materials in the public domain include: -any works published more than seventy-five years ago, and any work -published in the United States more than twenty-eight years ago, whose -copyright was not renewed. In talking about the new technology and -putting material in a digital form to send all over the world, PETERS -cautioned, one must keep in mind that while the rights may not be an -issue in the United States, they may be in different parts of the world, -where most countries previously employed a copyright term of the life of -the author plus fifty years. - -PETERS next reviewed the economics of copyright holding. Simply, -economic rights are the rights to control the reproduction of a work in -any form. They belong to the author, or in the case of a work made for -hire, the employer. The second right, which is critical to conversion, -is the right to change a work. The right to make new versions is perhaps -one of the most significant rights of authors, particularly in an -electronic world. The third right is the right to publish the work and -the right to disseminate it, something that everyone who deals in an -electronic medium needs to know. The basic rule is if a copy is sold, -all rights of distribution are extinguished with the sale of that copy. -The key is that it must be sold. A number of companies overcome this -obstacle by leasing or renting their product. These companies argue that -if the material is rented or leased and not sold, they control the uses -of a work. The fourth right, and one very important in a digital world, -is a right of public performance, which means the right to show the work -sequentially. For example, copyright owners control the showing of a -CD-ROM product in a public place such as a public library. The reverse -side of public performance is something called the right of public -display. Moral rights also exist, which at the federal level apply only -to very limited visual works of art, but in theory may apply under -contract and other principles. Moral rights may include the right of an -author to have his or her name on a work, the right of attribution, and -the right to object to distortion or mutilation--the right of integrity. - -The way copyright law is worded gives much latitude to activities such as -preservation; to use of material for scholarly and research purposes when -the user does not make multiple copies; and to the generation of -facsimile copies of unpublished works by libraries for themselves and -other libraries. But the law does not allow anyone to become the -distributor of the product for the entire world. In today's electronic -environment, publishers are extremely concerned that the entire world is -networked and can obtain the information desired from a single copy in a -single library. Hence, if there is to be only one sale, which publishers -may choose to live with, they will obtain their money in other ways, for -example, from access and use. Hence, the development of site licenses -and other kinds of agreements to cover what publishers believe they -should be compensated for. Any solution that the United States takes -today has to consider the international arena. - -Noting that the United States is a member of the Berne Convention and -subscribes to its provisions, PETERS described the permissions process. -She also defined compulsory licenses. A compulsory license, of which the -United States has had a few, builds into the law the right to use a work -subject to certain terms and conditions. In the international arena, -however, the ability to use compulsory licenses is extremely limited. -Thus, clearinghouses and other collectives comprise one option that has -succeeded in providing for use of a work. Often overlooked when one -begins to use copyrighted material and put products together is how -expensive the permissions process and managing it is. According to -PETERS, the price of copyright in a digital medium, whatever solution is -worked out, will include managing and assembling the database. She -strongly recommended that publishers and librarians or people with -various backgrounds cooperate to work out administratively feasible -systems, in order to produce better results. - -In the lengthy question-and-answer period that followed PETERS's -presentation, the following points emerged: - - * The Copyright Office maintains that anything mechanical and - totally exhaustive probably is not protected. In the event that - what an individual did in developing potentially copyrightable - material is not understood, the Copyright Office will ask about the - creative choices the applicant chose to make or not to make. As a - practical matter, if one believes she or he has made enough of those - choices, that person has a right to assert a copyright and someone - else must assert that the work is not copyrightable. The more - mechanical, the more automatic, a thing is, the less likely it is to - be copyrightable. - - * Nearly all photographs are deemed to be copyrightable, but no one - worries about them much, because everyone is free to take the same - image. Thus, a photographic copyright represents what is called a - "thin" copyright. The photograph itself must be duplicated, in - order for copyright to be violated. - - * The Copyright Office takes the position that X-rays are not - copyrightable because they are mechanical. It can be argued - whether or not image enhancement in scanning can be protected. One - must exercise care with material created with public funds and - generally in the public domain. An article written by a federal - employee, if written as part of official duties, is not - copyrightable. However, control over a scientific article written - by a National Institutes of Health grantee (i.e., someone who - receives money from the U.S. government), depends on NIH policy. If - the government agency has no policy (and that policy can be - contained in its regulations, the contract, or the grant), the - author retains copyright. If a provision of the contract, grant, or - regulation states that there will be no copyright, then it does not - exist. When a work is created, copyright automatically comes into - existence unless something exists that says it does not. - - * An enhanced electronic copy of a print copy of an older reference - work in the public domain that does not contain copyrightable new - material is a purely mechanical rendition of the original work, and - is not copyrightable. - - * Usually, when a work enters the public domain, nothing can remove - it. For example, Congress recently passed into law the concept of - automatic renewal, which means that copyright on any work published - between l964 and l978 does not have to be renewed in order to - receive a seventy-five-year term. But any work not renewed before - 1964 is in the public domain. - - * Concerning whether or not the United States keeps track of when - authors die, nothing was ever done, nor is anything being done at - the moment by the Copyright Office. - - * Software that drives a mechanical process is itself copyrightable. - If one changes platforms, the software itself has a copyright. The - World Intellectual Property Organization will hold a symposium 28 - March through 2 April l993, at Harvard University, on digital - technology, and will study this entire issue. If one purchases a - computer software package, such as MacPaint, and creates something - new, one receives protection only for that which has been added. - -PETERS added that often in copyright matters, rough justice is the -outcome, for example, in collective licensing, ASCAP (i.e., American -Society of Composers, Authors, and Publishers), and BMI (i.e., Broadcast -Music, Inc.), where it may seem that the big guys receive more than their -due. Of course, people ought not to copy a creative product without -paying for it; there should be some compensation. But the truth of the -world, and it is not a great truth, is that the big guy gets played on -the radio more frequently than the little guy, who has to do much more -until he becomes a big guy. That is true of every author, every -composer, everyone, and, unfortunately, is part of life. - -Copyright always originates with the author, except in cases of works -made for hire. (Most software falls into this category.) When an author -sends his article to a journal, he has not relinquished copyright, though -he retains the right to relinquish it. The author receives absolutely -everything. The less prominent the author, the more leverage the -publisher will have in contract negotiations. In order to transfer the -rights, the author must sign an agreement giving them away. - -In an electronic society, it is important to be able to license a writer -and work out deals. With regard to use of a work, it usually is much -easier when a publisher holds the rights. In an electronic era, a real -problem arises when one is digitizing and making information available. -PETERS referred again to electronic licensing clearinghouses. Copyright -ought to remain with the author, but as one moves forward globally in the -electronic arena, a middleman who can handle the various rights becomes -increasingly necessary. - -The notion of copyright law is that it resides with the individual, but -in an on-line environment, where a work can be adapted and tinkered with -by many individuals, there is concern. If changes are authorized and -there is no agreement to the contrary, the person who changes a work owns -the changes. To put it another way, the person who acquires permission -to change a work technically will become the author and the owner, unless -some agreement to the contrary has been made. It is typical for the -original publisher to try to control all of the versions and all of the -uses. Copyright law always only sets up the boundaries. Anything can be -changed by contract. - - ****** - -SESSION VII. CONCLUSION - -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -GENERAL DISCUSSION * Two questions for discussion * Different emphases in -the Workshop * Bringing the text and image partisans together * -Desiderata in planning the long-term development of something * Questions -surrounding the issue of electronic deposit * Discussion of electronic -deposit as an allusion to the issue of standards * Need for a directory -of preservation projects in digital form and for access to their -digitized files * CETH's catalogue of machine-readable texts in the -humanities * What constitutes a publication in the electronic world? * -Need for LC to deal with the concept of on-line publishing * LC's Network -Development Office exploring the limits of MARC as a standard in terms -of handling electronic information * Magnitude of the problem and the -need for distributed responsibility in order to maintain and store -electronic information * Workshop participants to be viewed as a starting -point * Development of a network version of AM urged * A step toward AM's -construction of some sort of apparatus for network access * A delicate -and agonizing policy question for LC * Re the issue of electronic -deposit, LC urged to initiate a catalytic process in terms of distributed -responsibility * Suggestions for cooperative ventures * Commercial -publishers' fears * Strategic questions for getting the image and text -people to think through long-term cooperation * Clarification of the -driving force behind both the Perseus and the Cornell Xerox projects * -+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -In his role as moderator of the concluding session, GIFFORD raised two -questions he believed would benefit from discussion: 1) Are there enough -commonalities among those of us that have been here for two days so that -we can see courses of action that should be taken in the future? And, if -so, what are they and who might take them? 2) Partly derivative from -that, but obviously very dangerous to LC as host, do you see a role for -the Library of Congress in all this? Of course, the Library of Congress -holds a rather special status in a number of these matters, because it is -not perceived as a player with an economic stake in them, but are there -roles that LC can play that can help advance us toward where we are heading? - -Describing himself as an uninformed observer of the technicalities of the -last two days, GIFFORD detected three different emphases in the Workshop: -1) people who are very deeply committed to text; 2) people who are almost -passionate about images; and 3) a few people who are very committed to -what happens to the networks. In other words, the new networking -dimension, the accessibility of the processability, the portability of -all this across the networks. How do we pull those three together? - -Adding a question that reflected HOCKEY's comment that this was the -fourth workshop she had attended in the previous thirty days, FLEISCHHAUER -wondered to what extent this meeting had reinvented the wheel, or if it -had contributed anything in the way of bringing together a different group -of people from those who normally appear on the workshop circuit. - -HOCKEY confessed to being struck at this meeting and the one the -Electronic Pierce Consortium organized the previous week that this was a -coming together of people working on texts and not images. Attempting to -bring the two together is something we ought to be thinking about for the -future: How one can think about working with image material to begin -with, but structuring it and digitizing it in such a way that at a later -stage it can be interpreted into text, and find a common way of building -text and images together so that they can be used jointly in the future, -with the network support to begin there because that is how people will -want to access it. - -In planning the long-term development of something, which is what is -being done in electronic text, HOCKEY stressed the importance not only -of discussing the technical aspects of how one does it but particularly -of thinking about what the people who use the stuff will want to do. -But conversely, there are numerous things that people start to do with -electronic text or material that nobody ever thought of in the beginning. - -LESK, in response to the question concerning the role of the Library of -Congress, remarked the often suggested desideratum of having electronic -deposit: Since everything is now computer-typeset, an entire decade of -material that was machine-readable exists, but the publishers frequently -did not save it; has LC taken any action to have its copyright deposit -operation start collecting these machine-readable versions? In the -absence of PETERS, GIFFORD replied that the question was being -actively considered but that that was only one dimension of the problem. -Another dimension is the whole question of the integrity of the original -electronic document. It becomes highly important in science to prove -authorship. How will that be done? - -ERWAY explained that, under the old policy, to make a claim for a -copyright for works that were published in electronic form, including -software, one had to submit a paper copy of the first and last twenty -pages of code--something that represented the work but did not include -the entire work itself and had little value to anyone. As a temporary -measure, LC has claimed the right to demand electronic versions of -electronic publications. This measure entails a proactive role for the -Library to say that it wants a particular electronic version. Publishers -then have perhaps a year to submit it. But the real problem for LC is -what to do with all this material in all these different formats. Will -the Library mount it? How will it give people access to it? How does LC -keep track of the appropriate computers, software, and media? The situation -is so hard to control, ERWAY said, that it makes sense for each publishing -house to maintain its own archive. But LC cannot enforce that either. - -GIFFORD acknowledged LESK's suggestion that establishing a priority -offered the solution, albeit a fairly complicated one. But who maintains -that register?, he asked. GRABER noted that LC does attempt to collect a -Macintosh version and the IBM-compatible version of software. It does -not collect other versions. But while true for software, BYRUM observed, -this reply does not speak to materials, that is, all the materials that -were published that were on somebody's microcomputer or driver tapes -at a publishing office across the country. LC does well to acquire -specific machine-readable products selectively that were intended to be -machine-readable. Materials that were in machine-readable form at one time, -BYRUM said, would be beyond LC's capability at the moment, insofar as -attempting to acquire, organize, and preserve them are concerned--and -preservation would be the most important consideration. In this -connection, GIFFORD reiterated the need to work out some sense of -distributive responsibility for a number of these issues, which -inevitably will require significant cooperation and discussion. -Nobody can do it all. - -LESK suggested that some publishers may look with favor on LC beginning -to serve as a depository of tapes in an electronic manuscript standard. -Publishers may view this as a service that they did not have to perform -and they might send in tapes. However, SPERBERG-McQUEEN countered, -although publishers have had equivalent services available to them for a -long time, the electronic text archive has never turned away or been -flooded with tapes and is forever sending feedback to the depositor. -Some publishers do send in tapes. - -ANDRE viewed this discussion as an allusion to the issue of standards. -She recommended that the AAP standard and the TEI, which has already been -somewhat harmonized internationally and which also shares several -compatibilities with the AAP, be harmonized to ensure sufficient -compatibility in the software. She drew the line at saying LC ought to -be the locus or forum for such harmonization. - -Taking the group in a slightly different direction, but one where at -least in the near term LC might play a helpful role, LYNCH remarked the -plans of a number of projects to carry out preservation by creating -digital images that will end up in on-line or near-line storage at some -institution. Presumably, LC will link this material somehow to its -on-line catalog in most cases. Thus, it is in a digital form. LYNCH had -the impression that many of these institutions would be willing to make -those files accessible to other people outside the institution, provided -that there is no copyright problem. This desideratum will require -propagating the knowledge that those digitized files exist, so that they -can end up in other on-line catalogs. Although uncertain about the -mechanism for achieving this result, LYNCH said that it warranted -scrutiny because it seemed to be connected to some of the basic issues of -cataloging and distribution of records. It would be foolish, given the -amount of work that all of us have to do and our meager resources, to -discover multiple institutions digitizing the same work. Re microforms, -LYNCH said, we are in pretty good shape. - -BATTIN called this a big problem and noted that the Cornell people (who -had already departed) were working on it. At issue from the beginning -was to learn how to catalog that information into RLIN and then into -OCLC, so that it would be accessible. That issue remains to be resolved. -LYNCH rejoined that putting it into OCLC or RLIN was helpful insofar as -somebody who is thinking of performing preservation activity on that work -could learn about it. It is not necessarily helpful for institutions to -make that available. BATTIN opined that the idea was that it not only be -for preservation purposes but for the convenience of people looking for -this material. She endorsed LYNCH's dictum that duplication of this -effort was to be avoided by every means. - -HOCKEY informed the Workshop about one major current activity of CETH, -namely a catalogue of machine-readable texts in the humanities. Held on -RLIN at present, the catalogue has been concentrated on ASCII as opposed -to digitized images of text. She is exploring ways to improve the -catalogue and make it more widely available, and welcomed suggestions -about these concerns. CETH owns the records, which are not just -restricted to RLIN, and can distribute them however it wishes. - -Taking up LESK's earlier question, BATTIN inquired whether LC, since it -is accepting electronic files and designing a mechanism for dealing with -that rather than putting books on shelves, would become responsible for -the National Copyright Depository of Electronic Materials. Of course -that could not be accomplished overnight, but it would be something LC -could plan for. GIFFORD acknowledged that much thought was being devoted -to that set of problems and returned the discussion to the issue raised -by LYNCH--whether or not putting the kind of records that both BATTIN and -HOCKEY have been talking about in RLIN is not a satisfactory solution. -It seemed to him that RLIN answered LYNCH's original point concerning -some kind of directory for these kinds of materials. In a situation -where somebody is attempting to decide whether or not to scan this or -film that or to learn whether or not someone has already done so, LYNCH -suggested, RLIN is helpful, but it is not helpful in the case of a local, -on-line catalogue. Further, one would like to have her or his system be -aware that that exists in digital form, so that one can present it to a -patron, even though one did not digitize it, if it is out of copyright. -The only way to make those linkages would be to perform a tremendous -amount of real-time look-up, which would be awkward at best, or -periodically to yank the whole file from RLIN and match it against one's -own stuff, which is a nuisance. - -But where, ERWAY inquired, does one stop including things that are -available with Internet, for instance, in one's local catalogue? -It almost seems that that is LC's means to acquire access to them. -That represents LC's new form of library loan. Perhaps LC's new on-line -catalogue is an amalgamation of all these catalogues on line. LYNCH -conceded that perhaps that was true in the very long term, but was not -applicable to scanning in the short term. In his view, the totals cited -by Yale, 10,000 books over perhaps a four-year period, and 1,000-1,500 -books from Cornell, were not big numbers, while searching all over -creation for relatively rare occurrences will prove to be less efficient. -As GIFFORD wondered if this would not be a separable file on RLIN and -could be requested from them, BATTIN interjected that it was easily -accessible to an institution. SEVERTSON pointed out that that file, cum -enhancements, was available with reference information on CD-ROM, which -makes it a little more available. - -In HOCKEY's view, the real question facing the Workshop is what to put in -this catalogue, because that raises the question of what constitutes a -publication in the electronic world. (WEIBEL interjected that Eric Joule -in OCLC's Office of Research is also wrestling with this particular -problem, while GIFFORD thought it sounded fairly generic.) HOCKEY -contended that a majority of texts in the humanities are in the hands -of either a small number of large research institutions or individuals -and are not generally available for anyone else to access at all. -She wondered if these texts ought to be catalogued. - -After argument proceeded back and forth for several minutes over why -cataloguing might be a necessary service, LEBRON suggested that this -issue involved the responsibility of a publisher. The fact that someone -has created something electronically and keeps it under his or her -control does not constitute publication. Publication implies -dissemination. While it would be important for a scholar to let other -people know that this creation exists, in many respects this is no -different from an unpublished manuscript. That is what is being accessed -in there, except that now one is not looking at it in the hard-copy but -in the electronic environment. - -LEBRON expressed puzzlement at the variety of ways electronic publishing -has been viewed. Much of what has been discussed throughout these two -days has concerned CD-ROM publishing, whereas in the on-line environment -that she confronts, the constraints and challenges are very different. -Sooner or later LC will have to deal with the concept of on-line -publishing. Taking up the comment ERWAY made earlier about storing -copies, LEBRON gave her own journal as an example. How would she deposit -OJCCT for copyright?, she asked, because the journal will exist in the -mainframe at OCLC and people will be able to access it. Here the -situation is different, ownership versus access, and is something that -arises with publication in the on-line environment, faster than is -sometimes realized. Lacking clear answers to all of these questions -herself, LEBRON did not anticipate that LC would be able to take a role -in helping to define some of them for quite a while. - -GREENFIELD observed that LC's Network Development Office is attempting, -among other things, to explore the limits of MARC as a standard in terms -of handling electronic information. GREENFIELD also noted that Rebecca -GUENTHER from that office gave a paper to the American Society for -Information Science (ASIS) summarizing several of the discussion papers -that were coming out of the Network Development Office. GREENFIELD said -he understood that that office had a list-server soliciting just the kind -of feedback received today concerning the difficulties of identifying and -cataloguing electronic information. GREENFIELD hoped that everybody -would be aware of that and somehow contribute to that conversation. - -Noting two of LC's roles, first, to act as a repository of record for -material that is copyrighted in this country, and second, to make -materials it holds available in some limited form to a clientele that -goes beyond Congress, BESSER suggested that it was incumbent on LC to -extend those responsibilities to all the things being published in -electronic form. This would mean eventually accepting electronic -formats. LC could require that at some point they be in a certain -limited set of formats, and then develop mechanisms for allowing people -to access those in the same way that other things are accessed. This -does not imply that they are on the network and available to everyone. -LC does that with most of its bibliographic records, BESSER said, which -end up migrating to the utility (e.g., OCLC) or somewhere else. But just -as most of LC's books are available in some form through interlibrary -loan or some other mechanism, so in the same way electronic formats ought -to be available to others in some format, though with some copyright -considerations. BESSER was not suggesting that these mechanisms be -established tomorrow, only that they seemed to fall within LC's purview, -and that there should be long-range plans to establish them. - -Acknowledging that those from LC in the room agreed with BESSER -concerning the need to confront difficult questions, GIFFORD underscored -the magnitude of the problem of what to keep and what to select. GIFFORD -noted that LC currently receives some 31,000 items per day, not counting -electronic materials, and argued for much more distributed responsibility -in order to maintain and store electronic information. - -BESSER responded that the assembled group could be viewed as a starting -point, whose initial operating premise could be helping to move in this -direction and defining how LC could do so, for example, in areas of -standardization or distribution of responsibility. - -FLEISCHHAUER added that AM was fully engaged, wrestling with some of the -questions that pertain to the conversion of older historical materials, -which would be one thing that the Library of Congress might do. Several -points mentioned by BESSER and several others on this question have a -much greater impact on those who are concerned with cataloguing and the -networking of bibliographic information, as well as preservation itself. - -Speaking directly to AM, which he considered was a largely uncopyrighted -database, LYNCH urged development of a network version of AM, or -consideration of making the data in it available to people interested in -doing network multimedia. On account of the current great shortage of -digital data that is both appealing and unencumbered by complex rights -problems, this course of action could have a significant effect on making -network multimedia a reality. - -In this connection, FLEISCHHAUER reported on a fragmentary prototype in -LC's Office of Information Technology Services that attempts to associate -digital images of photographs with cataloguing information in ways that -work within a local area network--a step, so to say, toward AM's -construction of some sort of apparatus for access. Further, AM has -attempted to use standard data forms in order to help make that -distinction between the access tools and the underlying data, and thus -believes that the database is networkable. - -A delicate and agonizing policy question for LC, however, which comes -back to resources and unfortunately has an impact on this, is to find -some appropriate, honorable, and legal cost-recovery possibilities. A -certain skittishness concerning cost-recovery has made people unsure -exactly what to do. AM would be highly receptive to discussing further -LYNCH's offer to test or demonstrate its database in a network -environment, FLEISCHHAUER said. - -Returning the discussion to what she viewed as the vital issue of -electronic deposit, BATTIN recommended that LC initiate a catalytic -process in terms of distributed responsibility, that is, bring together -the distributed organizations and set up a study group to look at all -these issues and see where we as a nation should move. The broader -issues of how we deal with the management of electronic information will -not disappear, but only grow worse. - -LESK took up this theme and suggested that LC attempt to persuade one -major library in each state to deal with its state equivalent publisher, -which might produce a cooperative project that would be equitably -distributed around the country, and one in which LC would be dealing with -a minimal number of publishers and minimal copyright problems. - -GRABER remarked the recent development in the scientific community of a -willingness to use SGML and either deposit or interchange on a fairly -standardized format. He wondered if a similar movement was taking place -in the humanities. Although the National Library of Medicine found only -a few publishers to cooperate in a like venture two or three years ago, a -new effort might generate a much larger number willing to cooperate. - -KIMBALL recounted his unit's (Machine-Readable Collections Reading Room) -troubles with the commercial publishers of electronic media in acquiring -materials for LC's collections, in particular the publishers' fear that -they would not be able to cover their costs and would lose control of -their products, that LC would give them away or sell them and make -profits from them. He doubted that the publishing industry was prepared -to move into this area at the moment, given its resistance to allowing LC -to use its machine-readable materials as the Library would like. - -The copyright law now addresses compact disk as a medium, and LC can -request one copy of that, or two copies if it is the only version, and -can request copies of software, but that fails to address magazines or -books or anything like that which is in machine-readable form. - -GIFFORD acknowledged the thorny nature of this issue, which he illustrated -with the example of the cumbersome process involved in putting a copy of a -scientific database on a LAN in LC's science reading room. He also -acknowledged that LC needs help and could enlist the energies and talents -of Workshop participants in thinking through a number of these problems. - -GIFFORD returned the discussion to getting the image and text people to -think through together where they want to go in the long term. MYLONAS -conceded that her experience at the Pierce Symposium the previous week at -Georgetown University and this week at LC had forced her to reevaluate -her perspective on the usefulness of text as images. MYLONAS framed the -issues in a series of questions: How do we acquire machine-readable -text? Do we take pictures of it and perform OCR on it later? Is it -important to obtain very high-quality images and text, etc.? -FLEISCHHAUER agreed with MYLONAS's framing of strategic questions, adding -that a large institution such as LC probably has to do all of those -things at different times. Thus, the trick is to exercise judgment. The -Workshop had added to his and AM's considerations in making those -judgments. Concerning future meetings or discussions, MYLONAS suggested -that screening priorities would be helpful. - -WEIBEL opined that the diversity reflected in this group was a sign both -of the health and of the immaturity of the field, and more time would -have to pass before we convince one another concerning standards. - -An exchange between MYLONAS and BATTIN clarified the point that the -driving force behind both the Perseus and the Cornell Xerox projects was -the preservation of knowledge for the future, not simply for particular -research use. In the case of Perseus, MYLONAS said, the assumption was -that the texts would not be entered again into electronically readable -form. SPERBERG-McQUEEN added that a scanned image would not serve as an -archival copy for purposes of preservation in the case of, say, the Bill -of Rights, in the sense that the scanned images are effectively the -archival copies for the Cornell mathematics books. - - - *** *** *** ****** *** *** *** - - - Appendix I: PROGRAM - - - - WORKSHOP - ON - ELECTRONIC - TEXTS - - - - 9-10 June 1992 - - Library of Congress - Washington, D.C. - - - - Supported by a Grant from the David and Lucile Packard Foundation - - -Tuesday, 9 June 1992 - -NATIONAL DEMONSTRATION LAB, ATRIUM, LIBRARY MADISON - -8:30 AM Coffee and Danish, registration - -9:00 AM Welcome - - Prosser Gifford, Director for Scholarly Programs, and Carl - Fleischhauer, Coordinator, American Memory, Library of - Congress - -9:l5 AM Session I. Content in a New Form: Who Will Use It and What - Will They Do? - - Broad description of the range of electronic information. - Characterization of who uses it and how it is or may be used. - In addition to a look at scholarly uses, this session will - include a presentation on use by students (K-12 and college) - and the general public. - - Moderator: James Daly - Avra Michelson, Archival Research and Evaluation Staff, - National Archives and Records Administration (Overview) - Susan H. Veccia, Team Leader, American Memory, User Evaluation, - and - Joanne Freeman, Associate Coordinator, American Memory, Library - of Congress (Beyond the scholar) - -10:30- -11:00 AM Break - -11:00 AM Session II. Show and Tell. - - Each presentation to consist of a fifteen-minute - statement/show; group discussion will follow lunch. - - Moderator: Jacqueline Hess, Director, National Demonstration - Lab - - 1. A classics project, stressing texts and text retrieval - more than multimedia: Perseus Project, Harvard - University - Elli Mylonas, Managing Editor - - 2. Other humanities projects employing the emerging norms of - the Text Encoding Initiative (TEI): Chadwyck-Healey's - The English Poetry Full Text Database and/or Patrologia - Latina Database - Eric M. Calaluca, Vice President, Chadwyck-Healey, Inc. - - 3. American Memory - Carl Fleischhauer, Coordinator, and - Ricky Erway, Associate Coordinator, Library of Congress - - 4. Founding Fathers example from Packard Humanities - Institute: The Papers of George Washington, University - of Virginia - Dorothy Twohig, Managing Editor, and/or - David Woodley Packard - - 5. An electronic medical journal offering graphics and - full-text searchability: The Online Journal of Current - Clinical Trials, American Association for the Advancement - of Science - Maria L. Lebron, Managing Editor - - 6. A project that offers facsimile images of pages but omits - searchable text: Cornell math books - Lynne K. Personius, Assistant Director, Cornell - Information Technologies for Scholarly Information - Sources, Cornell University - -12:30 PM Lunch (Dining Room A, Library Madison 620. Exhibits - available.) - -1:30 PM Session II. Show and Tell (Cont'd.). - -3:00- -3:30 PM Break - -3:30- -5:30 PM Session III. Distribution, Networks, and Networking: Options - for Dissemination. - - Published disks: University presses and public-sector - publishers, private-sector publishers - Computer networks - - Moderator: Robert G. Zich, Special Assistant to the Associate - Librarian for Special Projects, Library of Congress - Clifford A. Lynch, Director, Library Automation, University of - California - Howard Besser, School of Library and Information Science, - University of Pittsburgh - Ronald L. Larsen, Associate Director of Libraries for - Information Technology, University of Maryland at College - Park - Edwin B. Brownrigg, Executive Director, Memex Research - Institute - -6:30 PM Reception (Montpelier Room, Library Madison 619.) - - ****** - -Wednesday, 10 June 1992 - -DINING ROOM A, LIBRARY MADISON 620 - -8:30 AM Coffee and Danish - -9:00 AM Session IV. Image Capture, Text Capture, Overview of Text and - Image Storage Formats. - - Moderator: William L. Hooton, Vice President of Operations, - I-NET - - A) Principal Methods for Image Capture of Text: - Direct scanning - Use of microform - - Anne R. Kenney, Assistant Director, Department of Preservation - and Conservation, Cornell University - Pamela Q.J. Andre, Associate Director, Automation, and - Judith A. Zidar, Coordinator, National Agricultural Text - Digitizing Program (NATDP), National Agricultural Library - (NAL) - Donald J. Waters, Head, Systems Office, Yale University Library - - B) Special Problems: - Bound volumes - Conservation - Reproducing printed halftones - - Carl Fleischhauer, Coordinator, American Memory, Library of - Congress - George Thoma, Chief, Communications Engineering Branch, - National Library of Medicine (NLM) - -10:30- -11:00 AM Break - -11:00 AM Session IV. Image Capture, Text Capture, Overview of Text and - Image Storage Formats (Cont'd.). - - C) Image Standards and Implications for Preservation - - Jean Baronas, Senior Manager, Department of Standards and - Technology, Association for Information and Image Management - (AIIM) - Patricia Battin, President, The Commission on Preservation and - Access (CPA) - - D) Text Conversion: - OCR vs. rekeying - Standards of accuracy and use of imperfect texts - Service bureaus - - Stuart Weibel, Senior Research Specialist, Online Computer - Library Center, Inc. (OCLC) - Michael Lesk, Executive Director, Computer Science Research, - Bellcore - Ricky Erway, Associate Coordinator, American Memory, Library of - Congress - Pamela Q.J. Andre, Associate Director, Automation, and - Judith A. Zidar, Coordinator, National Agricultural Text - Digitizing Program (NATDP), National Agricultural Library - (NAL) - -12:30- -1:30 PM Lunch - -1:30 PM Session V. Approaches to Preparing Electronic Texts. - - Discussion of approaches to structuring text for the computer; - pros and cons of text coding, description of methods in - practice, and comparison of text-coding methods. - - Moderator: Susan Hockey, Director, Center for Electronic Texts - in the Humanities (CETH), Rutgers and Princeton Universities - David Woodley Packard - C.M. Sperberg-McQueen, Editor, Text Encoding Initiative (TEI), - University of Illinois-Chicago - Eric M. Calaluca, Vice President, Chadwyck-Healey, Inc. - -3:30- -4:00 PM Break - -4:00 PM Session VI. Copyright Issues. - - Marybeth Peters, Policy Planning Adviser to the Register of - Copyrights, Library of Congress - -5:00 PM Session VII. Conclusion. - - General discussion. - What topics were omitted or given short shrift that anyone - would like to talk about now? - Is there a "group" here? What should the group do next, if - anything? What should the Library of Congress do next, if - anything? - Moderator: Prosser Gifford, Director for Scholarly Programs, - Library of Congress - -6:00 PM Adjourn - - - *** *** *** ****** *** *** *** - - - Appendix II: ABSTRACTS - - -SESSION I - -Avra MICHELSON Forecasting the Use of Electronic Texts by - Social Sciences and Humanities Scholars - -This presentation explores the ways in which electronic texts are likely -to be used by the non-scientific scholarly community. Many of the -remarks are drawn from a report the speaker coauthored with Jeff -Rothenberg, a computer scientist at The RAND Corporation. - -The speaker assesses 1) current scholarly use of information technology -and 2) the key trends in information technology most relevant to the -research process, in order to predict how social sciences and humanities -scholars are apt to use electronic texts. In introducing the topic, -current use of electronic texts is explored broadly within the context of -scholarly communication. From the perspective of scholarly -communication, the work of humanities and social sciences scholars -involves five processes: 1) identification of sources, 2) communication -with colleagues, 3) interpretation and analysis of data, 4) dissemination -of research findings, and 5) curriculum development and instruction. The -extent to which computation currently permeates aspects of scholarly -communication represents a viable indicator of the prospects for -electronic texts. - -The discussion of current practice is balanced by an analysis of key -trends in the scholarly use of information technology. These include the -trends toward end-user computing and connectivity, which provide a -framework for forecasting the use of electronic texts through this -millennium. The presentation concludes with a summary of the ways in -which the nonscientific scholarly community can be expected to use -electronic texts, and the implications of that use for information -providers. - -Susan VECCIA and Joanne FREEMAN Electronic Archives for the Public: - Use of American Memory in Public and - School Libraries - -This joint discussion focuses on nonscholarly applications of electronic -library materials, specifically addressing use of the Library of Congress -American Memory (AM) program in a small number of public and school -libraries throughout the United States. AM consists of selected Library -of Congress primary archival materials, stored on optical media -(CD-ROM/videodisc), and presented with little or no editing. Many -collections are accompanied by electronic introductions and user's guides -offering background information and historical context. Collections -represent a variety of formats including photographs, graphic arts, -motion pictures, recorded sound, music, broadsides and manuscripts, -books, and pamphlets. - -In 1991, the Library of Congress began a nationwide evaluation of AM in -different types of institutions. Test sites include public libraries, -elementary and secondary school libraries, college and university -libraries, state libraries, and special libraries. Susan VECCIA and -Joanne FREEMAN will discuss their observations on the use of AM by the -nonscholarly community, using evidence gleaned from this ongoing -evaluation effort. - -VECCIA will comment on the overall goals of the evaluation project, and -the types of public and school libraries included in this study. Her -comments on nonscholarly use of AM will focus on the public library as a -cultural and community institution, often bridging the gap between formal -and informal education. FREEMAN will discuss the use of AM in school -libraries. Use by students and teachers has revealed some broad -questions about the use of electronic resources, as well as definite -benefits gained by the "nonscholar." Topics will include the problem of -grasping content and context in an electronic environment, the stumbling -blocks created by "new" technologies, and the unique skills and interests -awakened through use of electronic resources. - -SESSION II - -Elli MYLONAS The Perseus Project: Interactive Sources and - Studies in Classical Greece - -The Perseus Project (5) has just released Perseus 1.0, the first publicly -available version of its hypertextual database of multimedia materials on -classical Greece. Perseus is designed to be used by a wide audience, -comprised of readers at the student and scholar levels. As such, it must -be able to locate information using different strategies, and it must -contain enough detail to serve the different needs of its users. In -addition, it must be delivered so that it is affordable to its target -audience. [These problems and the solutions we chose are described in -Mylonas, "An Interface to Classical Greek Civilization," JASIS 43:2, -March 1992.] - -In order to achieve its objective, the project staff decided to make a -conscious separation between selecting and converting textual, database, -and image data on the one hand, and putting it into a delivery system on -the other. That way, it is possible to create the electronic data -without thinking about the restrictions of the delivery system. We have -made a great effort to choose system-independent formats for our data, -and to put as much thought and work as possible into structuring it so -that the translation from paper to electronic form will enhance the value -of the data. [A discussion of these solutions as of two years ago is in -Elli Mylonas, Gregory Crane, Kenneth Morrell, and D. Neel Smith, "The -Perseus Project: Data in the Electronic Age," in Accessing Antiquity: -The Computerization of Classical Databases, J. Solomon and T. Worthen -(eds.), University of Arizona Press, in press.] - -Much of the work on Perseus is focused on collecting and converting the -data on which the project is based. At the same time, it is necessary to -provide means of access to the information, in order to make it usable, -and them to investigate how it is used. As we learn more about what -students and scholars from different backgrounds do with Perseus, we can -adjust our data collection, and also modify the system to accommodate -them. In creating a delivery system for general use, we have tried to -avoid favoring any one type of use by allowing multiple forms of access -to and navigation through the system. - -The way text is handled exemplifies some of these principles. All text -in Perseus is tagged using SGML, following the guidelines of the Text -Encoding Initiative (TEI). This markup is used to index the text, and -process it so that it can be imported into HyperCard. No SGML markup -remains in the text that reaches the user, because currently it would be -too expensive to create a system that acts on SGML in real time. -However, the regularity provided by SGML is essential for verifying the -content of the texts, and greatly speeds all the processing performed on -them. The fact that the texts exist in SGML ensures that they will be -relatively easy to port to different hardware and software, and so will -outlast the current delivery platform. Finally, the SGML markup -incorporates existing canonical reference systems (chapter, verse, line, -etc.); indexing and navigation are based on these features. This ensures -that the same canonical reference will always resolve to the same point -within a text, and that all versions of our texts, regardless of delivery -platform (even paper printouts) will function the same way. - -In order to provide tools for users, the text is processed by a -morphological analyzer, and the results are stored in a database. -Together with the index, the Greek-English Lexicon, and the index of all -the English words in the definitions of the lexicon, the morphological -analyses comprise a set of linguistic tools that allow users of all -levels to work with the textual information, and to accomplish different -tasks. For example, students who read no Greek may explore a concept as -it appears in Greek texts by using the English-Greek index, and then -looking up works in the texts and translations, or scholars may do -detailed morphological studies of word use by using the morphological -analyses of the texts. Because these tools were not designed for any one -use, the same tools and the same data can be used by both students and -scholars. - -NOTES: - (5) Perseus is based at Harvard University, with collaborators at - several other universities. The project has been funded primarily - by the Annenberg/CPB Project, as well as by Harvard University, - Apple Computer, and others. It is published by Yale University - Press. Perseus runs on Macintosh computers, under the HyperCard - program. - -Eric CALALUCA - -Chadwyck-Healey embarked last year on two distinct yet related full-text -humanities database projects. - -The English Poetry Full-Text Database and the Patrologia Latina Database -represent new approaches to linguistic research resources. The size and -complexity of the projects present problems for electronic publishers, -but surmountable ones if they remain abreast of the latest possibilities -in data capture and retrieval software techniques. - -The issues which required address prior to the commencement of the -projects were legion: - - 1. Editorial selection (or exclusion) of materials in each - database - - 2. Deciding whether or not to incorporate a normative encoding - structure into the databases? - A. If one is selected, should it be SGML? - B. If SGML, then the TEI? - - 3. Deliver as CD-ROM, magnetic tape, or both? - - 4. Can one produce retrieval software advanced enough for the - postdoctoral linguist, yet accessible enough for unattended - general use? Should one try? - - 5. Re fair and liberal networking policies, what are the risks to - an electronic publisher? - - 6. How does the emergence of national and international education - networks affect the use and viability of research projects - requiring high investment? Do the new European Community - directives concerning database protection necessitate two - distinct publishing projects, one for North America and one for - overseas? - -From new notions of "scholarly fair use" to the future of optical media, -virtually every issue related to electronic publishing was aired. The -result is two projects which have been constructed to provide the quality -research resources with the fewest encumbrances to use by teachers and -private scholars. - -Dorothy TWOHIG - -In spring 1988 the editors of the papers of George Washington, John -Adams, Thomas Jefferson, James Madison, and Benjamin Franklin were -approached by classics scholar David Packard on behalf of the Packard -Humanities Foundation with a proposal to produce a CD-ROM edition of the -complete papers of each of the Founding Fathers. This electronic edition -will supplement the published volumes, making the documents widely -available to students and researchers at reasonable cost. We estimate -that our CD-ROM edition of Washington's Papers will be substantially -completed within the next two years and ready for publication. Within -the next ten years or so, similar CD-ROM editions of the Franklin, Adams, -Jefferson, and Madison papers also will be available. At the Library of -Congress's session on technology, I would like to discuss not only the -experience of the Washington Papers in producing the CD-ROM edition, but -the impact technology has had on these major editorial projects. -Already, we are editing our volumes with an eye to the material that will -be readily available in the CD-ROM edition. The completed electronic -edition will provide immense possibilities for the searching of documents -for information in a way never possible before. The kind of technical -innovations that are currently available and on the drawing board will -soon revolutionize historical research and the production of historical -documents. Unfortunately, much of this new technology is not being used -in the planning stages of historical projects, simply because many -historians are aware only in the vaguest way of its existence. At least -two major new historical editing projects are considering microfilm -editions, simply because they are not aware of the possibilities of -electronic alternatives and the advantages of the new technology in terms -of flexibility and research potential compared to microfilm. In fact, -too many of us in history and literature are still at the stage of -struggling with our PCs. There are many historical editorial projects in -progress presently, and an equal number of literary projects. While the -two fields have somewhat different approaches to textual editing, there -are ways in which electronic technology can be of service to both. - -Since few of the editors involved in the Founding Fathers CD-ROM editions -are technical experts in any sense, I hope to point out in my discussion -of our experience how many of these electronic innovations can be used -successfully by scholars who are novices in the world of new technology. -One of the major concerns of the sponsors of the multitude of new -scholarly editions is the limited audience reached by the published -volumes. Most of these editions are being published in small quantities -and the publishers' price for them puts them out of the reach not only of -individual scholars but of most public libraries and all but the largest -educational institutions. However, little attention is being given to -ways in which technology can bypass conventional publication to make -historical and literary documents more widely available. - -What attracted us most to the CD-ROM edition of The Papers of George -Washington was the fact that David Packard's aim was to make a complete -edition of all of the 135,000 documents we have collected available in an -inexpensive format that would be placed in public libraries, small -colleges, and even high schools. This would provide an audience far -beyond our present 1,000-copy, $45 published edition. Since the CD-ROM -edition will carry none of the explanatory annotation that appears in the -published volumes, we also feel that the use of the CD-ROM will lead many -researchers to seek out the published volumes. - -In addition to ignorance of new technical advances, I have found that too -many editors--and historians and literary scholars--are resistant and -even hostile to suggestions that electronic technology may enhance their -work. I intend to discuss some of the arguments traditionalists are -advancing to resist technology, ranging from distrust of the speed with -which it changes (we are already wondering what is out there that is -better than CD-ROM) to suspicion of the technical language used to -describe electronic developments. - -Maria LEBRON - -The Online Journal of Current Clinical Trials, a joint venture of the -American Association for the Advancement of Science (AAAS) and the Online -Computer Library Center, Inc. (OCLC), is the first peer-reviewed journal -to provide full text, tabular material, and line illustrations on line. -This presentation will discuss the genesis and start-up period of the -journal. Topics of discussion will include historical overview, -day-to-day management of the editorial peer review, and manuscript -tagging and publication. A demonstration of the journal and its features -will accompany the presentation. - -Lynne PERSONIUS - -Cornell University Library, Cornell Information Technologies, and Xerox -Corporation, with the support of the Commission on Preservation and -Access, and Sun Microsystems, Inc., have been collaborating in a project -to test a prototype system for recording brittle books as digital images -and producing, on demand, high-quality archival paper replacements. The -project goes beyond that, however, to investigate some of the issues -surrounding scanning, storing, retrieving, and providing access to -digital images in a network environment. - -The Joint Study in Digital Preservation began in January 1990. Xerox -provided the College Library Access and Storage System (CLASS) software, -a prototype 600-dots-per-inch (dpi) scanner, and the hardware necessary -to support network printing on the DocuTech printer housed in Cornell's -Computing and Communications Center (CCC). - -The Cornell staff using the hardware and software became an integral part -of the development and testing process for enhancements to the CLASS -software system. The collaborative nature of this relationship is -resulting in a system that is specifically tailored to the preservation -application. - -A digital library of 1,000 volumes (or approximately 300,000 images) has -been created and is stored on an optical jukebox that resides in CCC. -The library includes a collection of select mathematics monographs that -provides mathematics faculty with an opportunity to use the electronic -library. The remaining volumes were chosen for the library to test the -various capabilities of the scanning system. - -One project objective is to provide users of the Cornell library and the -library staff with the ability to request facsimiles of digitized images -or to retrieve the actual electronic image for browsing. A prototype -viewing workstation has been created by Xerox, with input into the design -by a committee of Cornell librarians and computer professionals. This -will allow us to experiment with patron access to the images that make up -the digital library. The viewing station provides search, retrieval, and -(ultimately) printing functions with enhancements to facilitate -navigation through multiple documents. - -Cornell currently is working to extend access to the digital library to -readers using workstations from their offices. This year is devoted to -the development of a network resident image conversion and delivery -server, and client software that will support readers who use Apple -Macintosh computers, IBM windows platforms, and Sun workstations. -Equipment for this development was provided by Sun Microsystems with -support from the Commission on Preservation and Access. - -During the show-and-tell session of the Workshop on Electronic Texts, a -prototype view station will be demonstrated. In addition, a display of -original library books that have been digitized will be available for -review with associated printed copies for comparison. The fifteen-minute -overview of the project will include a slide presentation that -constitutes a "tour" of the preservation digitizing process. - -The final network-connected version of the viewing station will provide -library users with another mechanism for accessing the digital library, -and will also provide the capability of viewing images directly. This -will not require special software, although a powerful computer with good -graphics will be needed. - -The Joint Study in Digital Preservation has generated a great deal of -interest in the library community. Unfortunately, or perhaps -fortunately, this project serves to raise a vast number of other issues -surrounding the use of digital technology for the preservation and use of -deteriorating library materials, which subsequent projects will need to -examine. Much work remains. - -SESSION III - -Howard BESSER Networking Multimedia Databases - -What do we have to consider in building and distributing databases of -visual materials in a multi-user environment? This presentation examines -a variety of concerns that need to be addressed before a multimedia -database can be set up in a networked environment. - -In the past it has not been feasible to implement databases of visual -materials in shared-user environments because of technological barriers. -Each of the two basic models for multi-user multimedia databases has -posed its own problem. The analog multimedia storage model (represented -by Project Athena's parallel analog and digital networks) has required an -incredibly complex (and expensive) infrastructure. The economies of -scale that make multi-user setups cheaper per user served do not operate -in an environment that requires a computer workstation, videodisc player, -and two display devices for each user. - -The digital multimedia storage model has required vast amounts of storage -space (as much as one gigabyte per thirty still images). In the past the -cost of such a large amount of storage space made this model a -prohibitive choice as well. But plunging storage costs are finally -making this second alternative viable. - -If storage no longer poses such an impediment, what do we need to -consider in building digitally stored multi-user databases of visual -materials? This presentation will examine the networking and -telecommunication constraints that must be overcome before such databases -can become commonplace and useful to a large number of people. - -The key problem is the vast size of multimedia documents, and how this -affects not only storage but telecommunications transmission time. -Anything slower than T-1 speed is impractical for files of 1 megabyte or -larger (which is likely to be small for a multimedia document). For -instance, even on a 56 Kb line it would take three minutes to transfer a -1-megabyte file. And these figures assume ideal circumstances, and do -not take into consideration other users contending for network bandwidth, -disk access time, or the time needed for remote display. Current common -telephone transmission rates would be completely impractical; few users -would be willing to wait the hour necessary to transmit a single image at -2400 baud. - -This necessitates compression, which itself raises a number of other -issues. In order to decrease file sizes significantly, we must employ -lossy compression algorithms. But how much quality can we afford to -lose? To date there has been only one significant study done of -image-quality needs for a particular user group, and this study did not -look at loss resulting from compression. Only after identifying -image-quality needs can we begin to address storage and network bandwidth -needs. - -Experience with X-Windows-based applications (such as Imagequery, the -University of California at Berkeley image database) demonstrates the -utility of a client-server topology, but also points to the limitation of -current software for a distributed environment. For example, -applications like Imagequery can incorporate compression, but current X -implementations do not permit decompression at the end user's -workstation. Such decompression at the host computer alleviates storage -capacity problems while doing nothing to address problems of -telecommunications bandwidth. - -We need to examine the effects on network through-put of moving -multimedia documents around on a network. We need to examine various -topologies that will help us avoid bottlenecks around servers and -gateways. Experience with applications such as these raise still broader -questions. How closely is the multimedia document tied to the software -for viewing it? Can it be accessed and viewed from other applications? -Experience with the MARC format (and more recently with the Z39.50 -protocols) shows how useful it can be to store documents in a form in -which they can be accessed by a variety of application software. - -Finally, from an intellectual-access standpoint, we need to address the -issue of providing access to these multimedia documents in -interdisciplinary environments. We need to examine terminology and -indexing strategies that will allow us to provide access to this material -in a cross-disciplinary way. - -Ronald LARSEN Directions in High-Performance Networking for - Libraries - -The pace at which computing technology has advanced over the past forty -years shows no sign of abating. Roughly speaking, each five-year period -has yielded an order-of-magnitude improvement in price and performance of -computing equipment. No fundamental hurdles are likely to prevent this -pace from continuing for at least the next decade. It is only in the -past five years, though, that computing has become ubiquitous in -libraries, affecting all staff and patrons, directly or indirectly. - -During these same five years, communications rates on the Internet, the -principal academic computing network, have grown from 56 kbps to 1.5 -Mbps, and the NSFNet backbone is now running 45 Mbps. Over the next five -years, communication rates on the backbone are expected to exceed 1 Gbps. -Growth in both the population of network users and the volume of network -traffic has continued to grow geometrically, at rates approaching 15 -percent per month. This flood of capacity and use, likened by some to -"drinking from a firehose," creates immense opportunities and challenges -for libraries. Libraries must anticipate the future implications of this -technology, participate in its development, and deploy it to ensure -access to the world's information resources. - -The infrastructure for the information age is being put in place. -Libraries face strategic decisions about their role in the development, -deployment, and use of this infrastructure. The emerging infrastructure -is much more than computers and communication lines. It is more than the -ability to compute at a remote site, send electronic mail to a peer -across the country, or move a file from one library to another. The next -five years will witness substantial development of the information -infrastructure of the network. - -In order to provide appropriate leadership, library professionals must -have a fundamental understanding of and appreciation for computer -networking, from local area networks to the National Research and -Education Network (NREN). This presentation addresses these -fundamentals, and how they relate to libraries today and in the near -future. - -Edwin BROWNRIGG Electronic Library Visions and Realities - -The electronic library has been a vision desired by many--and rejected by -some--since Vannevar Bush coined the term memex to describe an automated, -intelligent, personal information system. Variations on this vision have -included Ted Nelson's Xanadau, Alan Kay's Dynabook, and Lancaster's -"paperless library," with the most recent incarnation being the -"Knowledge Navigator" described by John Scully of Apple. But the reality -of library service has been less visionary and the leap to the electronic -library has eluded universities, publishers, and information technology -files. - -The Memex Research Institute (MemRI), an independent, nonprofit research -and development organization, has created an Electronic Library Program -of shared research and development in order to make the collective vision -more concrete. The program is working toward the creation of large, -indexed publicly available electronic image collections of published -documents in academic, special, and public libraries. This strategic -plan is the result of the first stage of the program, which has been an -investigation of the information technologies available to support such -an effort, the economic parameters of electronic service compared to -traditional library operations, and the business and political factors -affecting the shift from print distribution to electronic networked -access. - -The strategic plan envisions a combination of publicly searchable access -databases, image (and text) document collections stored on network "file -servers," local and remote network access, and an intellectual property -management-control system. This combination of technology and -information content is defined in this plan as an E-library or E-library -collection. Some participating sponsors are already developing projects -based on MemRI's recommended directions. - -The E-library strategy projected in this plan is a visionary one that can -enable major changes and improvements in academic, public, and special -library service. This vision is, though, one that can be realized with -today's technology. At the same time, it will challenge the political -and social structure within which libraries operate: in academic -libraries, the traditional emphasis on local collections, extending to -accreditation issues; in public libraries, the potential of electronic -branch and central libraries fully available to the public; and for -special libraries, new opportunities for shared collections and networks. - -The environment in which this strategic plan has been developed is, at -the moment, dominated by a sense of library limits. The continued -expansion and rapid growth of local academic library collections is now -clearly at an end. Corporate libraries, and even law libraries, are -faced with operating within a difficult economic climate, as well as with -very active competition from commercial information sources. For -example, public libraries may be seen as a desirable but not critical -municipal service in a time when the budgets of safety and health -agencies are being cut back. - -Further, libraries in general have a very high labor-to-cost ratio in -their budgets, and labor costs are still increasing, notwithstanding -automation investments. It is difficult for libraries to obtain capital, -startup, or seed funding for innovative activities, and those -technology-intensive initiatives that offer the potential of decreased -labor costs can provoke the opposition of library staff. - -However, libraries have achieved some considerable successes in the past -two decades by improving both their service and their credibility within -their organizations--and these positive changes have been accomplished -mostly with judicious use of information technologies. The advances in -computing and information technology have been well-chronicled: the -continuing precipitous drop in computing costs, the growth of the -Internet and private networks, and the explosive increase in publicly -available information databases. - -For example, OCLC has become one of the largest computer network -organizations in the world by creating a cooperative cataloging network -of more than 6,000 libraries worldwide. On-line public access catalogs -now serve millions of users on more than 50,000 dedicated terminals in -the United States alone. The University of California MELVYL on-line -catalog system has now expanded into an index database reference service -and supports more than six million searches a year. And, libraries have -become the largest group of customers of CD-ROM publishing technology; -more than 30,000 optical media publications such as those offered by -InfoTrac and Silver Platter are subscribed to by U.S. libraries. - -This march of technology continues and in the next decade will result in -further innovations that are extremely difficult to predict. What is -clear is that libraries can now go beyond automation of their order files -and catalogs to automation of their collections themselves--and it is -possible to circumvent the fiscal limitations that appear to obtain -today. - -This Electronic Library Strategic Plan recommends a paradigm shift in -library service, and demonstrates the steps necessary to provide improved -library services with limited capacities and operating investments. - -SESSION IV-A - -Anne KENNEY - -The Cornell/Xerox Joint Study in Digital Preservation resulted in the -recording of 1,000 brittle books as 600-dpi digital images and the -production, on demand, of high-quality and archivally sound paper -replacements. The project, which was supported by the Commission on -Preservation and Access, also investigated some of the issues surrounding -scanning, storing, retrieving, and providing access to digital images in -a network environment. - -Anne Kenney will focus on some of the issues surrounding direct scanning -as identified in the Cornell Xerox Project. Among those to be discussed -are: image versus text capture; indexing and access; image-capture -capabilities; a comparison to photocopy and microfilm; production and -cost analysis; storage formats, protocols, and standards; and the use of -this scanning technology for preservation purposes. - -The 600-dpi digital images produced in the Cornell Xerox Project proved -highly acceptable for creating paper replacements of deteriorating -originals. The 1,000 scanned volumes provided an array of image-capture -challenges that are common to nineteenth-century printing techniques and -embrittled material, and that defy the use of text-conversion processes. -These challenges include diminished contrast between text and background, -fragile and deteriorated pages, uneven printing, elaborate type faces, -faint and bold text adjacency, handwritten text and annotations, nonRoman -languages, and a proliferation of illustrated material embedded in text. -The latter category included high-frequency and low-frequency halftones, -continuous tone photographs, intricate mathematical drawings, maps, -etchings, reverse-polarity drawings, and engravings. - -The Xerox prototype scanning system provided a number of important -features for capturing this diverse material. Technicians used multiple -threshold settings, filters, line art and halftone definitions, -autosegmentation, windowing, and software-editing programs to optimize -image capture. At the same time, this project focused on production. -The goal was to make scanning as affordable and acceptable as -photocopying and microfilming for preservation reformatting. A -time-and-cost study conducted during the last three months of this -project confirmed the economic viability of digital scanning, and these -findings will be discussed here. - -From the outset, the Cornell Xerox Project was predicated on the use of -nonproprietary standards and the use of common protocols when standards -did not exist. Digital files were created as TIFF images which were -compressed prior to storage using Group 4 CCITT compression. The Xerox -software is MS DOS based and utilizes off-the shelf programs such as -Microsoft Windows and Wang Image Wizard. The digital library is designed -to be hardware-independent and to provide interchangeability with other -institutions through network connections. Access to the digital files -themselves is two-tiered: Bibliographic records for the computer files -are created in RLIN and Cornell's local system and access into the actual -digital images comprising a book is provided through a document control -structure and a networked image file-server, both of which will be -described. - -The presentation will conclude with a discussion of some of the issues -surrounding the use of this technology as a preservation tool (storage, -refreshing, backup). - -Pamela ANDRE and Judith ZIDAR - -The National Agricultural Library (NAL) has had extensive experience with -raster scanning of printed materials. Since 1987, the Library has -participated in the National Agricultural Text Digitizing Project (NATDP) -a cooperative effort between NAL and forty-five land grant university -libraries. An overview of the project will be presented, giving its -history and NAL's strategy for the future. - -An in-depth discussion of NATDP will follow, including a description of -the scanning process, from the gathering of the printed materials to the -archiving of the electronic pages. The type of equipment required for a -stand-alone scanning workstation and the importance of file management -software will be discussed. Issues concerning the images themselves will -be addressed briefly, such as image format; black and white versus color; -gray scale versus dithering; and resolution. - -Also described will be a study currently in progress by NAL to evaluate -the usefulness of converting microfilm to electronic images in order to -improve access. With the cooperation of Tuskegee University, NAL has -selected three reels of microfilm from a collection of sixty-seven reels -containing the papers, letters, and drawings of George Washington Carver. -The three reels were converted into 3,500 electronic images using a -specialized microfilm scanner. The selection, filming, and indexing of -this material will be discussed. - -Donald WATERS - -Project Open Book, the Yale University Library's effort to convert 10, -000 books from microfilm to digital imagery, is currently in an advanced -state of planning and organization. The Yale Library has selected a -major vendor to serve as a partner in the project and as systems -integrator. In its proposal, the successful vendor helped isolate areas -of risk and uncertainty as well as key issues to be addressed during the -life of the project. The Yale Library is now poised to decide what -material it will convert to digital image form and to seek funding, -initially for the first phase and then for the entire project. - -The proposal that Yale accepted for the implementation of Project Open -Book will provide at the end of three phases a conversion subsystem, -browsing stations distributed on the campus network within the Yale -Library, a subsystem for storing 10,000 books at 200 and 600 dots per -inch, and network access to the image printers. Pricing for the system -implementation assumes the existence of Yale's campus ethernet network -and its high-speed image printers, and includes other requisite hardware -and software, as well as system integration services. Proposed operating -costs include hardware and software maintenance, but do not include -estimates for the facilities management of the storage devices and image -servers. - -Yale selected its vendor partner in a formal process, partly funded by -the Commission for Preservation and Access. Following a request for -proposal, the Yale Library selected two vendors as finalists to work with -Yale staff to generate a detailed analysis of requirements for Project -Open Book. Each vendor used the results of the requirements analysis to -generate and submit a formal proposal for the entire project. This -competitive process not only enabled the Yale Library to select its -primary vendor partner but also revealed much about the state of the -imaging industry, about the varying, corporate commitments to the markets -for imaging technology, and about the varying organizational dynamics -through which major companies are responding to and seeking to develop -these markets. - -Project Open Book is focused specifically on the conversion of images -from microfilm to digital form. The technology for scanning microfilm is -readily available but is changing rapidly. In its project requirements, -the Yale Library emphasized features of the technology that affect the -technical quality of digital image production and the costs of creating -and storing the image library: What levels of digital resolution can be -achieved by scanning microfilm? How does variation in the quality of -microfilm, particularly in film produced to preservation standards, -affect the quality of the digital images? What technologies can an -operator effectively and economically apply when scanning film to -separate two-up images and to control for and correct image -imperfections? How can quality control best be integrated into -digitizing work flow that includes document indexing and storage? - -The actual and expected uses of digital images--storage, browsing, -printing, and OCR--help determine the standards for measuring their -quality. Browsing is especially important, but the facilities available -for readers to browse image documents is perhaps the weakest aspect of -imaging technology and most in need of development. As it defined its -requirements, the Yale Library concentrated on some fundamental aspects -of usability for image documents: Does the system have sufficient -flexibility to handle the full range of document types, including -monographs, multi-part and multivolume sets, and serials, as well as -manuscript collections? What conventions are necessary to identify a -document uniquely for storage and retrieval? Where is the database of -record for storing bibliographic information about the image document? -How are basic internal structures of documents, such as pagination, made -accessible to the reader? How are the image documents physically -presented on the screen to the reader? - -The Yale Library designed Project Open Book on the assumption that -microfilm is more than adequate as a medium for preserving the content of -deteriorated library materials. As planning in the project has advanced, -it is increasingly clear that the challenge of digital image technology -and the key to the success of efforts like Project Open Book is to -provide a means of both preserving and improving access to those -deteriorated materials. - -SESSION IV-B - -George THOMA - -In the use of electronic imaging for document preservation, there are -several issues to consider, such as: ensuring adequate image quality, -maintaining substantial conversion rates (through-put), providing unique -identification for automated access and retrieval, and accommodating -bound volumes and fragile material. - -To maintain high image quality, image processing functions are required -to correct the deficiencies in the scanned image. Some commercially -available systems include these functions, while some do not. The -scanned raw image must be processed to correct contrast deficiencies-- -both poor overall contrast resulting from light print and/or dark -background, and variable contrast resulting from stains and -bleed-through. Furthermore, the scan density must be adequate to allow -legibility of print and sufficient fidelity in the pseudo-halftoned gray -material. Borders or page-edge effects must be removed for both -compactibility and aesthetics. Page skew must be corrected for aesthetic -reasons and to enable accurate character recognition if desired. -Compound images consisting of both two-toned text and gray-scale -illustrations must be processed appropriately to retain the quality of -each. - -SESSION IV-C - -Jean BARONAS - -Standards publications being developed by scientists, engineers, and -business managers in Association for Information and Image Management -(AIIM) standards committees can be applied to electronic image management -(EIM) processes including: document (image) transfer, retrieval and -evaluation; optical disk and document scanning; and document design and -conversion. When combined with EIM system planning and operations, -standards can assist in generating image databases that are -interchangeable among a variety of systems. The applications of -different approaches for image-tagging, indexing, compression, and -transfer often cause uncertainty concerning EIM system compatibility, -calibration, performance, and upward compatibility, until standard -implementation parameters are established. The AIIM standards that are -being developed for these applications can be used to decrease the -uncertainty, successfully integrate imaging processes, and promote "open -systems." AIIM is an accredited American National Standards Institute -(ANSI) standards developer with more than twenty committees comprised of -300 volunteers representing users, vendors, and manufacturers. The -standards publications that are developed in these committees have -national acceptance and provide the basis for international harmonization -in the development of new International Organization for Standardization -(ISO) standards. - -This presentation describes the development of AIIM's EIM standards and a -new effort at AIIM, a database on standards projects in a wide framework -of imaging industries including capture, recording, processing, -duplication, distribution, display, evaluation, and preservation. The -AIIM Imagery Database will cover imaging standards being developed by -many organizations in many different countries. It will contain -standards publications' dates, origins, related national and -international projects, status, key words, and abstracts. The ANSI Image -Technology Standards Board requested that such a database be established, -as did the ISO/International Electrotechnical Commission Joint Task Force -on Imagery. AIIM will take on the leadership role for the database and -coordinate its development with several standards developers. - -Patricia BATTIN - - Characteristics of standards for digital imagery: - - * Nature of digital technology implies continuing volatility. - - * Precipitous standard-setting not possible and probably not - desirable. - - * Standards are a complex issue involving the medium, the - hardware, the software, and the technical capacity for - reproductive fidelity and clarity. - - * The prognosis for reliable archival standards (as defined by - librarians) in the foreseeable future is poor. - - Significant potential and attractiveness of digital technology as a - preservation medium and access mechanism. - - Productive use of digital imagery for preservation requires a - reconceptualizing of preservation principles in a volatile, - standardless world. - - Concept of managing continuing access in the digital environment - rather than focusing on the permanence of the medium and long-term - archival standards developed for the analog world. - - Transition period: How long and what to do? - - * Redefine "archival." - - * Remove the burden of "archival copy" from paper artifacts. - - * Use digital technology for storage, develop management - strategies for refreshing medium, hardware and software. - - * Create acid-free paper copies for transition period backup - until we develop reliable procedures for ensuring continuing - access to digital files. - -SESSION IV-D - -Stuart WEIBEL The Role of SGML Markup in the CORE Project (6) - -The emergence of high-speed telecommunications networks as a basic -feature of the scholarly workplace is driving the demand for electronic -document delivery. Three distinct categories of electronic -publishing/republishing are necessary to support access demands in this -emerging environment: - - 1.) Conversion of paper or microfilm archives to electronic format - 2.) Conversion of electronic files to formats tailored to - electronic retrieval and display - 3.) Primary electronic publishing (materials for which the - electronic version is the primary format) - -OCLC has experimental or product development activities in each of these -areas. Among the challenges that lie ahead is the integration of these -three types of information stores in coherent distributed systems. - -The CORE (Chemistry Online Retrieval Experiment) Project is a model for -the conversion of large text and graphics collections for which -electronic typesetting files are available (category 2). The American -Chemical Society has made available computer typography files dating from -1980 for its twenty journals. This collection of some 250 journal-years -is being converted to an electronic format that will be accessible -through several end-user applications. - -The use of Standard Generalized Markup Language (SGML) offers the means -to capture the structural richness of the original articles in a way that -will support a variety of retrieval, navigation, and display options -necessary to navigate effectively in very large text databases. - -An SGML document consists of text that is marked up with descriptive tags -that specify the function of a given element within the document. As a -formal language construct, an SGML document can be parsed against a -document-type definition (DTD) that unambiguously defines what elements -are allowed and where in the document they can (or must) occur. This -formalized map of article structure allows the user interface design to -be uncoupled from the underlying database system, an important step -toward interoperability. Demonstration of this separability is a part of -the CORE project, wherein user interface designs born of very different -philosophies will access the same database. - -NOTES: - (6) The CORE project is a collaboration among Cornell University's - Mann Library, Bell Communications Research (Bellcore), the American - Chemical Society (ACS), the Chemical Abstracts Service (CAS), and - OCLC. - -Michael LESK The CORE Electronic Chemistry Library - -A major on-line file of chemical journal literature complete with -graphics is being developed to test the usability of fully electronic -access to documents, as a joint project of Cornell University, the -American Chemical Society, the Chemical Abstracts Service, OCLC, and -Bellcore (with additional support from Sun Microsystems, Springer-Verlag, -DigitaI Equipment Corporation, Sony Corporation of America, and Apple -Computers). Our file contains the American Chemical Society's on-line -journals, supplemented with the graphics from the paper publication. The -indexing of the articles from Chemical Abstracts Documents is available -in both image and text format, and several different interfaces can be -used. Our goals are (1) to assess the effectiveness and acceptability of -electronic access to primary journals as compared with paper, and (2) to -identify the most desirable functions of the user interface to an -electronic system of journals, including in particular a comparison of -page-image display with ASCII display interfaces. Early experiments with -chemistry students on a variety of tasks suggest that searching tasks are -completed much faster with any electronic system than with paper, but -that for reading all versions of the articles are roughly equivalent. - -Pamela ANDRE and Judith ZIDAR - -Text conversion is far more expensive and time-consuming than image -capture alone. NAL's experience with optical character recognition (OCR) -will be related and compared with the experience of having text rekeyed. -What factors affect OCR accuracy? How accurate does full text have to be -in order to be useful? How do different users react to imperfect text? -These are questions that will be explored. For many, a service bureau -may be a better solution than performing the work inhouse; this will also -be discussed. - -SESSION VI - -Marybeth PETERS - -Copyright law protects creative works. Protection granted by the law to -authors and disseminators of works includes the right to do or authorize -the following: reproduce the work, prepare derivative works, distribute -the work to the public, and publicly perform or display the work. In -addition, copyright owners of sound recordings and computer programs have -the right to control rental of their works. These rights are not -unlimited; there are a number of exceptions and limitations. - -An electronic environment places strains on the copyright system. -Copyright owners want to control uses of their work and be paid for any -use; the public wants quick and easy access at little or no cost. The -marketplace is working in this area. Contracts, guidelines on electronic -use, and collective licensing are in use and being refined. - -Issues concerning the ability to change works without detection are more -difficult to deal with. Questions concerning the integrity of the work -and the status of the changed version under the copyright law are to be -addressed. These are public policy issues which require informed -dialogue. - - - *** *** *** ****** *** *** *** - - - Appendix III: DIRECTORY OF PARTICIPANTS - - -PRESENTERS: - - Pamela Q.J. Andre - Associate Director, Automation - National Agricultural Library - 10301 Baltimore Boulevard - Beltsville, MD 20705-2351 - Phone: (301) 504-6813 - Fax: (301) 504-7473 - E-mail: INTERNET: PANDRE@ASRR.ARSUSDA.GOV - - Jean Baronas, Senior Manager - Department of Standards and Technology - Association for Information and Image Management (AIIM) - 1100 Wayne Avenue, Suite 1100 - Silver Spring, MD 20910 - Phone: (301) 587-8202 - Fax: (301) 587-2711 - - Patricia Battin, President - The Commission on Preservation and Access - 1400 16th Street, N.W. - Suite 740 - Washington, DC 20036-2217 - Phone: (202) 939-3400 - Fax: (202) 939-3407 - E-mail: CPA@GWUVM.BITNET - - Howard Besser - Centre Canadien d'Architecture - (Canadian Center for Architecture) - 1920, rue Baile - Montreal, Quebec H3H 2S6 - CANADA - Phone: (514) 939-7001 - Fax: (514) 939-7020 - E-mail: howard@lis.pitt.edu - - Edwin B. Brownrigg, Executive Director - Memex Research Institute - 422 Bonita Avenue - Roseville, CA 95678 - Phone: (916) 784-2298 - Fax: (916) 786-7559 - E-mail: BITNET: MEMEX@CALSTATE.2 - - Eric M. Calaluca, Vice President - Chadwyck-Healey, Inc. - 1101 King Street - Alexandria, VA 223l4 - Phone: (800) 752-05l5 - Fax: (703) 683-7589 - - James Daly - 4015 Deepwood Road - Baltimore, MD 21218-1404 - Phone: (410) 235-0763 - - Ricky Erway, Associate Coordinator - American Memory - Library of Congress - Phone: (202) 707-6233 - Fax: (202) 707-3764 - - Carl Fleischhauer, Coordinator - American Memory - Library of Congress - Phone: (202) 707-6233 - Fax: (202) 707-3764 - - Joanne Freeman - 2000 Jefferson Park Avenue, No. 7 - Charlottesville, VA 22903 - - Prosser Gifford - Director for Scholarly Programs - Library of Congress - Phone: (202) 707-1517 - Fax: (202) 707-9898 - E-mail: pgif@seq1.loc.gov - - Jacqueline Hess, Director - National Demonstration Laboratory - for Interactive Information Technologies - Library of Congress - Phone: (202) 707-4157 - Fax: (202) 707-2829 - - Susan Hockey, Director - Center for Electronic Texts in the Humanities (CETH) - Alexander Library - Rutgers University - 169 College Avenue - New Brunswick, NJ 08903 - Phone: (908) 932-1384 - Fax: (908) 932-1386 - E-mail: hockey@zodiac.rutgers.edu - - William L. Hooton, Vice President - Business & Technical Development - Imaging & Information Systems Group - I-NET - 6430 Rockledge Drive, Suite 400 - Bethesda, MD 208l7 - Phone: (301) 564-6750 - Fax: (513) 564-6867 - - Anne R. Kenney, Associate Director - Department of Preservation and Conservation - 701 Olin Library - Cornell University - Ithaca, NY 14853 - Phone: (607) 255-6875 - Fax: (607) 255-9346 - E-mail: LYDY@CORNELLA.BITNET - - Ronald L. Larsen - Associate Director for Information Technology - University of Maryland at College Park - Room B0224, McKeldin Library - College Park, MD 20742-7011 - Phone: (301) 405-9194 - Fax: (301) 314-9865 - E-mail: rlarsen@libr.umd.edu - - Maria L. Lebron, Managing Editor - The Online Journal of Current Clinical Trials - l333 H Street, N.W. - Washington, DC 20005 - Phone: (202) 326-6735 - Fax: (202) 842-2868 - E-mail: PUBSAAAS@GWUVM.BITNET - - Michael Lesk, Executive Director - Computer Science Research - Bell Communications Research, Inc. - Rm 2A-385 - 445 South Street - Morristown, NJ 07960-l9l0 - Phone: (201) 829-4070 - Fax: (201) 829-5981 - E-mail: lesk@bellcore.com (Internet) or bellcore!lesk (uucp) - - Clifford A. Lynch - Director, Library Automation - University of California, - Office of the President - 300 Lakeside Drive, 8th Floor - Oakland, CA 94612-3350 - Phone: (510) 987-0522 - Fax: (510) 839-3573 - E-mail: calur@uccmvsa - - Avra Michelson - National Archives and Records Administration - NSZ Rm. 14N - 7th & Pennsylvania, N.W. - Washington, D.C. 20408 - Phone: (202) 501-5544 - Fax: (202) 501-5533 - E-mail: tmi@cu.nih.gov - - Elli Mylonas, Managing Editor - Perseus Project - Department of the Classics - Harvard University - 319 Boylston Hall - Cambridge, MA 02138 - Phone: (617) 495-9025, (617) 495-0456 (direct) - Fax: (617) 496-8886 - E-mail: Elli@IKAROS.Harvard.EDU or elli@wjh12.harvard.edu - - David Woodley Packard - Packard Humanities Institute - 300 Second Street, Suite 201 - Los Altos, CA 94002 - Phone: (415) 948-0150 (PHI) - Fax: (415) 948-5793 - - Lynne K. Personius, Assistant Director - Cornell Information Technologies for - Scholarly Information Sources - 502 Olin Library - Cornell University - Ithaca, NY 14853 - Phone: (607) 255-3393 - Fax: (607) 255-9346 - E-mail: JRN@CORNELLC.BITNET - - Marybeth Peters - Policy Planning Adviser to the - Register of Copyrights - Library of Congress - Office LM 403 - Phone: (202) 707-8350 - Fax: (202) 707-8366 - - C. Michael Sperberg-McQueen - Editor, Text Encoding Initiative - Computer Center (M/C 135) - University of Illinois at Chicago - Box 6998 - Chicago, IL 60680 - Phone: (312) 413-0317 - Fax: (312) 996-6834 - E-mail: u35395@uicvm..cc.uic.edu or u35395@uicvm.bitnet - - George R. Thoma, Chief - Communications Engineering Branch - National Library of Medicine - 8600 Rockville Pike - Bethesda, MD 20894 - Phone: (301) 496-4496 - Fax: (301) 402-0341 - E-mail: thoma@lhc.nlm.nih.gov - - Dorothy Twohig, Editor - The Papers of George Washington - 504 Alderman Library - University of Virginia - Charlottesville, VA 22903-2498 - Phone: (804) 924-0523 - Fax: (804) 924-4337 - - Susan H. Veccia, Team leader - American Memory, User Evaluation - Library of Congress - American Memory Evaluation Project - Phone: (202) 707-9104 - Fax: (202) 707-3764 - E-mail: svec@seq1.loc.gov - - Donald J. Waters, Head - Systems Office - Yale University Library - New Haven, CT 06520 - Phone: (203) 432-4889 - Fax: (203) 432-7231 - E-mail: DWATERS@YALEVM.BITNET or DWATERS@YALEVM.YCC.YALE.EDU - - Stuart Weibel, Senior Research Scientist - OCLC - 6565 Frantz Road - Dublin, OH 43017 - Phone: (614) 764-608l - Fax: (614) 764-2344 - E-mail: INTERNET: Stu@rsch.oclc.org - - Robert G. Zich - Special Assistant to the Associate Librarian - for Special Projects - Library of Congress - Phone: (202) 707-6233 - Fax: (202) 707-3764 - E-mail: rzic@seq1.loc.gov - - Judith A. Zidar, Coordinator - National Agricultural Text Digitizing Program - Information Systems Division - National Agricultural Library - 10301 Baltimore Boulevard - Beltsville, MD 20705-2351 - Phone: (301) 504-6813 or 504-5853 - Fax: (301) 504-7473 - E-mail: INTERNET: JZIDAR@ASRR.ARSUSDA.GOV - - -OBSERVERS: - - Helen Aguera, Program Officer - Division of Research - Room 318 - National Endowment for the Humanities - 1100 Pennsylvania Avenue, N.W. - Washington, D.C. 20506 - Phone: (202) 786-0358 - Fax: (202) 786-0243 - - M. Ellyn Blanton, Deputy Director - National Demonstration Laboratory - for Interactive Information Technologies - Library of Congress - Phone: (202) 707-4157 - Fax: (202) 707-2829 - - Charles M. Dollar - National Archives and Records Administration - NSZ Rm. 14N - 7th & Pennsylvania, N.W. - Washington, DC 20408 - Phone: (202) 501-5532 - Fax: (202) 501-5512 - - Jeffrey Field, Deputy to the Director - Division of Preservation and Access - Room 802 - National Endowment for the Humanities - 1100 Pennsylvania Avenue, N.W. - Washington, DC 20506 - Phone: (202) 786-0570 - Fax: (202) 786-0243 - - Lorrin Garson - American Chemical Society - Research and Development Department - 1155 16th Street, N.W. - Washington, D.C. 20036 - Phone: (202) 872-4541 - Fax: E-mail: INTERNET: LRG96@ACS.ORG - - William M. Holmes, Jr. - National Archives and Records Administration - NSZ Rm. 14N - 7th & Pennsylvania, N.W. - Washington, DC 20408 - Phone: (202) 501-5540 - Fax: (202) 501-5512 - E-mail: WHOLMES@AMERICAN.EDU - - Sperling Martin - Information Resource Management - 20030 Doolittle Street - Gaithersburg, MD 20879 - Phone: (301) 924-1803 - - Michael Neuman, Director - The Center for Text and Technology - Academic Computing Center - 238 Reiss Science Building - Georgetown University - Washington, DC 20057 - Phone: (202) 687-6096 - Fax: (202) 687-6003 - E-mail: neuman@guvax.bitnet, neuman@guvax.georgetown.edu - - Barbara Paulson, Program Officer - Division of Preservation and Access - Room 802 - National Endowment for the Humanities - 1100 Pennsylvania Avenue, N.W. - Washington, DC 20506 - Phone: (202) 786-0577 - Fax: (202) 786-0243 - - Allen H. Renear - Senior Academic Planning Analyst - Brown University Computing and Information Services - 115 Waterman Street - Campus Box 1885 - Providence, R.I. 02912 - Phone: (401) 863-7312 - Fax: (401) 863-7329 - E-mail: BITNET: Allen@BROWNVM or - INTERNET: Allen@brownvm.brown.edu - - Susan M. Severtson, President - Chadwyck-Healey, Inc. - 1101 King Street - Alexandria, VA 223l4 - Phone: (800) 752-05l5 - Fax: (703) 683-7589 - - Frank Withrow - U.S. Department of Education - 555 New Jersey Avenue, N.W. - Washington, DC 20208-5644 - Phone: (202) 219-2200 - Fax: (202) 219-2106 - - -(LC STAFF) - - Linda L. Arret - Machine-Readable Collections Reading Room LJ 132 - (202) 707-1490 - - John D. Byrum, Jr. - Descriptive Cataloging Division LM 540 - (202) 707-5194 - - Mary Jane Cavallo - Science and Technology Division LA 5210 - (202) 707-1219 - - Susan Thea David - Congressional Research Service LM 226 - (202) 707-7169 - - Robert Dierker - Senior Adviser for Multimedia Activities LM 608 - (202) 707-6151 - - William W. Ellis - Associate Librarian for Science and Technology LM 611 - (202) 707-6928 - - Ronald Gephart - Manuscript Division LM 102 - (202) 707-5097 - - James Graber - Information Technology Services LM G51 - (202) 707-9628 - - Rich Greenfield - American Memory LM 603 - (202) 707-6233 - - Rebecca Guenther - Network Development LM 639 - (202) 707-5092 - - Kenneth E. Harris - Preservation LM G21 - (202) 707-5213 - - Staley Hitchcock - Manuscript Division LM 102 - (202) 707-5383 - - Bohdan Kantor - Office of Special Projects LM 612 - (202) 707-0180 - - John W. Kimball, Jr - Machine-Readable Collections Reading Room LJ 132 - (202) 707-6560 - - Basil Manns - Information Technology Services LM G51 - (202) 707-8345 - - Sally Hart McCallum - Network Development LM 639 - (202) 707-6237 - - Dana J. Pratt - Publishing Office LM 602 - (202) 707-6027 - - Jane Riefenhauser - American Memory LM 603 - (202) 707-6233 - - William Z. Schenck - Collections Development LM 650 - (202) 707-7706 - - Chandru J. Shahani - Preservation Research and Testing Office (R&T) LM G38 - (202) 707-5607 - - William J. Sittig - Collections Development LM 650 - (202) 707-7050 - - Paul Smith - Manuscript Division LM 102 - (202) 707-5097 - - James L. Stevens - Information Technology Services LM G51 - (202) 707-9688 - - Karen Stuart - Manuscript Division LM 130 - (202) 707-5389 - - Tamara Swora - Preservation Microfilming Office LM G05 - (202) 707-6293 - - Sarah Thomas - Collections Cataloging LM 642 - (202) 707-5333 - - - END - ************************************************************* - -Note: This file has been edited for use on computer networks. This -editing required the removal of diacritics, underlining, and fonts such -as italics and bold. - -kde 11/92 - -[A few of the italics (when used for emphasis) were replaced by CAPS mh] - -*End of The Project Gutenberg Etext of LOC WORKSHOP ON ELECTRONIC ETEXTS - diff --git a/libs/zlibng/test/data/paper-100k.pdf b/libs/zlibng/test/data/paper-100k.pdf deleted file mode 100644 index b3325e4a2..000000000 --- a/libs/zlibng/test/data/paper-100k.pdf +++ /dev/null @@ -1,598 +0,0 @@ - - - C=10 M=100 Y=50 K=0 - CMYK - PROCESS - 10.000002 - 100.000000 - 50.000000 - 0.000000 - - - C=0 M=95 Y=20 K=0 - CMYK - PROCESS - 0.000000 - 94.999999 - 19.999999 - 0.000000 - - - C=25 M=25 Y=40 K=0 - CMYK - PROCESS - 25.000000 - 25.000000 - 39.999998 - 0.000000 - - - C=40 M=45 Y=50 K=5 - CMYK - PROCESS - 39.999998 - 44.999999 - 50.000000 - 5.000001 - - - C=50 M=50 Y=60 K=25 - CMYK - PROCESS - 50.000000 - 50.000000 - 60.000002 - 25.000000 - - - C=55 M=60 Y=65 K=40 - CMYK - PROCESS - 55.000001 - 60.000002 - 64.999998 - 39.999998 - - - C=25 M=40 Y=65 K=0 - CMYK - PROCESS - 25.000000 - 39.999998 - 64.999998 - 0.000000 - - - C=30 M=50 Y=75 K=10 - CMYK - PROCESS - 30.000001 - 50.000000 - 75.000000 - 10.000002 - - - C=35 M=60 Y=80 K=25 - CMYK - PROCESS - 35.000002 - 60.000002 - 80.000001 - 25.000000 - - - C=40 M=65 Y=90 K=35 - CMYK - PROCESS - 39.999998 - 64.999998 - 90.000004 - 35.000002 - - - C=40 M=70 Y=100 K=50 - CMYK - PROCESS - 39.999998 - 69.999999 - 100.000000 - 50.000000 - - - C=50 M=70 Y=80 K=70 - CMYK - PROCESS - 50.000000 - 69.999999 - 80.000001 - 69.999999 - - - - - - Grays - 1 - - - - C=0 M=0 Y=0 K=100 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 100.000000 - - - C=0 M=0 Y=0 K=90 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 89.999402 - - - C=0 M=0 Y=0 K=80 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 79.998797 - - - C=0 M=0 Y=0 K=70 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 69.999701 - - - C=0 M=0 Y=0 K=60 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 59.999102 - - - C=0 M=0 Y=0 K=50 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 50.000000 - - - C=0 M=0 Y=0 K=40 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 39.999402 - - - C=0 M=0 Y=0 K=30 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 29.998803 - - - C=0 M=0 Y=0 K=20 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 19.999701 - - - C=0 M=0 Y=0 K=10 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 9.999102 - - - C=0 M=0 Y=0 K=5 - CMYK - PROCESS - 0.000000 - 0.000000 - 0.000000 - 4.998803 - - - - - - Brights - 1 - - - - C=0 M=100 Y=100 K=0 - CMYK - PROCESS - 0.000000 - 100.000000 - 100.000000 - 0.000000 - - - C=0 M=75 Y=100 K=0 - CMYK - PROCESS - 0.000000 - 75.000000 - 100.000000 - 0.000000 - - - C=0 M=10 Y=95 K=0 - CMYK - PROCESS - 0.000000 - 10.000002 - 94.999999 - 0.000000 - - - C=85 M=10 Y=100 K=0 - CMYK - PROCESS - 84.999996 - 10.000002 - 100.000000 - 0.000000 - - - C=100 M=90 Y=0 K=0 - CMYK - PROCESS - 100.000000 - 90.000004 - 0.000000 - 0.000000 - - - C=60 M=90 Y=0 K=0 - CMYK - PROCESS - 60.000002 - 90.000004 - 0.003099 - 0.003099 - - - - - - - - - Adobe PDF library 9.00 - - - - - - - - - - - - - - - - - - - - - - - - - -endstream endobj 145 0 obj<> endobj 1 0 obj<> endobj 2 0 obj<>/Font<>/ProcSet[/PDF/Text]/ExtGState<>>> endobj 3 0 obj<>stream -hޔ[MsFWnmU(se{kjw`7ƨhhҜ_e&rl(BG2ˏ_oͷ|H.>޽)Vs"Wq\Xإob5{|)^xylD]E~g*vM_YAڨjqݷ?b*]PWrUm?04]\}\ʲNVId=ɼup6wN~reߎU;6c5652cvu gS3>_D04Qw#*ׇ}L%m_9f0^YצYN9npse)9&|O"~lms=2yTǾZ?'=VW;`L)T0XA4&q'IGJdשŷC7bb1QtrJ1E\ESñR!"dwǝ -?Gq pۢ_⧑}}؉+.DAɤ$& -*vo:UTi͑ks?y'V^4m]O߽A$xI;#4.|ýoQwvK,ă2kd6X,4#.C͛ ]=F6wQD1{~۴(}EK_w*hZ@CtEAg/)rjJчvS\a #xhGFؓ}lcYh)(ǍTNSb[,ʔW%ʣMswW/S2XGO5r>, b`'%E,B>|$G0,1%@T/2;,BQC)e]MRض~Rm[Q -P c ] QkONFJ_ɇz{θCn5yٜh׏Ұq P$ -Yp%b#X5|b^Q*B;NJ:3R*ě9"axpNA - -Sb' Up~t܅6C׏s$tWheޢ+hq, GFIH[W5Sa<DXSq-͘1+"G[!&f,ݭpg |v0EQ͝`ҎIYZ)+S wM@]G\ѵcv[C?0!8C1R<*`yqY!K5_q7|M QS:Y0YuIaf>]"B]<-W{0ps涹f^HGѸdV`)0YohjVB訅aRpv)PO%̹ W-%~ח >-@e\: +pXIRt/'* O.XIMh=N`Bepxc_ ~d~R'%W( &o׷+,NyL'$Rxa9KBYXW2Ө/0,sJ1yX>(f$W(J -쇋ÏD~1RQg#pp2:}RHX0 = #1p:]cQ3&sd̤joF?8V&Ӓ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.c b/libs/zlibng/test/example.c deleted file mode 100644 index 97ca0029b..000000000 --- a/libs/zlibng/test/example.c +++ /dev/null @@ -1,1067 +0,0 @@ -/* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2006, 2011, 2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif -#include "deflate.h" - -#include - -#include -#include -#include -#include - -#define TESTFILE "foo.gz" - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -static const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -static const char dictionary[] = "hello"; -static unsigned long dictId = 0; /* Adler32 value of the dictionary */ - - -void test_compress (unsigned char *compr, z_size_t comprLen,unsigned char *uncompr, z_size_t uncomprLen); -void test_gzio (const char *fname, unsigned char *uncompr, z_size_t uncomprLen); -void test_deflate (unsigned char *compr, size_t comprLen); -void test_inflate (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen); -void test_large_deflate (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen, int zng_params); -void test_large_inflate (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen); -void test_flush (unsigned char *compr, z_size_t *comprLen); -void test_sync (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen); -void test_dict_deflate (unsigned char *compr, size_t comprLen); -void test_dict_inflate (unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen); -int main (int argc, char *argv[]); - - -static alloc_func zalloc = NULL; -static free_func zfree = NULL; - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(unsigned char *compr, z_size_t comprLen, unsigned char *uncompr, z_size_t uncomprLen) { - int err; - size_t len = strlen(hello)+1; - - err = PREFIX(compress)(compr, &comprLen, (const unsigned char*)hello, (z_size_t)len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = PREFIX(uncompress)(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(const char *fname, unsigned char *uncompr, z_size_t uncomprLen) { -#ifdef NO_GZCOMPRESS - fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); -#else - int err; - size_t read; - size_t len = strlen(hello)+1; - gzFile file; - z_off64_t pos; - z_off64_t comprLen; - - /* Write gz file with test data */ - file = PREFIX(gzopen)(fname, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - /* Write hello, hello! using gzputs and gzprintf */ - PREFIX(gzputc)(file, 'h'); - if (PREFIX(gzputs)(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - if (PREFIX(gzprintf)(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - /* Write string null-teriminator using gzseek */ - if (PREFIX(gzseek)(file, 1L, SEEK_CUR) < 0) - { - fprintf(stderr, "gzseek error, gztell=%ld\n", (long)PREFIX(gztell)(file)); - exit(1); - } - /* Write hello, hello! using gzfwrite using best compression level */ - if (PREFIX(gzsetparams)(file, Z_BEST_COMPRESSION, Z_DEFAULT_STRATEGY) != Z_OK) { - fprintf(stderr, "gzsetparams err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - if (PREFIX(gzfwrite)(hello, len, 1, file) == 0) { - fprintf(stderr, "gzfwrite err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - /* Flush compressed bytes to file */ - if (PREFIX(gzflush)(file, Z_SYNC_FLUSH) != Z_OK) { - fprintf(stderr, "gzflush err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - comprLen = PREFIX(gzoffset)(file); - if (comprLen <= 0) { - fprintf(stderr, "gzoffset err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - PREFIX(gzclose)(file); - - /* Open gz file we previously wrote */ - file = PREFIX(gzopen)(fname, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - /* Read uncompressed data - hello, hello! string twice */ - strcpy((char*)uncompr, "garbages"); - if (PREFIX(gzread)(file, uncompr, (unsigned)uncomprLen) != (int)(len + len)) { - fprintf(stderr, "gzread err: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char*)uncompr); - } - /* Check position at the end of the gz file */ - if (PREFIX(gzeof)(file) != 1) { - fprintf(stderr, "gzeof err: not reporting end of stream\n"); - exit(1); - } - /* Seek backwards mid-string and check char reading with gzgetc and gzungetc */ - pos = PREFIX(gzseek)(file, -22L, SEEK_CUR); - if (pos != 6 || PREFIX(gztell)(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)PREFIX(gztell)(file)); - exit(1); - } - if (PREFIX(gzgetc)(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - if (PREFIX(gzungetc)(' ', file) != ' ') { - fprintf(stderr, "gzungetc error\n"); - exit(1); - } - /* Read first hello, hello! string with gzgets */ - strcpy((char*)uncompr, "garbages"); - PREFIX(gzgets)(file, (char*)uncompr, (int)uncomprLen); - if (strlen((char*)uncompr) != 7) { /* " hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", PREFIX(gzerror)(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello + 6)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char*)uncompr); - } - /* Seek to second hello, hello! string */ - pos = PREFIX(gzseek)(file, 14L, SEEK_SET); - if (pos != 14 || PREFIX(gztell)(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)PREFIX(gztell)(file)); - exit(1); - } - /* Check position not at end of file */ - if (PREFIX(gzeof)(file) != 0) { - fprintf(stderr, "gzeof err: reporting end of stream\n"); - exit(1); - } - /* Read first hello, hello! string with gzfread */ - strcpy((char*)uncompr, "garbages"); - read = PREFIX(gzfread)(uncompr, uncomprLen, 1, file); - if (strcmp((const char *)uncompr, hello) != 0) { - fprintf(stderr, "bad gzgets\n"); - exit(1); - } else { - printf("gzgets(): %s\n", (char*)uncompr); - } - pos = PREFIX(gzoffset)(file); - if (pos < 0 || pos != (comprLen + 10)) { - fprintf(stderr, "gzoffset err: wrong offset at end\n"); - exit(1); - } - /* Trigger an error and clear it with gzclearerr */ - PREFIX(gzfread)(uncompr, (size_t)-1, (size_t)-1, file); - PREFIX(gzerror)(file, &err); - if (err == 0) { - fprintf(stderr, "gzerror err: no error returned\n"); - exit(1); - } - PREFIX(gzclearerr)(file); - PREFIX(gzerror)(file, &err); - if (err != 0) { - fprintf(stderr, "gzclearerr err: not zero %d\n", err); - exit(1); - } - - PREFIX(gzclose)(file); - - if (PREFIX(gzclose)(NULL) != Z_STREAM_ERROR) { - fprintf(stderr, "gzclose unexpected return when handle null\n"); - exit(1); - } - (void)read; -#endif -} - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - size_t len = strlen(hello)+1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - c_stream.total_in = 0; - c_stream.total_out = 0; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - d_stream.total_in = 0; - d_stream.total_out = 0; - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -static unsigned int diff; - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen, int zng_params) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; -#ifndef ZLIB_COMPAT - int level = -1; - int strategy = -1; - zng_deflate_param_value params[2]; - - params[0].param = Z_DEFLATE_LEVEL; - params[0].buf = &level; - params[0].size = sizeof(level); - - params[1].param = Z_DEFLATE_STRATEGY; - params[1].buf = &strategy; - params[1].size = sizeof(strategy); -#endif - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - - err = PREFIX(deflateInit)(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (unsigned int)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (unsigned int)uncomprLen; - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - if (zng_params) { -#ifndef ZLIB_COMPAT - zng_deflateGetParams(&c_stream, params, sizeof(params) / sizeof(params[0])); - if (level != Z_BEST_SPEED) { - fprintf(stderr, "Expected compression level Z_BEST_SPEED, got %d\n", level); - exit(1); - } - if (strategy != Z_DEFAULT_STRATEGY) { - fprintf(stderr, "Expected compression strategy Z_DEFAULT_STRATEGY, got %d\n", strategy); - exit(1); - } - level = Z_NO_COMPRESSION; - strategy = Z_DEFAULT_STRATEGY; - zng_deflateSetParams(&c_stream, params, sizeof(params) / sizeof(params[0])); -#else - fprintf(stderr, "test_large_deflate() called with zng_params=1 in compat mode\n"); - exit(1); -#endif - } else { - PREFIX(deflateParams)(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - } - c_stream.next_in = compr; - diff = (unsigned int)(c_stream.next_out - compr); - c_stream.avail_in = diff; - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - if (zng_params) { -#ifndef ZLIB_COMPAT - level = -1; - strategy = -1; - zng_deflateGetParams(&c_stream, params, sizeof(params) / sizeof(params[0])); - if (level != Z_NO_COMPRESSION) { - fprintf(stderr, "Expected compression level Z_NO_COMPRESSION, got %d\n", level); - exit(1); - } - if (strategy != Z_DEFAULT_STRATEGY) { - fprintf(stderr, "Expected compression strategy Z_DEFAULT_STRATEGY, got %d\n", strategy); - exit(1); - } - level = Z_BEST_COMPRESSION; - strategy = Z_FILTERED; - zng_deflateSetParams(&c_stream, params, sizeof(params) / sizeof(params[0])); -#else - fprintf(stderr, "test_large_deflate() called with zng_params=1 in compat mode\n"); - exit(1); -#endif - } else { - PREFIX(deflateParams)(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - } - c_stream.next_in = uncompr; - c_stream.avail_in = (unsigned int)uncomprLen; - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = (unsigned int)comprLen; - d_stream.total_in = 0; - d_stream.total_out = 0; - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (unsigned int)uncomprLen; - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + diff) { - fprintf(stderr, "bad large inflate: %" PRIu64 "\n", (uint64_t)d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(unsigned char *compr, z_size_t *comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - unsigned int len = (unsigned int)strlen(hello)+1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (unsigned int)*comprLen; - err = PREFIX(deflate)(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = (z_size_t)c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (unsigned int)uncomprLen; - - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (unsigned int)comprLen-2; /* read all compressed data */ - err = PREFIX(inflateSync)(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = PREFIX(inflate)(&d_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "inflate should report Z_STREAM_END\n"); - exit(1); - } - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - c_stream.adler = 0; - - err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = PREFIX(deflateSetDictionary)(&c_stream, - (const unsigned char*)dictionary, (int)sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (unsigned int)comprLen; - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.avail_in = (unsigned int)strlen(hello)+1; - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage garbage garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - d_stream.adler = 0; - d_stream.next_in = compr; - d_stream.avail_in = (unsigned int)comprLen; - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (unsigned int)uncomprLen; - - for (;;) { - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = PREFIX(inflateSetDictionary)(&d_stream, (const unsigned char*)dictionary, - (int)sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strncmp((char*)uncompr, hello, sizeof(hello))) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflateBound() with small buffers - */ -void test_deflate_bound(void) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - unsigned int len = (unsigned int)strlen(hello)+1; - int estimateLen = 0; - unsigned char *outBuf = NULL; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - c_stream.avail_in = len; - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.avail_out = 0; - c_stream.next_out = outBuf; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - /* calculate actual output length and update structure */ - estimateLen = PREFIX(deflateBound)(&c_stream, len); - outBuf = malloc(estimateLen); - - if (outBuf != NULL) { - /* update zlib configuration */ - c_stream.avail_out = estimateLen; - c_stream.next_out = outBuf; - - /* do the compression */ - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) { - printf("deflateBound(): OK\n"); - } else { - CHECK_ERR(err, "deflate"); - } - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - free(outBuf); -} - -/* =========================================================================== - * Test deflateCopy() with small buffers - */ -void test_deflate_copy(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream, c_stream_copy; /* compression stream */ - int err; - size_t len = strlen(hello)+1; - - memset(&c_stream, 0, sizeof(c_stream)); - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = PREFIX(deflateCopy)(&c_stream_copy, &c_stream); - CHECK_ERR(err, "deflate_copy"); - - if (c_stream.state->status == c_stream_copy.state->status) { - printf("deflate_copy(): OK\n"); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd original"); - - err = PREFIX(deflateEnd)(&c_stream_copy); - CHECK_ERR(err, "deflateEnd copy"); -} - -/* =========================================================================== - * Test deflateGetDictionary() with small buffers - */ -void test_deflate_get_dict(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - unsigned char *dictNew = NULL; - unsigned int *dictLen; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.avail_in = (unsigned int)strlen(hello)+1; - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - - dictNew = calloc(256, 1); - dictLen = (unsigned int *)calloc(4, 1); - err = PREFIX(deflateGetDictionary)(&c_stream, dictNew, dictLen); - - CHECK_ERR(err, "deflateGetDictionary"); - if (err == Z_OK) { - printf("deflateGetDictionary(): %s\n", dictNew); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - free(dictNew); - free(dictLen); -} - -/* =========================================================================== - * Test deflatePending() with small buffers - */ -void test_deflate_pending(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - int *bits = calloc(256, 1); - unsigned *ped = calloc(256, 1); - size_t len = strlen(hello)+1; - - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - - err = PREFIX(deflatePending)(&c_stream, ped, bits); - CHECK_ERR(err, "deflatePending"); - - if (*bits >= 0 && *bits <= 7) { - printf("deflatePending(): OK\n"); - } else { - printf("deflatePending(): error\n"); - } - - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - free(bits); - free(ped); -} - -/* =========================================================================== - * Test deflatePrime() wrapping gzip around deflate stream - */ -void test_deflate_prime(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - PREFIX3(stream) d_stream; /* decompression stream */ - int err; - size_t len = strlen(hello)+1; - uint32_t crc = 0; - - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - /* Raw deflate windowBits is -15 */ - err = PREFIX(deflateInit2)(&c_stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY); - CHECK_ERR(err, "deflateInit2"); - - /* Gzip magic number */ - err = PREFIX(deflatePrime)(&c_stream, 16, 0x8b1f); - CHECK_ERR(err, "deflatePrime"); - /* Gzip compression method (deflate) */ - err = PREFIX(deflatePrime)(&c_stream, 8, 0x08); - CHECK_ERR(err, "deflatePrime"); - /* Gzip flags (one byte, using two odd bit calls) */ - err = PREFIX(deflatePrime)(&c_stream, 3, 0x0); - CHECK_ERR(err, "deflatePrime"); - err = PREFIX(deflatePrime)(&c_stream, 5, 0x0); - CHECK_ERR(err, "deflatePrime"); - /* Gzip modified time */ - err = PREFIX(deflatePrime)(&c_stream, 32, 0x0); - CHECK_ERR(err, "deflatePrime"); - /* Gzip extra flags */ - err = PREFIX(deflatePrime)(&c_stream, 8, 0x0); - CHECK_ERR(err, "deflatePrime"); - /* Gzip operating system */ - err = PREFIX(deflatePrime)(&c_stream, 8, 255); - CHECK_ERR(err, "deflatePrime"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.avail_in = (uint32_t)len; - c_stream.next_out = compr; - c_stream.avail_out = (uint32_t)comprLen; - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) - CHECK_ERR(err, "deflate"); - - /* Gzip uncompressed data crc32 */ - crc = PREFIX(crc32)(0, (const uint8_t *)hello, (uint32_t)len); - err = PREFIX(deflatePrime)(&c_stream, 32, crc); - CHECK_ERR(err, "deflatePrime"); - /* Gzip uncompressed data length */ - err = PREFIX(deflatePrime)(&c_stream, 32, (uint32_t)len); - CHECK_ERR(err, "deflatePrime"); - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uint32_t)c_stream.total_out; - d_stream.next_out = uncompr; - d_stream.avail_out = (uint32_t)uncomprLen; - d_stream.total_in = 0; - d_stream.total_out = 0; - - /* Inflate with gzip header */ - err = PREFIX(inflateInit2)(&d_stream, MAX_WBITS + 32); - CHECK_ERR(err, "inflateInit"); - - err = PREFIX(inflate)(&d_stream, Z_FINISH); - if (err != Z_BUF_ERROR) { - CHECK_ERR(err, "inflate"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((const char *)uncompr, hello) != 0) { - fprintf(stderr, "bad deflatePrime\n"); - exit(1); - } - - if (err == Z_OK) { - printf("deflatePrime(): OK\n"); - } -} - -/* =========================================================================== - * Test deflateSetHeader() with small buffers - */ -void test_deflate_set_header(unsigned char *compr, size_t comprLen) { - PREFIX(gz_header) *head = calloc(1, sizeof(PREFIX(gz_header))); - PREFIX3(stream) c_stream; /* compression stream */ - int err; - size_t len = strlen(hello)+1; - - - if (head == NULL) { - printf("out of memory\n"); - exit(1); - } - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - /* gzip */ - err = PREFIX(deflateInit2)(&c_stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, MAX_WBITS + 16, 8, Z_DEFAULT_STRATEGY); - CHECK_ERR(err, "deflateInit2"); - - head->text = 1; - err = PREFIX(deflateSetHeader)(&c_stream, head); - CHECK_ERR(err, "deflateSetHeader"); - if (err == Z_OK) { - printf("deflateSetHeader(): OK\n"); - } - - c_stream.next_in = (unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - free(head); -} - -/* =========================================================================== - * Test deflateTune() with small buffers - */ -void test_deflate_tune(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - int good_length = 3; - int max_lazy = 5; - int nice_length = 18; - int max_chain = 6; - size_t len = strlen(hello)+1; - - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = PREFIX(deflateTune)(&c_stream,(uInt)good_length,(uInt)max_lazy,nice_length,(uInt)max_chain); - CHECK_ERR(err, "deflateTune"); - if (err == Z_OK) { - printf("deflateTune(): OK\n"); - } - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ -int main(int argc, char *argv[]) { - unsigned char *compr, *uncompr; - z_size_t comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - z_size_t uncomprLen = comprLen; - static const char* myVersion = PREFIX2(VERSION); - - if (zVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zVersion(), PREFIX2(VERSION)) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", - PREFIX2(VERSION), PREFIX2(VERNUM), PREFIX(zlibCompileFlags)()); - - compr = (unsigned char*)calloc((unsigned int)comprLen, 1); - uncompr = (unsigned char*)calloc((unsigned int)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == NULL || uncompr == NULL) { - printf("out of memory\n"); - exit(1); - } - - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - uncompr, uncomprLen); - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen, 0); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - -#ifndef ZLIB_COMPAT - test_large_deflate(compr, comprLen, uncompr, uncomprLen, 1); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); -#endif - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - test_deflate_bound(); - test_deflate_copy(compr, comprLen); - test_deflate_get_dict(compr, comprLen); - test_deflate_set_header(compr, comprLen); - test_deflate_tune(compr, comprLen); - test_deflate_pending(compr, comprLen); - test_deflate_prime(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - return 0; -} diff --git a/libs/zlibng/test/fuzz/checksum_fuzzer.c b/libs/zlibng/test/fuzz/checksum_fuzzer.c deleted file mode 100644 index ef9942111..000000000 --- a/libs/zlibng/test/fuzz/checksum_fuzzer.c +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) { - uint32_t crc0 = PREFIX(crc32)(0L, NULL, 0); - uint32_t crc1 = crc0; - uint32_t crc2 = crc0; - uint32_t adler0 = PREFIX(adler32)(0L, NULL, 0); - uint32_t adler1 = adler0; - uint32_t adler2 = adler0; - uint32_t combine1, combine2; - /* Checksum with a buffer of size equal to the first byte in the input. */ - uint32_t buffSize = data[0]; - uint32_t offset = 0; - uint32_t op[32]; - - /* Discard inputs larger than 1Mb. */ - static size_t kMaxSize = 1024 * 1024; - if (dataLen < 1 || dataLen > kMaxSize) - return 0; - - /* Make sure the buffer has at least a byte. */ - if (buffSize == 0) - ++buffSize; - - /* CRC32 */ - PREFIX(crc32_combine_gen)(op, buffSize); - for (offset = 0; offset + buffSize <= dataLen; offset += buffSize) { - uint32_t crc3 = PREFIX(crc32_z)(crc0, data + offset, buffSize); - uint32_t crc4 = PREFIX(crc32_combine_op)(crc1, crc3, op); - crc1 = PREFIX(crc32_z)(crc1, data + offset, buffSize); - assert(crc1 == crc4); - (void)crc1; - (void)crc4; - } - crc1 = PREFIX(crc32_z)(crc1, data + offset, dataLen % buffSize); - - crc2 = PREFIX(crc32_z)(crc2, data, dataLen); - - assert(crc1 == crc2); - (void)crc1; - (void)crc2; - combine1 = PREFIX(crc32_combine)(crc1, crc2, (z_off_t)dataLen); - combine2 = PREFIX(crc32_combine)(crc1, crc1, (z_off_t)dataLen); - assert(combine1 == combine2); - - /* Fast CRC32 combine. */ - PREFIX(crc32_combine_gen)(op, (z_off_t)dataLen); - combine1 = PREFIX(crc32_combine_op)(crc1, crc2, op); - combine2 = PREFIX(crc32_combine_op)(crc2, crc1, op); - assert(combine1 == combine2); - combine1 = PREFIX(crc32_combine)(crc1, crc2, (z_off_t)dataLen); - combine2 = PREFIX(crc32_combine_op)(crc2, crc1, op); - assert(combine1 == combine2); - - /* Adler32 */ - for (offset = 0; offset + buffSize <= dataLen; offset += buffSize) - adler1 = PREFIX(adler32_z)(adler1, data + offset, buffSize); - adler1 = PREFIX(adler32_z)(adler1, data + offset, dataLen % buffSize); - - adler2 = PREFIX(adler32_z)(adler2, data, dataLen); - - assert(adler1 == adler2); - (void)adler1; - (void)adler2; - combine1 = PREFIX(adler32_combine)(adler1, adler2, (z_off_t)dataLen); - combine2 = PREFIX(adler32_combine)(adler1, adler1, (z_off_t)dataLen); - assert(combine1 == combine2); - (void)combine1; - (void)combine2; - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/compress_fuzzer.c b/libs/zlibng/test/fuzz/compress_fuzzer.c deleted file mode 100644 index 9712e882a..000000000 --- a/libs/zlibng/test/fuzz/compress_fuzzer.c +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -static const uint8_t *data; -static size_t dataLen; - -static void check_compress_level(uint8_t *compr, z_size_t comprLen, - uint8_t *uncompr, z_size_t uncomprLen, - int level) { - PREFIX(compress2)(compr, &comprLen, data, dataLen, level); - PREFIX(uncompress)(uncompr, &uncomprLen, compr, comprLen); - - /* Make sure compress + uncompress gives back the input data. */ - assert(dataLen == uncomprLen); - assert(0 == memcmp(data, uncompr, dataLen)); -} - -#define put_byte(s, i, c) {s[i] = (unsigned char)(c);} - -static void write_zlib_header(uint8_t *s) { - unsigned level_flags = 0; /* compression level (0..3) */ - unsigned w_bits = 8; /* window size log2(w_size) (8..16) */ - unsigned int header = (Z_DEFLATED + ((w_bits-8)<<4)) << 8; - header |= (level_flags << 6); - - header += 31 - (header % 31); - - /* s is guaranteed to be longer than 2 bytes. */ - put_byte(s, 0, (header >> 8)); - put_byte(s, 1, (header & 0xff)); -} - -static void check_decompress(uint8_t *compr, size_t comprLen) { - /* We need to write a valid zlib header of size two bytes. Copy the input data - in a larger buffer. Do not modify the input data to avoid libFuzzer error: - fuzz target overwrites its const input. */ - size_t copyLen = dataLen + 2; - uint8_t *copy = (uint8_t *)malloc(copyLen); - memcpy(copy + 2, data, dataLen); - write_zlib_header(copy); - - PREFIX(uncompress)(compr, &comprLen, copy, copyLen); - free(copy); -} - -int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) { - /* compressBound does not provide enough space for low compression levels. */ - z_size_t comprLen = 100 + 2 * PREFIX(compressBound)(size); - z_size_t uncomprLen = (z_size_t)size; - uint8_t *compr, *uncompr; - - /* Discard inputs larger than 1Mb. */ - static size_t kMaxSize = 1024 * 1024; - - if (size < 1 || size > kMaxSize) - return 0; - - data = d; - dataLen = size; - compr = (uint8_t *)calloc(1, comprLen); - uncompr = (uint8_t *)calloc(1, uncomprLen); - - check_compress_level(compr, comprLen, uncompr, uncomprLen, 1); - check_compress_level(compr, comprLen, uncompr, uncomprLen, 3); - check_compress_level(compr, comprLen, uncompr, uncomprLen, 6); - check_compress_level(compr, comprLen, uncompr, uncomprLen, 7); - - check_decompress(compr, comprLen); - - free(compr); - free(uncompr); - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/example_dict_fuzzer.c b/libs/zlibng/test/fuzz/example_dict_fuzzer.c deleted file mode 100644 index 027c9a806..000000000 --- a/libs/zlibng/test/fuzz/example_dict_fuzzer.c +++ /dev/null @@ -1,169 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -static const uint8_t *data; -static size_t dataLen; -static alloc_func zalloc = NULL; -static free_func zfree = NULL; -static unsigned int dictionaryLen = 0; -static unsigned long dictId; /* Adler32 value of the dictionary */ - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(unsigned char **compr, size_t *comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - int level = data[0] % 11 - 1; /* [-1..9] - compression levels - #define Z_NO_COMPRESSION 0 - #define Z_BEST_SPEED 1 - #define Z_BEST_COMPRESSION 9 - #define Z_DEFAULT_COMPRESSION (-1) */ - - int method = Z_DEFLATED; /* The deflate compression method (the only one - supported in this version) */ - int windowBits = 8 + data[0] % 8; /* The windowBits parameter is the base - two logarithm of the window size (the size of the history buffer). It - should be in the range 8..15 for this version of the library. */ - int memLevel = 1 + data[0] % 9; /* memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. */ - int strategy = data[0] % 5; /* [0..4] - #define Z_FILTERED 1 - #define Z_HUFFMAN_ONLY 2 - #define Z_RLE 3 - #define Z_FIXED 4 - #define Z_DEFAULT_STRATEGY 0 */ - - /* deflate would fail for no-compression or for speed levels. */ - if (level == 0 || level == 1) - level = -1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - - err = PREFIX(deflateInit2)(&c_stream, level, method, windowBits, memLevel, - strategy); - CHECK_ERR(err, "deflateInit"); - - err = PREFIX(deflateSetDictionary)( - &c_stream, (const unsigned char *)data, dictionaryLen); - CHECK_ERR(err, "deflateSetDictionary"); - - /* deflateBound does not provide enough space for low compression levels. */ - *comprLen = 100 + 2 * PREFIX(deflateBound)(&c_stream, (unsigned long)dataLen); - *compr = (uint8_t *)calloc(1, *comprLen); - - dictId = c_stream.adler; - c_stream.next_out = *compr; - c_stream.avail_out = (unsigned int)(*comprLen); - - c_stream.next_in = (z_const unsigned char *)data; - c_stream.avail_in = (uint32_t)dataLen; - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate dict should report Z_STREAM_END\n"); - exit(1); - } - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(unsigned char *compr, size_t comprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - unsigned char *uncompr; - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = (unsigned int)comprLen; - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - uncompr = (uint8_t *)calloc(1, dataLen); - d_stream.next_out = uncompr; - d_stream.avail_out = (unsigned int)dataLen; - - for (;;) { - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) - break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = PREFIX(inflateSetDictionary)( - &d_stream, (const unsigned char *)data, dictionaryLen); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (memcmp(uncompr, data, dataLen)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } - - free(uncompr); -} - -int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) { - size_t comprLen = 0; - uint8_t *compr; - - /* Discard inputs larger than 100Kb. */ - static size_t kMaxSize = 100 * 1024; - - if (size < 1 || size > kMaxSize) - return 0; - - data = d; - dataLen = size; - - /* Set up the contents of the dictionary. The size of the dictionary is - intentionally selected to be of unusual size. To help cover more corner - cases, the size of the dictionary is read from the input data. */ - dictionaryLen = data[0]; - if (dictionaryLen > dataLen) - dictionaryLen = (unsigned int)dataLen; - - test_dict_deflate(&compr, &comprLen); - test_dict_inflate(compr, comprLen); - - free(compr); - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/example_flush_fuzzer.c b/libs/zlibng/test/fuzz/example_flush_fuzzer.c deleted file mode 100644 index 81ec7e36d..000000000 --- a/libs/zlibng/test/fuzz/example_flush_fuzzer.c +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -static const uint8_t *data; -static size_t dataLen; -static alloc_func zalloc = NULL; -static free_func zfree = NULL; - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(unsigned char *compr, z_size_t *comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - unsigned int len = (unsigned int)dataLen; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)data; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (unsigned int)*comprLen; - err = PREFIX(deflate)(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate flush 1"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate flush 2"); - } - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = (z_size_t)c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (unsigned int)uncomprLen; - - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (unsigned int)comprLen - 2; /* read all compressed data */ - err = PREFIX(inflateSync)(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = PREFIX(inflate)(&d_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "inflate should report Z_STREAM_END\n"); - exit(1); - } - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); -} - -int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) { - z_size_t comprLen = 100 + 2 * PREFIX(compressBound)(size); - z_size_t uncomprLen = (z_size_t)size; - uint8_t *compr, *uncompr; - - /* Discard inputs larger than 1Mb. */ - static size_t kMaxSize = 1024 * 1024; - - // This test requires at least 3 bytes of input data. - if (size <= 3 || size > kMaxSize) - return 0; - - data = d; - dataLen = size; - compr = (uint8_t *)calloc(1, comprLen); - uncompr = (uint8_t *)calloc(1, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/example_large_fuzzer.c b/libs/zlibng/test/fuzz/example_large_fuzzer.c deleted file mode 100644 index bd27a84f1..000000000 --- a/libs/zlibng/test/fuzz/example_large_fuzzer.c +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -static const uint8_t *data; -static size_t dataLen; -static alloc_func zalloc = NULL; -static free_func zfree = NULL; -static unsigned int diff; - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - - err = PREFIX(deflateInit)(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (unsigned int)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (unsigned int)uncomprLen; - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate large 1"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - PREFIX(deflateParams)(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - diff = (unsigned int)(c_stream.next_out - compr); - c_stream.avail_in = diff; - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate large 2"); - - /* Switch back to compressing mode: */ - PREFIX(deflateParams)(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (unsigned int)uncomprLen; - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate large 3"); - - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate large should report Z_STREAM_END\n"); - exit(1); - } - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = (unsigned int)comprLen; - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (unsigned int)uncomprLen; - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) - break; - CHECK_ERR(err, "large inflate"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2 * uncomprLen + diff) { - fprintf(stderr, "bad large inflate: %" PRIu64 "\n", (uint64_t)d_stream.total_out); - exit(1); - } -} - -int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) { - size_t comprLen = 100 + 3 * size; - size_t uncomprLen = comprLen; - uint8_t *compr, *uncompr; - - /* Discard inputs larger than 512Kb. */ - static size_t kMaxSize = 512 * 1024; - - if (size < 1 || size > kMaxSize) - return 0; - - data = d; - dataLen = size; - compr = (uint8_t *)calloc(1, comprLen); - uncompr = (uint8_t *)calloc(1, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/example_small_fuzzer.c b/libs/zlibng/test/fuzz/example_small_fuzzer.c deleted file mode 100644 index d02a812de..000000000 --- a/libs/zlibng/test/fuzz/example_small_fuzzer.c +++ /dev/null @@ -1,123 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -static const uint8_t *data; -static size_t dataLen; -static alloc_func zalloc = NULL; -static free_func zfree = NULL; - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(unsigned char *compr, size_t comprLen) { - PREFIX3(stream) c_stream; /* compression stream */ - int err; - unsigned long len = (unsigned long)dataLen; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (void *)0; - - err = PREFIX(deflateInit)(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)data; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(deflate)(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate small 1"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) - break; - CHECK_ERR(err, "deflate small 2"); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { - int err; - PREFIX3(stream) d_stream; /* decompression stream */ - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (void *)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = PREFIX(inflateInit)(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = PREFIX(inflate)(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) - break; - CHECK_ERR(err, "inflate"); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (memcmp(uncompr, data, dataLen)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } -} - -int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) { - size_t comprLen = PREFIX(compressBound)(size); - size_t uncomprLen = size; - uint8_t *compr, *uncompr; - - /* Discard inputs larger than 1Mb. */ - static size_t kMaxSize = 1024 * 1024; - - if (size < 1 || size > kMaxSize) - return 0; - - data = d; - dataLen = size; - compr = (uint8_t *)calloc(1, comprLen); - uncompr = (uint8_t *)calloc(1, uncomprLen); - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/minigzip_fuzzer.c b/libs/zlibng/test/fuzz/minigzip_fuzzer.c deleted file mode 100644 index 1f19126f4..000000000 --- a/libs/zlibng/test/fuzz/minigzip_fuzzer.c +++ /dev/null @@ -1,321 +0,0 @@ -/* minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995-2006, 2010, 2011, 2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * minigzip is a minimal implementation of the gzip utility. This is - * only an example of using zlib and isn't meant to replace the - * full-featured gzip. No attempt is made to deal with file systems - * limiting names to 14 or 8+3 characters, etc... Error checking is - * very limited. So use minigzip only for testing; use gzip for the - * real thing. - */ - -#define _POSIX_SOURCE 1 /* This file needs POSIX for fileno(). */ -#define _POSIX_C_SOURCE 200112 /* For snprintf(). */ - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif -#include -#include -#include -#include - -#ifdef USE_MMAP -# include -# include -# include -#endif - -#ifndef UNALIGNED_OK -# include -#endif - -#if defined(_WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif - -#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) -#ifndef _WIN32 /* unlink already in stdio.h for Win32 */ -extern int unlink (const char *); -#endif -#endif - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#define BUFLEN 16384 /* read buffer size */ -#define BUFLENW (BUFLEN * 3) /* write buffer size */ -#define MAX_NAME_LEN 1024 - -static const char *prog = "minigzip_fuzzer"; - -void error (const char *msg); -void gz_compress (FILE *in, gzFile out); -#ifdef USE_MMAP -int gz_compress_mmap (FILE *in, gzFile out); -#endif -void gz_uncompress (gzFile in, FILE *out); -void file_compress (char *file, char *mode); -void file_uncompress (char *file); -int main (int argc, char *argv[]); - -/* =========================================================================== - * Display error message and exit - */ -void error(const char *msg) { - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(FILE *in, gzFile out) { - char buf[BUFLEN]; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - /* Clear out the contents of buf before reading from the file to avoid - MemorySanitizer: use-of-uninitialized-value warnings. */ - memset(buf, 0, sizeof(buf)); - for (;;) { - len = (int)fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (PREFIX(gzwrite)(out, buf, (unsigned)len) != len) error(PREFIX(gzerror)(out, &err)); - } - fclose(in); - if (PREFIX(gzclose)(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(FILE *in, gzFile out) { - int len; - int err; - int ifd = fileno(in); - char *buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((void *)0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (char *)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = PREFIX(gzwrite)(out, (char *)buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(PREFIX(gzerror)(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (PREFIX(gzclose)(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(gzFile in, FILE *out) { - char buf[BUFLENW]; - int len; - int err; - - for (;;) { - len = PREFIX(gzread)(in, buf, sizeof(buf)); - if (len < 0) error (PREFIX(gzerror)(in, &err)); - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } - } - if (fclose(out)) error("failed fclose"); - - if (PREFIX(gzclose)(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(char *file, char *mode) { - char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - - snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = PREFIX(gzopen)(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(char *file) { - char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - size_t len = strlen(file); - - if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - - snprintf(buf, sizeof(buf), "%s", file); - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; - snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX); - } - in = PREFIX(gzopen)(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - unlink(infile); -} - -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen) { - char *inFileName = "minigzip_fuzzer.out"; - char *outFileName = "minigzip_fuzzer.out.gz"; - char outmode[20]; - FILE *in; - char buf[BUFLEN]; - uint32_t offset = 0; - - /* Discard inputs larger than 1Mb. */ - static size_t kMaxSize = 1024 * 1024; - if (dataLen < 1 || dataLen > kMaxSize) - return 0; - - in = fopen(inFileName, "wb"); - if (fwrite(data, 1, (unsigned)dataLen, in) != dataLen) - error("failed fwrite"); - if (fclose(in)) - error("failed fclose"); - - memset(outmode, 0, sizeof(outmode)); - snprintf(outmode, sizeof(outmode), "%s", "wb"); - - /* Compression level: [0..9]. */ - outmode[2] = data[0] % 10; - - switch (data[0] % 4) { - default: - case 0: - outmode[3] = 0; - break; - case 1: - /* compress with Z_FILTERED */ - outmode[3] = 'f'; - break; - case 2: - /* compress with Z_HUFFMAN_ONLY */ - outmode[3] = 'h'; - break; - case 3: - /* compress with Z_RLE */ - outmode[3] = 'R'; - break; - } - - file_compress(inFileName, outmode); - file_uncompress(outFileName); - - /* Check that the uncompressed file matches the input data. */ - in = fopen(inFileName, "rb"); - if (in == NULL) { - perror(inFileName); - exit(1); - } - - memset(buf, 0, sizeof(buf)); - for (;;) { - int len = (int)fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) - break; - assert(0 == memcmp(data + offset, buf, len)); - offset += len; - } - - if (fclose(in)) - error("failed fclose"); - - /* This function must return 0. */ - return 0; -} diff --git a/libs/zlibng/test/fuzz/standalone_fuzz_target_runner.c b/libs/zlibng/test/fuzz/standalone_fuzz_target_runner.c deleted file mode 100644 index a291b4882..000000000 --- a/libs/zlibng/test/fuzz/standalone_fuzz_target_runner.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include - -extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); - -int main(int argc, char **argv) { - int i; - fprintf(stderr, "StandaloneFuzzTargetMain: running %d inputs\n", argc - 1); - - for (i = 1; i < argc; i++) { - size_t len, n_read, err; - unsigned char *buf; - FILE *f = fopen(argv[i], "rb+"); - if (!f) { - /* Failed to open this file: it may be a directory. */ - fprintf(stderr, "Skipping: %s\n", argv[i]); - continue; - } - fprintf(stderr, "Running: %s %s\n", argv[0], argv[i]); - fseek(f, 0, SEEK_END); - len = ftell(f); - fseek(f, 0, SEEK_SET); - buf = (unsigned char *)malloc(len); - n_read = fread(buf, 1, len, f); - assert(n_read == len); - LLVMFuzzerTestOneInput(buf, len); - free(buf); - err = fclose(f); - assert(err == 0); - (void)err; - fprintf(stderr, "Done: %s: (%d bytes)\n", argv[i], (int)n_read); - } - - return 0; -} diff --git a/libs/zlibng/test/infcover.c b/libs/zlibng/test/infcover.c deleted file mode 100644 index 3466b202d..000000000 --- a/libs/zlibng/test/infcover.c +++ /dev/null @@ -1,682 +0,0 @@ -/* infcover.c -- test zlib's inflate routines with full code coverage - * Copyright (C) 2011, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* to use, do: ./configure --cover && make cover */ - -#include -#include -#include -#undef NDEBUG -#include -#include -#include - -/* get definition of internal structure so we can mess with it (see pull()), - and so we can call inflate_trees() (see cover5()) */ -#define ZLIB_INTERNAL -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif -#include "inftrees.h" -#include "inflate.h" - -/* -- memory tracking routines -- */ - -/* - These memory tracking routines are provided to zlib and track all of zlib's - allocations and deallocations, check for LIFO operations, keep a current - and high water mark of total bytes requested, optionally set a limit on the - total memory that can be allocated, and when done check for memory leaks. - - They are used as follows: - - PREFIX3(stream) strm; - mem_setup(&strm) initializes the memory tracking and sets the - zalloc, zfree, and opaque members of strm to use - memory tracking for all zlib operations on strm - mem_limit(&strm, limit) sets a limit on the total bytes requested -- a - request that exceeds this limit will result in an - allocation failure (returns NULL) -- setting the - limit to zero means no limit, which is the default - after mem_setup() - mem_used(&strm, "msg") prints to stderr "msg" and the total bytes used - mem_high(&strm, "msg") prints to stderr "msg" and the high water mark - mem_done(&strm, "msg") ends memory tracking, releases all allocations - for the tracking as well as leaked zlib blocks, if - any. If there was anything unusual, such as leaked - blocks, non-FIFO frees, or frees of addresses not - allocated, then "msg" and information about the - problem is printed to stderr. If everything is - normal, nothing is printed. mem_done resets the - strm members to NULL to use the default memory - allocation routines on the next zlib initialization - using strm. - */ - -/* these items are strung together in a linked list, one for each allocation */ -struct mem_item { - void *ptr; /* pointer to allocated memory */ - size_t size; /* requested size of allocation */ - struct mem_item *next; /* pointer to next item in list, or NULL */ -}; - -/* this structure is at the root of the linked list, and tracks statistics */ -struct mem_zone { - struct mem_item *first; /* pointer to first item in list, or NULL */ - size_t total, highwater; /* total allocations, and largest total */ - size_t limit; /* memory allocation limit, or 0 if no limit */ - int notlifo, rogue; /* counts of non-LIFO frees and rogue frees */ -}; - -/* memory allocation routine to pass to zlib */ -static void *mem_alloc(void *mem, unsigned count, unsigned size) { - void *ptr; - struct mem_item *item; - struct mem_zone *zone = mem; - size_t len = count * (size_t)size; - - /* induced allocation failure */ - if (zone == NULL || (zone->limit && zone->total + len > zone->limit)) - return NULL; - - /* perform allocation using the standard library, fill memory with a - non-zero value to make sure that the code isn't depending on zeros */ - ptr = malloc(len); - if (ptr == NULL) - return NULL; - memset(ptr, 0xa5, len); - - /* create a new item for the list */ - item = malloc(sizeof(struct mem_item)); - if (item == NULL) { - free(ptr); - return NULL; - } - item->ptr = ptr; - item->size = len; - - /* insert item at the beginning of the list */ - item->next = zone->first; - zone->first = item; - - /* update the statistics */ - zone->total += item->size; - if (zone->total > zone->highwater) - zone->highwater = zone->total; - - /* return the allocated memory */ - return ptr; -} - -/* memory free routine to pass to zlib */ -static void mem_free(void *mem, void *ptr) { - struct mem_item *item, *next; - struct mem_zone *zone = mem; - - /* if no zone, just do a free */ - if (zone == NULL) { - free(ptr); - return; - } - - /* point next to the item that matches ptr, or NULL if not found -- remove - the item from the linked list if found */ - next = zone->first; - if (next) { - if (next->ptr == ptr) - zone->first = next->next; /* first one is it, remove from list */ - else { - do { /* search the linked list */ - item = next; - next = item->next; - } while (next != NULL && next->ptr != ptr); - if (next) { /* if found, remove from linked list */ - item->next = next->next; - zone->notlifo++; /* not a LIFO free */ - } - - } - } - - /* if found, update the statistics and free the item */ - if (next) { - zone->total -= next->size; - free(next); - } - - /* if not found, update the rogue count */ - else - zone->rogue++; - - /* in any case, do the requested free with the standard library function */ - free(ptr); -} - -/* set up a controlled memory allocation space for monitoring, set the stream - parameters to the controlled routines, with opaque pointing to the space */ -static void mem_setup(PREFIX3(stream) *strm) { - struct mem_zone *zone; - - zone = malloc(sizeof(struct mem_zone)); - assert(zone != NULL); - zone->first = NULL; - zone->total = 0; - zone->highwater = 0; - zone->limit = 0; - zone->notlifo = 0; - zone->rogue = 0; - strm->opaque = zone; - strm->zalloc = mem_alloc; - strm->zfree = mem_free; -} - -/* set a limit on the total memory allocation, or 0 to remove the limit */ -static void mem_limit(PREFIX3(stream) *strm, size_t limit) { - struct mem_zone *zone = strm->opaque; - - zone->limit = limit; -} - -/* show the current total requested allocations in bytes */ -static void mem_used(PREFIX3(stream) *strm, char *prefix) { - struct mem_zone *zone = strm->opaque; - - fprintf(stderr, "%s: %" PRIu64 " allocated\n", prefix, (uint64_t)zone->total); -} - -/* show the high water allocation in bytes */ -static void mem_high(PREFIX3(stream) *strm, char *prefix) { - struct mem_zone *zone = strm->opaque; - - fprintf(stderr, "%s: %" PRIu64 " high water mark\n", prefix, (uint64_t)zone->highwater); -} - -/* release the memory allocation zone -- if there are any surprises, notify */ -static void mem_done(PREFIX3(stream) *strm, char *prefix) { - int count = 0; - struct mem_item *item, *next; - struct mem_zone *zone = strm->opaque; - - /* show high water mark */ - mem_high(strm, prefix); - - /* free leftover allocations and item structures, if any */ - item = zone->first; - while (item != NULL) { - free(item->ptr); - next = item->next; - free(item); - item = next; - count++; - } - - /* issue alerts about anything unexpected */ - if (count || zone->total) - fprintf(stderr, "** %s: %" PRIu64 " bytes in %d blocks not freed\n", - prefix, (uint64_t)zone->total, count); - if (zone->notlifo) - fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo); - if (zone->rogue) - fprintf(stderr, "** %s: %d frees not recognized\n", - prefix, zone->rogue); - - /* free the zone and delete from the stream */ - free(zone); - strm->opaque = NULL; - strm->zalloc = NULL; - strm->zfree = NULL; -} - -/* -- inflate test routines -- */ - -/* Decode a hexadecimal string, set *len to length, in[] to the bytes. This - decodes liberally, in that hex digits can be adjacent, in which case two in - a row writes a byte. Or they can be delimited by any non-hex character, - where the delimiters are ignored except when a single hex digit is followed - by a delimiter, where that single digit writes a byte. The returned data is - allocated and must eventually be freed. NULL is returned if out of memory. - If the length is not needed, then len can be NULL. */ -static unsigned char *h2b(const char *hex, unsigned *len) { - unsigned char *in, *re; - unsigned next, val; - size_t inlen; - - inlen = (strlen(hex) + 1) >> 1; - assert(inlen != 0); /* tell static analyzer we won't call malloc(0) */ - in = malloc(inlen); - if (in == NULL) - return NULL; - next = 0; - val = 1; - do { - if (*hex >= '0' && *hex <= '9') - val = (val << 4) + *hex - '0'; - else if (*hex >= 'A' && *hex <= 'F') - val = (val << 4) + *hex - 'A' + 10; - else if (*hex >= 'a' && *hex <= 'f') - val = (val << 4) + *hex - 'a' + 10; - else if (val != 1 && val < 32) /* one digit followed by delimiter */ - val += 240; /* make it look like two digits */ - if (val > 255) { /* have two digits */ - in[next++] = val & 0xff; /* save the decoded byte */ - val = 1; /* start over */ - } - } while (*hex++); /* go through the loop with the terminating null */ - if (len != NULL) - *len = next; - assert(next != 0); /* tell static analyzer we won't call realloc(in, 0) */ - re = realloc(in, next); - return re == NULL ? in : re; -} - -/* generic inflate() run, where hex is the hexadecimal input data, what is the - text to include in an error message, step is how much input data to feed - inflate() on each call, or zero to feed it all, win is the window bits - parameter to inflateInit2(), len is the size of the output buffer, and err - is the error code expected from the first inflate() call (the second - inflate() call is expected to return Z_STREAM_END). If win is 47, then - header information is collected with inflateGetHeader(). If a zlib stream - is looking for a dictionary, then an empty dictionary is provided. - inflate() is run until all of the input data is consumed. */ -static void inf(char *hex, char *what, unsigned step, int win, unsigned len, int err) { - int ret; - unsigned have; - unsigned char *in, *out; - PREFIX3(stream) strm, copy; - PREFIX(gz_header) head; - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = NULL; - ret = PREFIX(inflateInit2)(&strm, win); - if (ret != Z_OK) { - mem_done(&strm, what); - return; - } - out = malloc(len); assert(out != NULL); - if (win == 47) { - head.extra = out; - head.extra_max = len; - head.name = out; - head.name_max = len; - head.comment = out; - head.comm_max = len; - ret = PREFIX(inflateGetHeader)(&strm, &head); - assert(ret == Z_OK); - } - in = h2b(hex, &have); assert(in != NULL); - if (step == 0 || step > have) - step = have; - strm.avail_in = step; - have -= step; - strm.next_in = in; - do { - strm.avail_out = len; - strm.next_out = out; - ret = PREFIX(inflate)(&strm, Z_NO_FLUSH); - assert(err == 9 || ret == err); - if (ret != Z_OK && ret != Z_BUF_ERROR && ret != Z_NEED_DICT) - break; - if (ret == Z_NEED_DICT) { - ret = PREFIX(inflateSetDictionary)(&strm, in, 1); - assert(ret == Z_DATA_ERROR); - mem_limit(&strm, 1); - ret = PREFIX(inflateSetDictionary)(&strm, out, 0); - assert(ret == Z_MEM_ERROR); - mem_limit(&strm, 0); - ((struct inflate_state *)strm.state)->mode = DICT; - ret = PREFIX(inflateSetDictionary)(&strm, out, 0); - assert(ret == Z_OK); - ret = PREFIX(inflate)(&strm, Z_NO_FLUSH); - assert(ret == Z_BUF_ERROR); - } - ret = PREFIX(inflateCopy)(©, &strm); - assert(ret == Z_OK); - ret = PREFIX(inflateEnd)(©); assert(ret == Z_OK); - err = 9; /* don't care next time around */ - have += strm.avail_in; - strm.avail_in = step > have ? have : step; - have -= strm.avail_in; - } while (strm.avail_in); - free(in); - free(out); - ret = PREFIX(inflateReset2)(&strm, -8); assert(ret == Z_OK); - ret = PREFIX(inflateEnd)(&strm); assert(ret == Z_OK); - mem_done(&strm, what); - (void)err; -} - -/* cover all of the lines in inflate.c up to inflate() */ -static void cover_support(void) { - int ret; - PREFIX3(stream) strm; - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = NULL; - ret = PREFIX(inflateInit)(&strm); assert(ret == Z_OK); - mem_used(&strm, "inflate init"); - ret = PREFIX(inflatePrime)(&strm, 5, 31); assert(ret == Z_OK); - ret = PREFIX(inflatePrime)(&strm, -1, 0); assert(ret == Z_OK); - ret = PREFIX(inflateSetDictionary)(&strm, NULL, 0); - assert(ret == Z_STREAM_ERROR); - ret = PREFIX(inflateEnd)(&strm); assert(ret == Z_OK); - mem_done(&strm, "prime"); - - inf("63 0", "force window allocation", 0, -15, 1, Z_OK); - inf("63 18 5", "force window replacement", 0, -8, 259, Z_OK); - inf("63 18 68 30 d0 0 0", "force split window update", 4, -8, 259, Z_OK); - inf("3 0", "use fixed blocks", 0, -15, 1, Z_STREAM_END); - inf("", "bad window size", 0, 1, 0, Z_STREAM_ERROR); - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = NULL; - ret = PREFIX(inflateInit_)(&strm, &PREFIX2(VERSION)[1], (int)sizeof(PREFIX3(stream))); - assert(ret == Z_VERSION_ERROR); - mem_done(&strm, "wrong version"); - - strm.avail_in = 0; - strm.next_in = NULL; - ret = PREFIX(inflateInit)(&strm); assert(ret == Z_OK); - ret = PREFIX(inflateEnd)(&strm); assert(ret == Z_OK); - fputs("inflate built-in memory routines\n", stderr); - (void)ret; -} - -/* cover all inflate() header and trailer cases and code after inflate() */ -static void cover_wrap(void) { - int ret; - PREFIX3(stream) strm, copy; - unsigned char dict[257]; - - ret = PREFIX(inflate)(NULL, 0); assert(ret == Z_STREAM_ERROR); - ret = PREFIX(inflateEnd)(NULL); assert(ret == Z_STREAM_ERROR); - ret = PREFIX(inflateCopy)(NULL, NULL); assert(ret == Z_STREAM_ERROR); - fputs("inflate bad parameters\n", stderr); - - inf("1f 8b 0 0", "bad gzip method", 0, 31, 0, Z_DATA_ERROR); - inf("1f 8b 8 80", "bad gzip flags", 0, 31, 0, Z_DATA_ERROR); - inf("77 85", "bad zlib method", 0, 15, 0, Z_DATA_ERROR); - inf("8 99", "set window size from header", 0, 0, 0, Z_OK); - inf("78 9c", "bad zlib window size", 0, 8, 0, Z_DATA_ERROR); - inf("78 9c 63 0 0 0 1 0 1", "check adler32", 0, 15, 1, Z_STREAM_END); - inf("1f 8b 8 1e 0 0 0 0 0 0 1 0 0 0 0 0 0", "bad header crc", 0, 47, 1, - Z_DATA_ERROR); - inf("1f 8b 8 2 0 0 0 0 0 0 1d 26 3 0 0 0 0 0 0 0 0 0", "check gzip length", - 0, 47, 0, Z_STREAM_END); - inf("78 90", "bad zlib header check", 0, 47, 0, Z_DATA_ERROR); - inf("8 b8 0 0 0 1", "need dictionary", 0, 8, 0, Z_NEED_DICT); - inf("78 9c 63 0", "compute adler32", 0, 15, 1, Z_OK); - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = NULL; - ret = PREFIX(inflateInit2)(&strm, -8); - strm.avail_in = 2; - strm.next_in = (void *)"\x63"; - strm.avail_out = 1; - strm.next_out = (void *)&ret; - mem_limit(&strm, 1); - ret = PREFIX(inflate)(&strm, Z_NO_FLUSH); assert(ret == Z_MEM_ERROR); - ret = PREFIX(inflate)(&strm, Z_NO_FLUSH); assert(ret == Z_MEM_ERROR); - mem_limit(&strm, 0); - memset(dict, 0, 257); - ret = PREFIX(inflateSetDictionary)(&strm, dict, 257); - assert(ret == Z_OK); - mem_limit(&strm, (sizeof(struct inflate_state) << 1) + 256); - ret = PREFIX(inflatePrime)(&strm, 16, 0); assert(ret == Z_OK); - strm.avail_in = 2; - strm.next_in = (void *)"\x80"; - ret = PREFIX(inflateSync)(&strm); assert(ret == Z_DATA_ERROR); - ret = PREFIX(inflate)(&strm, Z_NO_FLUSH); assert(ret == Z_STREAM_ERROR); - strm.avail_in = 4; - strm.next_in = (void *)"\0\0\xff\xff"; - ret = PREFIX(inflateSync)(&strm); assert(ret == Z_OK); - (void)PREFIX(inflateSyncPoint)(&strm); - ret = PREFIX(inflateCopy)(©, &strm); assert(ret == Z_MEM_ERROR); - mem_limit(&strm, 0); - ret = PREFIX(inflateUndermine)(&strm, 1); -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - assert(ret == Z_OK); -#else - assert(ret == Z_DATA_ERROR); -#endif - (void)PREFIX(inflateMark)(&strm); - ret = PREFIX(inflateEnd)(&strm); assert(ret == Z_OK); - mem_done(&strm, "miscellaneous, force memory errors"); -} - -/* input and output functions for inflateBack() */ -static unsigned pull(void *desc, z_const unsigned char **buf) { - static unsigned int next = 0; - static unsigned char dat[] = {0x63, 0, 2, 0}; - struct inflate_state *state; - - if (desc == NULL) { - next = 0; - return 0; /* no input (already provided at next_in) */ - } - state = (void *)((PREFIX3(stream) *)desc)->state; - if (state != NULL) - state->mode = SYNC; /* force an otherwise impossible situation */ - return next < sizeof(dat) ? (*buf = dat + next++, 1) : 0; -} - -static int push(void *desc, unsigned char *buf, unsigned len) { - buf += len; - (void)buf; - return desc != NULL; /* force error if desc not null */ -} - -/* cover inflateBack() up to common deflate data cases and after those */ -static void cover_back(void) { - int ret; - PREFIX3(stream) strm; - unsigned char win[32768]; - - ret = PREFIX(inflateBackInit_)(NULL, 0, win, 0, 0); - assert(ret == Z_VERSION_ERROR); - ret = PREFIX(inflateBackInit)(NULL, 0, win); - assert(ret == Z_STREAM_ERROR); - ret = PREFIX(inflateBack)(NULL, NULL, NULL, NULL, NULL); - assert(ret == Z_STREAM_ERROR); - ret = PREFIX(inflateBackEnd)(NULL); assert(ret == Z_STREAM_ERROR); - fputs("inflateBack bad parameters\n", stderr); - - mem_setup(&strm); - ret = PREFIX(inflateBackInit)(&strm, 15, win); - assert(ret == Z_OK); - strm.avail_in = 2; - strm.next_in = (void *)"\x03"; - ret = PREFIX(inflateBack)(&strm, pull, NULL, push, NULL); - assert(ret == Z_STREAM_END); - /* force output error */ - strm.avail_in = 3; - strm.next_in = (void *)"\x63\x00"; - ret = PREFIX(inflateBack)(&strm, pull, NULL, push, &strm); - assert(ret == Z_BUF_ERROR); - /* force mode error by mucking with state */ - ret = PREFIX(inflateBack)(&strm, pull, &strm, push, NULL); - assert(ret == Z_STREAM_ERROR); - ret = PREFIX(inflateBackEnd)(&strm); assert(ret == Z_OK); - mem_done(&strm, "inflateBack bad state"); - - ret = PREFIX(inflateBackInit)(&strm, 15, win); - assert(ret == Z_OK); - ret = PREFIX(inflateBackEnd)(&strm); assert(ret == Z_OK); - fputs("inflateBack built-in memory routines\n", stderr); - (void)ret; -} - -/* do a raw inflate of data in hexadecimal with both inflate and inflateBack */ -static int try(char *hex, char *id, int err) { - int ret; - unsigned len, size; - unsigned char *in, *out, *win; - char *prefix; - PREFIX3(stream) strm; - - /* convert to hex */ - in = h2b(hex, &len); - assert(in != NULL); - - /* allocate work areas */ - size = len << 3; - out = malloc(size); - assert(out != NULL); - win = malloc(32768); - assert(win != NULL); - prefix = malloc(strlen(id) + 6); - assert(prefix != NULL); - - /* first with inflate */ - strcpy(prefix, id); - strcat(prefix, "-late"); - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = NULL; - ret = PREFIX(inflateInit2)(&strm, err < 0 ? 47 : -15); - assert(ret == Z_OK); - strm.avail_in = len; - strm.next_in = in; - do { - strm.avail_out = size; - strm.next_out = out; - ret = PREFIX(inflate)(&strm, Z_TREES); - assert(ret != Z_STREAM_ERROR && ret != Z_MEM_ERROR); - if (ret == Z_DATA_ERROR || ret == Z_NEED_DICT) - break; - } while (strm.avail_in || strm.avail_out == 0); - if (err) { - assert(ret == Z_DATA_ERROR); - assert(strcmp(id, strm.msg) == 0); - } - PREFIX(inflateEnd)(&strm); - mem_done(&strm, prefix); - - /* then with inflateBack */ - if (err >= 0) { - strcpy(prefix, id); - strcat(prefix, "-back"); - mem_setup(&strm); - ret = PREFIX(inflateBackInit)(&strm, 15, win); - assert(ret == Z_OK); - strm.avail_in = len; - strm.next_in = in; - ret = PREFIX(inflateBack)(&strm, pull, NULL, push, NULL); - assert(ret != Z_STREAM_ERROR); - if (err && ret != Z_BUF_ERROR) { - assert(ret == Z_DATA_ERROR); - assert(strcmp(id, strm.msg) == 0); - } - PREFIX(inflateBackEnd)(&strm); - mem_done(&strm, prefix); - } - - /* clean up */ - free(prefix); - free(win); - free(out); - free(in); - return ret; -} - -/* cover deflate data cases in both inflate() and inflateBack() */ -static void cover_inflate(void) { - try("0 0 0 0 0", "invalid stored block lengths", 1); - try("3 0", "fixed", 0); - try("6", "invalid block type", 1); - try("1 1 0 fe ff 0", "stored", 0); - try("fc 0 0", "too many length or distance symbols", 1); - try("4 0 fe ff", "invalid code lengths set", 1); - try("4 0 24 49 0", "invalid bit length repeat", 1); - try("4 0 24 e9 ff ff", "invalid bit length repeat", 1); - try("4 0 24 e9 ff 6d", "invalid code -- missing end-of-block", 1); - try("4 80 49 92 24 49 92 24 71 ff ff 93 11 0", - "invalid literal/lengths set", 1); - try("4 80 49 92 24 49 92 24 f b4 ff ff c3 84", "invalid distances set", 1); - try("4 c0 81 8 0 0 0 0 20 7f eb b 0 0", "invalid literal/length code", 1); - try("2 7e ff ff", "invalid distance code", 1); -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - try("c c0 81 0 0 0 0 0 90 ff 6b 4 0", "invalid distance too far back", 0); -#else - try("c c0 81 0 0 0 0 0 90 ff 6b 4 0", "invalid distance too far back", 1); -#endif - - /* also trailer mismatch just in inflate() */ - try("1f 8b 8 0 0 0 0 0 0 0 3 0 0 0 0 1", "incorrect data check", -1); - try("1f 8b 8 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1", - "incorrect length check", -1); - try("5 c0 21 d 0 0 0 80 b0 fe 6d 2f 91 6c", "pull 17", 0); - try("5 e0 81 91 24 cb b2 2c 49 e2 f 2e 8b 9a 47 56 9f fb fe ec d2 ff 1f", - "long code", 0); - try("ed c0 1 1 0 0 0 40 20 ff 57 1b 42 2c 4f", "length extra", 0); - try("ed cf c1 b1 2c 47 10 c4 30 fa 6f 35 1d 1 82 59 3d fb be 2e 2a fc f c", - "long distance and extra", 0); - try("ed c0 81 0 0 0 0 80 a0 fd a9 17 a9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " - "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6", "window end", 0); - inf("2 8 20 80 0 3 0", "inflate_fast TYPE return", 0, -15, 258, - Z_STREAM_END); - inf("63 18 5 40 c 0", "window wrap", 3, -8, 300, Z_OK); -} - -/* cover remaining lines in inftrees.c */ -static void cover_trees(void) { - int ret; - unsigned bits; - uint16_t lens[16], work[16]; - code *next, table[ENOUGH_DISTS]; - - /* we need to call inflate_table() directly in order to manifest not- - enough errors, since zlib insures that enough is always enough */ - for (bits = 0; bits < 15; bits++) - lens[bits] = (uint16_t)(bits + 1); - lens[15] = 15; - next = table; - bits = 15; - ret = zng_inflate_table(DISTS, lens, 16, &next, &bits, work); - assert(ret == 1); - next = table; - bits = 1; - ret = zng_inflate_table(DISTS, lens, 16, &next, &bits, work); - assert(ret == 1); - fputs("inflate_table not enough errors\n", stderr); - (void)ret; -} - -/* cover remaining inffast.c decoding and window copying */ -static void cover_fast(void) { - inf("e5 e0 81 ad 6d cb b2 2c c9 01 1e 59 63 ae 7d ee fb 4d fd b5 35 41 68" - " ff 7f 0f 0 0 0", "fast length extra bits", 0, -8, 258, Z_DATA_ERROR); - inf("25 fd 81 b5 6d 59 b6 6a 49 ea af 35 6 34 eb 8c b9 f6 b9 1e ef 67 49" - " 50 fe ff ff 3f 0 0", "fast distance extra bits", 0, -8, 258, - Z_DATA_ERROR); - inf("3 7e 0 0 0 0 0", "fast invalid distance code", 0, -8, 258, - Z_DATA_ERROR); - inf("1b 7 0 0 0 0 0", "fast invalid literal/length code", 0, -8, 258, - Z_DATA_ERROR); - inf("d c7 1 ae eb 38 c 4 41 a0 87 72 de df fb 1f b8 36 b1 38 5d ff ff 0", - "fast 2nd level codes and too far back", 0, -8, 258, Z_DATA_ERROR); - inf("63 18 5 8c 10 8 0 0 0 0", "very common case", 0, -8, 259, Z_OK); - inf("63 60 60 18 c9 0 8 18 18 18 26 c0 28 0 29 0 0 0", - "contiguous and wrap around window", 6, -8, 259, Z_OK); - inf("63 0 3 0 0 0 0 0", "copy direct from output", 0, -8, 259, - Z_STREAM_END); -} - -int main(void) { - fprintf(stderr, "%s\n", zVersion()); - cover_support(); - cover_wrap(); - cover_back(); - cover_inflate(); - cover_trees(); - cover_fast(); - return 0; -} diff --git a/libs/zlibng/test/minideflate.c b/libs/zlibng/test/minideflate.c deleted file mode 100644 index 392516852..000000000 --- a/libs/zlibng/test/minideflate.c +++ /dev/null @@ -1,307 +0,0 @@ -/* minideflate.c -- test deflate/inflate under specific conditions - * Copyright (C) 2020 Nathan Moinvaziri - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#if defined(_WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -/* =========================================================================== - * deflate() using specialized parameters - */ -void deflate_params(FILE *fin, FILE *fout, int32_t read_buf_size, int32_t write_buf_size, int32_t level, - int32_t window_bits, int32_t mem_level, int32_t strategy, int32_t flush) { - PREFIX3(stream) c_stream; /* compression stream */ - uint8_t *read_buf; - uint8_t *write_buf; - int32_t read; - int err; - - read_buf = (uint8_t *)malloc(read_buf_size); - if (read_buf == NULL) { - fprintf(stderr, "failed to create read buffer (%d)\n", read_buf_size); - return; - } - write_buf = (uint8_t *)malloc(write_buf_size); - if (write_buf == NULL) { - fprintf(stderr, "failed to create write buffer (%d)\n", write_buf_size); - free(read_buf); - return; - } - - c_stream.zalloc = NULL; - c_stream.zfree = NULL; - c_stream.opaque = (void *)0; - c_stream.total_in = 0; - c_stream.total_out = 0; - - err = PREFIX(deflateInit2)(&c_stream, level, Z_DEFLATED, window_bits, mem_level, strategy); - CHECK_ERR(err, "deflateInit2"); - - /* Process input using our read buffer and flush type, - * output to stdout only once write buffer is full */ - do { - read = (int32_t)fread(read_buf, 1, read_buf_size, fin); - if (read <= 0) - break; - - c_stream.next_in = (z_const uint8_t *)read_buf; - c_stream.next_out = write_buf; - c_stream.avail_in = read; - - do { - c_stream.avail_out = write_buf_size; - err = PREFIX(deflate)(&c_stream, flush); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - - if (c_stream.next_out == write_buf + write_buf_size) { - fwrite(write_buf, 1, write_buf_size, fout); - c_stream.next_out = write_buf; - } - } while (c_stream.next_in < read_buf + read); - } while (err == Z_OK); - - /* Finish the stream if necessary */ - if (flush != Z_FINISH) { - c_stream.avail_in = 0; - do { - if (c_stream.next_out == write_buf + write_buf_size) { - fwrite(write_buf, 1, write_buf_size, fout); - c_stream.next_out = write_buf; - } - - c_stream.avail_out = write_buf_size; - err = PREFIX(deflate)(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } while (err == Z_OK); - } - - /* Output remaining data in write buffer */ - if (c_stream.next_out != write_buf) { - fwrite(write_buf, 1, c_stream.next_out - write_buf, fout); - } - - err = PREFIX(deflateEnd)(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - free(read_buf); - free(write_buf); -} - -/* =========================================================================== - * inflate() using specialized parameters - */ -void inflate_params(FILE *fin, FILE *fout, int32_t read_buf_size, int32_t write_buf_size, int32_t window_bits, - int32_t flush) { - PREFIX3(stream) d_stream; /* decompression stream */ - uint8_t *read_buf; - uint8_t *write_buf; - int32_t read; - int err; - - - read_buf = (uint8_t *)malloc(read_buf_size); - if (read_buf == NULL) { - fprintf(stderr, "failed to create read buffer (%d)\n", read_buf_size); - return; - } - write_buf = (uint8_t *)malloc(write_buf_size); - if (write_buf == NULL) { - fprintf(stderr, "failed to create write buffer (%d)\n", write_buf_size); - free(read_buf); - return; - } - - d_stream.zalloc = NULL; - d_stream.zfree = NULL; - d_stream.opaque = (void *)0; - d_stream.total_in = 0; - d_stream.total_out = 0; - - err = PREFIX(inflateInit2)(&d_stream, window_bits); - CHECK_ERR(err, "inflateInit2"); - - /* Process input using our read buffer and flush type, - * output to stdout only once write buffer is full */ - do { - read = (int32_t)fread(read_buf, 1, read_buf_size, fin); - if (read <= 0) - break; - - d_stream.next_in = (z_const uint8_t *)read_buf; - d_stream.next_out = write_buf; - d_stream.avail_in = read; - - do { - d_stream.avail_out = write_buf_size; - err = PREFIX(inflate)(&d_stream, flush); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - - if (d_stream.next_out == write_buf + write_buf_size) { - fwrite(write_buf, 1, write_buf_size, fout); - d_stream.next_out = write_buf; - } - } while (d_stream.next_in < read_buf + read); - } while (err == Z_OK); - - /* Finish the stream if necessary */ - if (flush != Z_FINISH) { - d_stream.avail_in = 0; - do { - if (d_stream.next_out == write_buf + write_buf_size) { - fwrite(write_buf, 1, write_buf_size, fout); - d_stream.next_out = write_buf; - } - - d_stream.avail_out = write_buf_size; - err = PREFIX(inflate)(&d_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } while (err == Z_OK); - } - - /* Output remaining data in write buffer */ - if (d_stream.next_out != write_buf) { - fwrite(write_buf, 1, d_stream.next_out - write_buf, fout); - } - - err = PREFIX(inflateEnd)(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - free(read_buf); - free(write_buf); -} - -void show_help(void) { - printf("Usage: minideflate [-c] [-f|-h|-R|-F] [-m level] [-r/-t size] [-s flush] [-w bits] [-0 to -9] [input file]\n\n" \ - " -c : write to standard output\n" \ - " -d : decompress\n" \ - " -f : compress with Z_FILTERED\n" \ - " -h : compress with Z_HUFFMAN_ONLY\n" \ - " -R : compress with Z_RLE\n" \ - " -F : compress with Z_FIXED\n" \ - " -m : memory level (1 to 8)\n" \ - " -w : window bits (8 to 15 for gzip, -8 to -15 for zlib)\n" \ - " -s : flush type (0 to 5)\n" \ - " -r : read buffer size\n" \ - " -t : write buffer size\n" \ - " -0 to -9 : compression level\n\n"); -} - -int main(int argc, char **argv) { - int32_t i; - int32_t mem_level = DEF_MEM_LEVEL; - int32_t window_bits = MAX_WBITS; - int32_t strategy = Z_DEFAULT_STRATEGY; - int32_t level = Z_DEFAULT_COMPRESSION; - int32_t read_buf_size = 4096; - int32_t write_buf_size = 4096; - int32_t flush = Z_NO_FLUSH; - uint8_t copyout = 0; - uint8_t uncompr = 0; - char out_file[320]; - FILE *fin = stdin; - FILE *fout = stdout; - - for (i = 1; i < argc; i++) { - if ((strcmp(argv[i], "-m") == 0) && (i + 1 < argc)) - mem_level = atoi(argv[++i]); - else if ((strcmp(argv[i], "-w") == 0) && (i + 1 < argc)) - window_bits = atoi(argv[++i]); - else if ((strcmp(argv[i], "-r") == 0) && (i + 1 < argc)) - read_buf_size = atoi(argv[++i]); - else if ((strcmp(argv[i], "-t") == 0) && (i + 1 < argc)) - write_buf_size = atoi(argv[++i]); - else if ((strcmp(argv[i], "-s") == 0) && (i + 1 < argc)) - flush = atoi(argv[++i]); - else if (strcmp(argv[i], "-c") == 0) - copyout = 1; - else if (strcmp(argv[i], "-d") == 0) - uncompr = 1; - else if (strcmp(argv[i], "-f") == 0) - strategy = Z_FILTERED; - else if (strcmp(argv[i], "-h") == 0) - strategy = Z_HUFFMAN_ONLY; - else if (strcmp(argv[i], "-R") == 0) - strategy = Z_RLE; - else if (argv[i][0] == '-' && argv[i][1] >= '0' && argv[i][1] <= '9' && argv[i][2] == 0) - level = argv[i][1] - '0'; - else if (strcmp(argv[i], "--help") == 0) { - show_help(); - return 0; - } else if (argv[i][0] == '-') { - show_help(); - return 64; /* EX_USAGE */ - } else - break; - } - - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (i != argc) { - fin = fopen(argv[i], "rb+"); - if (fin == NULL) { - fprintf(stderr, "Failed to open file: %s\n", argv[i]); - exit(1); - } - if (!copyout) { - snprintf(out_file, sizeof(out_file), "%s%s", argv[i], (window_bits < 0) ? ".zz" : ".gz"); - fout = fopen(out_file, "wb"); - if (fout == NULL) { - fprintf(stderr, "Failed to open file: %s\n", out_file); - exit(1); - } - } - } - - if (uncompr) { - inflate_params(fin, fout, read_buf_size, write_buf_size, window_bits, flush); - } else { - deflate_params(fin, fout, read_buf_size, write_buf_size, level, window_bits, mem_level, strategy, flush); - } - - if (fin != stdin) { - fclose(fin); - } - if (fout != stdout) { - fclose(fout); - } - - return 0; -} diff --git a/libs/zlibng/test/minigzip.c b/libs/zlibng/test/minigzip.c deleted file mode 100644 index 2e4ef8e2a..000000000 --- a/libs/zlibng/test/minigzip.c +++ /dev/null @@ -1,376 +0,0 @@ -/* minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995-2006, 2010, 2011, 2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * minigzip is a minimal implementation of the gzip utility. This is - * only an example of using zlib and isn't meant to replace the - * full-featured gzip. No attempt is made to deal with file systems - * limiting names to 14 or 8+3 characters, etc... Error checking is - * very limited. So use minigzip only for testing; use gzip for the - * real thing. - */ - -#define _POSIX_SOURCE 1 /* This file needs POSIX for fdopen(). */ -#define _POSIX_C_SOURCE 200112 /* For snprintf(). */ - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif -#include - -#include -#include - -#ifdef USE_MMAP -# include -# include -# include -#endif - -#ifndef UNALIGNED_OK -# include -#endif - -#if defined(_WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif - -#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) -#ifndef _WIN32 /* unlink already in stdio.h for Win32 */ -extern int unlink (const char *); -#endif -#endif - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#ifndef BUFLEN -# define BUFLEN 16384 /* read buffer size */ -#endif -#define BUFLENW (BUFLEN * 3) /* write buffer size */ -#define MAX_NAME_LEN 1024 - -static char *prog; - -void error (const char *msg); -void gz_compress (FILE *in, gzFile out); -#ifdef USE_MMAP -int gz_compress_mmap (FILE *in, gzFile out); -#endif -void gz_uncompress (gzFile in, FILE *out); -void file_compress (char *file, char *mode, int keep); -void file_uncompress (char *file, int keep); -int main (int argc, char *argv[]); - -/* =========================================================================== - * Display error message and exit - */ -void error(const char *msg) { - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(FILE *in, gzFile out) { - char *buf; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - buf = (char *)calloc(BUFLEN, 1); - if (buf == NULL) { - perror("out of memory"); - exit(1); - } - - for (;;) { - len = (int)fread(buf, 1, BUFLEN, in); - if (ferror(in)) { - free(buf); - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (PREFIX(gzwrite)(out, buf, (unsigned)len) != len) error(PREFIX(gzerror)(out, &err)); - } - free(buf); - fclose(in); - if (PREFIX(gzclose)(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(FILE *in, gzFile out) { - int len; - int err; - int ifd = fileno(in); - char *buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((void *)0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (char *)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = PREFIX(gzwrite)(out, buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(PREFIX(gzerror)(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (PREFIX(gzclose)(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(gzFile in, FILE *out) { - char *buf = (char *)malloc(BUFLENW); - int len; - int err; - - if (buf == NULL) error("out of memory"); - - for (;;) { - len = PREFIX(gzread)(in, buf, BUFLENW); - if (len < 0) { - free(buf); - error(PREFIX(gzerror)(in, &err)); - } - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - free(buf); - error("failed fwrite"); - } - } - free(buf); - if (fclose(out)) error("failed fclose"); - - if (PREFIX(gzclose)(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(char *file, char *mode, int keep) { - char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - - snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = PREFIX(gzopen)(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - if (!keep) - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(char *file, int keep) { - char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - size_t len = strlen(file); - - if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - - snprintf(buf, sizeof(buf), "%s", file); - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; - snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX); - } - in = PREFIX(gzopen)(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - if (!keep) - unlink(infile); -} - -void show_help(void) { - printf("Usage: minigzip [-c] [-d] [-k] [-f|-h|-R|-F|-T] [-A] [-0 to -9] [files...]\n\n" \ - " -c : write to standard output\n" \ - " -d : decompress\n" \ - " -k : keep input files\n" \ - " -f : compress with Z_FILTERED\n" \ - " -h : compress with Z_HUFFMAN_ONLY\n" \ - " -R : compress with Z_RLE\n" \ - " -F : compress with Z_FIXED\n" \ - " -T : stored raw\n" \ - " -A : auto detect type\n" \ - " -0 to -9 : compression level\n\n"); -} - -int main(int argc, char *argv[]) { - int copyout = 0; - int uncompr = 0; - int keep = 0; - int i = 0; - gzFile file; - char *bname, outmode[20]; - char *strategy = ""; - char *level = "6"; - char *type = "b"; - - prog = argv[i]; - bname = strrchr(argv[i], '/'); - if (bname) - bname++; - else - bname = argv[i]; - - if (!strcmp(bname, "gunzip")) - uncompr = 1; - else if (!strcmp(bname, "zcat")) - copyout = uncompr = 1; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-c") == 0) - copyout = 1; - else if (strcmp(argv[i], "-d") == 0) - uncompr = 1; - else if (strcmp(argv[i], "-k") == 0) - keep = 1; - else if (strcmp(argv[i], "-A") == 0) - type = ""; - else if (argv[i][0] == '-' && (argv[i][1] == 'f' || argv[i][1] == 'h' || - argv[i][1] == 'R' || argv[i][1] == 'F' || argv[i][1] == 'T') && argv[i][2] == 0) - strategy = argv[i] + 1; - else if (argv[i][0] == '-' && argv[i][1] >= '0' && argv[i][1] <= '9' && argv[i][2] == 0) - level = argv[i] + 1; - else if (strcmp(argv[i], "--help") == 0) { - show_help(); - return 0; - } else if (argv[i][0] == '-') { - show_help(); - return 64; /* EX_USAGE */ - } else { - break; - } - } - - snprintf(outmode, sizeof(outmode), "w%s%s%s", type, strategy, level); - - if (i == argc) { - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (uncompr) { - file = PREFIX(gzdopen)(fileno(stdin), "rb"); - if (file == NULL) error("can't gzdopen stdin"); - gz_uncompress(file, stdout); - } else { - file = PREFIX(gzdopen)(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - gz_compress(stdin, file); - } - } else { - if (copyout) { - SET_BINARY_MODE(stdout); - } - do { - if (uncompr) { - if (copyout) { - file = PREFIX(gzopen)(argv[i], "rb"); - if (file == NULL) - fprintf(stderr, "%s: can't gzopen %s\n", prog, argv[i]); - else - gz_uncompress(file, stdout); - } else { - file_uncompress(argv[i], keep); - } - } else { - if (copyout) { - FILE * in = fopen(argv[i], "rb"); - - if (in == NULL) { - perror(argv[i]); - } else { - file = PREFIX(gzdopen)(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - - gz_compress(in, file); - } - - } else { - file_compress(argv[i], outmode, keep); - } - } - } while (++i < argc); - } - return 0; -} diff --git a/libs/zlibng/test/pkgcheck.sh b/libs/zlibng/test/pkgcheck.sh deleted file mode 100644 index 4c757dff1..000000000 --- a/libs/zlibng/test/pkgcheck.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/sh - -usage() { - cat <<"_EOF_" -Usage: sh test/pkgcheck.sh [--zlib-compat] - -Verifies that the various build systems produce identical results on a Unixlike system. -If --zlib-compat, tests with zlib compatible builds. - -To build the 32 bit version for the current 64 bit arch: - -$ sudo apt install ninja-build diffoscope gcc-multilib -$ export CMAKE_ARGS="-DCMAKE_C_FLAGS=-m32" CFLAGS=-m32 LDFLAGS=-m32 -$ sh test/pkgcheck.sh - -To cross-build, install the appropriate qemu and gcc packages, -and set the environment variables used by configure or cmake. -On Ubuntu, for example (values taken from .github/workflows/pkgconf.yml): - -arm HF: -$ sudo apt install ninja-build diffoscope qemu gcc-arm-linux-gnueabihf libc6-dev-armhf-cross -$ export CHOST=arm-linux-gnueabihf -$ export CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=${CHOST}" - -aarch64: -$ sudo apt install ninja-build diffoscope qemu gcc-aarch64-linux-gnu libc6-dev-arm64-cross -$ export CHOST=aarch64-linux-gnu -$ export CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DCMAKE_C_COMPILER_TARGET=${CHOST}" - -ppc (32 bit big endian): -$ sudo apt install ninja-build diffoscope qemu gcc-powerpc-linux-gnu libc6-dev-powerpc-cross -$ export CHOST=powerpc-linux-gnu -$ export CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake" - -ppc64le: -$ sudo apt install ninja-build diffoscope qemu gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross -$ export CHOST=powerpc64le-linux-gnu -$ export CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake" - -then: -$ export CC=${CHOST}-gcc -$ sh test/pkgcheck.sh [--zlib-compat] - -Note: on Mac, you may also need to do 'sudo xcode-select -r' to get cmake to match configure/make's behavior (i.e. omit -isysroot). -_EOF_ -} - -set -ex - -# Caller can also set CMAKE_ARGS or CONFIGURE_ARGS if desired -CMAKE_ARGS=${CMAKE_ARGS} -CONFIGURE_ARGS=${CONFIGURE_ARGS} - -case "$1" in ---zlib-compat) - suffix="" - CMAKE_ARGS="$CMAKE_ARGS -DZLIB_COMPAT=ON" - CONFIGURE_ARGS="$CONFIGURE_ARGS --zlib-compat" - ;; -"") - suffix="-ng" - ;; -*) - echo "Unknown arg '$1'" - usage - exit 1 - ;; -esac - -if ! test -f "configure" -then - echo "Please run from top of source tree" - exit 1 -fi - -# Tell GNU's ld etc. to use Jan 1 1970 when embedding timestamps -# Probably only needed on older systems (ubuntu 14.04, BSD?) -export SOURCE_DATE_EPOCH=0 -case $(uname) in -Darwin) - # Tell Apple's ar etc. to use zero timestamps - export ZERO_AR_DATE=1 - # What CPU are we running on, exactly? - sysctl -n machdep.cpu.brand_string - sysctl -n machdep.cpu.features - sysctl -n machdep.cpu.leaf7_features - sysctl -n machdep.cpu.extfeatures - ;; -esac - -# Use same compiler for make and cmake builds -if test "$CC"x = ""x -then - if clang --version - then - export CC=clang - elif gcc --version - then - export CC=gcc - fi -fi - -# New build system -# Happens to delete top-level zconf.h -# (which itself is a bug, https://github.com/madler/zlib/issues/162 ) -# which triggers another bug later in configure, -# https://github.com/madler/zlib/issues/499 -rm -rf btmp2 pkgtmp2 -mkdir btmp2 pkgtmp2 -export DESTDIR=$(pwd)/pkgtmp2 -cd btmp2 - cmake -G Ninja ${CMAKE_ARGS} .. - ninja -v - ninja install -cd .. - -# Original build system -rm -rf btmp1 pkgtmp1 -mkdir btmp1 pkgtmp1 -export DESTDIR=$(pwd)/pkgtmp1 -cd btmp1 - case $(uname) in - Darwin) - export LDFLAGS="-Wl,-headerpad_max_install_names" - ;; - esac - ../configure $CONFIGURE_ARGS - make - make install -cd .. - -repack_ar() { - if ! cmp --silent pkgtmp1/usr/local/lib/libz$suffix.a pkgtmp2/usr/local/lib/libz$suffix.a - then - echo "libz$suffix.a does not match. Probably filenames differ (.o vs .c.o). Unpacking and renaming..." - # Note: %% is posix shell syntax meaning "Remove Largest Suffix Pattern", see - # https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02 - cd pkgtmp1; ar x usr/local/lib/libz$suffix.a; rm usr/local/lib/libz$suffix.a; cd .. - cd pkgtmp2; ar x usr/local/lib/libz$suffix.a; rm usr/local/lib/libz$suffix.a; for a in *.c.o; do mv $a ${a%%.c.o}.o; done; cd .. - # Also, remove __.SYMDEF SORTED if present, as it has those funky .c.o names embedded in it. - rm -f pkgtmp[12]/__.SYMDEF\ SORTED - fi -} - -case $(uname) in -Darwin) - # Remove the build uuid. - dylib1=$(find pkgtmp1 -type f -name '*.dylib*') - dylib2=$(find pkgtmp2 -type f -name '*.dylib*') - strip -x -no_uuid "$dylib1" - strip -x -no_uuid "$dylib2" - ;; -esac - -# The ar on newer systems defaults to -D (i.e. deterministic), -# but FreeBSD 12.1, Debian 8, and Ubuntu 14.04 seem to not do that. -# I had trouble passing -D safely to the ar inside CMakeLists.txt, -# so punt and unpack the archive if needed before comparing. -# Also, cmake uses different .o suffix anyway... -repack_ar - -if diff -Nur pkgtmp1 pkgtmp2 -then - echo pkgcheck-cmake-bits-identical PASS -else - echo pkgcheck-cmake-bits-identical FAIL - dylib1=$(find pkgtmp1 -type f -name '*.dylib*' -print -o -type f -name '*.so.*' -print) - dylib2=$(find pkgtmp2 -type f -name '*.dylib*' -print -o -type f -name '*.so.*' -print) - diffoscope $dylib1 $dylib2 | cat - exit 1 -fi - -rm -rf btmp1 btmp2 pkgtmp1 pkgtmp2 - -# any failure would have caused an early exit already -echo "pkgcheck: PASS" diff --git a/libs/zlibng/test/switchlevels.c b/libs/zlibng/test/switchlevels.c deleted file mode 100644 index 0f850113e..000000000 --- a/libs/zlibng/test/switchlevels.c +++ /dev/null @@ -1,169 +0,0 @@ -/* Compresses a user-specified number of chunks from stdin into stdout as a single gzip stream. - * Each chunk is compressed with a user-specified level. - */ - -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -#include -#include -#include - -#if defined(_WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -static int read_all(unsigned char *buf, size_t size) { - size_t total_read = 0; - while (total_read < size) { - size_t n_read = fread(buf + total_read, 1, size - total_read, stdin); - if (ferror(stdin)) { - perror("fread\n"); - return 1; - } - if (n_read == 0) { - fprintf(stderr, "Premature EOF\n"); - return 1; - } - total_read += n_read; - } - return 0; -} - -static int write_all(unsigned char *buf, size_t size) { - size_t total_written = 0; - while (total_written < size) { - size_t n_written = fwrite(buf + total_written, 1, size - total_written, stdout); - if (ferror(stdout)) { - perror("fwrite\n"); - return 1; - } - total_written += n_written; - } - return 0; -} - -static int compress_chunk(PREFIX3(stream) *strm, int level, int size, int last) { - int ret = 1; - int err = 0; - unsigned long compsize; - unsigned char *buf; - - if (size <= 0) { - fprintf(stderr, "compress_chunk() invalid size %d\n", size); - goto done; - } - if (level < 0 || level > 9) { - fprintf(stderr, "compress_chunk() invalid level %d\n", level); - goto done; - } - - compsize = 100 + 2 * PREFIX(deflateBound)(strm, size); - buf = malloc(size + compsize); - if (buf == NULL) { - fprintf(stderr, "Out of memory\n"); - goto done; - } - if (read_all(buf, size) != 0) { - goto free_buf; - } - - /* Provide only output buffer to deflateParams(). It might need some space to flush the leftovers from the last - * deflate(), but we don't want it to compress anything new. */ - strm->next_in = NULL; - strm->avail_in = 0; - strm->next_out = buf + size; - strm->avail_out = compsize; - err = PREFIX(deflateParams)(strm, level, Z_DEFAULT_STRATEGY); - if (err != Z_OK) { - fprintf(stderr, "deflateParams() failed with code %d\n", err); - goto free_buf; - } - - /* Provide input buffer to deflate(). */ - strm->next_in = buf; - strm->avail_in = size; - err = PREFIX(deflate)(strm, last ? Z_FINISH : Z_SYNC_FLUSH); - if ((!last && err != Z_OK) || (last && err != Z_STREAM_END)) { - fprintf(stderr, "deflate() failed with code %d\n", err); - goto free_buf; - } - if (strm->avail_in != 0) { - fprintf(stderr, "deflate() did not consume %d bytes of input\n", strm->avail_in); - goto free_buf; - } - if (write_all(buf + size, compsize - strm->avail_out) != 0) { - goto free_buf; - } - ret = 0; - -free_buf: - free(buf); -done: - return ret; -} - -void show_help(void) -{ - printf("Usage: switchlevels [-w bits] level1 size1 [level2 size2 ...]\n\n" \ - " -w : window bits (8 to 15 for gzip, -8 to -15 for zlib)\n\n"); -} - -int main(int argc, char **argv) { - int ret = EXIT_FAILURE; - int err = 0; - int size = 0; - int level = Z_DEFAULT_COMPRESSION; - int level_arg = 1; - int window_bits = MAX_WBITS + 16; - PREFIX3(stream) strm; - - - if ((argc == 1) || (argc == 2 && strcmp(argv[1], "--help") == 0)) { - show_help(); - return 0; - } - - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - - memset(&strm, 0, sizeof(strm)); - - for (int i = 1; i < argc - 1; i++) { - if (strcmp(argv[i], "-w") == 0 && i+1 < argc) { - window_bits = atoi(argv[++i]); - } else { - level_arg = i; - level = atoi(argv[i]); - break; - } - } - - err = PREFIX(deflateInit2)(&strm, level, Z_DEFLATED, window_bits, 8, Z_DEFAULT_STRATEGY); - if (err != Z_OK) { - fprintf(stderr, "deflateInit() failed with code %d\n", err); - goto done; - } - - for (int i = level_arg; i < argc - 1; i += 2) { - level = atoi(argv[i]); - size = atoi(argv[i + 1]); - if (compress_chunk(&strm, level, size, i + 2 >= argc - 1) != 0) { - goto deflate_end; - } - } - ret = EXIT_SUCCESS; - -deflate_end: - PREFIX(deflateEnd)(&strm); -done: - return ret; -} diff --git a/libs/zlibng/test/testCVEinputs.sh b/libs/zlibng/test/testCVEinputs.sh deleted file mode 100644 index 84f6b31c5..000000000 --- a/libs/zlibng/test/testCVEinputs.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -TESTDIR="$(dirname "$0")" - -# check for QEMU if QEMU_RUN is set -if [ ! -z "${QEMU_RUN}" ]; then - QEMU_VERSION=$(${QEMU_RUN} --version 2> /dev/null) - if [ -z "${QEMU_VERSION}" ]; then - echo "**** You need QEMU to run tests on non-native platform" - exit 1 - fi -fi - -CVEs="CVE-2002-0059 CVE-2004-0797 CVE-2005-1849 CVE-2005-2096" - -for CVE in $CVEs; do - fail=0 - for testcase in ${TESTDIR}/${CVE}/*.gz; do - ${QEMU_RUN} ../minigzip${EXE} -d < "$testcase" - # we expect that a 1 error code is OK - # for a vulnerable failure we'd expect 134 or similar - if [ $? -ne 1 ] && [ $? -ne 0 ]; then - fail=1 - fi - done - if [ $fail -eq 0 ]; then - echo " --- zlib not vulnerable to $CVE ---"; - else - echo " --- zlib VULNERABLE to $CVE ---"; exit 1; - fi -done diff --git a/libs/zlibng/tools/codecov-upload.sh b/libs/zlibng/tools/codecov-upload.sh deleted file mode 100644 index e3a48aab7..000000000 --- a/libs/zlibng/tools/codecov-upload.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -ux -cd "$CODECOV_DIR" -python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" -if [ $? -ne 0 ]; then - sleep 30 - python -m codecov --required --flags "$CODECOV_FLAGS" --name "$CODECOV_NAME" --gcov-exec="$CODECOV_EXEC" --tries=25 -fi -exit $? diff --git a/libs/zlibng/tools/config.sub b/libs/zlibng/tools/config.sub deleted file mode 100644 index dba175ae3..000000000 --- a/libs/zlibng/tools/config.sub +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Canonicalize CHOST. -# In particular, converts Debian multiarch tuples into GNU triplets. -# See also -# https://wiki.debian.org/Multiarch/Tuples -# https://wiki.gentoo.org/wiki/CHOST -# If you need an architecture not listed here, file a bug at github.com/zlib-ng/zlib-ng -# and work around the problem by dropping libtool's much more comprehensive config.sub -# on top of this file, see -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub - -case "$1" in -*-*-linux-gnu*) echo $1;; -i686-linux-gnu*|x86_64-linux-gnu*) echo $1 | sed 's/-linux-gnu/-pc-linux-gnu/';; -*-linux-gnu*) echo $1 | sed 's/-linux-gnu/-unknown-linux-gnu/';; -*) echo $1;; -esac diff --git a/libs/zlibng/tools/makecrct.c b/libs/zlibng/tools/makecrct.c deleted file mode 100644 index 323d0c03d..000000000 --- a/libs/zlibng/tools/makecrct.c +++ /dev/null @@ -1,177 +0,0 @@ -/* crc32.c -- output crc32 tables - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016, 2018 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h -*/ - -#include -#include -#include "zbuild.h" -#include "deflate.h" -#include "crc32_p.h" - -static uint32_t crc_table[8][256]; -static uint32_t crc_comb[GF2_DIM][GF2_DIM]; - -static void gf2_matrix_square(uint32_t *square, const uint32_t *mat); -static void make_crc_table(void); -static void make_crc_combine_table(void); -static void print_crc_table(void); -static void print_crc_combine_table(void); -static void write_table(const uint32_t *, int); - - -/* ========================================================================= */ -static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) { - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= - 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. -*/ -static void make_crc_table(void) { - int n, k; - uint32_t c; - uint32_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static const unsigned char p[] = {0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26}; - - /* make exclusive-or pattern from polynomial (0xedb88320) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (uint32_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (uint32_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - - /* 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); - } - } -} - -static void make_crc_combine_table(void) { - int n, k; - /* generate zero operators table for crc32_combine() */ - - /* generate the operator to apply a single zero bit to a CRC -- the - first row adds the polynomial if the low bit is a 1, and the - remaining rows shift the CRC right one bit */ - k = GF2_DIM - 3; - crc_comb[k][0] = 0xedb88320UL; /* CRC-32 polynomial */ - uint32_t row = 1; - for (n = 1; n < GF2_DIM; n++) { - crc_comb[k][n] = row; - row <<= 1; - } - /* generate operators that apply 2, 4, and 8 zeros to a CRC, putting - the last one, the operator for one zero byte, at the 0 position */ - gf2_matrix_square(crc_comb[k + 1], crc_comb[k]); - gf2_matrix_square(crc_comb[k + 2], crc_comb[k + 1]); - gf2_matrix_square(crc_comb[0], crc_comb[k + 2]); - - /* generate operators for applying 2^n zero bytes to a CRC, filling out - the remainder of the table -- the operators repeat after GF2_DIM - values of n, so the table only needs GF2_DIM entries, regardless of - the size of the length being processed */ - for (n = 1; n < k; n++) - gf2_matrix_square(crc_comb[n], crc_comb[n - 1]); -} - -static void write_table(const uint32_t *table, int k) { - int n; - - for (n = 0; n < k; n++) - printf("%s0x%08" PRIx32 "%s", n % 5 ? "" : " ", - (uint32_t)(table[n]), - n == k - 1 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} - -static void print_crc_table(void) { - int k; - printf("#ifndef CRC32_TBL_H_\n"); - printf("#define CRC32_TBL_H_\n\n"); - printf("/* crc32_tbl.h -- tables for rapid CRC calculation\n"); - printf(" * Generated automatically by makecrct.c\n */\n\n"); - - /* print CRC table */ - printf("static const uint32_t "); - printf("crc_table[8][256] =\n{\n {\n"); - write_table(crc_table[0], 256); - for (k = 1; k < 8; k++) { - printf(" },\n {\n"); - write_table(crc_table[k], 256); - } - printf(" }\n};\n\n"); - - printf("#endif /* CRC32_TBL_H_ */\n"); -} - -static void print_crc_combine_table(void) { - int k; - printf("#ifndef CRC32_COMB_TBL_H_\n"); - printf("#define CRC32_COMB_TBL_H_\n\n"); - printf("/* crc32_comb_tbl.h -- zero operators table for CRC combine\n"); - printf(" * Generated automatically by makecrct.c\n */\n\n"); - - /* print zero operator table */ - printf("static const uint32_t "); - printf("crc_comb[%d][%d] =\n{\n {\n", GF2_DIM, GF2_DIM); - write_table(crc_comb[0], GF2_DIM); - for (k = 1; k < GF2_DIM; k++) { - printf(" },\n {\n"); - write_table(crc_comb[k], GF2_DIM); - } - printf(" }\n};\n\n"); - - printf("#endif /* CRC32_COMB_TBL_H_ */\n"); -} - -// The output of this application can be piped out to recreate crc32.h -int main(int argc, char *argv[]) { - if (argc > 1 && strcmp(argv[1], "-c") == 0) { - make_crc_combine_table(); - print_crc_combine_table(); - } else { - make_crc_table(); - print_crc_table(); - } - return 0; -} diff --git a/libs/zlibng/tools/makefixed.c b/libs/zlibng/tools/makefixed.c deleted file mode 100644 index 7fe71e75e..000000000 --- a/libs/zlibng/tools/makefixed.c +++ /dev/null @@ -1,89 +0,0 @@ -#include -#include "zbuild.h" -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" - -// Build and return state with length and distance decoding tables and index sizes set to fixed code decoding. -void Z_INTERNAL buildfixedtables(struct inflate_state *state) { - static code *lenfix, *distfix; - static code fixed[544]; - - // build fixed huffman tables - unsigned sym, bits; - static code *next; - - // literal/length table - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - zng_inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - // distance table - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - zng_inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - - -// Create fixed tables on the fly and write out a inffixed_tbl.h file that is #include'd above. -// makefixed() writes those tables to stdout, which would be piped to inffixed_tbl.h. -void makefixed(void) { - unsigned low, size; - struct inflate_state state; - - memset(&state, 0, sizeof(state)); - buildfixedtables(&state); - puts("/* inffixed_tbl.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts("/* WARNING: this file should *not* be used by applications."); - puts(" * It is part of the implementation of this library and is"); - puts(" * subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf("static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) - printf("\n "); - printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, - state.lencode[low].bits, state.lencode[low].val); - if (++low == size) - break; - putchar(','); - } - puts("\n};"); - size = 1U << 5; - printf("\nstatic const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) - printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, state.distcode[low].val); - if (++low == size) - break; - putchar(','); - } - puts("\n};"); -} - -// The output of this application can be piped out to recreate inffixed_tbl.h -int main(void) { - makefixed(); - return 0; -} diff --git a/libs/zlibng/tools/maketrees.c b/libs/zlibng/tools/maketrees.c deleted file mode 100644 index 337f2fc07..000000000 --- a/libs/zlibng/tools/maketrees.c +++ /dev/null @@ -1,147 +0,0 @@ -/* maketrees.c -- output static huffman trees - * Copyright (C) 1995-2017 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include -#include "zbuild.h" -#include "deflate.h" -#include "trees.h" - -static ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see zng_tr_init). - */ - -static ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use 5 bits.) - */ - -static unsigned char dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances 3 .. 258, - * the last 256 values correspond to the top 8 bits of the 15 bit distances. - */ - -static unsigned char length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -static int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -static int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - - -static void tr_static_init(void) { - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - uint16_t bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - length_code[length++] = (unsigned char)code; - } - } - Assert(length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented in two different - * ways: code 284 + 5 bits or code 285, so we overwrite length_code[255] to use the best encoding: - */ - length_code[length-1] = (unsigned char)code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - dist_code[dist++] = (unsigned char)code; - } - } - Assert(dist == 256, "tr_static_init: dist != 256"); - dist >>= 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++) { - dist_code[256 + dist++] = (unsigned char)code; - } - } - 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; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the tree construction - * to get a canonical Huffman tree (longest code all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = (uint16_t)bi_reverse((unsigned)n, 5); - } -} - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -static void gen_trees_header() { - int i; - - printf("#ifndef TREES_TBL_H_\n"); - printf("#define TREES_TBL_H_\n\n"); - - printf("/* header created automatically with maketrees.c */\n\n"); - - printf("Z_INTERNAL const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - printf("{{%3u},{%u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - printf("Z_INTERNAL const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - printf("{{%2u},{%u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - printf("const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - printf("%2u%s", dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - printf("const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - printf("%2u%s", length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - printf("Z_INTERNAL const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - printf("%d%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - printf("Z_INTERNAL const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - printf("%5d%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10)); - } - - printf("#endif /* TREES_TBL_H_ */\n"); -} - -// The output of this application can be piped out to recreate trees.h -int main(void) { - tr_static_init(); - gen_trees_header(); - return 0; -} diff --git a/libs/zlibng/trees.c b/libs/zlibng/trees.c deleted file mode 100644 index efd4d49fb..000000000 --- a/libs/zlibng/trees.c +++ /dev/null @@ -1,822 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2017 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 - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -#include "zbuild.h" -#include "deflate.h" -#include "trees.h" -#include "trees_emit.h" -#include "trees_tbl.h" - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const int *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - unsigned int max_length; /* max bit length for the codes */ -}; - -static const static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -static const static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -static const static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -static void init_block (deflate_state *s); -static void pqdownheap (deflate_state *s, ct_data *tree, int k); -static void gen_bitlen (deflate_state *s, tree_desc *desc); -static void build_tree (deflate_state *s, tree_desc *desc); -static void scan_tree (deflate_state *s, ct_data *tree, int max_code); -static void send_tree (deflate_state *s, ct_data *tree, int max_code); -static int build_bl_tree (deflate_state *s); -static void send_all_trees (deflate_state *s, int lcodes, int dcodes, int blcodes); -static void compress_block (deflate_state *s, const ct_data *ltree, const ct_data *dtree); -static int detect_data_type (deflate_state *s); -static void bi_flush (deflate_state *s); - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void Z_INTERNAL zng_tr_init(deflate_state *s) { - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef ZLIB_DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -static void init_block(deflate_state *s) { - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) - s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) - s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) - s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->sym_next = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -static void pqdownheap(deflate_state *s, ct_data *tree, int k) { - /* tree: the tree to restore */ - /* k: node to move down */ - int v = s->heap[k]; - int j = k << 1; /* left son of 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)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) - break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -static void gen_bitlen(deflate_state *s, tree_desc *desc) { - /* desc: the tree descriptor */ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const int *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - unsigned int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - unsigned int bits; /* bit length */ - int xbits; /* extra bits */ - uint16_t f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) - s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max + 1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1u; - if (bits > max_length){ - bits = max_length; - overflow++; - } - tree[n].Len = (uint16_t)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) /* not a leaf node */ - continue; - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) - xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (unsigned long)f * (unsigned int)(bits + xbits); - if (stree) - s->static_len += (unsigned long)f * (unsigned int)(stree[n].Len + xbits); - } - if (overflow == 0) - return; - - Tracev((stderr, "\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - 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] += 2u; /* 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] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) - continue; - if (tree[m].Len != bits) { - Tracev((stderr, "code %d bits %d->%u\n", m, tree[m].Len, bits)); - s->opt_len += (unsigned long)(bits * tree[m].Freq); - s->opt_len -= (unsigned long)(tree[m].Len * tree[m].Freq); - tree[m].Len = (uint16_t)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -Z_INTERNAL void gen_codes(ct_data *tree, int max_code, uint16_t *bl_count) { - /* tree: the tree to decorate */ - /* max_code: largest code with non zero frequency */ - /* bl_count: number of codes at each bit length */ - uint16_t next_code[MAX_BITS+1]; /* next code value for each bit length */ - unsigned int code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; - next_code[bits] = (uint16_t)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 << MAX_BITS)-1, "inconsistent bit counts"); - Tracev((stderr, "\ngen_codes: max_code %d ", max_code)); - - for (n = 0; n <= max_code; n++) { - int len = tree[n].Len; - if (len == 0) - continue; - /* Now reverse the bits */ - tree[n].Code = (uint16_t)bi_reverse(next_code[len]++, len); - - Tracecv(tree != static_ltree, (stderr, "\nn %3d %c l %2d c %4x (%x) ", - n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); - } -} - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -static void build_tree(deflate_state *s, tree_desc *desc) { - /* desc: the tree descriptor */ - ct_data *tree = desc->dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0; - s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; - if (stree) - s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* 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); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (unsigned char)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (uint16_t)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr, "\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -static void scan_tree(deflate_state *s, ct_data *tree, int max_code) { - /* tree: the tree to be scanned */ - /* max_code: and its largest code of non zero frequency */ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - uint16_t count = 0; /* repeat count of the current code */ - uint16_t max_count = 7; /* max repeat count */ - uint16_t min_count = 4; /* min repeat count */ - - if (nextlen == 0) - max_count = 138, min_count = 3; - - tree[max_code+1].Len = (uint16_t)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) - s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; - prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -static void send_tree(deflate_state *s, ct_data *tree, int max_code) { - /* tree: the tree to be scanned */ - /* max_code and its largest code of non zero frequency */ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) - max_count = 138, min_count = 3; - - // Temp local variables - uint32_t bi_valid = s->bi_valid; - uint64_t bi_buf = s->bi_buf; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { - send_code(s, curlen, s->bl_tree, bi_buf, bi_valid); - } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree, bi_buf, bi_valid); - count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree, bi_buf, bi_valid); - send_bits(s, count-3, 2, bi_buf, bi_valid); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree, bi_buf, bi_valid); - send_bits(s, count-3, 3, bi_buf, bi_valid); - - } else { - send_code(s, REPZ_11_138, s->bl_tree, bi_buf, bi_valid); - send_bits(s, count-11, 7, bi_buf, bi_valid); - } - count = 0; - prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } - - // Store back temp variables - s->bi_buf = bi_buf; - s->bi_valid = bi_valid; -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -static int build_bl_tree(deflate_state *s) { - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* 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. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - 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*((unsigned long)max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %lu, stat %lu", s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes) { - int rank; /* index in bl_order */ - - Assert(lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert(lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); - - // Temp local variables - uint32_t bi_valid = s->bi_valid; - uint64_t bi_buf = s->bi_buf; - - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5, bi_buf, bi_valid); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5, bi_buf, bi_valid); - send_bits(s, blcodes-4, 4, bi_buf, bi_valid); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2u ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3, bi_buf, bi_valid); - } - Tracev((stderr, "\nbl tree: sent %lu", s->bits_sent)); - - // Store back temp variables - s->bi_buf = bi_buf; - s->bi_valid = bi_valid; - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %lu", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %lu", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void Z_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last) { - /* buf: input block */ - /* stored_len: length of input block */ - /* last: one if this is the last block for a file */ - zng_tr_emit_tree(s, STORED_BLOCK, last); /* send block type */ - zng_tr_emit_align(s); /* align on byte boundary */ - cmpr_bits_align(s); - put_short(s, (uint16_t)stored_len); - put_short(s, (uint16_t)~stored_len); - cmpr_bits_add(s, 32); - sent_bits_add(s, 32); - if (stored_len) { - memcpy(s->pending_buf + s->pending, (unsigned char *)buf, stored_len); - s->pending += stored_len; - cmpr_bits_add(s, stored_len << 3); - sent_bits_add(s, stored_len << 3); - } -} - -/* =========================================================================== - * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) - */ -void Z_INTERNAL zng_tr_flush_bits(deflate_state *s) { - bi_flush(s); -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -void Z_INTERNAL zng_tr_align(deflate_state *s) { - zng_tr_emit_tree(s, STATIC_TREES, 0); - zng_tr_emit_end_block(s, static_ltree, 0); - bi_flush(s); -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and write out the encoded block. - */ -void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last) { - /* buf: input block, or NULL if too old */ - /* stored_len: length of input block */ - /* last: one if this is the last block for a file */ - unsigned long opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (UNLIKELY(s->sym_next == 0)) { - /* Emit an empty static tree block with no codes */ - opt_lenb = static_lenb = 0; - s->static_len = 7; - } else if (s->level > 0) { - /* Check if the file is binary or text */ - if (s->strm->data_type == Z_UNKNOWN) - s->strm->data_type = detect_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %lu, stat %lu", s->opt_len, s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %lu, stat %lu", s->opt_len, s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - 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; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %u lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->sym_next / 3)); - - if (static_lenb <= opt_lenb) - opt_lenb = static_lenb; - - } else { - Assert(buf != NULL, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if (stored_len+4 <= opt_lenb && buf != NULL) { - /* 4: two words for the lengths - * The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - zng_tr_stored_block(s, buf, stored_len, last); - - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { - zng_tr_emit_tree(s, STATIC_TREES, last); - compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); - cmpr_bits_add(s, s->static_len); - } else { - zng_tr_emit_tree(s, DYN_TREES, last); - 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); - cmpr_bits_add(s, s->opt_len); - } - Assert(s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and unsigned long implemented on 32 bits. - */ - init_block(s); - - if (last) { - zng_tr_emit_align(s); - } - Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*last)); -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) { - /* ltree: literal tree */ - /* dtree: distance tree */ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ - - 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) { - zng_emit_lit(s, ltree, lc); - } else { - zng_emit_dist(s, ltree, dtree, lc, dist); - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and sym_buf is ok: */ - Assert(s->pending < s->lit_bufsize + sx, "pending_buf overflow"); - } while (sx < s->sym_next); - } - - zng_emit_end_block(s, ltree, 0); -} - -/* =========================================================================== - * 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). - * b) There is at least one printable character belonging to the - * "white 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: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -static int detect_data_type(deflate_state *s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - unsigned long black_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)) - return Z_BINARY; - - /* Check for textual ("white-listed") bytes. */ - if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 || s->dyn_ltree[13].Freq != 0) - return Z_TEXT; - for (n = 32; n < LITERALS; n++) - if (s->dyn_ltree[n].Freq != 0) - return Z_TEXT; - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -static void bi_flush(deflate_state *s) { - if (s->bi_valid == 64) { - put_uint64(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else { - if (s->bi_valid >= 32) { - put_uint32(s, (uint32_t)s->bi_buf); - s->bi_buf >>= 32; - s->bi_valid -= 32; - } - if (s->bi_valid >= 16) { - put_short(s, (uint16_t)s->bi_buf); - s->bi_buf >>= 16; - s->bi_valid -= 16; - } - if (s->bi_valid >= 8) { - put_byte(s, s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } - } -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -Z_INTERNAL unsigned bi_reverse(unsigned code, int len) { - /* code: the value to invert */ - /* len: its bit length */ - Z_REGISTER unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} diff --git a/libs/zlibng/trees.h b/libs/zlibng/trees.h deleted file mode 100644 index e57f92648..000000000 --- a/libs/zlibng/trees.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef TREES_H_ -#define TREES_H_ - -/* Constants */ - -#define DIST_CODE_LEN 512 -/* see definition of array dist_code in trees.c */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -static const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -static const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -static const int extra_blbits[BL_CODES] /* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -static const unsigned char bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; - /* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - - -/* Function definitions */ -void gen_codes (ct_data *tree, int max_code, uint16_t *bl_count); - -#endif diff --git a/libs/zlibng/trees_emit.h b/libs/zlibng/trees_emit.h deleted file mode 100644 index 118dbb2d8..000000000 --- a/libs/zlibng/trees_emit.h +++ /dev/null @@ -1,228 +0,0 @@ -#ifndef TREES_EMIT_H_ -#define TREES_EMIT_H_ - -#include "zbuild.h" -#include "trees.h" - -#ifdef ZLIB_DEBUG -# include -# include -# include -#endif - - -/* trees.h */ -extern Z_INTERNAL const ct_data static_ltree[L_CODES+2]; -extern Z_INTERNAL const ct_data static_dtree[D_CODES]; - -extern const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN]; -extern const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1]; - -extern Z_INTERNAL const int base_length[LENGTH_CODES]; -extern Z_INTERNAL const int base_dist[D_CODES]; - -/* Bit buffer and deflate code stderr tracing */ -#ifdef ZLIB_DEBUG -# define send_bits_trace(s, value, length) { \ - Tracevv((stderr, " l %2d v %4llx ", (int)(length), (long long)(value))); \ - Assert(length > 0 && length <= BIT_BUF_SIZE, "invalid length"); \ - } -# define send_code_trace(s, c) \ - if (z_verbose > 2) { \ - fprintf(stderr, "\ncd %3d ", (c)); \ - } -#else -# define send_bits_trace(s, value, length) -# define send_code_trace(s, c) -#endif - -/* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (64 - bi_valid) bits from value, leaving (width - (64-bi_valid)) - * unused bits in value. - */ -#define send_bits(s, t_val, t_len, bi_buf, bi_valid) {\ - uint64_t val = (uint64_t)t_val;\ - uint32_t len = (uint32_t)t_len;\ - uint32_t total_bits = bi_valid + len;\ - send_bits_trace(s, val, len);\ - sent_bits_add(s, len);\ - if (total_bits < BIT_BUF_SIZE) {\ - bi_buf |= val << bi_valid;\ - bi_valid = total_bits;\ - } else if (bi_valid == BIT_BUF_SIZE) {\ - put_uint64(s, bi_buf);\ - bi_buf = val;\ - bi_valid = len;\ - } else {\ - bi_buf |= val << bi_valid;\ - put_uint64(s, bi_buf);\ - bi_buf = val >> (BIT_BUF_SIZE - bi_valid);\ - bi_valid = total_bits - BIT_BUF_SIZE;\ - }\ -} - -/* Send a code of the given tree. c and tree must not have side effects */ -#ifdef ZLIB_DEBUG -# define send_code(s, c, tree, bi_buf, bi_valid) { \ - send_code_trace(s, c); \ - send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid); \ -} -#else -# define send_code(s, c, tree, bi_buf, bi_valid) \ - send_bits(s, tree[c].Code, tree[c].Len, bi_buf, bi_valid) -#endif - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -static void bi_windup(deflate_state *s) { - if (s->bi_valid > 56) { - put_uint64(s, s->bi_buf); - } else { - if (s->bi_valid > 24) { - put_uint32(s, (uint32_t)s->bi_buf); - s->bi_buf >>= 32; - s->bi_valid -= 32; - } - if (s->bi_valid > 8) { - put_short(s, (uint16_t)s->bi_buf); - s->bi_buf >>= 16; - s->bi_valid -= 16; - } - if (s->bi_valid > 0) { - put_byte(s, s->bi_buf); - } - } - s->bi_buf = 0; - s->bi_valid = 0; -} - -/* =========================================================================== - * Emit literal code - */ -static inline uint32_t zng_emit_lit(deflate_state *s, const ct_data *ltree, unsigned c) { - uint32_t bi_valid = s->bi_valid; - uint64_t bi_buf = s->bi_buf; - - send_code(s, c, ltree, bi_buf, bi_valid); - - s->bi_valid = bi_valid; - s->bi_buf = bi_buf; - - Tracecv(isgraph(c), (stderr, " '%c' ", c)); - - return ltree[c].Len; -} - -/* =========================================================================== - * Emit match distance/length code - */ -static inline uint32_t zng_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree, - uint32_t lc, uint32_t dist) { - uint32_t c, extra; - uint8_t code; - uint64_t match_bits; - uint32_t match_bits_len; - uint32_t bi_valid = s->bi_valid; - uint64_t bi_buf = s->bi_buf; - - /* Send the length code, len is the match length - MIN_MATCH */ - code = zng_length_code[lc]; - c = code+LITERALS+1; - Assert(c < L_CODES, "bad l_code"); - send_code_trace(s, c); - - match_bits = ltree[c].Code; - match_bits_len = ltree[c].Len; - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - match_bits |= ((uint64_t)lc << match_bits_len); - match_bits_len += extra; - } - - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert(code < D_CODES, "bad d_code"); - send_code_trace(s, code); - - /* Send the distance code */ - match_bits |= ((uint64_t)dtree[code].Code << match_bits_len); - match_bits_len += dtree[code].Len; - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - match_bits |= ((uint64_t)dist << match_bits_len); - match_bits_len += extra; - } - - send_bits(s, match_bits, match_bits_len, bi_buf, bi_valid); - - s->bi_valid = bi_valid; - s->bi_buf = bi_buf; - - return match_bits_len; -} - -/* =========================================================================== - * Emit end block - */ -static inline void zng_emit_end_block(deflate_state *s, const ct_data *ltree, const int last) { - uint32_t bi_valid = s->bi_valid; - uint64_t bi_buf = s->bi_buf; - send_code(s, END_BLOCK, ltree, bi_buf, bi_valid); - s->bi_valid = bi_valid; - s->bi_buf = bi_buf; - Tracev((stderr, "\n+++ Emit End Block: Last: %u Pending: %u Total Out: %" PRIu64 "\n", - last, s->pending, (uint64_t)s->strm->total_out)); - (void)last; -} - -/* =========================================================================== - * Emit literal and count bits - */ -static inline void zng_tr_emit_lit(deflate_state *s, const ct_data *ltree, unsigned c) { - cmpr_bits_add(s, zng_emit_lit(s, ltree, c)); -} - -/* =========================================================================== - * Emit match and count bits - */ -static inline void zng_tr_emit_dist(deflate_state *s, const ct_data *ltree, const ct_data *dtree, - uint32_t lc, uint32_t dist) { - cmpr_bits_add(s, zng_emit_dist(s, ltree, dtree, lc, dist)); -} - -/* =========================================================================== - * Emit start of block - */ -static inline void zng_tr_emit_tree(deflate_state *s, int type, const int last) { - uint32_t bi_valid = s->bi_valid; - uint64_t bi_buf = s->bi_buf; - uint32_t header_bits = (type << 1) + last; - send_bits(s, header_bits, 3, bi_buf, bi_valid); - cmpr_bits_add(s, 3); - s->bi_valid = bi_valid; - s->bi_buf = bi_buf; - Tracev((stderr, "\n--- Emit Tree: Last: %u\n", last)); -} - -/* =========================================================================== - * Align bit buffer on a byte boundary and count bits - */ -static inline void zng_tr_emit_align(deflate_state *s) { - bi_windup(s); /* align on byte boundary */ - sent_bits_align(s); -} - -/* =========================================================================== - * Emit an end block and align bit buffer if last block - */ -static inline void zng_tr_emit_end_block(deflate_state *s, const ct_data *ltree, const int last) { - zng_emit_end_block(s, ltree, last); - cmpr_bits_add(s, 7); - if (last) - zng_tr_emit_align(s); -} - -#endif diff --git a/libs/zlibng/trees_tbl.h b/libs/zlibng/trees_tbl.h deleted file mode 100644 index a4c68a566..000000000 --- a/libs/zlibng/trees_tbl.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef TREES_TBL_H_ -#define TREES_TBL_H_ - -/* header created automatically with maketrees.c */ - -Z_INTERNAL const ct_data static_ltree[L_CODES+2] = { -{{ 12},{8}}, {{140},{8}}, {{ 76},{8}}, {{204},{8}}, {{ 44},{8}}, -{{172},{8}}, {{108},{8}}, {{236},{8}}, {{ 28},{8}}, {{156},{8}}, -{{ 92},{8}}, {{220},{8}}, {{ 60},{8}}, {{188},{8}}, {{124},{8}}, -{{252},{8}}, {{ 2},{8}}, {{130},{8}}, {{ 66},{8}}, {{194},{8}}, -{{ 34},{8}}, {{162},{8}}, {{ 98},{8}}, {{226},{8}}, {{ 18},{8}}, -{{146},{8}}, {{ 82},{8}}, {{210},{8}}, {{ 50},{8}}, {{178},{8}}, -{{114},{8}}, {{242},{8}}, {{ 10},{8}}, {{138},{8}}, {{ 74},{8}}, -{{202},{8}}, {{ 42},{8}}, {{170},{8}}, {{106},{8}}, {{234},{8}}, -{{ 26},{8}}, {{154},{8}}, {{ 90},{8}}, {{218},{8}}, {{ 58},{8}}, -{{186},{8}}, {{122},{8}}, {{250},{8}}, {{ 6},{8}}, {{134},{8}}, -{{ 70},{8}}, {{198},{8}}, {{ 38},{8}}, {{166},{8}}, {{102},{8}}, -{{230},{8}}, {{ 22},{8}}, {{150},{8}}, {{ 86},{8}}, {{214},{8}}, -{{ 54},{8}}, {{182},{8}}, {{118},{8}}, {{246},{8}}, {{ 14},{8}}, -{{142},{8}}, {{ 78},{8}}, {{206},{8}}, {{ 46},{8}}, {{174},{8}}, -{{110},{8}}, {{238},{8}}, {{ 30},{8}}, {{158},{8}}, {{ 94},{8}}, -{{222},{8}}, {{ 62},{8}}, {{190},{8}}, {{126},{8}}, {{254},{8}}, -{{ 1},{8}}, {{129},{8}}, {{ 65},{8}}, {{193},{8}}, {{ 33},{8}}, -{{161},{8}}, {{ 97},{8}}, {{225},{8}}, {{ 17},{8}}, {{145},{8}}, -{{ 81},{8}}, {{209},{8}}, {{ 49},{8}}, {{177},{8}}, {{113},{8}}, -{{241},{8}}, {{ 9},{8}}, {{137},{8}}, {{ 73},{8}}, {{201},{8}}, -{{ 41},{8}}, {{169},{8}}, {{105},{8}}, {{233},{8}}, {{ 25},{8}}, -{{153},{8}}, {{ 89},{8}}, {{217},{8}}, {{ 57},{8}}, {{185},{8}}, -{{121},{8}}, {{249},{8}}, {{ 5},{8}}, {{133},{8}}, {{ 69},{8}}, -{{197},{8}}, {{ 37},{8}}, {{165},{8}}, {{101},{8}}, {{229},{8}}, -{{ 21},{8}}, {{149},{8}}, {{ 85},{8}}, {{213},{8}}, {{ 53},{8}}, -{{181},{8}}, {{117},{8}}, {{245},{8}}, {{ 13},{8}}, {{141},{8}}, -{{ 77},{8}}, {{205},{8}}, {{ 45},{8}}, {{173},{8}}, {{109},{8}}, -{{237},{8}}, {{ 29},{8}}, {{157},{8}}, {{ 93},{8}}, {{221},{8}}, -{{ 61},{8}}, {{189},{8}}, {{125},{8}}, {{253},{8}}, {{ 19},{9}}, -{{275},{9}}, {{147},{9}}, {{403},{9}}, {{ 83},{9}}, {{339},{9}}, -{{211},{9}}, {{467},{9}}, {{ 51},{9}}, {{307},{9}}, {{179},{9}}, -{{435},{9}}, {{115},{9}}, {{371},{9}}, {{243},{9}}, {{499},{9}}, -{{ 11},{9}}, {{267},{9}}, {{139},{9}}, {{395},{9}}, {{ 75},{9}}, -{{331},{9}}, {{203},{9}}, {{459},{9}}, {{ 43},{9}}, {{299},{9}}, -{{171},{9}}, {{427},{9}}, {{107},{9}}, {{363},{9}}, {{235},{9}}, -{{491},{9}}, {{ 27},{9}}, {{283},{9}}, {{155},{9}}, {{411},{9}}, -{{ 91},{9}}, {{347},{9}}, {{219},{9}}, {{475},{9}}, {{ 59},{9}}, -{{315},{9}}, {{187},{9}}, {{443},{9}}, {{123},{9}}, {{379},{9}}, -{{251},{9}}, {{507},{9}}, {{ 7},{9}}, {{263},{9}}, {{135},{9}}, -{{391},{9}}, {{ 71},{9}}, {{327},{9}}, {{199},{9}}, {{455},{9}}, -{{ 39},{9}}, {{295},{9}}, {{167},{9}}, {{423},{9}}, {{103},{9}}, -{{359},{9}}, {{231},{9}}, {{487},{9}}, {{ 23},{9}}, {{279},{9}}, -{{151},{9}}, {{407},{9}}, {{ 87},{9}}, {{343},{9}}, {{215},{9}}, -{{471},{9}}, {{ 55},{9}}, {{311},{9}}, {{183},{9}}, {{439},{9}}, -{{119},{9}}, {{375},{9}}, {{247},{9}}, {{503},{9}}, {{ 15},{9}}, -{{271},{9}}, {{143},{9}}, {{399},{9}}, {{ 79},{9}}, {{335},{9}}, -{{207},{9}}, {{463},{9}}, {{ 47},{9}}, {{303},{9}}, {{175},{9}}, -{{431},{9}}, {{111},{9}}, {{367},{9}}, {{239},{9}}, {{495},{9}}, -{{ 31},{9}}, {{287},{9}}, {{159},{9}}, {{415},{9}}, {{ 95},{9}}, -{{351},{9}}, {{223},{9}}, {{479},{9}}, {{ 63},{9}}, {{319},{9}}, -{{191},{9}}, {{447},{9}}, {{127},{9}}, {{383},{9}}, {{255},{9}}, -{{511},{9}}, {{ 0},{7}}, {{ 64},{7}}, {{ 32},{7}}, {{ 96},{7}}, -{{ 16},{7}}, {{ 80},{7}}, {{ 48},{7}}, {{112},{7}}, {{ 8},{7}}, -{{ 72},{7}}, {{ 40},{7}}, {{104},{7}}, {{ 24},{7}}, {{ 88},{7}}, -{{ 56},{7}}, {{120},{7}}, {{ 4},{7}}, {{ 68},{7}}, {{ 36},{7}}, -{{100},{7}}, {{ 20},{7}}, {{ 84},{7}}, {{ 52},{7}}, {{116},{7}}, -{{ 3},{8}}, {{131},{8}}, {{ 67},{8}}, {{195},{8}}, {{ 35},{8}}, -{{163},{8}}, {{ 99},{8}}, {{227},{8}} -}; - -Z_INTERNAL const ct_data static_dtree[D_CODES] = { -{{ 0},{5}}, {{16},{5}}, {{ 8},{5}}, {{24},{5}}, {{ 4},{5}}, -{{20},{5}}, {{12},{5}}, {{28},{5}}, {{ 2},{5}}, {{18},{5}}, -{{10},{5}}, {{26},{5}}, {{ 6},{5}}, {{22},{5}}, {{14},{5}}, -{{30},{5}}, {{ 1},{5}}, {{17},{5}}, {{ 9},{5}}, {{25},{5}}, -{{ 5},{5}}, {{21},{5}}, {{13},{5}}, {{29},{5}}, {{ 3},{5}}, -{{19},{5}}, {{11},{5}}, {{27},{5}}, {{ 7},{5}}, {{23},{5}} -}; - -const unsigned char Z_INTERNAL zng_dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const unsigned char Z_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -Z_INTERNAL const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -Z_INTERNAL const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - -#endif /* TREES_TBL_H_ */ diff --git a/libs/zlibng/uncompr.c b/libs/zlibng/uncompr.c deleted file mode 100644 index 1435fab97..000000000 --- a/libs/zlibng/uncompr.c +++ /dev/null @@ -1,85 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#define Z_INTERNAL -#include "zbuild.h" -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. *sourceLen is - the byte length of the source buffer. Upon entry, *destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, - *destLen is the size of the decompressed data and *sourceLen is the number - of source bytes consumed. Upon return, source + *sourceLen points to the - first unused input byte. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, or - Z_DATA_ERROR if the input data was corrupted, including if the input data is - an incomplete zlib stream. -*/ -int Z_EXPORT PREFIX(uncompress2)(unsigned char *dest, z_size_t *destLen, const unsigned char *source, z_size_t *sourceLen) { - PREFIX3(stream) stream; - int err; - const unsigned int max = (unsigned int)-1; - z_size_t len, left; - unsigned char buf[1]; /* for detection of incomplete stream when *destLen == 0 */ - - len = *sourceLen; - if (*destLen) { - left = *destLen; - *destLen = 0; - } else { - left = 1; - dest = buf; - } - - stream.next_in = (z_const unsigned char *)source; - stream.avail_in = 0; - stream.zalloc = NULL; - stream.zfree = NULL; - stream.opaque = NULL; - - err = PREFIX(inflateInit)(&stream); - if (err != Z_OK) return err; - - stream.next_out = dest; - stream.avail_out = 0; - - do { - if (stream.avail_out == 0) { - stream.avail_out = left > (unsigned long)max ? max : (unsigned int)left; - left -= stream.avail_out; - } - if (stream.avail_in == 0) { - stream.avail_in = len > (unsigned long)max ? max : (unsigned int)len; - len -= stream.avail_in; - } - err = PREFIX(inflate)(&stream, Z_NO_FLUSH); - } while (err == Z_OK); - - *sourceLen -= len + stream.avail_in; - if (dest != buf) - *destLen = (z_size_t)stream.total_out; - else if (stream.total_out && err == Z_BUF_ERROR) - left = 1; - - PREFIX(inflateEnd)(&stream); - return err == Z_STREAM_END ? Z_OK : - err == Z_NEED_DICT ? Z_DATA_ERROR : - err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : - err; -} - -int Z_EXPORT PREFIX(uncompress)(unsigned char *dest, z_size_t *destLen, const unsigned char *source, z_size_t sourceLen) { - return PREFIX(uncompress2)(dest, destLen, source, &sourceLen); -} diff --git a/libs/zlibng/win32/DLL_FAQ.txt b/libs/zlibng/win32/DLL_FAQ.txt deleted file mode 100644 index c21298596..000000000 --- a/libs/zlibng/win32/DLL_FAQ.txt +++ /dev/null @@ -1,397 +0,0 @@ - - Frequently Asked Questions about ZLIB1.DLL - - -This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have -general questions about zlib, you should see the file "FAQ" found -in the zlib distribution, or at the following location: - http://www.gzip.org/zlib/zlib_faq.html - - - 1. What is ZLIB1.DLL, and how can I get it? - - - ZLIB1.DLL is the official build of zlib as a DLL. - (Please remark the character '1' in the name.) - - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - http://www.zlib.net/ - - Applications that link to ZLIB1.DLL can rely on the following - specification: - - * The exported symbols are exclusively defined in the source - files "zlib.h" and "zlib.def", found in an official zlib - source distribution. - * The symbols are exported by name, not by ordinal. - * The exported names are undecorated. - * The calling convention of functions is "C" (CDECL). - * The ZLIB1.DLL binary is linked to MSVCRT.DLL. - - The archive in which ZLIB1.DLL is bundled contains compiled - test programs that must run with a valid build of ZLIB1.DLL. - It is recommended to download the prebuilt DLL from the zlib - web site, instead of building it yourself, to avoid potential - incompatibilities that could be introduced by your compiler - and build settings. If you do build the DLL yourself, please - make sure that it complies with all the above requirements, - and it runs with the precompiled test programs, bundled with - the original ZLIB1.DLL distribution. - - If, for any reason, you need to build an incompatible DLL, - please use a different file name. - - - 2. Why did you change the name of the DLL to ZLIB1.DLL? - What happened to the old ZLIB.DLL? - - - The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required - compilation settings that were incompatible to those used by - a static build. The DLL settings were supposed to be enabled - by defining the macro ZLIB_DLL, before including "zlib.h". - Incorrect handling of this macro was silently accepted at - build time, resulting in two major problems: - - * ZLIB_DLL was missing from the old makefile. When building - the DLL, not all people added it to the build options. In - consequence, incompatible incarnations of ZLIB.DLL started - to circulate around the net. - - * When switching from using the static library to using the - DLL, applications had to define the ZLIB_DLL macro and - to recompile all the sources that contained calls to zlib - functions. Failure to do so resulted in creating binaries - that were unable to run with the official ZLIB.DLL build. - - The only possible solution that we could foresee was to make - a binary-incompatible change in the DLL interface, in order to - remove the dependency on the ZLIB_DLL macro, and to release - the new DLL under a different name. - - We chose the name ZLIB1.DLL, where '1' indicates the major - zlib version number. We hope that we will not have to break - the binary compatibility again, at least not as long as the - zlib-1.x series will last. - - There is still a ZLIB_DLL macro, that can trigger a more - efficient build and use of the DLL, but compatibility no - longer dependents on it. - - - 3. Can I build ZLIB.DLL from the new zlib sources, and replace - an old ZLIB.DLL, that was built from zlib-1.1.4 or earlier? - - - In principle, you can do it by assigning calling convention - keywords to the macros Z_EXPORT and Z_EXPORTVA. In practice, - it depends on what you mean by "an old ZLIB.DLL", because the - old DLL exists in several mutually-incompatible versions. - You have to find out first what kind of calling convention is - being used in your particular ZLIB.DLL build, and to use the - same one in the new build. If you don't know what this is all - about, you might be better off if you would just leave the old - DLL intact. - - - 4. Can I compile my application using the new zlib interface, and - link it to an old ZLIB.DLL, that was built from zlib-1.1.4 or - earlier? - - - The official answer is "no"; the real answer depends again on - what kind of ZLIB.DLL you have. Even if you are lucky, this - course of action is unreliable. - - If you rebuild your application and you intend to use a newer - version of zlib (post- 1.1.4), it is strongly recommended to - link it to the new ZLIB1.DLL. - - - 5. Why are the zlib symbols exported by name, and not by ordinal? - - - Although exporting symbols by ordinal is a little faster, it - is risky. Any single glitch in the maintenance or use of the - DEF file that contains the ordinals can result in incompatible - builds and frustrating crashes. Simply put, the benefits of - exporting symbols by ordinal do not justify the risks. - - Technically, it should be possible to maintain ordinals in - the DEF file, and still export the symbols by name. Ordinals - exist in every DLL, and even if the dynamic linking performed - at the DLL startup is searching for names, ordinals serve as - hints, for a faster name lookup. However, if the DEF file - contains ordinals, the Microsoft linker automatically builds - an implib that will cause the executables linked to it to use - those ordinals, and not the names. It is interesting to - notice that the GNU linker for Win32 does not suffer from this - problem. - - It is possible to avoid the DEF file if the exported symbols - are accompanied by a "__declspec(dllexport)" attribute in the - source files. You can do this in zlib by predefining the - ZLIB_DLL macro. - - - 6. I see that the ZLIB1.DLL functions use the "C" (CDECL) calling - convention. Why not use the STDCALL convention? - STDCALL is the standard convention in Win32, and I need it in - my Visual Basic project! - - (For readability, we use CDECL to refer to the convention - triggered by the "__cdecl" keyword, STDCALL to refer to - the convention triggered by "__stdcall", and FASTCALL to - refer to the convention triggered by "__fastcall".) - - - Most of the native Windows API functions (without varargs) use - indeed the WINAPI convention (which translates to STDCALL in - Win32), but the standard C functions use CDECL. If a user - application is intrinsically tied to the Windows API (e.g. - it calls native Windows API functions such as CreateFile()), - sometimes it makes sense to decorate its own functions with - WINAPI. But if ANSI C or POSIX portability is a goal (e.g. - it calls standard C functions such as fopen()), it is not a - sound decision to request the inclusion of , or to - use non-ANSI constructs, for the sole purpose to make the user - functions STDCALL-able. - - The functionality offered by zlib is not in the category of - "Windows functionality", but is more like "C functionality". - - Technically, STDCALL is not bad; in fact, it is slightly - faster than CDECL, and it works with variable-argument - functions, just like CDECL. It is unfortunate that, in spite - of using STDCALL in the Windows API, it is not the default - convention used by the C compilers that run under Windows. - The roots of the problem reside deep inside the unsafety of - the K&R-style function prototypes, where the argument types - are not specified; but that is another story for another day. - - The remaining fact is that CDECL is the default convention. - Even if an explicit convention is hard-coded into the function - prototypes inside C headers, problems may appear. The - necessity to expose the convention in users' callbacks is one - of these problems. - - The calling convention issues are also important when using - zlib in other programming languages. Some of them, like Ada - (GNAT) and Fortran (GNU G77), have C bindings implemented - initially on Unix, and relying on the C calling convention. - On the other hand, the pre- .NET versions of Microsoft Visual - Basic require STDCALL, while Borland Delphi prefers, although - it does not require, FASTCALL. - - In fairness to all possible uses of zlib outside the C - programming language, we choose the default "C" convention. - Anyone interested in different bindings or conventions is - encouraged to maintain specialized projects. The "contrib/" - directory from the zlib distribution already holds a couple - of foreign bindings, such as Ada, C++, and Delphi. - - - 7. I need a DLL for my Visual Basic project. What can I do? - - - Define the ZLIB_WINAPI macro before including "zlib.h", when - building both the DLL and the user application (except that - you don't need to define anything when using the DLL in Visual - Basic). The ZLIB_WINAPI macro will switch on the WINAPI - (STDCALL) convention. The name of this DLL must be different - than the official ZLIB1.DLL. - - Gilles Vollant has contributed a build named ZLIBWAPI.DLL, - with the ZLIB_WINAPI macro turned on, and with the minizip - functionality built in. For more information, please read - the notes inside "contrib/vstudio/readme.txt", found in the - zlib distribution. - - - 8. I need to use zlib in my Microsoft .NET project. What can I - do? - - - Henrik Ravn has contributed a .NET wrapper around zlib. Look - into contrib/dotzlib/, inside the zlib distribution. - - - 9. If my application uses ZLIB1.DLL, should I link it to - MSVCRT.DLL? Why? - - - It is not required, but it is recommended to link your - application to MSVCRT.DLL, if it uses ZLIB1.DLL. - - The executables (.EXE, .DLL, etc.) that are involved in the - same process and are using the C run-time library (i.e. they - are calling standard C functions), must link to the same - library. There are several libraries in the Win32 system: - CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc. - Since ZLIB1.DLL is linked to MSVCRT.DLL, the executables that - depend on it should also be linked to MSVCRT.DLL. - - -10. Why are you saying that ZLIB1.DLL and my application should - be linked to the same C run-time (CRT) library? I linked my - application and my DLLs to different C libraries (e.g. my - application to a static library, and my DLLs to MSVCRT.DLL), - and everything works fine. - - - If a user library invokes only pure Win32 API (accessible via - and the related headers), its DLL build will work - in any context. But if this library invokes standard C API, - things get more complicated. - - There is a single Win32 library in a Win32 system. Every - function in this library resides in a single DLL module, that - is safe to call from anywhere. On the other hand, there are - multiple versions of the C library, and each of them has its - own separate internal state. Standalone executables and user - DLLs that call standard C functions must link to a C run-time - (CRT) library, be it static or shared (DLL). Intermixing - occurs when an executable (not necessarily standalone) and a - DLL are linked to different CRTs, and both are running in the - same process. - - Intermixing multiple CRTs is possible, as long as their - internal states are kept intact. The Microsoft Knowledge Base - articles KB94248 "HOWTO: Use the C Run-Time" and KB140584 - "HOWTO: Link with the Correct C Run-Time (CRT) Library" - mention the potential problems raised by intermixing. - - If intermixing works for you, it's because your application - and DLLs are avoiding the corruption of each of the CRTs' - internal states, maybe by careful design, or maybe by fortune. - - Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such - as those provided by Borland, raises similar problems. - - -11. Why are you linking ZLIB1.DLL to MSVCRT.DLL? - - - MSVCRT.DLL exists on every Windows 95 with a new service pack - installed, or with Microsoft Internet Explorer 4 or later, and - on all other Windows 4.x or later (Windows 98, Windows NT 4, - or later). It is freely distributable; if not present in the - system, it can be downloaded from Microsoft or from other - software provider for free. - - The fact that MSVCRT.DLL does not exist on a virgin Windows 95 - is not so problematic. Windows 95 is scarcely found nowadays, - Microsoft ended its support a long time ago, and many recent - applications from various vendors, including Microsoft, do not - even run on it. Furthermore, no serious user should run - Windows 95 without a proper update installed. - - -12. Why are you not linking ZLIB1.DLL to - <> ? - - - We considered and abandoned the following alternatives: - - * Linking ZLIB1.DLL to a static C library (LIBC.LIB, or - LIBCMT.LIB) is not a good option. People are using the DLL - mainly to save disk space. If you are linking your program - to a static C library, you may as well consider linking zlib - in statically, too. - - * Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because - CRTDLL.DLL is present on every Win32 installation. - Unfortunately, it has a series of problems: it does not - work properly with Microsoft's C++ libraries, it does not - provide support for 64-bit file offsets, (and so on...), - and Microsoft discontinued its support a long time ago. - - * Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied - with the Microsoft .NET platform, and Visual C++ 7.0/7.1, - raises problems related to the status of ZLIB1.DLL as a - system component. According to the Microsoft Knowledge Base - article KB326922 "INFO: Redistribution of the Shared C - Runtime Component in Visual C++ .NET", MSVCR70.DLL and - MSVCR71.DLL are not supposed to function as system DLLs, - because they may clash with MSVCRT.DLL. Instead, the - application's installer is supposed to put these DLLs - (if needed) in the application's private directory. - If ZLIB1.DLL depends on a non-system runtime, it cannot - function as a redistributable system component. - - * Linking ZLIB1.DLL to non-Microsoft runtimes, such as - Borland's, or Cygwin's, raises problems related to the - reliable presence of these runtimes on Win32 systems. - It's easier to let the DLL build of zlib up to the people - who distribute these runtimes, and who may proceed as - explained in the answer to Question 14. - - -13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL, - how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0 - (Visual Studio .NET) or newer? - - - Due to the problems explained in the Microsoft Knowledge Base - article KB326922 (see the previous answer), the C runtime that - comes with the VC7 environment is no longer considered a - system component. That is, it should not be assumed that this - runtime exists, or may be installed in a system directory. - Since ZLIB1.DLL is supposed to be a system component, it may - not depend on a non-system component. - - In order to link ZLIB1.DLL and your application to MSVCRT.DLL - in VC7, you need the library of Visual C++ 6.0 or older. If - you don't have this library at hand, it's probably best not to - use ZLIB1.DLL. - - We are hoping that, in the future, Microsoft will provide a - way to build applications linked to a proper system runtime, - from the Visual C++ environment. Until then, you have a - couple of alternatives, such as linking zlib in statically. - If your application requires dynamic linking, you may proceed - as explained in the answer to Question 14. - - -14. I need to link my own DLL build to a CRT different than - MSVCRT.DLL. What can I do? - - - Feel free to rebuild the DLL from the zlib sources, and link - it the way you want. You should, however, clearly state that - your build is unofficial. You should give it a different file - name, and/or install it in a private directory that can be - accessed by your application only, and is not visible to the - others (i.e. it's neither in the PATH, nor in the SYSTEM or - SYSTEM32 directories). Otherwise, your build may clash with - applications that link to the official build. - - For example, in Cygwin, zlib is linked to the Cygwin runtime - CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. - - -15. May I include additional pieces of code that I find useful, - link them in ZLIB1.DLL, and export them? - - - No. A legitimate build of ZLIB1.DLL must not include code - that does not originate from the official zlib source code. - But you can make your own private DLL build, under a different - file name, as suggested in the previous answer. - - For example, zlib is a part of the VCL library, distributed - with Borland Delphi and C++ Builder. The DLL build of VCL - is a redistributable file, named VCLxx.DLL. - - -16. May I remove some functionality out of ZLIB1.DLL, by enabling - macros like NO_GZCOMPRESS or NO_GZIP at compile time? - - - No. A legitimate build of ZLIB1.DLL must provide the complete - zlib functionality, as implemented in the official zlib source - code. But you can make your own private DLL build, under a - different file name, as suggested in the previous answer. - - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - -** - -This document is written and maintained by -Cosmin Truta diff --git a/libs/zlibng/win32/Makefile.a64 b/libs/zlibng/win32/Makefile.a64 deleted file mode 100644 index a2f2e6a60..000000000 --- a/libs/zlibng/win32/Makefile.a64 +++ /dev/null @@ -1,208 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.a64 (standard build) -# nmake -f win32/Makefile.a64 LOC=-DFOO (nonstandard build) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -LD = link -AR = lib -RC = rc -CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = \ - -D_CRT_SECURE_NO_DEPRECATE \ - -D_CRT_NONSTDC_NO_DEPRECATE \ - -DUNALIGNED_OK \ - -DUNALIGNED64_OK \ - -D_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \ - -DARM_FEATURES \ - # -LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest -ARFLAGS = -nologo -RCFLAGS = /dARM64 /r -DEFFILE = zlib.def -RCFILE = zlib1.rc -RESFILE = zlib1.res -WITH_GZFILEOP = yes -ZLIB_COMPAT = -SUFFIX = - -OBJS = \ - adler32.obj \ - armfeature.obj \ - chunkset.obj \ - compare258.obj \ - compress.obj \ - crc32.obj \ - crc32_comb.obj \ - deflate.obj \ - deflate_fast.obj \ - deflate_slow.obj \ - deflate_quick.obj \ - deflate_medium.obj \ - functable.obj \ - infback.obj \ - inflate.obj \ - inftrees.obj \ - inffast.obj \ - insert_string.obj \ - trees.obj \ - uncompr.obj \ - zutil.obj \ - # -!if "$(ZLIB_COMPAT)" != "" -WITH_GZFILEOP = yes -WFLAGS = $(WFLAGS) -DZLIB_COMPAT -DEFFILE = zlibcompat.def -!else -STATICLIB = zlib-ng.lib -SHAREDLIB = zlib-ng1.dll -IMPLIB = zngdll.lib -DEFFILE = zlib-ng.def -RCFILE = zlib-ng1.rc -RESFILE = zlib-ng1.res -SUFFIX = -ng -!endif - -!if "$(WITH_GZFILEOP)" != "" -WFLAGS = $(WFLAGS) -DWITH_GZFILEOP -OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj -!endif - -WFLAGS = $(WFLAGS) \ - -DARM_ACLE_CRC_HASH \ - -D__ARM_NEON__=1 \ - -DARM_NEON_ADLER32 \ - -DARM_NEON_CHUNKSET \ - -DARM_NEON_SLIDEHASH \ - -DARM_NOCHECK_NEON \ - # -OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj adler32_neon.obj chunkset_neon.obj slide_neon.obj - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -zconf: $(TOP)/zconf$(SUFFIX).h.in - $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h - -$(STATICLIB): zconf $(OBJS) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) - $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x55A4C0000 $(OBJS) $(RESFILE) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -gzlib2.obj: gzlib.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c - -gzread2.obj: gzread.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c - -gzwrite2.obj: gzwrite.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c - -{$(TOP)/arch/arm}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< - -$(TOP)/zconf$(SUFFIX).h: zconf - -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h -crc32_comb.obj: $(SRCDIR)/crc32_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/crc32_comb_tbl.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h -inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -$(RESFILE): $(TOP)/win32/$(RCFILE) - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -distclean: clean - -del zconf$(SUFFIX).h diff --git a/libs/zlibng/win32/Makefile.arm b/libs/zlibng/win32/Makefile.arm deleted file mode 100644 index 5ed53f5f3..000000000 --- a/libs/zlibng/win32/Makefile.arm +++ /dev/null @@ -1,220 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.arm (standard build) -# nmake -f win32/Makefile.arm LOC=-DFOO (nonstandard build) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -LD = link -AR = lib -RC = rc -CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = \ - -D_CRT_SECURE_NO_DEPRECATE \ - -D_CRT_NONSTDC_NO_DEPRECATE \ - -DUNALIGNED_OK \ - -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \ - -DARM_FEATURES \ - # -LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest -ARFLAGS = -nologo -RCFLAGS = /dARM /r -DEFFILE = zlib.def -RCFILE = zlib1.rc -RESFILE = zlib1.res -WITH_GZFILEOP = yes -ZLIB_COMPAT = -WITH_ACLE = -WITH_NEON = -WITH_VFPV3 = -NEON_ARCH = /arch:VFPv4 -SUFFIX = - -OBJS = \ - adler32.obj \ - armfeature.obj \ - chunkset.obj \ - compare258.obj \ - compress.obj \ - crc32.obj \ - crc32_comb.obj \ - deflate.obj \ - deflate_fast.obj \ - deflate_slow.obj \ - deflate_quick.obj \ - deflate_medium.obj \ - functable.obj \ - infback.obj \ - inflate.obj \ - inftrees.obj \ - inffast.obj \ - insert_string.obj \ - trees.obj \ - uncompr.obj \ - zutil.obj \ - # -!if "$(ZLIB_COMPAT)" != "" -WITH_GZFILEOP = yes -WFLAGS = $(WFLAGS) -DZLIB_COMPAT -DEFFILE = zlibcompat.def -!else -STATICLIB = zlib-ng.lib -SHAREDLIB = zlib-ng1.dll -IMPLIB = zngdll.lib -DEFFILE = zlib-ng.def -RCFILE = zlib-ng1.rc -RESFILE = zlib-ng1.res -SUFFIX = -ng -!endif - -!if "$(WITH_GZFILEOP)" != "" -WFLAGS = $(WFLAGS) -DWITH_GZFILEOP -OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj -!endif - -!if "$(WITH_ACLE)" != "" -WFLAGS = $(WFLAGS) -DARM_ACLE_CRC_HASH -OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj -!endif -!if "$(WITH_VFPV3)" != "" -NEON_ARCH = /arch:VFPv3 -!endif -!if "$(WITH_NEON)" != "" -CFLAGS = $(CFLAGS) $(NEON_ARCH) -WFLAGS = $(WFLAGS) \ - -D__ARM_NEON__=1 \ - -DARM_NEON_ADLER32 \ - -DARM_NEON_CHUNKSET \ - -DARM_NEON_SLIDEHASH \ - -DARM_NOCHECK_NEON \ - # -OBJS = $(OBJS) adler32_neon.obj chunkset_neon.obj slide_neon.obj -!endif - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -zconf: $(TOP)/zconf$(SUFFIX).h.in - $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h - -$(STATICLIB): zconf $(OBJS) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) - $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x5A4C0000 $(OBJS) $(RESFILE) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -gzlib2.obj: gzlib.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c - -gzread2.obj: gzread.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c - -gzwrite2.obj: gzwrite.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c - -{$(TOP)/arch/arm}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< - -$(TOP)/zconf$(SUFFIX).h: zconf - -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h -crc32_comb.obj: $(SRCDIR)/crc32_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/crc32_comb_tbl.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h -inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -$(RESFILE): $(TOP)/win32/$(RCFILE) - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -distclean: clean - -del zconf$(SUFFIX).h diff --git a/libs/zlibng/win32/Makefile.msc b/libs/zlibng/win32/Makefile.msc deleted file mode 100644 index 85d27b9d7..000000000 --- a/libs/zlibng/win32/Makefile.msc +++ /dev/null @@ -1,215 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.msc (standard build) -# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -LD = link -AR = lib -RC = rc -CP = copy /y -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = \ - -D_CRT_SECURE_NO_DEPRECATE \ - -D_CRT_NONSTDC_NO_DEPRECATE \ - -DX86_FEATURES \ - -DX86_PCLMULQDQ_CRC \ - -DX86_SSE2 \ - -DX86_SSE42_CRC_INTRIN \ - -DX86_SSE42_CRC_HASH \ - -DX86_AVX2 \ - -DX86_AVX_CHUNKSET \ - -DX86_SSE2_CHUNKSET \ - -DUNALIGNED_OK \ - -DUNALIGNED64_OK \ - # -LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest -ARFLAGS = -nologo -RCFLAGS = /dWIN32 /r -DEFFILE = zlib.def -RCFILE = zlib1.rc -RESFILE = zlib1.res -WITH_GZFILEOP = yes -ZLIB_COMPAT = -SUFFIX = - -OBJS = \ - adler32.obj \ - chunkset.obj \ - chunkset_avx.obj \ - chunkset_sse.obj \ - compare258.obj \ - compare258_avx.obj \ - compare258_sse.obj \ - compress.obj \ - crc32.obj \ - crc32_comb.obj \ - crc_folding.obj \ - deflate.obj \ - deflate_fast.obj \ - deflate_quick.obj \ - deflate_slow.obj \ - deflate_medium.obj \ - functable.obj \ - infback.obj \ - inflate.obj \ - inftrees.obj \ - inffast.obj \ - insert_string.obj \ - insert_string_sse.obj \ - slide_avx.obj \ - slide_sse.obj \ - trees.obj \ - uncompr.obj \ - zutil.obj \ - x86.obj \ - # -!if "$(ZLIB_COMPAT)" != "" -WITH_GZFILEOP = yes -WFLAGS = $(WFLAGS) -DZLIB_COMPAT -DEFFILE = zlibcompat.def -!else -STATICLIB = zlib-ng.lib -SHAREDLIB = zlib-ng1.dll -IMPLIB = zngdll.lib -DEFFILE = zlib-ng.def -RCFILE = zlib-ng1.rc -RESFILE = zlib-ng1.res -SUFFIX = -ng -!endif - -!if "$(WITH_GZFILEOP)" != "" -WFLAGS = $(WFLAGS) -DWITH_GZFILEOP -OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj -!endif - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -zconf: $(TOP)/zconf$(SUFFIX).h.in - $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h - -$(STATICLIB): zconf $(OBJS) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) - $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x5A4C0000 $(OBJS) $(RESFILE) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -gzlib2.obj: gzlib.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c - -gzread2.obj: gzread.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c - -gzwrite2.obj: gzwrite.c - $(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c - -{$(TOP)/arch/x86}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $< - -$(TOP)/zconf$(SUFFIX).h: zconf - -SRCDIR = $(TOP) -# Keep the dependences in sync with top-level Makefile.in -adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h -functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h -gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h -compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h -chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_avx.obj: $(SRCDIR)/arch/x86/chunkset_avx.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -chunkset_sse.obj: $(SRCDIR)/arch/x86/chunkset_sse.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h -crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h -crc32_comb.obj: $(SRCDIR)/crc32_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/crc32_comb_tbl.h -deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h -deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h -infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h -inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h -inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h -inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h -slide_sse.obj: $(SRCDIR)/arch/x86/slide_sse.c $(SRCDIR)/deflate.h -trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h -zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h - -example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h - -$(RESFILE): $(TOP)/win32/$(RCFILE) - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE) - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -distclean: clean - -del zconf$(SUFFIX).h diff --git a/libs/zlibng/win32/README-WIN32.txt b/libs/zlibng/win32/README-WIN32.txt deleted file mode 100644 index 7a859bb23..000000000 --- a/libs/zlibng/win32/README-WIN32.txt +++ /dev/null @@ -1,103 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.11 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) -and rfc1952.txt (gzip format). - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). Two compiled -examples are distributed in this package, example and minigzip. The example_d -and minigzip_d flavors validate that the zlib1.dll file is working correctly. - -Questions about zlib should be sent to . The zlib home page -is http://zlib.net/ . Before reporting a problem, please check this site to -verify that you have the latest version of zlib; otherwise get the latest -version and check whether the problem still exists or not. - -PLEASE read DLL_FAQ.txt, and the the zlib FAQ http://zlib.net/zlib_faq.html -before asking for help. - - -Manifest: - -The package zlib-1.2.11-win32-x86.zip will contain the following files: - - README-WIN32.txt This document - ChangeLog Changes since previous zlib packages - DLL_FAQ.txt Frequently asked questions about zlib1.dll - zlib.3.pdf Documentation of this library in Adobe Acrobat format - - example.exe A statically-bound example (using zlib.lib, not the dll) - example.pdb Symbolic information for debugging example.exe - - example_d.exe A zlib1.dll bound example (using zdll.lib) - example_d.pdb Symbolic information for debugging example_d.exe - - minigzip.exe A statically-bound test program (using zlib.lib, not the dll) - minigzip.pdb Symbolic information for debugging minigzip.exe - - minigzip_d.exe A zlib1.dll bound test program (using zdll.lib) - minigzip_d.pdb Symbolic information for debugging minigzip_d.exe - - zlib.h Install these files into the compilers' INCLUDE path to - zconf.h compile programs which use zlib.lib or zdll.lib - - zdll.lib Install these files into the compilers' LIB path if linking - zdll.exp a compiled program to the zlib1.dll binary - - zlib.lib Install these files into the compilers' LIB path to link zlib - zlib.pdb into compiled programs, without zlib1.dll runtime dependency - (zlib.pdb provides debugging info to the compile time linker) - - zlib1.dll Install this binary shared library into the system PATH, or - the program's runtime directory (where the .exe resides) - zlib1.pdb Install in the same directory as zlib1.dll, in order to debug - an application crash using WinDbg or similar tools. - -All .pdb files above are entirely optional, but are very useful to a developer -attempting to diagnose program misbehavior or a crash. Many additional -important files for developers can be found in the zlib127.zip source package -available from http://zlib.net/ - review that package's README file for details. - - -Acknowledgments: - -The deflate format used by zlib was defined by Phil Katz. The deflate and -zlib specifications were written by L. Peter Deutsch. Thanks to all the -people who reported problems and suggested various improvements in zlib; they -are too numerous to cite here. - - -Copyright notice: - - (C) 1995-2012 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 - -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. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. diff --git a/libs/zlibng/win32/zlib-ng.def b/libs/zlibng/win32/zlib-ng.def deleted file mode 100644 index 467d79009..000000000 --- a/libs/zlibng/win32/zlib-ng.def +++ /dev/null @@ -1,60 +0,0 @@ -; zlib-ng data compression library -EXPORTS -; basic functions - zlibng_version - zng_deflate - zng_deflateEnd - zng_inflate - zng_inflateEnd -; advanced functions - zng_deflateSetDictionary - zng_deflateGetDictionary - zng_deflateCopy - zng_deflateReset - zng_deflateParams - zng_deflateTune - zng_deflateBound - zng_deflatePending - zng_deflatePrime - zng_deflateSetHeader - zng_deflateSetParams - zng_deflateGetParams - zng_inflateSetDictionary - zng_inflateGetDictionary - zng_inflateSync - zng_inflateCopy - zng_inflateReset - zng_inflateReset2 - zng_inflatePrime - zng_inflateMark - zng_inflateGetHeader - zng_inflateBack - zng_inflateBackEnd - zng_zlibCompileFlags -; utility functions - zng_compress - zng_compress2 - zng_compressBound - zng_uncompress - zng_uncompress2 -; checksum functions - zng_adler32 - zng_adler32_z - zng_crc32 - zng_crc32_z - zng_adler32_combine - zng_crc32_combine -; various hacks, don't look :) - zng_deflateInit_ - zng_deflateInit2_ - zng_inflateInit_ - zng_inflateInit2_ - zng_inflateBackInit_ - zng_zError - zng_inflateSyncPoint - zng_get_crc_table - zng_inflateUndermine - zng_inflateValidate - zng_inflateCodesUsed - zng_inflateResetKeep - zng_deflateResetKeep diff --git a/libs/zlibng/win32/zlib-ng1.rc b/libs/zlibng/win32/zlib-ng1.rc deleted file mode 100644 index fdac56ff6..000000000 --- a/libs/zlibng/win32/zlib-ng1.rc +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "../zlib-ng.h" - -#ifdef GCC_WINDRES -VS_VERSION_INFO VERSIONINFO -#else -VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE -#endif - FILEVERSION ZLIBNG_VER_MAJOR,ZLIBNG_VER_MINOR,ZLIBNG_VER_REVISION,0 - PRODUCTVERSION ZLIBNG_VER_MAJOR,ZLIBNG_VER_MINOR,ZLIBNG_VER_REVISION,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS 1 -#else - FILEFLAGS 0 -#endif - FILEOS VOS__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 library\0" - VALUE "FileVersion", ZLIBNG_VERSION "\0" - VALUE "InternalName", "zlib-ng1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" - VALUE "OriginalFilename", "zlib-ng1.dll\0" - VALUE "ProductName", "zlib\0" - VALUE "ProductVersion", ZLIBNG_VERSION "\0" - VALUE "Comments", "For more information visit http://www.zlib.net/\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/libs/zlibng/win32/zlib.def b/libs/zlibng/win32/zlib.def deleted file mode 100644 index 67644205a..000000000 --- a/libs/zlibng/win32/zlib.def +++ /dev/null @@ -1,61 +0,0 @@ -; zlib data compression library -EXPORTS -; basic functions - zlibVersion - deflate - deflateEnd - inflate - inflateEnd -; advanced functions - deflateSetDictionary - deflateGetDictionary - deflateCopy - deflateReset - deflateParams - deflateTune - deflateBound - deflatePending - deflatePrime - deflateSetHeader - inflateSetDictionary - inflateGetDictionary - inflateSync - inflateCopy - inflateReset - inflateReset2 - inflatePrime - inflateMark - inflateGetHeader - inflateBack - inflateBackEnd - zlibCompileFlags -; utility functions - compress - compress2 - compressBound - uncompress - uncompress2 -; large file functions - adler32_combine64 - crc32_combine64 -; checksum functions - adler32 - adler32_z - crc32 - crc32_z - adler32_combine - crc32_combine -; various hacks, don't look :) - deflateInit_ - deflateInit2_ - inflateInit_ - inflateInit2_ - inflateBackInit_ - zError - inflateSyncPoint - get_crc_table - inflateUndermine - inflateValidate - inflateCodesUsed - inflateResetKeep - deflateResetKeep diff --git a/libs/zlibng/win32/zlib1.rc b/libs/zlibng/win32/zlib1.rc deleted file mode 100644 index 5c0feed1b..000000000 --- a/libs/zlibng/win32/zlib1.rc +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "../zlib.h" - -#ifdef GCC_WINDRES -VS_VERSION_INFO VERSIONINFO -#else -VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE -#endif - FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 - PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS 1 -#else - FILEFLAGS 0 -#endif - FILEOS VOS__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 library\0" - VALUE "FileVersion", ZLIB_VERSION "\0" - VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0" - VALUE "OriginalFilename", "zlib1.dll\0" - VALUE "ProductName", "zlib\0" - VALUE "ProductVersion", ZLIB_VERSION "\0" - VALUE "Comments", "For more information visit http://www.zlib.net/\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/libs/zlibng/win32/zlibcompat.def b/libs/zlibng/win32/zlibcompat.def deleted file mode 100644 index a2188b000..000000000 --- a/libs/zlibng/win32/zlibcompat.def +++ /dev/null @@ -1,94 +0,0 @@ -; zlib data compression library -EXPORTS -; basic functions - zlibVersion - deflate - deflateEnd - inflate - inflateEnd -; advanced functions - deflateSetDictionary - deflateGetDictionary - deflateCopy - deflateReset - deflateParams - deflateTune - deflateBound - deflatePending - deflatePrime - deflateSetHeader - inflateSetDictionary - inflateGetDictionary - inflateSync - inflateCopy - inflateReset - inflateReset2 - inflatePrime - inflateMark - inflateGetHeader - inflateBack - inflateBackEnd - zlibCompileFlags -; utility functions - compress - compress2 - compressBound - uncompress - uncompress2 - gzopen - gzdopen - gzbuffer - gzsetparams - gzread - gzfread - gzwrite - gzfwrite - gzprintf - gzvprintf - gzputs - gzgets - gzputc - gzgetc - gzungetc - gzflush - gzseek - gzrewind - gztell - gzoffset - gzeof - gzdirect - gzclose - gzclose_r - gzclose_w - gzerror - gzclearerr -; large file functions - gzopen64 - gzseek64 - gztell64 - gzoffset64 - adler32_combine64 - crc32_combine64 -; checksum functions - adler32 - adler32_z - crc32 - crc32_z - adler32_combine - crc32_combine -; various hacks, don't look :) - deflateInit_ - deflateInit2_ - inflateInit_ - inflateInit2_ - inflateBackInit_ - gzgetc_ - zError - inflateSyncPoint - get_crc_table - inflateUndermine - inflateValidate - inflateCodesUsed - inflateResetKeep - deflateResetKeep - gzopen_w diff --git a/libs/zlibng/zbuild.h b/libs/zlibng/zbuild.h deleted file mode 100644 index 3bd4f4898..000000000 --- a/libs/zlibng/zbuild.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _ZBUILD_H -#define _ZBUILD_H - -/* This has to be first include that defines any types */ -#if defined(_MSC_VER) -# if defined(_WIN64) - typedef __int64 ssize_t; -# else - typedef long ssize_t; -# endif -#endif - -#if defined(ZLIB_COMPAT) -# define PREFIX(x) x -# define PREFIX2(x) ZLIB_ ## x -# define PREFIX3(x) z_ ## x -# define PREFIX4(x) x ## 64 -# define zVersion zlibVersion -# define z_size_t unsigned long -#else -# define PREFIX(x) zng_ ## x -# define PREFIX2(x) ZLIBNG_ ## x -# define PREFIX3(x) zng_ ## x -# define PREFIX4(x) zng_ ## x -# define zVersion zlibng_version -# define z_size_t size_t -#endif - -#endif diff --git a/libs/zlibng/zconf-ng.h.in b/libs/zlibng/zconf-ng.h.in deleted file mode 100644 index 7d54668d3..000000000 --- a/libs/zlibng/zconf-ng.h.in +++ /dev/null @@ -1,177 +0,0 @@ -/* zconf-ng.h -- configuration of the zlib-ng compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ZCONFNG_H -#define ZCONFNG_H - -#if !defined(_WIN32) && defined(__WIN32__) -# define _WIN32 -#endif - -#ifdef __STDC_VERSION__ -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif - -/* Clang macro for detecting declspec support - * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute - */ -#ifndef __has_declspec_attribute -# define __has_declspec_attribute(x) 0 -#endif - -/* Always define z_const as const */ -#define z_const const - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# define MAX_MEM_LEVEL 9 -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - -/* Type declarations */ - -#ifdef ZLIB_INTERNAL -# define Z_INTERNAL ZLIB_INTERNAL -#endif - -/* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) -# ifdef Z_INTERNAL -# define Z_EXTERN extern __declspec(dllexport) -# else -# define Z_EXTERN extern __declspec(dllimport) -# endif -#endif - -/* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -#if defined(ZLIB_WINAPI) && defined(_WIN32) -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define Z_EXPORT WINAPI -# define Z_EXPORTVA WINAPIV -#endif - -#ifndef Z_EXTERN -# define Z_EXTERN extern -#endif -#ifndef Z_EXPORT -# define Z_EXPORT -#endif -#ifndef Z_EXPORTVA -# define Z_EXPORTVA -#endif - -/* Fallback for something that includes us. */ -typedef unsigned char Byte; -typedef Byte Bytef; - -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -typedef char charf; -typedef int intf; -typedef uInt uIntf; -typedef uLong uLongf; - -typedef void const *voidpc; -typedef void *voidpf; -typedef void *voidp; - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by configure/cmake/etc */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */ -typedef PTRDIFF_TYPE ptrdiff_t; -#endif - -#include /* for off_t */ -#include /* for va_list */ - -#include /* for wchar_t and NULL */ - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifndef z_off_t -# define z_off_t off_t -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && defined(WITH_GZFILEOP) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(__MSYS__) -# define z_off64_t _off64_t -# elif defined(_WIN32) && !defined(__GNUC__) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -#endif /* ZCONFNG_H */ diff --git a/libs/zlibng/zconf.h.in b/libs/zlibng/zconf.h.in deleted file mode 100644 index fcbcbb6b1..000000000 --- a/libs/zlibng/zconf.h.in +++ /dev/null @@ -1,185 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ZCONF_H -#define ZCONF_H - -#if !defined(_WIN32) && defined(__WIN32__) -# define _WIN32 -#endif - -#ifdef __STDC_VERSION__ -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif - -/* Clang macro for detecting declspec support - * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute - */ -#ifndef __has_declspec_attribute -# define __has_declspec_attribute(x) 0 -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# define MAX_MEM_LEVEL 9 -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - -/* Type declarations */ - - -#ifndef OF /* function prototypes */ -# define OF(args) args -#endif - -#ifdef ZLIB_INTERNAL -# define Z_INTERNAL ZLIB_INTERNAL -#endif - -/* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) -# ifdef Z_INTERNAL -# define Z_EXTERN extern __declspec(dllexport) -# else -# define Z_EXTERN extern __declspec(dllimport) -# endif -#endif - -/* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -#if defined(ZLIB_WINAPI) && defined(_WIN32) -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define Z_EXPORT WINAPI -# define Z_EXPORTVA WINAPIV -#endif - -#ifndef Z_EXTERN -# define Z_EXTERN extern -#endif -#ifndef Z_EXPORT -# define Z_EXPORT -#endif -#ifndef Z_EXPORTVA -# define Z_EXPORTVA -#endif - -/* Fallback for something that includes us. */ -typedef unsigned char Byte; -typedef Byte Bytef; - -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -typedef char charf; -typedef int intf; -typedef uInt uIntf; -typedef uLong uLongf; - -typedef void const *voidpc; -typedef void *voidpf; -typedef void *voidp; - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by configure/cmake/etc */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */ -typedef PTRDIFF_TYPE ptrdiff_t; -#endif - -#include /* for off_t */ -#include /* for va_list */ - -#include /* for wchar_t and NULL */ - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifndef z_off_t -# define z_off_t off_t -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(__MSYS__) -# define z_off64_t _off64_t -# elif defined(_WIN32) && !defined(__GNUC__) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -#endif /* ZCONF_H */ diff --git a/libs/zlibng/zendian.h b/libs/zlibng/zendian.h deleted file mode 100644 index 54718ed14..000000000 --- a/libs/zlibng/zendian.h +++ /dev/null @@ -1,60 +0,0 @@ -/* zendian.h -- define BYTE_ORDER for endian tests - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifndef ENDIAN_H_ -#define ENDIAN_H_ - -/* First check whether the compiler knows the target __BYTE_ORDER__. */ -#if defined(__BYTE_ORDER__) -# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# if !defined(LITTLE_ENDIAN) -# define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ -# endif -# if !defined(BYTE_ORDER) -# define BYTE_ORDER LITTLE_ENDIAN -# endif -# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# if !defined(BIG_ENDIAN) -# define BIG_ENDIAN __ORDER_BIG_ENDIAN__ -# endif -# if !defined(BYTE_ORDER) -# define BYTE_ORDER BIG_ENDIAN -# endif -# endif -#elif defined(__MINGW32__) -# include -#elif defined(_WIN32) -# define LITTLE_ENDIAN 1234 -# define BIG_ENDIAN 4321 -# if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64) || defined (_M_ARM) || defined (_M_ARM64) -# define BYTE_ORDER LITTLE_ENDIAN -# else -# error Unknown endianness! -# endif -#elif defined(__linux__) -# include -#elif defined(__APPLE__) || defined(__arm__) || defined(__aarch64__) -# include -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) -# include -#elif defined(__sun) || defined(sun) -# include -# if !defined(LITTLE_ENDIAN) -# define LITTLE_ENDIAN 4321 -# endif -# if !defined(BIG_ENDIAN) -# define BIG_ENDIAN 1234 -# endif -# if !defined(BYTE_ORDER) -# if defined(_BIG_ENDIAN) -# define BYTE_ORDER BIG_ENDIAN -# else -# define BYTE_ORDER LITTLE_ENDIAN -# endif -# endif -#else -# include -#endif - -#endif diff --git a/libs/zlibng/zlib-ng.h b/libs/zlibng/zlib-ng.h deleted file mode 100644 index 275ded703..000000000 --- a/libs/zlibng/zlib-ng.h +++ /dev/null @@ -1,1888 +0,0 @@ -#ifndef ZNGLIB_H_ -#define ZNGLIB_H_ -/* zlib-ng.h -- interface of the 'zlib-ng' compression library, forked from zlib. - - Copyright (C) 1995-2016 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 - - - 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 rfc1952 (gzip format). -*/ - -#include -#include "zconf-ng.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIBNG_VERSION "2.0.0-RC2" -#define ZLIBNG_VERNUM 0x2000 -#define ZLIBNG_VER_MAJOR 2 -#define ZLIBNG_VER_MINOR 0 -#define ZLIBNG_VER_REVISION 0 -#define ZLIBNG_VER_SUBREVISION 0 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip and raw deflate streams in - memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in the case of corrupted input. -*/ - -typedef void *(*alloc_func) (void *opaque, unsigned int items, unsigned int size); -typedef void (*free_func) (void *opaque, void *address); - -struct internal_state; - -typedef struct zng_stream_s { - const uint8_t *next_in; /* next input byte */ - uint32_t avail_in; /* number of bytes available at next_in */ - size_t total_in; /* total number of input bytes read so far */ - - uint8_t *next_out; /* next output byte will go here */ - uint32_t avail_out; /* remaining free space at next_out */ - size_t total_out; /* total number of bytes output so far */ - - const char *msg; /* last error message, NULL if no error */ - struct internal_state *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - void *opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text - for deflate, or the decoding state for inflate */ - uint32_t adler; /* Adler-32 or CRC-32 value of the uncompressed data */ - unsigned long reserved; /* reserved for future use */ -} zng_stream; - -typedef zng_stream *zng_streamp; /* Obsolete type, retained for compatibility only */ - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct zng_gz_header_s { - int32_t text; /* true if compressed data believed to be text */ - unsigned long time; /* modification time */ - int32_t xflags; /* extra flags (not used when writing a gzip file) */ - int32_t os; /* operating system */ - uint8_t *extra; /* pointer to extra field or NULL if none */ - uint32_t extra_len; /* extra field length (valid if extra != NULL) */ - uint32_t extra_max; /* space at extra (only when reading header) */ - uint8_t *name; /* pointer to zero-terminated file name or NULL */ - uint32_t name_max; /* space at name (only when reading header) */ - uint8_t *comment; /* pointer to zero-terminated comment or NULL */ - uint32_t comm_max; /* space at comment (only when reading header) */ - int32_t hcrc; /* true if there was or will be a header crc */ - int32_t done; /* true when done reading gzip header (not used when writing a gzip file) */ -} zng_gz_header; - -typedef zng_gz_header *zng_gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. In that case, zlib is thread-safe. When zalloc and zfree are - Z_NULL on entry to the initialization function, they are set to internal - routines that use the standard library functions malloc() and free(). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use by the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field for deflate() */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL NULL /* for compatibility with zlib, was for initializing zalloc, zfree, opaque */ - - - /* basic functions */ - -Z_EXTERN Z_EXPORT -const char *zlibng_version(void); -/* The application can compare zlibng_version and ZLIBNG_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib-ng.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -Z_EXTERN Z_EXPORT -int zng_deflateInit(zng_stream *strm, int level); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to NULL, deflateInit updates them to use default - allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zng_version) is incompatible - with the version assumed by the caller (ZLIBNG_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -Z_EXTERN Z_EXPORT -int32_t zng_deflate(zng_stream *strm, int32_t flush); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary. Some output may be provided even if - flush is zero. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 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 - in that case. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed - codes block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this - function must be called again with Z_FINISH and more output space (updated - avail_out) but no more input data, until it returns with Z_STREAM_END or an - error. After deflate has returned Z_STREAM_END, the only possible operations - on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used in the first deflate call after deflateInit if all the - compression is to be done in a single step. In order to complete in one - call, avail_out must be at least the value returned by deflateBound (see - below). Then deflate is guaranteed to return Z_STREAM_END. If not enough - output space is provided, deflate will not return Z_STREAM_END, and it must - be called again as described above. - - deflate() sets strm->adler to the Adler-32 checksum of all input read - so far (that is, total_in bytes). If a gzip stream is being generated, then - strm->adler will be the CRC-32 checksum of the input read so far. (See - deflateInit2 below.) - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is - considered binary. This field is only for information purposes and does not - affect the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL) or the state was inadvertently written over - by the application), or Z_BUF_ERROR if no progress is possible (for example - avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and - deflate() can be called again with more input and more output space to - continue compressing. -*/ - - -Z_EXTERN Z_EXPORT -int32_t zng_deflateEnd(zng_stream *strm); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -Z_EXTERN Z_EXPORT -int zng_inflateInit(zng_stream *strm); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. In the current version of inflate, the provided input is not - read or consumed. The allocation of a sliding window will be deferred to - the first call of inflate (if the decompression does not complete on the - first call). If zalloc and zfree are set to NULL, inflateInit updates - them to use default allocation functions. - - inflateInit 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 - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression. - Actual decompression will be done by inflate(). So next_in, and avail_in, - next_out, and avail_out are unused and unchanged. The current - implementation of inflateInit() does not process any header information -- - that is deferred until inflate() is called. -*/ - - -Z_EXTERN Z_EXPORT -int32_t zng_inflate(zng_stream *strm, int32_t flush); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), then next_in and avail_in are updated - accordingly, and processing will resume at this point for the next call of - inflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. If the - caller of inflate() does not provide both available input and available - output space, it is possible that there will be no progress made. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate 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. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed Adler-32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained unless inflateGetHeader() is used. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - produced so far. The CRC-32 is checked against the gzip trailer, as is the - uncompressed length, modulo 2^32. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value, in which case strm->msg points to a string with a more specific - error), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was NULL, or the state was inadvertently written over - by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR - if no progress is possible or if there was not enough room in the output - buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is to be attempted. -*/ - - -Z_EXTERN Z_EXPORT -int32_t zng_inflateEnd(zng_stream *strm); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state - was inconsistent. -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -Z_EXTERN Z_EXPORT -int zng_deflateInit2(zng_stream *strm, int level, int method, int windowBits, int memLevel, int strategy); - - This is another version of deflateInit with more compression options. The - 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. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - For the current implementation of deflate(), a windowBits value of 8 (a - window size of 256 bytes) is not supported. As a result, a request for 8 - will result in 9 (a 512-byte window). In that case, providing 8 to - inflateInit2() will result in an error when the zlib header with 9 is - checked against the initialization of inflate(). The remedy is to not use 8 - with deflateInit2() with this initialization, or at least in that case use 9 - with inflateInit2(). - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute a check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to the appropriate value, - if the operating system was determined at compile time. If a gzip stream is - being written, strm->adler is a CRC-32 instead of an Adler-32. - - For raw deflate or gzip encoding, a request for a 256-byte window is - rejected as invalid, since only the zlib header provides a means of - transmitting the window size to the decompressor. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zng_version) is - incompatible with the version assumed by the caller (ZLIBNG_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateSetDictionary(zng_stream *strm, const uint8_t *dictionary, uint32_t dictLength); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the Adler-32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler-32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - Adler-32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateGetDictionary(zng_stream *strm, uint8_t *dictionary, uint32_t *dictLength); -/* - Returns the sliding dictionary being maintained by deflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - 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. - - 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 - to 258 bytes less in that case, due to how zlib's implementation of deflate - manages the sliding window and lookahead for matches, where matches can be - up to 258 bytes long. If the application needs the last window-size bytes of - input, then that would need to be saved by the application outside of zlib. - - deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateCopy(zng_stream *dest, zng_stream *source); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateReset(zng_stream *strm); -/* - This function is equivalent to deflateEnd followed by deflateInit, but - does not free and reallocate the internal compression state. The stream - will leave the compression level and any other attributes that may have been - set unchanged. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateParams(zng_stream *strm, int32_t level, int32_t strategy); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2(). This can be - 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 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 - take effect. In this case, deflateParams() can be called again with the - same parameters and more output space to try again. - - In order to assure a change in the parameters on the first try, the - deflate stream should be flushed using deflate() with Z_BLOCK or other flush - request until strm.avail_out is not zero, before calling deflateParams(). - Then no more input data should be provided before the deflateParams() call. - If this is done, the old level and strategy will be applied to the data - compressed before deflateParams(), and the new level and strategy will be - applied to the the data compressed after deflateParams(). - - deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream - state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if - there was not enough output space to complete the compression of the - available input data before a change in the strategy or approach. Note that - in the case of a Z_BUF_ERROR, the parameters are not changed. A return - value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be - retried with more output space. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateTune(zng_stream *strm, int32_t good_length, int32_t max_lazy, int32_t nice_length, int32_t max_chain); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -Z_EXTERN Z_EXPORT -unsigned long zng_deflateBound(zng_stream *strm, unsigned long sourceLen); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflatePending(zng_stream *strm, uint32_t *pending, int32_t *bits); -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. - */ - -Z_EXTERN Z_EXPORT -int32_t zng_deflatePrime(zng_stream *strm, int32_t bits, int32_t value); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateSetHeader(zng_stream *strm, zng_gz_headerp head); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided zng_gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not NULL, name and comment are terminated with - a zero byte, and that if extra is not NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -Z_EXTERN Z_EXPORT -int zng_inflateInit2(zng_stream *strm, int windowBits); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an Adler-32 or a CRC-32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - 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 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 - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateSetDictionary(zng_stream *strm, const uint8_t *dictionary, uint32_t dictLength); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler-32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler-32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateGetDictionary(zng_stream *strm, uint8_t *dictionary, uint32_t *dictLength); -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateSync(zng_stream *strm); -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateCopy(zng_stream *dest, zng_stream *source); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateReset(zng_stream *strm); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateReset2(zng_stream *strm, int32_t windowBits); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. If the window size is changed, then the - memory allocated for the window is freed, and the window will be reallocated - by inflate() if needed. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL), or if - the windowBits parameter is invalid. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflatePrime(zng_stream *strm, int32_t bits, int32_t value); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -Z_EXTERN Z_EXPORT -long zng_inflateMark(zng_stream *strm); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above, or -65536 if the provided - source stream state was inconsistent. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateGetHeader(zng_stream *strm, zng_gz_headerp head); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided zng_gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not NULL and the respective field is not - present in the header, then that field is set to NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -Z_EXTERN Z_EXPORT -int zng_inflateBackInit(zng_stream *strm, int windowBits, unsigned char *window); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the parameters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef uint32_t (*in_func) (void *, const uint8_t * *); -typedef int32_t (*out_func) (void *, uint8_t *, uint32_t); - -Z_EXTERN Z_EXPORT -int32_t zng_inflateBack(zng_stream *strm, in_func in, void *in_desc, out_func out, void *out_desc); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the default - behavior of inflate(), which expects a zlib header and trailer around the - deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero -- buf is ignored in that - case -- and inflateBack() will return a buffer error. inflateBack() will - call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. - out() should return zero on success, or non-zero on failure. If out() - returns non-zero, inflateBack() will return with an error. Neither in() nor - out() are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is NULL, then in() will be called - immediately for input. If strm->next_in is not NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be NULL only if in() returned an error. If - strm->next_in is not NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_inflateBackEnd(zng_stream *strm); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -Z_EXTERN Z_EXPORT -unsigned long zng_zlibCompileFlags(void); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of unsigned int - 3.2: size of unsigned long - 5.4: size of void * (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: ZLIB_DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed (not supported by zlib-ng) - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_compress(uint8_t *dest, size_t *destLen, const uint8_t *source, size_t sourceLen); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. compress() is equivalent to compress2() with a level - parameter of Z_DEFAULT_COMPRESSION. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_compress2(uint8_t *dest, size_t *destLen, const uint8_t *source, size_t sourceLen, int32_t level); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -Z_EXTERN Z_EXPORT -size_t zng_compressBound(size_t sourceLen); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_uncompress(uint8_t *dest, size_t *destLen, const uint8_t *source, size_t sourceLen); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed data. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ - - -Z_EXTERN Z_EXPORT -int32_t zng_uncompress2(uint8_t *dest, size_t *destLen, const uint8_t *source, size_t *sourceLen); -/* - Same as uncompress, except that sourceLen is a pointer, where the - length of the source is *sourceLen. On return, *sourceLen is the number of - source bytes consumed. -*/ - - -#ifdef WITH_GZFILEOP - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ - -Z_EXTERN Z_EXPORT -gzFile zng_gzopen(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. - - "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 - reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ - -Z_EXTERN Z_EXPORT -gzFile zng_gzdopen(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. - - 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 - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzbuffer(gzFile file, uint32_t 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). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzsetparams(gzFile file, int32_t level, int32_t 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. - - 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, - or Z_MEM_ERROR if there is a memory allocation error. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzread(gzFile file, void *buf, uint32_t len); -/* - Reads the given number of uncompressed bytes from the compressed file. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. If len is too large to fit in an int, - then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. -*/ - -Z_EXTERN Z_EXPORT -size_t zng_gzfread(void *buf, size_t size, 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. - - 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 - there was an error. gzerror() must be consulted if zero is returned in - order to determine if there was an error. If the multiplication of size and - nitems overflows, i.e. the product does not fit in a size_t, then nothing - is read, zero is returned, and the error state is set to Z_STREAM_ERROR. - - 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 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. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzwrite(gzFile file, void const *buf, uint32_t 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. -*/ - -Z_EXTERN Z_EXPORT -size_t zng_gzfwrite(void const *buf, size_t size, size_t nitems, gzFile file); -/* - gzfwrite() writes nitems items of size size from buf to file, duplicating - the interface of stdio's fwrite(), with size_t request and return types. - - gzfwrite() returns the number of full items written of size size, or zero - if there was an error. If the multiplication of size and nitems overflows, - i.e. the product does not fit in a size_t, then nothing is written, zero - is returned, and the error state is set to Z_STREAM_ERROR. -*/ - -Z_EXTERN Z_EXPORTVA -int32_t zng_gzprintf(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 - 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() - because the secure snprintf() or vsnprintf() functions were not available. - This can be determined using zlibCompileFlags(). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzputs(gzFile file, const char *s); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ - -Z_EXTERN Z_EXPORT -char * zng_gzgets(gzFile file, char *buf, int32_t 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. - - 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 - buf are indeterminate. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzputc(gzFile file, int32_t c); -/* - Writes c, converted to an unsigned char, into the compressed file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzgetc(gzFile file); -/* - Reads one byte from the compressed 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 - points to has been clobbered or not. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzungetc(int32_t 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. - 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 - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzflush(gzFile file, int32_t 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. - - 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 - gzip stream will be started in the output. gzread() is able to read such - concatenated gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -Z_EXTERN Z_EXPORT -z_off64_t zng_gzseek(gzFile file, z_off64_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 - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzrewind(gzFile file); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -Z_EXTERN Z_EXPORT -z_off64_t zng_gztell(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(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -Z_EXTERN Z_EXPORT -z_off64_t zng_gzoffset(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. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzeof(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. - - 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 - has grown since the previous end of file was detected. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzdirect(gzFile file); -/* - Returns 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 - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzclose(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 - 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. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_gzclose_r(gzFile file); -Z_EXTERN Z_EXPORT -int32_t zng_gzclose_w(gzFile file); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -Z_EXTERN Z_EXPORT -const char * zng_gzerror(gzFile file, int32_t *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. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -Z_EXTERN Z_EXPORT -void zng_gzclearerr(gzFile file); -/* - Clears 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. -*/ - -#endif /* WITH_GZFILEOP */ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_adler32(uint32_t adler, const uint8_t *buf, uint32_t len); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is 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. - - Usage example: - - uint32_t adler = adler32(0L, NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_adler32_z(uint32_t adler, const uint8_t *buf, size_t len); -/* - Same as adler32(), but with a size_t length. -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_adler32_combine(uint32_t adler1, uint32_t adler2, z_off64_t len2); -/* - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_crc32(uint32_t crc, const uint8_t *buf, uint32_t len); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is 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: - - uint32_t crc = crc32(0L, NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_crc32_z(uint32_t crc, const uint8_t *buf, size_t len); -/* - Same as crc32(), but with a size_t length. -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_crc32_combine(uint32_t crc1, uint32_t crc2, z_off64_t len2); - -/* - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - -Z_EXTERN Z_EXPORT -void zng_crc32_combine_gen(uint32_t op[32], z_off64_t len2); - -/* - Generate the operator op corresponding to length len2, to be used with - crc32_combine_op(). op must have room for 32 uint32_t values. (32 is the - number of bits in the CRC.) -*/ - -Z_EXTERN Z_EXPORT -uint32_t zng_crc32_combine_op(uint32_t crc1, uint32_t crc2, const uint32_t *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 many times. -*/ - - /* various hacks, don't look :) */ - -/* zng_deflateInit and zng_inflateInit are macros to allow checking the zlib version - * and the compiler's view of zng_stream: - */ -Z_EXTERN Z_EXPORT int32_t zng_deflateInit_(zng_stream *strm, int32_t level, const char *version, int32_t stream_size); -Z_EXTERN Z_EXPORT int32_t zng_inflateInit_(zng_stream *strm, const char *version, int32_t stream_size); -Z_EXTERN Z_EXPORT int32_t zng_deflateInit2_(zng_stream *strm, int32_t level, int32_t method, int32_t windowBits, int32_t memLevel, - int32_t strategy, const char *version, int32_t stream_size); -Z_EXTERN Z_EXPORT int32_t zng_inflateInit2_(zng_stream *strm, int32_t windowBits, const char *version, int32_t stream_size); -Z_EXTERN Z_EXPORT int32_t zng_inflateBackInit_(zng_stream *strm, int32_t windowBits, uint8_t *window, - const char *version, int32_t stream_size); - -#define zng_deflateInit(strm, level) zng_deflateInit_((strm), (level), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream)) -#define zng_inflateInit(strm) zng_inflateInit_((strm), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream)) -#define zng_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - zng_deflateInit2_((strm), (level), (method), (windowBits), (memLevel), \ - (strategy), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream)) -#define zng_inflateInit2(strm, windowBits) zng_inflateInit2_((strm), (windowBits), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream)) -#define zng_inflateBackInit(strm, windowBits, window) \ - zng_inflateBackInit_((strm), (windowBits), (window), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream)) - -#ifdef WITH_GZFILEOP - -/* gzgetc() macro and its supporting function and exposed data structure. Note - * that the real internal state is much larger than the exposed structure. - * This abbreviated structure exposes just enough for the gzgetc() macro. The - * user should not mess with these exposed elements, since their names or - * behavior could change in the future, perhaps even capriciously. They can - * only be used by the gzgetc() macro. You have been warned. - */ -struct gzFile_s { - unsigned have; - unsigned char *next; - z_off64_t pos; -}; -Z_EXTERN Z_EXPORT int32_t zng_gzgetc_(gzFile file); /* backward compatibility */ -# define zng_gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (zng_gzgetc)(g)) - -#endif /* WITH_GZFILEOP */ - - -typedef enum { - Z_DEFLATE_LEVEL = 0, /* compression level, represented as an int */ - Z_DEFLATE_STRATEGY = 1, /* compression strategy, represented as an int */ - Z_DEFLATE_REPRODUCIBLE = 2, - /* - Whether reproducible compression results are required. Represented as an int, where 0 means that it is allowed - to trade reproducibility for e.g. improved performance or compression ratio, and non-0 means that - reproducibility is strictly required. Reproducibility is guaranteed only when using an identical zlib-ng build. - Default is 0. - */ -} zng_deflate_param; - -typedef struct { - zng_deflate_param param; /* parameter ID */ - void *buf; /* parameter value */ - size_t size; /* parameter value size */ - int32_t status; /* result of the last set/get call */ -} zng_deflate_param_value; - -Z_EXTERN Z_EXPORT -int32_t zng_deflateSetParams(zng_stream *strm, zng_deflate_param_value *params, size_t count); -/* - Sets the values of the given zlib-ng deflate stream parameters. All the buffers are copied internally, so the - caller still owns them after this function returns. Returns Z_OK if success. - - If the size of at least one of the buffers is too small to hold the entire value of the corresponding parameter, - or if the same parameter is specified multiple times, Z_BUF_ERROR is returned. The caller may inspect status fields - in order to determine which of the parameters caused this error. No other changes are performed. - - If the stream state is inconsistent or if at least one of the values cannot be updated, Z_STREAM_ERROR is - returned. The caller may inspect status fields in order to determine which of the parameters caused this error. - Parameters, whose status field is equal to Z_OK, have been applied successfully. If all status fields are not equal - to Z_STREAM_ERROR, then the error was caused by a stream state inconsistency. - - If there are no other errors, but at least one parameter is not supported by the current zlib-ng version, - Z_VERSION_ERROR is returned. The caller may inspect status fields in order to determine which of the parameters - caused this error. -*/ - -Z_EXTERN Z_EXPORT -int32_t zng_deflateGetParams(zng_stream *strm, zng_deflate_param_value *params, size_t count); -/* - Copies the values of the given zlib-ng deflate stream parameters into the user-provided buffers. Returns Z_OK if - success, Z_VERSION_ERROR if at least one parameter is not supported by the current zlib-ng version, Z_STREAM_ERROR - if the stream state is inconsistent, and Z_BUF_ERROR if the size of at least one buffer is too small to hold the - entire value of the corresponding parameter. -*/ - -/* undocumented functions */ -Z_EXTERN Z_EXPORT const char * zng_zError (int32_t); -Z_EXTERN Z_EXPORT int32_t zng_inflateSyncPoint (zng_stream *); -Z_EXTERN Z_EXPORT const uint32_t * zng_get_crc_table (void); -Z_EXTERN Z_EXPORT int32_t zng_inflateUndermine (zng_stream *, int32_t); -Z_EXTERN Z_EXPORT int32_t zng_inflateValidate (zng_stream *, int32_t); -Z_EXTERN Z_EXPORT unsigned long zng_inflateCodesUsed (zng_stream *); -Z_EXTERN Z_EXPORT int32_t zng_inflateResetKeep (zng_stream *); -Z_EXTERN Z_EXPORT int32_t zng_deflateResetKeep (zng_stream *); - -#ifdef WITH_GZFILEOP -# if defined(_WIN32) - Z_EXTERN Z_EXPORT gzFile zng_gzopen_w(const wchar_t *path, const char *mode); -# endif -Z_EXTERN Z_EXPORTVA int32_t zng_gzvprintf(gzFile file, const char *format, va_list va); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ZNGLIB_H_ */ diff --git a/libs/zlibng/zlib-ng.map b/libs/zlibng/zlib-ng.map deleted file mode 100644 index b0046034c..000000000 --- a/libs/zlibng/zlib-ng.map +++ /dev/null @@ -1,107 +0,0 @@ -ZLIB_NG_2.0.0 { - global: - zng_adler32; - zng_adler32_c; - zng_adler32_combine; - zng_adler32_z; - zng_compress; - zng_compress2; - zng_compressBound; - zng_crc32; - zng_crc32_combine; - zng_crc32_combine_gen; - zng_crc32_combine_op; - zng_crc32_z; - zng_deflate; - zng_deflateBound; - zng_deflateCopy; - zng_deflateEnd; - zng_deflateGetDictionary; - zng_deflateGetParams; - zng_deflateInit_; - zng_deflateInit2_; - zng_deflateParams; - zng_deflatePending; - zng_deflatePrime; - zng_deflateReset; - zng_deflateResetKeep; - zng_deflateSetDictionary; - zng_deflateSetHeader; - zng_deflateSetParams; - zng_deflateTune; - zng_get_crc_table; - zng_inflate; - zng_inflateBack; - zng_inflateBackEnd; - zng_inflateBackInit_; - zng_inflateCodesUsed; - zng_inflateCopy; - zng_inflateEnd; - zng_inflateGetDictionary; - zng_inflateGetHeader; - zng_inflateInit_; - zng_inflateInit2_; - zng_inflateMark; - zng_inflatePrime; - zng_inflateReset; - zng_inflateReset2; - zng_inflateResetKeep; - zng_inflateSetDictionary; - zng_inflateSync; - zng_inflateSyncPoint; - zng_inflateUndermine; - zng_inflateValidate; - zng_uncompress; - zng_uncompress2; - zng_zError; - zng_zlibCompileFlags; - zng_zlibng_string; - zng_version; - local: - zng_deflate_copyright; - zng_inflate_copyright; - zng_inflate_fast; - zng_inflate_table; - zng_zcalloc; - zng_zcfree; - zng_z_errmsg; - zng_gz_error; - zng_gz_intmax; - _*; -}; - -ZLIB_NG_GZ_2.0.0 { - global: - zng_gzbuffer; - zng_gzclearerr; - zng_gzclose; - zng_gzclose_r; - zng_gzclose_w; - zng_gzdirect; - zng_gzdopen; - zng_gzeof; - zng_gzerror; - zng_gzflush; - zng_gzfread; - zng_gzfwrite; - zng_gzgetc; - zng_gzgetc_; - zng_gzgets; - zng_gzoffset; - zng_gzoffset64; - zng_gzopen; - zng_gzopen64; - zng_gzprintf; - zng_gzputc; - zng_gzputs; - zng_gzread; - zng_gzrewind; - zng_gzseek; - zng_gzseek64; - zng_gzsetparams; - zng_gztell; - zng_gztell64; - zng_gzungetc; - zng_gzvprintf; - zng_gzwrite; -}; diff --git a/libs/zlibng/zlib.3 b/libs/zlibng/zlib.3 deleted file mode 100644 index eddeec024..000000000 --- a/libs/zlibng/zlib.3 +++ /dev/null @@ -1,149 +0,0 @@ -.TH ZLIB 3 "15 Jan 2017" -.SH NAME -zlib \- compression/decompression library -.SH SYNOPSIS -[see -.I zlib.h -for full description] -.SH DESCRIPTION -The -.I zlib -library is a general purpose data compression library. -The code is thread safe, assuming that the standard library functions -used are thread safe, such as memory allocation routines. -It provides in-memory compression and decompression functions, -including integrity checks of the uncompressed data. -This version of the library supports only one compression method (deflation) -but other algorithms may be added later -with the same stream interface. -.LP -Compression can be done in a single step if the buffers are large enough -or can be done by repeated calls of the compression function. -In the latter case, -the application must provide more input and/or consume the output -(providing more output space) before each call. -.LP -The library also supports reading and writing files in -.IR gzip (1) -(.gz) format -with an interface similar to that of stdio. -.LP -The library does not install any signal handler. -The decoder checks the consistency of the compressed data, -so the library should never crash even in the case of corrupted input. -.LP -All functions of the compression library are documented in the file -.IR zlib.h . -The distribution source includes examples of use of the library -in the files -.I test/example.c -and -.IR test/minigzip.c, -as well as other examples in the -.IR examples/ -directory. -.LP -Changes to this version are documented in the file -.I ChangeLog -that accompanies the source. -.LP -.I zlib -is built in to many languages and operating systems, including but not limited to -Java, Python, .NET, PHP, Perl, Ruby, Swift, and Go. -.LP -An experimental package to read and write files in the .zip format, -written on top of -.I zlib -by Gilles Vollant (info@winimage.com), -is available at: -.IP -http://www.winimage.com/zLibDll/minizip.html -and also in the -.I contrib/minizip -directory of the main -.I zlib -source distribution. -.SH "SEE ALSO" -The -.I zlib -web site can be found at: -.IP -http://zlib.net/ -.LP -The data format used by the -.I zlib -library is described by RFC -(Request for Comments) 1950 to 1952 in the files: -.IP -http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format) -.br -http://tools.ietf.org/html/rfc1951 (for the deflate compressed data format) -.br -http://tools.ietf.org/html/rfc1952 (for the gzip header and trailer format) -.LP -Mark Nelson wrote an article about -.I zlib -for the Jan. 1997 issue of Dr. Dobb's Journal; -a copy of the article is available at: -.IP -http://marknelson.us/1997/01/01/zlib-engine/ -.SH "REPORTING PROBLEMS" -Before reporting a problem, -please check the -.I zlib -web site to verify that you have the latest version of -.IR zlib ; -otherwise, -obtain the latest version and see if the problem still exists. -Please read the -.I zlib -FAQ at: -.IP -http://zlib.net/zlib_faq.html -.LP -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 -.LP -Copyright (C) 1995-2016 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 -arising from the use of this software. -.LP -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: -.LP -.nr step 1 1 -.IP \n[step]. 3 -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. -.IP \n+[step]. -Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. -.IP \n+[step]. -This notice may not be removed or altered from any source distribution. -.LP -Jean-loup Gailly Mark Adler -.br -jloup@gzip.org madler@alumni.caltech.edu -.LP -The deflate format used by -.I zlib -was defined by Phil Katz. -The deflate and -.I zlib -specifications were written by L. Peter Deutsch. -Thanks to all the people who reported problems and suggested various -improvements in -.IR zlib ; -who are too numerous to cite here. -.LP -UNIX manual page by R. P. C. Rodgers, -U.S. National Library of Medicine (rodgers@nlm.nih.gov). -.\" end of man page diff --git a/libs/zlibng/zlib.h b/libs/zlibng/zlib.h deleted file mode 100644 index 688fe440e..000000000 --- a/libs/zlibng/zlib.h +++ /dev/null @@ -1,1831 +0,0 @@ -#ifndef ZLIB_H_ -#define ZLIB_H_ -/* zlib.h -- interface of the 'zlib-ng' compression library - Forked from and compatible with zlib 1.2.11 - - Copyright (C) 1995-2016 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 - - - 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 rfc1952 (gzip format). -*/ - -#include -#include -#include "zconf-ng.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIBNG_VERSION "2.0.0-RC2" -#define ZLIBNG_VERNUM 0x2000 -#define ZLIBNG_VER_MAJOR 2 -#define ZLIBNG_VER_MINOR 0 -#define ZLIBNG_VER_REVISION 0 -#define ZLIBNG_VER_SUBREVISION 0 - -#define ZLIB_VERSION "1.2.11.zlib-ng" -#define ZLIB_VERNUM 0x12bf -#define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 -#define ZLIB_VER_SUBREVISION 0 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip and raw deflate streams in - memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in the case of corrupted input. -*/ - -typedef void *(*alloc_func) (void *opaque, unsigned int items, unsigned int size); -typedef void (*free_func) (void *opaque, void *address); - -struct internal_state; - -typedef struct z_stream_s { - z_const unsigned char *next_in; /* next input byte */ - uint32_t avail_in; /* number of bytes available at next_in */ - unsigned long total_in; /* total number of input bytes read so far */ - - unsigned char *next_out; /* next output byte will go here */ - uint32_t avail_out; /* remaining free space at next_out */ - unsigned long total_out; /* total number of bytes output so far */ - - z_const char *msg; /* last error message, NULL if no error */ - struct internal_state *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - void *opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text - for deflate, or the decoding state for inflate */ - unsigned long adler; /* Adler-32 or CRC-32 value of the uncompressed data */ - unsigned long reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream *z_streamp; /* Obsolete type, retained for compatibility only */ - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - unsigned long time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - unsigned char *extra; /* pointer to extra field or NULL if none */ - unsigned int extra_len; /* extra field length (valid if extra != NULL) */ - unsigned int extra_max; /* space at extra (only when reading header) */ - unsigned char *name; /* pointer to zero-terminated file name or NULL */ - unsigned int name_max; /* space at name (only when reading header) */ - unsigned char *comment; /* pointer to zero-terminated comment or NULL */ - unsigned int comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used when writing a gzip file) */ -} gz_header; - -typedef gz_header *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. In that case, zlib is thread-safe. When zalloc and zfree are - Z_NULL on entry to the initialization function, they are set to internal - routines that use the standard library functions malloc() and free(). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use by the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field for deflate() */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL NULL /* for compatibility with zlib, was for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - - /* basic functions */ - -Z_EXTERN const char * Z_EXPORT zlibVersion(void); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -Z_EXTERN int Z_EXPORT deflateInit (z_stream *strm, int level); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to NULL, deflateInit updates them to use default - allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -Z_EXTERN int Z_EXPORT deflate(z_stream *strm, int flush); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary. Some output may be provided even if - flush is zero. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 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 - in that case. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed - codes block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this - function must be called again with Z_FINISH and more output space (updated - avail_out) but no more input data, until it returns with Z_STREAM_END or an - error. After deflate has returned Z_STREAM_END, the only possible operations - on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used in the first deflate call after deflateInit if all the - compression is to be done in a single step. In order to complete in one - call, avail_out must be at least the value returned by deflateBound (see - below). Then deflate is guaranteed to return Z_STREAM_END. If not enough - output space is provided, deflate will not return Z_STREAM_END, and it must - be called again as described above. - - deflate() sets strm->adler to the Adler-32 checksum of all input read - so far (that is, total_in bytes). If a gzip stream is being generated, then - strm->adler will be the CRC-32 checksum of the input read so far. (See - deflateInit2 below.) - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is - considered binary. This field is only for information purposes and does not - affect the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL) or the state was inadvertently written over - by the application), or Z_BUF_ERROR if no progress is possible (for example - avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and - deflate() can be called again with more input and more output space to - continue compressing. -*/ - - -Z_EXTERN int Z_EXPORT deflateEnd(z_stream *strm); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -Z_EXTERN int Z_EXPORT inflateInit (z_stream *strm); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. In the current version of inflate, the provided input is not - read or consumed. The allocation of a sliding window will be deferred to - the first call of inflate (if the decompression does not complete on the - first call). If zalloc and zfree are set to NULL, inflateInit updates - them to use default allocation functions. - - inflateInit 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 - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression. - Actual decompression will be done by inflate(). So next_in, and avail_in, - next_out, and avail_out are unused and unchanged. The current - implementation of inflateInit() does not process any header information -- - that is deferred until inflate() is called. -*/ - - -Z_EXTERN int Z_EXPORT inflate(z_stream *strm, int flush); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), then next_in and avail_in are updated - accordingly, and processing will resume at this point for the next call of - inflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. If the - caller of inflate() does not provide both available input and available - output space, it is possible that there will be no progress made. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate 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. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed Adler-32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained unless inflateGetHeader() is used. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - produced so far. The CRC-32 is checked against the gzip trailer, as is the - uncompressed length, modulo 2^32. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value, in which case strm->msg points to a string with a more specific - error), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was NULL, or the state was inadvertently written over - by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR - if no progress is possible or if there was not enough room in the output - buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is to be attempted. -*/ - - -Z_EXTERN int Z_EXPORT inflateEnd(z_stream *strm); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state - was inconsistent. -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -Z_EXTERN int Z_EXPORT deflateInit2 (z_stream *strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy); - - This is another version of deflateInit with more compression options. The - 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. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - For the current implementation of deflate(), a windowBits value of 8 (a - window size of 256 bytes) is not supported. As a result, a request for 8 - will result in 9 (a 512-byte window). In that case, providing 8 to - inflateInit2() will result in an error when the zlib header with 9 is - checked against the initialization of inflate(). The remedy is to not use 8 - with deflateInit2() with this initialization, or at least in that case use 9 - with inflateInit2(). - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute a check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to the appropriate value, - if the operating system was determined at compile time. If a gzip stream is - being written, strm->adler is a CRC-32 instead of an Adler-32. - - For raw deflate or gzip encoding, a request for a 256-byte window is - rejected as invalid, since only the zlib header provides a means of - transmitting the window size to the decompressor. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -Z_EXTERN int Z_EXPORT deflateSetDictionary(z_stream *strm, - const unsigned char *dictionary, - unsigned int dictLength); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the Adler-32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler-32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - Adler-32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ - -Z_EXTERN int Z_EXPORT deflateGetDictionary (z_stream *strm, unsigned char *dictionary, unsigned int *dictLength); -/* - Returns the sliding dictionary being maintained by deflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - 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. - - 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 - to 258 bytes less in that case, due to how zlib's implementation of deflate - manages the sliding window and lookahead for matches, where matches can be - up to 258 bytes long. If the application needs the last window-size bytes of - input, then that would need to be saved by the application outside of zlib. - - deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -Z_EXTERN int Z_EXPORT deflateCopy(z_stream *dest, z_stream *source); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -Z_EXTERN int Z_EXPORT deflateReset(z_stream *strm); -/* - This function is equivalent to deflateEnd followed by deflateInit, but - does not free and reallocate the internal compression state. The stream - will leave the compression level and any other attributes that may have been - set unchanged. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -Z_EXTERN int Z_EXPORT deflateParams(z_stream *strm, int level, int strategy); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2(). This can be - 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 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 - take effect. In this case, deflateParams() can be called again with the - same parameters and more output space to try again. - - In order to assure a change in the parameters on the first try, the - deflate stream should be flushed using deflate() with Z_BLOCK or other flush - request until strm.avail_out is not zero, before calling deflateParams(). - Then no more input data should be provided before the deflateParams() call. - If this is done, the old level and strategy will be applied to the data - compressed before deflateParams(), and the new level and strategy will be - applied to the the data compressed after deflateParams(). - - deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream - state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if - there was not enough output space to complete the compression of the - available input data before a change in the strategy or approach. Note that - in the case of a Z_BUF_ERROR, the parameters are not changed. A return - value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be - retried with more output space. -*/ - -Z_EXTERN int Z_EXPORT deflateTune(z_stream *strm, int good_length, int max_lazy, int nice_length, int max_chain); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -Z_EXTERN unsigned long Z_EXPORT deflateBound(z_stream *strm, unsigned long sourceLen); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. -*/ - -Z_EXTERN int Z_EXPORT deflatePending(z_stream *strm, uint32_t *pending, int *bits); -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. - */ - -Z_EXTERN int Z_EXPORT deflatePrime(z_stream *strm, int bits, int value); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ - -Z_EXTERN int Z_EXPORT deflateSetHeader(z_stream *strm, gz_headerp head); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not NULL, name and comment are terminated with - a zero byte, and that if extra is not NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -Z_EXTERN int Z_EXPORT inflateInit2(z_stream *strm, int windowBits); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an Adler-32 or a CRC-32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - 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 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 - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -Z_EXTERN int Z_EXPORT inflateSetDictionary(z_stream *strm, const unsigned char *dictionary, unsigned int dictLength); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler-32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler-32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -Z_EXTERN int Z_EXPORT inflateGetDictionary(z_stream *strm, unsigned char *dictionary, unsigned int *dictLength); -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -Z_EXTERN int Z_EXPORT inflateSync(z_stream *strm); -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. -*/ - -Z_EXTERN int Z_EXPORT inflateCopy(z_stream *dest, z_stream *source); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -Z_EXTERN int Z_EXPORT inflateReset(z_stream *strm); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -Z_EXTERN int Z_EXPORT inflateReset2(z_stream *strm, int windowBits); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. If the window size is changed, then the - memory allocated for the window is freed, and the window will be reallocated - by inflate() if needed. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL), or if - the windowBits parameter is invalid. -*/ - -Z_EXTERN int Z_EXPORT inflatePrime(z_stream *strm, int bits, int value); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -Z_EXTERN long Z_EXPORT inflateMark(z_stream *strm); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above, or -65536 if the provided - source stream state was inconsistent. -*/ - -Z_EXTERN int Z_EXPORT inflateGetHeader(z_stream *strm, gz_headerp head); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not NULL and the respective field is not - present in the header, then that field is set to NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -Z_EXTERN int Z_EXPORT inflateBackInit (z_stream *strm, int windowBits, unsigned char *window); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the parameters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef uint32_t (*in_func) (void *, z_const unsigned char * *); -typedef int (*out_func) (void *, unsigned char *, uint32_t); - -Z_EXTERN int Z_EXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out, void *out_desc); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the default - behavior of inflate(), which expects a zlib header and trailer around the - deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero -- buf is ignored in that - case -- and inflateBack() will return a buffer error. inflateBack() will - call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. - out() should return zero on success, or non-zero on failure. If out() - returns non-zero, inflateBack() will return with an error. Neither in() nor - out() are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is NULL, then in() will be called - immediately for input. If strm->next_in is not NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be NULL only if in() returned an error. If - strm->next_in is not NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -Z_EXTERN int Z_EXPORT inflateBackEnd(z_stream *strm); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -Z_EXTERN unsigned long Z_EXPORT zlibCompileFlags(void); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of unsigned int - 3.2: size of unsigned long - 5.4: size of void * (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: ZLIB_DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed (not supported by zlib-ng) - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ - -Z_EXTERN int Z_EXPORT compress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. compress() is equivalent to compress2() with a level - parameter of Z_DEFAULT_COMPRESSION. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -Z_EXTERN int Z_EXPORT compress2(unsigned char *dest, unsigned long *destLen, const unsigned char *source, - unsigned long sourceLen, int level); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -Z_EXTERN unsigned long Z_EXPORT compressBound(unsigned long sourceLen); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -Z_EXTERN int Z_EXPORT uncompress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed data. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ - - -Z_EXTERN int Z_EXPORT uncompress2 (unsigned char *dest, unsigned long *destLen, - const unsigned char *source, unsigned long *sourceLen); -/* - Same as uncompress, except that sourceLen is a pointer, where the - length of the source is *sourceLen. On return, *sourceLen is the number of - source bytes consumed. -*/ - - - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ - -/* -Z_EXTERN gzFile Z_EXPORT gzopen(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. - - "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 - reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ - -Z_EXTERN gzFile Z_EXPORT gzdopen(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. - - 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 - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -Z_EXTERN int Z_EXPORT gzbuffer(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). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -Z_EXTERN int Z_EXPORT gzsetparams(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. - - 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, - or Z_MEM_ERROR if there is a memory allocation error. -*/ - -Z_EXTERN int Z_EXPORT gzread(gzFile file, void *buf, unsigned len); -/* - Reads the given number of uncompressed bytes from the compressed file. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. If len is too large to fit in an int, - then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. -*/ - -Z_EXTERN size_t Z_EXPORT gzfread (void *buf, size_t size, 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. - - 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 - there was an error. gzerror() must be consulted if zero is returned in - order to determine if there was an error. If the multiplication of size and - nitems overflows, i.e. the product does not fit in a size_t, then nothing - is read, zero is returned, and the error state is set to Z_STREAM_ERROR. - - 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 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. -*/ - -Z_EXTERN int Z_EXPORT gzwrite(gzFile file, void const *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. -*/ - -Z_EXTERN size_t Z_EXPORT gzfwrite(void const *buf, size_t size, size_t nitems, gzFile file); -/* - gzfwrite() writes nitems items of size size from buf to file, duplicating - the interface of stdio's fwrite(), with size_t request and return types. - - gzfwrite() returns the number of full items written of size size, or zero - if there was an error. If the multiplication of size and nitems overflows, - i.e. the product does not fit in a size_t, then nothing is written, zero - is returned, and the error state is set to Z_STREAM_ERROR. -*/ - -Z_EXTERN int Z_EXPORTVA gzprintf(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 - 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() - because the secure snprintf() or vsnprintf() functions were not available. - This can be determined using zlibCompileFlags(). -*/ - -Z_EXTERN int Z_EXPORT gzputs(gzFile file, const char *s); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ - -Z_EXTERN char * Z_EXPORT gzgets(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. - - 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 - buf are indeterminate. -*/ - -Z_EXTERN int Z_EXPORT gzputc(gzFile file, int c); -/* - Writes c, converted to an unsigned char, into the compressed file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -Z_EXTERN int Z_EXPORT gzgetc(gzFile file); -/* - Reads one byte from the compressed 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 - points to has been clobbered or not. -*/ - -Z_EXTERN int Z_EXPORT gzungetc(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. - 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 - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ - -Z_EXTERN int Z_EXPORT gzflush(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. - - 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 - gzip stream will be started in the output. gzread() is able to read such - concatenated gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -/* -Z_EXTERN z_off_t Z_EXPORT gzseek (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 - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -Z_EXTERN int Z_EXPORT gzrewind(gzFile file); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -/* -Z_EXTERN z_off_t Z_EXPORT gztell(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(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -/* -Z_EXTERN z_off_t Z_EXPORT gzoffset(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. -*/ - -Z_EXTERN int Z_EXPORT gzeof(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. - - 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 - has grown since the previous end of file was detected. -*/ - -Z_EXTERN int Z_EXPORT gzdirect(gzFile file); -/* - Returns 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 - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ - -Z_EXTERN int Z_EXPORT gzclose(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 - 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. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ - -Z_EXTERN int Z_EXPORT gzclose_r(gzFile file); -Z_EXTERN int Z_EXPORT gzclose_w(gzFile file); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -Z_EXTERN const char * Z_EXPORT gzerror(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. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -Z_EXTERN void Z_EXPORT gzclearerr(gzFile file); -/* - Clears 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. -*/ - - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -Z_EXTERN unsigned long Z_EXPORT adler32(unsigned long adler, const unsigned char *buf, unsigned int len); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is 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. - - Usage example: - - uint32_t adler = adler32(0L, NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -Z_EXTERN unsigned long Z_EXPORT adler32_z(unsigned long adler, const unsigned char *buf, size_t len); -/* - Same as adler32(), but with a size_t length. -*/ - -/* -Z_EXTERN unsigned long Z_EXPORT adler32_combine(unsigned long adler1, unsigned long adler2, z_off_t len2); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ - -Z_EXTERN unsigned long Z_EXPORT crc32(unsigned long crc, const unsigned char *buf, unsigned int len); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is 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: - - uint32_t crc = crc32(0L, NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -Z_EXTERN unsigned long Z_EXPORT crc32_z(unsigned long crc, const unsigned char *buf, size_t len); -/* - Same as crc32(), but with a size_t length. -*/ - -/* -Z_EXTERN unsigned long Z_EXPORT crc32_combine(unsigned long crc1, unsigned long crc2, z_off64_t len2); - - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - -/* -Z_EXTERN void Z_EXPORT crc32_combine_gen(uint32_t op[32], z_off_t len2); - - Generate the operator op corresponding to length len2, to be used with - crc32_combine_op(). op must have room for 32 z_crc_t values. (32 is the - number of bits in the CRC.) -*/ - -Z_EXTERN uint32_t Z_EXPORT crc32_combine_op(uint32_t crc1, uint32_t crc2, - const uint32_t *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 many times. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -Z_EXTERN int Z_EXPORT deflateInit_(z_stream *strm, int level, const char *version, int stream_size); -Z_EXTERN int Z_EXPORT inflateInit_(z_stream *strm, const char *version, int stream_size); -Z_EXTERN int Z_EXPORT deflateInit2_(z_stream *strm, int level, int method, int windowBits, int memLevel, - int strategy, const char *version, int stream_size); -Z_EXTERN int Z_EXPORT inflateInit2_(z_stream *strm, int windowBits, const char *version, int stream_size); -Z_EXTERN int Z_EXPORT inflateBackInit_(z_stream *strm, int windowBits, unsigned char *window, - const char *version, int stream_size); -#define deflateInit(strm, level) deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateInit(strm) inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm), (level), (method), (windowBits), (memLevel), \ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateInit2(strm, windowBits) inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), ZLIB_VERSION, (int)sizeof(z_stream)) - - -/* gzgetc() macro and its supporting function and exposed data structure. Note - * that the real internal state is much larger than the exposed structure. - * This abbreviated structure exposes just enough for the gzgetc() macro. The - * user should not mess with these exposed elements, since their names or - * behavior could change in the future, perhaps even capriciously. They can - * only be used by the gzgetc() macro. You have been warned. - */ -struct gzFile_s { - unsigned have; - unsigned char *next; - z_off64_t pos; -}; -Z_EXTERN int Z_EXPORT gzgetc_(gzFile file); /* backward compatibility */ -# define gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) - -/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or - * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if - * both are true, the application gets the *64 functions, and the regular - * functions are changed to 64 bits) -- in case these are set on systems - * without large file support, _LFS64_LARGEFILE must also be true - */ -#ifdef Z_LARGE64 - Z_EXTERN gzFile Z_EXPORT gzopen64(const char *, const char *); - Z_EXTERN z_off64_t Z_EXPORT gzseek64(gzFile, z_off64_t, int); - Z_EXTERN z_off64_t Z_EXPORT gztell64(gzFile); - Z_EXTERN z_off64_t Z_EXPORT gzoffset64(gzFile); - Z_EXTERN unsigned long Z_EXPORT adler32_combine64(unsigned long, unsigned long, z_off64_t); - Z_EXTERN unsigned long Z_EXPORT crc32_combine64(unsigned long, unsigned long, z_off64_t); - Z_EXTERN void Z_EXPORT crc32_combine_gen64(uint32_t *op, z_off64_t); -#endif - -#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# define crc32_combine_gen crc32_combine_gen64 -# ifndef Z_LARGE64 - Z_EXTERN gzFile Z_EXPORT gzopen64(const char *, const char *); - Z_EXTERN z_off_t Z_EXPORT gzseek64(gzFile, z_off_t, int); - Z_EXTERN z_off_t Z_EXPORT gztell64(gzFile); - Z_EXTERN z_off_t Z_EXPORT gzoffset64(gzFile); - Z_EXTERN unsigned long Z_EXPORT adler32_combine64(unsigned long, unsigned long, z_off_t); - Z_EXTERN unsigned long Z_EXPORT crc32_combine64(unsigned long, unsigned long, z_off_t); - Z_EXTERN void Z_EXPORT crc32_combine_gen64(uint32_t *op, z_off64_t); -# endif -#else - Z_EXTERN gzFile Z_EXPORT gzopen(const char *, const char *); - Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int); - Z_EXTERN z_off_t Z_EXPORT gztell(gzFile); - Z_EXTERN z_off_t Z_EXPORT gzoffset(gzFile); - Z_EXTERN unsigned long Z_EXPORT adler32_combine(unsigned long, unsigned long, z_off_t); - Z_EXTERN unsigned long Z_EXPORT crc32_combine(unsigned long, unsigned long, z_off_t); - Z_EXTERN void Z_EXPORT crc32_combine_gen(uint32_t *op, z_off_t); -#endif - -/* undocumented functions */ -Z_EXTERN const char * Z_EXPORT zError (int); -Z_EXTERN int Z_EXPORT inflateSyncPoint (z_stream *); -Z_EXTERN const uint32_t * Z_EXPORT get_crc_table (void); -Z_EXTERN int Z_EXPORT inflateUndermine (z_stream *, int); -Z_EXTERN int Z_EXPORT inflateValidate (z_stream *, int); -Z_EXTERN unsigned long Z_EXPORT inflateCodesUsed (z_stream *); -Z_EXTERN int Z_EXPORT inflateResetKeep (z_stream *); -Z_EXTERN int Z_EXPORT deflateResetKeep (z_stream *); - -#if defined(_WIN32) - Z_EXTERN gzFile Z_EXPORT gzopen_w(const wchar_t *path, const char *mode); -#endif -Z_EXTERN int Z_EXPORTVA gzvprintf(gzFile file, const char *format, va_list va); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H_ */ diff --git a/libs/zlibng/zlib.map b/libs/zlibng/zlib.map deleted file mode 100644 index f608f2bd5..000000000 --- a/libs/zlibng/zlib.map +++ /dev/null @@ -1,100 +0,0 @@ -ZLIB_1.2.0 { - global: - compressBound; - deflateBound; - inflateBack; - inflateBackEnd; - inflateBackInit_; - inflateCopy; - local: - deflate_copyright; - inflate_copyright; - inflate_fast; - inflate_table; - zcalloc; - zcfree; - z_errmsg; - gz_error; - gz_intmax; - _*; -}; - -ZLIB_1.2.0.2 { - gzclearerr; - gzungetc; - zlibCompileFlags; -} ZLIB_1.2.0; - -ZLIB_1.2.0.8 { - deflatePrime; -} ZLIB_1.2.0.2; - -ZLIB_1.2.2 { - adler32_combine; - crc32_combine; - deflateSetHeader; - inflateGetHeader; -} ZLIB_1.2.0.8; - -ZLIB_1.2.2.3 { - deflateTune; - gzdirect; -} ZLIB_1.2.2; - -ZLIB_1.2.2.4 { - inflatePrime; -} ZLIB_1.2.2.3; - -ZLIB_1.2.3.3 { - adler32_combine64; - crc32_combine64; - gzopen64; - gzseek64; - gztell64; - inflateUndermine; -} ZLIB_1.2.2.4; - -ZLIB_1.2.3.4 { - inflateReset2; - inflateMark; -} ZLIB_1.2.3.3; - -ZLIB_1.2.3.5 { - gzbuffer; - gzoffset; - gzoffset64; - gzclose_r; - gzclose_w; -} ZLIB_1.2.3.4; - -ZLIB_1.2.5.1 { - deflatePending; -} ZLIB_1.2.3.5; - -ZLIB_1.2.5.2 { - deflateResetKeep; - gzgetc_; - inflateResetKeep; -} ZLIB_1.2.5.1; - -ZLIB_1.2.7.1 { - inflateGetDictionary; - gzvprintf; -} ZLIB_1.2.5.2; - -ZLIB_1.2.9 { - inflateCodesUsed; - inflateValidate; - uncompress2; - gzfread; - gzfwrite; - deflateGetDictionary; - 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/libs/zlibng/zlib.pc.cmakein b/libs/zlibng/zlib.pc.cmakein deleted file mode 100644 index 9b64252dc..000000000 --- a/libs/zlibng/zlib.pc.cmakein +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=${prefix} -libdir=@PC_LIB_INSTALL_DIR@ -sharedlibdir=${libdir} -includedir=@PC_INC_INSTALL_DIR@ - -Name: zlib@SUFFIX@ -Description: zlib-ng compression library -Version: @ZLIB_FULL_VERSION@ - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz@SUFFIX@ -Cflags: -I${includedir} diff --git a/libs/zlibng/zlib.pc.in b/libs/zlibng/zlib.pc.in deleted file mode 100644 index d0a6766b5..000000000 --- a/libs/zlibng/zlib.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -sharedlibdir=@sharedlibdir@ -includedir=@includedir@ - -Name: zlib@SUFFIX@ -Description: zlib-ng compression library -Version: @VERSION@ - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz@SUFFIX@ -Cflags: -I${includedir} diff --git a/libs/zlibng/zutil.c b/libs/zlibng/zutil.c deleted file mode 100644 index ba36e93f9..000000000 --- a/libs/zlibng/zutil.c +++ /dev/null @@ -1,111 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2017 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zbuild.h" -#include "zutil.h" -#include "zutil_p.h" - -z_const char * const PREFIX(z_errmsg)[10] = { - (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ - (z_const char *)"stream end", /* Z_STREAM_END 1 */ - (z_const char *)"", /* Z_OK 0 */ - (z_const char *)"file error", /* Z_ERRNO (-1) */ - (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */ - (z_const char *)"data error", /* Z_DATA_ERROR (-3) */ - (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */ - (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */ - (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */ - (z_const char *)"" -}; - -const char zlibng_string[] = - " zlib-ng 2.0.0-RC2 forked from zlib"; - -#ifdef ZLIB_COMPAT -const char * Z_EXPORT zlibVersion(void) { - return ZLIB_VERSION; -} -#endif - -const char * Z_EXPORT zlibng_version(void) { - return ZLIBNG_VERSION; -} - -unsigned long Z_EXPORT PREFIX(zlibCompileFlags)(void) { - unsigned long flags; - - flags = 0; - switch ((int)(sizeof(unsigned int))) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch ((int)(sizeof(unsigned long))) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch ((int)(sizeof(void *))) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch ((int)(sizeof(z_off_t))) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef ZLIB_DEBUG - flags += 1 << 8; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif - /* Bit 13 reserved for DYNAMIC_CRC_TABLE */ -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif - return flags; -} - -#ifdef ZLIB_DEBUG -# include -# ifndef verbose -# define verbose 0 -# endif -int Z_INTERNAL z_verbose = verbose; - -void Z_INTERNAL z_error(char *m) { - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * Z_EXPORT PREFIX(zError)(int err) { - return ERR_MSG(err); -} - -void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size) { - (void)opaque; - return zng_alloc((size_t)items * (size_t)size); -} - -void Z_INTERNAL zng_cfree(void *opaque, void *ptr) { - (void)opaque; - zng_free(ptr); -} diff --git a/libs/zlibng/zutil.h b/libs/zlibng/zutil.h deleted file mode 100644 index 497cb22b4..000000000 --- a/libs/zlibng/zutil.h +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef ZUTIL_H_ -#define ZUTIL_H_ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -#if defined(HAVE_VISIBILITY_INTERNAL) -# define Z_INTERNAL __attribute__((visibility ("internal"))) -#elif defined(HAVE_VISIBILITY_HIDDEN) -# define Z_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define Z_INTERNAL -#endif - -#ifndef __cplusplus -# define Z_REGISTER register -#else -# define Z_REGISTER -#endif - -#ifndef Z_TLS -# define Z_TLS -#endif - -#include -#include -#include -#include -#ifdef ZLIB_COMPAT -# include "zlib.h" -#else -# include "zlib-ng.h" -#endif -#include "zbuild.h" - -typedef unsigned char uch; /* Included for compatibility with external code only */ -typedef uint16_t ush; /* Included for compatibility with external code only */ -typedef unsigned long ulg; - -extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) PREFIX(z_errmsg)[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - -#define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */ - - /* target dependencies */ - -#ifdef AMIGA -# define OS_CODE 1 -#endif - -#ifdef __370__ -# if __TARGET_LIB__ < 0x20000000 -# define OS_CODE 4 -# elif __TARGET_LIB__ < 0x40000000 -# define OS_CODE 11 -# else -# define OS_CODE 8 -# endif -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 5 -#endif - -#ifdef OS2 -# define OS_CODE 6 -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 7 -#endif - -#ifdef __acorn -# define OS_CODE 13 -#endif - -#if defined(_WIN32) && !defined(__CYGWIN__) -# define OS_CODE 10 -#endif - -#ifdef __APPLE__ -# define OS_CODE 19 -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# define fdopen(fd, type) _fdopen(fd, type) -#endif - -/* MS Visual Studio does not allow inline in C, only C++. - But it provides __inline instead, so use that. */ -#if defined(_MSC_VER) && !defined(inline) && !defined(__cplusplus) -# define inline __inline -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 3 /* assume Unix */ -#endif - - /* functions */ - -/* Diagnostic functions */ -#ifdef ZLIB_DEBUG -# include - extern int Z_INTERNAL z_verbose; - extern void Z_INTERNAL z_error(char *m); -# define Assert(cond, msg) {if (!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose >= 0) fprintf x;} -# define Tracev(x) {if (z_verbose > 0) fprintf x;} -# define Tracevv(x) {if (z_verbose > 1) fprintf x;} -# define Tracec(c, x) {if (z_verbose > 0 && (c)) fprintf x;} -# define Tracecv(c, x) {if (z_verbose > 1 && (c)) fprintf x;} -#else -# define Assert(cond, msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c, x) -# define Tracecv(c, x) -#endif - -void Z_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size); -void Z_INTERNAL zng_cfree(void *opaque, void *ptr); - -#define ZALLOC(strm, items, size) (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (void *)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -/* Reverse the bytes in a value. Use compiler intrinsics when - possible to take advantage of hardware implementations. */ -#if defined(_MSC_VER) && (_MSC_VER >= 1300) -# pragma intrinsic(_byteswap_ulong) -# define ZSWAP16(q) _byteswap_ushort(q) -# define ZSWAP32(q) _byteswap_ulong(q) -# define ZSWAP64(q) _byteswap_uint64(q) - -#elif defined(__Clang__) || (defined(__GNUC__) && \ - (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))) -# define ZSWAP16(q) __builtin_bswap16(q) -# define ZSWAP32(q) __builtin_bswap32(q) -# define ZSWAP64(q) __builtin_bswap64(q) - -#elif defined(__GNUC__) && (__GNUC__ >= 2) && defined(__linux__) -# include -# define ZSWAP16(q) bswap_16(q) -# define ZSWAP32(q) bswap_32(q) -# define ZSWAP64(q) bswap_64(q) - -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -# include -# define ZSWAP16(q) bswap16(q) -# define ZSWAP32(q) bswap32(q) -# define ZSWAP64(q) bswap64(q) - -#elif defined(__INTEL_COMPILER) -/* ICC does not provide a two byte swap. */ -# define ZSWAP16(q) ((((q) & 0xff) << 8) | (((q) & 0xff00) >> 8)) -# define ZSWAP32(q) _bswap(q) -# define ZSWAP64(q) _bswap64(q) - -#else -# define ZSWAP16(q) ((((q) & 0xff) << 8) | (((q) & 0xff00) >> 8)) -# define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) -# define ZSWAP64(q) \ - ((q & 0xFF00000000000000u) >> 56u) | \ - ((q & 0x00FF000000000000u) >> 40u) | \ - ((q & 0x0000FF0000000000u) >> 24u) | \ - ((q & 0x000000FF00000000u) >> 8u) | \ - ((q & 0x00000000FF000000u) << 8u) | \ - ((q & 0x0000000000FF0000u) << 24u) | \ - ((q & 0x000000000000FF00u) << 40u) | \ - ((q & 0x00000000000000FFu) << 56u) -#endif - -/* Only enable likely/unlikely if the compiler is known to support it */ -#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__INTEL_COMPILER) || defined(__Clang__) -# define LIKELY_NULL(x) __builtin_expect((x) != 0, 0) -# define LIKELY(x) __builtin_expect(!!(x), 1) -# define UNLIKELY(x) __builtin_expect(!!(x), 0) -# define PREFETCH_L1(addr) __builtin_prefetch(addr, 0, 3) -# define PREFETCH_L2(addr) __builtin_prefetch(addr, 0, 2) -# define PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 2) -#elif defined(__WIN__) -# include -# define LIKELY_NULL(x) x -# define LIKELY(x) x -# define UNLIKELY(x) x -# define PREFETCH_L1(addr) _mm_prefetch((char *) addr, _MM_HINT_T0) -# define PREFETCH_L2(addr) _mm_prefetch((char *) addr, _MM_HINT_T1) -# define PREFETCH_RW(addr) _mm_prefetch((char *) addr, _MM_HINT_T1) -#else -# define LIKELY_NULL(x) x -# define LIKELY(x) x -# define UNLIKELY(x) x -# define PREFETCH_L1(addr) addr -# define PREFETCH_L2(addr) addr -# define PREFETCH_RW(addr) addr -#endif /* (un)likely */ - -#if defined(_MSC_VER) -# define ALIGNED_(x) __declspec(align(x)) -#else -# if defined(__GNUC__) -# define ALIGNED_(x) __attribute__ ((aligned(x))) -# endif -#endif - -#if defined(X86_FEATURES) -# include "arch/x86/x86.h" -#elif defined(ARM_FEATURES) -# include "arch/arm/arm.h" -#elif defined(POWER_FEATURES) -# include "arch/power/power.h" -#endif - -#endif /* ZUTIL_H_ */ diff --git a/libs/zlibng/zutil_p.h b/libs/zlibng/zutil_p.h deleted file mode 100644 index a5f2e525d..000000000 --- a/libs/zlibng/zutil_p.h +++ /dev/null @@ -1,34 +0,0 @@ -/* zutil_p.h -- Private inline functions used internally in zlib-ng - * - */ - -#ifndef ZUTIL_P_H -#define ZUTIL_P_H - -#ifdef __APPLE__ -# include -#else -# include -#endif - -/* Function to allocate 16 or 64-byte aligned memory */ -static inline void *zng_alloc(size_t size) { -#if defined(_WIN32) - return (void *)_aligned_malloc(size, 64); -#elif defined(__APPLE__) - return (void *)malloc(size); /* MacOS always aligns to 16 bytes */ -#else - return (void *)memalign(64, size); -#endif -} - -/* Function that can free aligned memory */ -static inline void zng_free(void *ptr) { -#if defined(_WIN32) - _aligned_free(ptr); -#else - free(ptr); -#endif -} - -#endif From 3f8746d33cab390ed7649e311a93541c0ad7f30c Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 22 Nov 2025 22:34:32 -0800 Subject: [PATCH 18/44] More cleanup --- client_files/CMakeLists.txt | 2 +- client_files/export/CMakeLists.txt | 14 ++++----- client_files/import/CMakeLists.txt | 14 ++++----- eqlaunch/CMakeLists.txt | 14 ++++----- loginserver/CMakeLists.txt | 14 ++++----- queryserv/CMakeLists.txt | 16 +++++----- shared_memory/CMakeLists.txt | 14 ++++----- tests/CMakeLists.txt | 50 +++++++++++++++--------------- tests/cppunit/CMakeLists.txt | 16 +++++----- ucs/CMakeLists.txt | 17 +++++----- world/CMakeLists.txt | 20 ++++++------ zone/CMakeLists.txt | 20 ++++++------ 12 files changed, 106 insertions(+), 105 deletions(-) diff --git a/client_files/CMakeLists.txt b/client_files/CMakeLists.txt index d4b5962e3..2fec654cf 100644 --- a/client_files/CMakeLists.txt +++ b/client_files/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.5) +cmake_minimum_required(VERSION 3.20) add_subdirectory(import) add_subdirectory(export) diff --git a/client_files/export/CMakeLists.txt b/client_files/export/CMakeLists.txt index 985a18b79..a127963b6 100644 --- a/client_files/export/CMakeLists.txt +++ b/client_files/export/CMakeLists.txt @@ -1,16 +1,16 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -SET(export_sources +set(export_sources main.cpp ) -SET(export_headers +set(export_headers ) -ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers}) +add_executable(export_client_files ${export_sources} ${export_headers}) -INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -TARGET_LINK_LIBRARIES(export_client_files ${SERVER_LIBS}) +target_link_libraries(export_client_files ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/client_files/import/CMakeLists.txt b/client_files/import/CMakeLists.txt index 673f6ec7f..2643090af 100644 --- a/client_files/import/CMakeLists.txt +++ b/client_files/import/CMakeLists.txt @@ -1,16 +1,16 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -SET(import_sources +set(import_sources main.cpp ) -SET(import_headers +set(import_headers ) -ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers}) +add_executable(import_client_files ${import_sources} ${import_headers}) -INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -TARGET_LINK_LIBRARIES(import_client_files ${SERVER_LIBS}) +target_link_libraries(import_client_files ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 4fde2c222..f0cdc987d 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -1,20 +1,20 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) -SET(eqlaunch_sources +set(eqlaunch_sources eqlaunch.cpp worldserver.cpp zone_launch.cpp ) -SET(eqlaunch_headers +set(eqlaunch_headers worldserver.h zone_launch.h ) -ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) +add_executable(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) -INSTALL(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -TARGET_LINK_LIBRARIES(eqlaunch ${SERVER_LIBS}) +target_link_libraries(eqlaunch ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 5f2b43248..67729481b 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) -SET(eqlogin_sources +set(eqlogin_sources account_management.cpp client.cpp client_manager.cpp @@ -12,7 +12,7 @@ SET(eqlogin_sources world_server.cpp ) -SET(eqlogin_headers +set(eqlogin_headers account_management.h client.h client_manager.h @@ -26,10 +26,10 @@ SET(eqlogin_headers world_server.h ) -ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers}) +add_executable(loginserver ${eqlogin_sources} ${eqlogin_headers}) -INSTALL(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -TARGET_LINK_LIBRARIES(loginserver ${SERVER_LIBS}) +target_link_libraries(loginserver ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 82613065a..093fa0bc1 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) -SET(qserv_sources +set(qserv_sources database.cpp lfguild.cpp queryserv.cpp @@ -10,7 +10,7 @@ SET(qserv_sources zoneserver.cpp ) -SET(qserv_headers +set(qserv_headers database.h lfguild.h queryservconfig.h @@ -19,12 +19,12 @@ SET(qserv_headers zoneserver.h ) -ADD_EXECUTABLE(queryserv ${qserv_sources} ${qserv_headers}) +add_executable(queryserv ${qserv_sources} ${qserv_headers}) -INSTALL(TARGETS queryserv RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS queryserv RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -ADD_DEFINITIONS(-DQSERV) +add_definitions(-DQSERV) -TARGET_LINK_LIBRARIES(queryserv ${SERVER_LIBS}) +target_link_libraries(queryserv ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 7c62403bd..92e8d17d6 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -1,20 +1,20 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.17.0) -SET(shared_memory_sources +set(shared_memory_sources items.cpp main.cpp spells.cpp ) -SET(shared_memory_headers +set(shared_memory_headers items.h spells.h ) -ADD_EXECUTABLE(shared_memory ${shared_memory_sources} ${shared_memory_headers}) +add_executable(shared_memory ${shared_memory_sources} ${shared_memory_headers}) -INSTALL(TARGETS shared_memory RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS shared_memory RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -TARGET_LINK_LIBRARIES(shared_memory ${SERVER_LIBS}) +target_link_libraries(shared_memory ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2310d765a..e38dc7066 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,12 +1,12 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -ADD_SUBDIRECTORY(cppunit) +add_subdirectory(cppunit) -SET(tests_sources +set(tests_sources main.cpp ) -SET(tests_headers +set(tests_headers atobool_test.h data_verification_test.h fixed_memory_test.h @@ -19,30 +19,30 @@ SET(tests_headers task_state_test.h ) -ADD_EXECUTABLE(tests ${tests_sources} ${tests_headers}) +add_executable(tests ${tests_sources} ${tests_headers}) -TARGET_LINK_LIBRARIES(tests common cppunit ${SERVER_LIBS}) +target_link_libraries(tests common cppunit ${SERVER_LIBS}) -INSTALL(TARGETS tests RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS tests RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -IF(MSVC) - SET_TARGET_PROPERTIES(tests PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") - TARGET_LINK_LIBRARIES(tests "Ws2_32.lib") -ENDIF(MSVC) +if(MSVC) + set_target_properties(tests PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF") + target_link_libraries(tests "Ws2_32.lib") +endif() -IF(MINGW) - TARGET_LINK_LIBRARIES(tests "WS2_32") -ENDIF(MINGW) +if(MINGW) + target_link_libraries(tests "WS2_32") +endif() -IF(UNIX) - TARGET_LINK_LIBRARIES(tests "${CMAKE_DL_LIBS}") - TARGET_LINK_LIBRARIES(tests "z") - TARGET_LINK_LIBRARIES(tests "m") - IF(NOT DARWIN) - TARGET_LINK_LIBRARIES(tests "rt") - ENDIF(NOT DARWIN) - TARGET_LINK_LIBRARIES(tests "pthread") - ADD_DEFINITIONS(-fPIC) -ENDIF(UNIX) +if(UNIX) + target_link_libraries(tests "${CMAKE_DL_LIBS}") + target_link_libraries(tests "z") + target_link_libraries(tests "m") + if(NOT DARWIN) + target_link_libraries(tests "rt") + endif() + target_link_libraries(tests "pthread") + add_definitions(-fPIC) +endif() -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/tests/cppunit/CMakeLists.txt b/tests/cppunit/CMakeLists.txt index e8f602d82..a6f82df87 100644 --- a/tests/cppunit/CMakeLists.txt +++ b/tests/cppunit/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.17.0) +cmake_minimum_required(VERSION 3.20.0) -SET(cppunit_sources +set(cppunit_sources collectoroutput.cpp compileroutput.cpp htmloutput.cpp @@ -12,7 +12,7 @@ SET(cppunit_sources utils.cpp ) -SET(cppunit_headers +set(cppunit_headers cpptest-assert.h cpptest-collectoroutput.h cpptest-compileroutput.h @@ -28,11 +28,11 @@ SET(cppunit_headers winconfig.h ) -ADD_LIBRARY(cppunit ${cppunit_sources} ${cppunit_headers}) +add_library(cppunit ${cppunit_sources} ${cppunit_headers}) -IF(UNIX) - ADD_DEFINITIONS(-fPIC) -ENDIF(UNIX) +if(UNIX) + add_definitions(-fPIC) +endif() -SET(LIBRARY_OUTPUT_PATH ../../bin) +set(LIBRARY_OUTPUT_PATH ../../bin) diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 660d168d8..e4238b0dd 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -1,5 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) -SET(ucs_sources +cmake_minimum_required(VERSION 3.20) + +set(ucs_sources chatchannel.cpp clientlist.cpp database.cpp @@ -8,7 +9,7 @@ SET(ucs_sources worldserver.cpp ) -SET(ucs_headers +set(ucs_headers chatchannel.h clientlist.h database.h @@ -16,12 +17,12 @@ SET(ucs_headers worldserver.h ) -ADD_EXECUTABLE(ucs ${ucs_sources} ${ucs_headers}) +add_executable(ucs ${ucs_sources} ${ucs_headers}) -INSTALL(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -ADD_DEFINITIONS(-DUCS) +add_definitions(-DUCS) -TARGET_LINK_LIBRARIES(ucs ${SERVER_LIBS}) +target_link_libraries(ucs ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index 1963c83ae..273a0a375 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) -SET(world_sources +set(world_sources adventure.cpp adventure_manager.cpp client.cpp @@ -35,7 +35,7 @@ SET(world_sources zoneserver.cpp ) -SET(world_headers +set(world_headers adventure.h adventure_manager.h adventure_template.h @@ -72,16 +72,16 @@ SET(world_headers zoneserver.h ) -ADD_EXECUTABLE(world ${world_sources} ${world_headers}) +add_executable(world ${world_sources} ${world_headers}) -INSTALL(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) +install(TARGETS world RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -IF (WIN32 AND EQEMU_BUILD_PCH) +if(WIN32 AND EQEMU_BUILD_PCH) TARGET_PRECOMPILE_HEADERS(world PRIVATE ../common/pch/std-pch.h) -ENDIF () +endif() -ADD_DEFINITIONS(-DWORLD) +add_definitions(-DWORLD) -TARGET_LINK_LIBRARIES(world ${SERVER_LIBS}) +target_link_libraries(world ${SERVER_LIBS}) -SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 6e1cb4743..2edc24992 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -1,6 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.12) +cmake_minimum_required(VERSION 3.20) -SET(zone_sources +set(zone_sources aa.cpp aa_ability.cpp aggro.cpp @@ -121,7 +121,7 @@ SET(zone_sources zoning.cpp ) -SET(zone_headers +set(zone_headers aa.h aa_ability.h aggromanager.h @@ -476,24 +476,24 @@ target_link_libraries(gm_commands_zone PRIVATE cereal::cereal fmt::fmt $ Date: Sat, 22 Nov 2025 22:51:10 -0800 Subject: [PATCH 19/44] vcpkg baseline set for CI --- vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/vcpkg.json b/vcpkg.json index bdcf7d247..fe43a3f01 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,7 @@ { "name": "eqemu", "version-string": "24.10.3", + "builtin-baseline": "d1ff36c6520ee43f1a656c03cd6425c2974a449e", "dependencies": [ "boost-dynamic-bitset", "boost-foreach", From 64329f3e59264b0d53f716c260331103db507c02 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 22 Nov 2025 23:24:45 -0800 Subject: [PATCH 20/44] Remove pkg-config, it's the suggested way to use luajit with vcpkg but it causes issues with CI and might be a pain point for windows users --- CMakeLists.txt | 9 +++++---- libs/luabind/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fd5ee965..a3c37979c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.20.0) +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH}) + if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) message(STATUS "Using vcpkg env variable") set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") @@ -77,7 +79,6 @@ add_definitions(-DGLM_FORCE_RADIANS) add_definitions(-DGLM_FORCE_CTOR_INIT) add_definitions(-DGLM_ENABLE_EXPERIMENTAL) -find_package(PkgConfig) find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple) find_package(cereal CONFIG REQUIRED) find_package(fmt CONFIG REQUIRED) @@ -87,7 +88,7 @@ find_package(libuv CONFIG REQUIRED) find_package(OpenSSL REQUIRED) find_package(recastnavigation CONFIG REQUIRED) find_package(ZLIB REQUIRED) -pkg_check_modules(luajit REQUIRED IMPORTED_TARGET luajit) +find_package(LuaJit REQUIRED) find_package(PerlLibs) message(STATUS "**************************************************") @@ -218,8 +219,8 @@ option(EQEMU_BUILD_LUA "Build Lua parser." ON) if(EQEMU_BUILD_LUA) add_definitions(-DLUA_EQEMU) - #set(ZONE_LIBS ${pkgcfg_lib_luajit_lua51}) - include_directories(SYSTEM "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/luajit" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") + + include_directories(SYSTEM "${LUAJIT_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") option(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) if(EQEMU_SANITIZE_LUA_LIBS) diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index 3cbac5341..982e7b7b5 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -25,7 +25,7 @@ set(lb_headers ) add_library(luabind ${lb_sources} ${lb_headers}) -target_link_libraries(luabind PRIVATE PkgConfig::luajit Boost::dynamic_bitset Boost::tuple Boost::foreach) +target_link_libraries(luabind PRIVATE Boost::dynamic_bitset Boost::tuple Boost::foreach ${LUAJIT_LIBRARY}) if(UNIX) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) From f4717b8414309b595a56513b52bbb6a446531ac2 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 22 Nov 2025 23:41:58 -0800 Subject: [PATCH 21/44] Actually add file --- cmake/FindLuaJit.cmake | 90 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 cmake/FindLuaJit.cmake diff --git a/cmake/FindLuaJit.cmake b/cmake/FindLuaJit.cmake new file mode 100644 index 000000000..188074339 --- /dev/null +++ b/cmake/FindLuaJit.cmake @@ -0,0 +1,90 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. +# Modified from the FindLua51 that comes with CMake + +#[=======================================================================[.rst: +FindLuaJit +--------- + + + +Locate LuaJit library This module defines + +:: + + LUAJIT_FOUND, if false, do not try to link to Lua + LUAJIT_LIBRARIES + LUAJIT_INCLUDE_DIR, where to find lua.h + LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8) + + + +Note that the expected include convention is + +:: + + #include "lua.h" + +and not + +:: + + #include + +This is because, the lua location is not standardized and may exist in +locations other than lua/ +#]=======================================================================] + +find_path(LUAJIT_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(LUAJIT_LIBRARY + NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51 + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) + +if(LUAJIT_LIBRARY) + # include the math library for Unix + if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU) + find_library(LUAJIT_MATH_LIBRARY m) + set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + else() + set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() + +if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") + + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit + REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR + VERSION_VAR LUAJIT_VERSION_STRING) + +mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY) From 587422bdc16c07639471c75b66680071c1f355bb Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 23 Nov 2025 13:54:01 -0800 Subject: [PATCH 22/44] Set perlbind include dir --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3c37979c..aa73baedb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,7 +232,7 @@ if(PERL_LIBRARY_ENABLED) option(EQEMU_BUILD_PERL "Build Perl parser." ON) if(EQEMU_BUILD_PERL) set(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) - INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}") + INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}" "${CMAKE_CURRENT_SOURCE_DIR}/libs/perlbind/include") add_definitions(-DEMBPERL) add_definitions(-DEMBPERL_PLUGIN) add_definitions(-DPERLBIND_NO_STRICT_SCALAR_TYPES) From e544f72da045013c66b4fca83b2597f229fb96d9 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 23 Nov 2025 21:37:37 -0800 Subject: [PATCH 23/44] Perl link got lost --- zone/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 2edc24992..feac2f134 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -501,7 +501,7 @@ if (EQEMU_BUILD_STATIC AND LUA_LIBRARY) endif() # perl unity build links against perl_zone -target_link_libraries(perl_zone PRIVATE perlbind fmt::fmt unofficial::libmariadb) +target_link_libraries(perl_zone PRIVATE perlbind fmt::fmt unofficial::libmariadb ${PERL_LIBRARY_LIBS}) if (EQEMU_BUILD_STATIC AND PERL_LIBRARY) target_link_libraries(zone PRIVATE ${PERL_LIBRARY}) endif() From 42a3780d80c015887beaa0e2b747f151f0e8ce7f Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 23 Nov 2025 23:57:06 -0800 Subject: [PATCH 24/44] PERL_SET_INTERP causes an issue on newer versions of perl on windows because a symbol is not properly exported in their API, change the lines so it's basically what it used to be --- zone/embperl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zone/embperl.cpp b/zone/embperl.cpp index b48c714e3..75bc1793c 100644 --- a/zone/embperl.cpp +++ b/zone/embperl.cpp @@ -75,15 +75,15 @@ void Embperl::DoInit() throw "Failed to init Perl (perl_alloc)"; } PERL_SET_CONTEXT(my_perl); - PERL_SET_INTERP(my_perl); + PL_curinterp = (PerlInterpreter*)(my_perl); PL_perl_destruct_level = 1; perl_construct(my_perl); perl_parse(my_perl, xs_init, argc, argv, nullptr); perl_run(my_perl); - + //a little routine we use a lot. eval_pv("sub my_eval { eval $_[0];}", TRUE); //dies on error - + //ruin the perl exit and command: eval_pv("sub my_exit {}", TRUE); eval_pv("sub my_sleep {}", TRUE); @@ -95,7 +95,7 @@ void Embperl::DoInit() GvCV_set(sleepgp, perl_get_cv("my_sleep", TRUE)); //dies on error GvIMPORTED_CV_on(sleepgp); } - + //declare our file eval routine. try { init_eval_file(); @@ -181,7 +181,7 @@ Embperl::~Embperl() void Embperl::Reinit() { PERL_SET_CONTEXT(my_perl); - PERL_SET_INTERP(my_perl); + PL_curinterp = (PerlInterpreter*)(my_perl); PL_perl_destruct_level = 1; perl_destruct(my_perl); perl_free(my_perl); From f64e29433e0885c2e6b0ee5e280464bcc0b85680 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 24 Nov 2025 10:13:25 -0800 Subject: [PATCH 25/44] Remove static unix linking, we dont do automated released anymore and this was tightly coupled to that. Can explore this again if we decide to change that. --- CMakeLists.txt | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa73baedb..bbc4b0bfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,22 +20,8 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -option(EQEMU_BUILD_STATIC "Build with static linking" OFF) option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) -if(EQEMU_BUILD_STATIC) - set(BUILD_SHARED_LIBS OFF) - set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") - message(STATUS "Building with static linking") - set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") - if(UNIX) - set(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so") - set(PERL_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/") - set(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl") - endif() -endif() - - # Requires libgoogle-perftools-dev google-perftools packages for linux (debian) if(EQEMU_ADD_PROFILER) set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") @@ -236,9 +222,6 @@ if(PERL_LIBRARY_ENABLED) add_definitions(-DEMBPERL) add_definitions(-DEMBPERL_PLUGIN) add_definitions(-DPERLBIND_NO_STRICT_SCALAR_TYPES) - if(UNIX AND EQEMU_BUILD_STATIC) - set(SERVER_LIBS ${SERVER_LIBS} libcrypt.a) - endif() endif() endif() From b2618569171c3150c16e019dcd84122aee440a6c Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 25 Nov 2025 20:05:28 -0800 Subject: [PATCH 26/44] Remove unused submodules, set cmake policy for boost --- .gitmodules | 15 --------------- CMakeLists.txt | 5 +++++ submodules/cereal | 1 - submodules/fmt | 1 - submodules/glm | 1 - submodules/libuv | 1 - submodules/recastnavigation | 1 - 7 files changed, 5 insertions(+), 20 deletions(-) delete mode 160000 submodules/cereal delete mode 160000 submodules/fmt delete mode 160000 submodules/glm delete mode 160000 submodules/libuv delete mode 160000 submodules/recastnavigation diff --git a/.gitmodules b/.gitmodules index e032eabac..b7f3564e5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,6 @@ -[submodule "submodules/glm"] - path = submodules/glm - url = https://github.com/g-truc/glm.git -[submodule "submodules/fmt"] - path = submodules/fmt - url = https://github.com/fmtlib/fmt.git -[submodule "submodules/libuv"] - path = submodules/libuv - url = https://github.com/libuv/libuv.git -[submodule "submodules/cereal"] - path = submodules/cereal - url = https://github.com/USCiLab/cereal.git [submodule "submodules/websocketpp"] path = submodules/websocketpp url = https://github.com/zaphoyd/websocketpp.git -[submodule "submodules/recastnavigation"] - path = submodules/recastnavigation - url = https://github.com/EQEmu/recastnavigation.git [submodule "submodules/vcpkg"] path = submodules/vcpkg url = https://github.com/microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index bbc4b0bfd..0a6828c74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,11 @@ endif() project(EQEmu) +#explicitly set CMP0167 for Find Boost +if(POLICY CMP0167) + cmake_policy(SET CMP0167 NEW) +endif() + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) endif() diff --git a/submodules/cereal b/submodules/cereal deleted file mode 160000 index ebef1e929..000000000 --- a/submodules/cereal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ebef1e929807629befafbb2918ea1a08c7194554 diff --git a/submodules/fmt b/submodules/fmt deleted file mode 160000 index e69e5f977..000000000 --- a/submodules/fmt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e69e5f977d458f2650bb346dadf2ad30c5320281 diff --git a/submodules/glm b/submodules/glm deleted file mode 160000 index 9749727c2..000000000 --- a/submodules/glm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9749727c2db4742369219e1d452f43e918734b4e diff --git a/submodules/libuv b/submodules/libuv deleted file mode 160000 index 8fb9cb919..000000000 --- a/submodules/libuv +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8fb9cb919489a48880680a56efecff6a7dfb4504 diff --git a/submodules/recastnavigation b/submodules/recastnavigation deleted file mode 160000 index 710dabee7..000000000 --- a/submodules/recastnavigation +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 710dabee701710431938c92d2348849a072f4e27 From aee5be9f189820deb61665d5a52da3fb0a00a29a Mon Sep 17 00:00:00 2001 From: KimLS Date: Thu, 4 Dec 2025 19:53:31 -0800 Subject: [PATCH 27/44] Fix some cereal includes --- common/eq_packet_structs.h | 6 +++--- common/patches/uf.cpp | 2 +- common/repositories/trader_repository.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index 0a1349254..cb0cc7732 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -23,9 +23,9 @@ #include #include #include -#include "../cereal/include/cereal/archives/binary.hpp" -#include "../cereal/include/cereal/types/string.hpp" -#include "../cereal/include/cereal/types/vector.hpp" +#include +#include +#include #include "../common/version.h" #include "emu_constants.h" #include "textures.h" diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 6433621f5..c414b3353 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -38,7 +38,7 @@ #include "../raid.h" #include "../guilds.h" //#include "../repositories/trader_repository.h" -#include "../cereal/include/cereal/types/vector.hpp" +#include #include #include diff --git a/common/repositories/trader_repository.h b/common/repositories/trader_repository.h index 0354d6437..3c5fbdafc 100644 --- a/common/repositories/trader_repository.h +++ b/common/repositories/trader_repository.h @@ -7,8 +7,8 @@ #include "items_repository.h" #include "../../common/item_data.h" #include "../../common/races.h" -#include "../cereal/include/cereal/archives/binary.hpp" -#include "../cereal/include/cereal/types/string.hpp" +#include +#include class TraderRepository : public BaseTraderRepository { public: From 612a2486125747985d14a78ecbe976ebeba166b9 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sat, 6 Dec 2025 16:04:57 -0800 Subject: [PATCH 28/44] Improve some boilerplate, I'd still like to do better about getting linker stuff set. --- CMakeLists.txt | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a6828c74..546b39808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,23 +2,34 @@ cmake_minimum_required(VERSION 3.20.0) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH}) -if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) - message(STATUS "Using vcpkg env variable") - set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") -elseif(NOT DEFINED CMAKE_TOOLCHAIN_FILE) - message(STATUS "Using vcpkg submodule") - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") +if(NOT CMAKE_TOOLCHAIN_FILE) + if(DEFINED ENV{VCPKG_ROOT}) + message(STATUS "Using vcpkg from VCPKG_ROOT") + set(CMAKE_TOOLCHAIN_FILE + "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + CACHE FILEPATH "Vcpkg toolchain file" + ) + else() + message(STATUS "Using vcpkg submodule") + set(CMAKE_TOOLCHAIN_FILE + "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" + CACHE FILEPATH "Vcpkg toolchain file" + ) + endif() endif() -project(EQEmu) +project(EQEmu + VERSION 24.10.3 + LANGUAGES CXX +) #explicitly set CMP0167 for Find Boost if(POLICY CMP0167) cmake_policy(SET CMP0167 NEW) endif() -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) +if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type") endif() set(CMAKE_CXX_STANDARD 20) @@ -26,6 +37,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) +option(EQEMU_ADD_PROFILER "Link with Google perftools profiler" OFF) +option(USE_MAP_MMFS "Use memory-mapped files for maps" OFF) # Requires libgoogle-perftools-dev google-perftools packages for linux (debian) if(EQEMU_ADD_PROFILER) @@ -38,18 +51,14 @@ endif() if(MSVC) add_compile_options(/bigobj) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-DNOMINMAX) - add_definitions(-DCRASH_LOGGING) - add_definitions(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17 - + add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -DCRASH_LOGGING -D_HAS_AUTO_PTR_ETC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") option(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON) if(EQEMU_DISABLE_MSVC_WARNINGS) - add_definitions( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os") + add_compile_options(/W0 /wd4005 /wd4996 /nologo /Os) endif() -else(MSVC) +else() add_definitions(-DHAS_UNION_SEMUN) endif() @@ -182,7 +191,7 @@ if(EQEMU_COMMANDS_LOGGING) endif() if(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") - add_definitions(-DCPPHTTPLIB_OPENSSL_SUPPORT) + add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT) endif() if(PerlLibs_FOUND) @@ -219,6 +228,8 @@ if(EQEMU_BUILD_LUA) endif() endif() +set(SERVER_LIBS common) + if(PERL_LIBRARY_ENABLED) option(EQEMU_BUILD_PERL "Build Perl parser." ON) if(EQEMU_BUILD_PERL) @@ -230,7 +241,6 @@ if(PERL_LIBRARY_ENABLED) endif() endif() -set(SERVER_LIBS common) # silence obnoxious deprecation message add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) From 6027c56d9efa1c8484c4b3fe66a670f14c5266d8 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 7 Dec 2025 16:35:58 -0800 Subject: [PATCH 29/44] Going through and cleaning up the build. --- CMakeLists.txt | 181 +++----------- common/CMakeLists.txt | 454 +++++++++++++++++++++++++++++++++++ libs/luabind/CMakeLists.txt | 9 +- libs/perlbind/CMakeLists.txt | 6 +- 4 files changed, 495 insertions(+), 155 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 546b39808..243ea485d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,21 +37,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) -option(EQEMU_ADD_PROFILER "Link with Google perftools profiler" OFF) -option(USE_MAP_MMFS "Use memory-mapped files for maps" OFF) - -# Requires libgoogle-perftools-dev google-perftools packages for linux (debian) -if(EQEMU_ADD_PROFILER) - set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") -endif() - -if(USE_MAP_MMFS) - add_definitions(-DUSE_MAP_MMFS) -endif() if(MSVC) add_compile_options(/bigobj) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -DCRASH_LOGGING -D_HAS_AUTO_PTR_ETC) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS NOMINMAX CRASH_LOGGING _HAS_AUTO_PTR_ETC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") option(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON) @@ -59,26 +48,22 @@ if(MSVC) add_compile_options(/W0 /wd4005 /wd4996 /nologo /Os) endif() else() - add_definitions(-DHAS_UNION_SEMUN) + add_compile_definitions(HAS_UNION_SEMUN) endif() #FreeBSD support if(UNIX) if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") - add_definitions(-DFREEBSD) - add_definitions(-D_GLIBCXX_USE_C99) + add_compile_definitions(FREEBSD) + add_compile_definitions(_GLIBCXX_USE_C99) set(FREEBSD TRUE) endif() if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - add_definitions(-DDARWIN) + add_compile_definitions(DARWIN) set(DARWIN TRUE) endif() endif() -add_definitions(-DGLM_FORCE_RADIANS) -add_definitions(-DGLM_FORCE_CTOR_INIT) -add_definitions(-DGLM_ENABLE_EXPERIMENTAL) - find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple) find_package(cereal CONFIG REQUIRED) find_package(fmt CONFIG REQUIRED) @@ -133,75 +118,22 @@ message(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}") message(STATUS "PERL_VERSION: ${PERL_VERSION}") message(STATUS "**************************************************") -include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp") - -add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) - #options -option(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON) option(EQEMU_BUILD_SERVER "Build the game server." ON) option(EQEMU_BUILD_LOGIN "Build the login server." ON) option(EQEMU_BUILD_TESTS "Build utility tests." OFF) option(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) -option(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF) - -#PRNG options -option(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF) -mark_as_advanced(EQEMU_ADDITIVE_LFIB_PRNG) -option(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF) -mark_as_advanced(EQEMU_BIASED_INT_DIST) -set(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)") -mark_as_advanced(EQEMU_CUSTOM_PRNG_ENGINE) - -if(CMAKE_COMPILER_IS_GNUCXX) - option(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF) - mark_as_advanced(EQEMU_SFMT19937) -endif() - -if(EQEMU_ADDITIVE_LFIB_PRNG) - add_definitions(-DUSE_ADDITIVE_LFIB_PRNG) - if(EQEMU_SFMT19937) - message(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.") - set(EQEMU_SFMT19937 OFF) - endif() - if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - message(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.") - set(EQEMU_CUSTOM_PRNG_ENGINE "") - endif() -endif() - -if(EQEMU_SFMT19937) - add_definitions(-DUSE_SFMT19937) - if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - message(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.") - set(EQEMU_CUSTOM_PRNG_ENGINE "") - endif() -endif() - -if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") - add_definitions(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE}) -endif() - -if(EQEMU_BIASED_INT_DIST) - add_definitions(-DBIASED_INT_DIST) -endif() - -if(EQEMU_COMMANDS_LOGGING) - add_definitions(-DCOMMANDS_LOGGING) -endif() - -if(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") - add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT) -endif() if(PerlLibs_FOUND) - set(PERL_LIBRARY_TYPE " Perl") - set(PERL_LIBRARY_ENABLED ON) - set(PERL_LIBRARY_LIBS ${PERL_LIBRARY}) - set(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH}) + option(EQEMU_BUILD_PERL "Build Perl parser." ON) + + if(EQEMU_BUILD_PERL) + set(PERL_LIBRARY_TYPE " Perl") + else() + set(PERL_LIBRARY_TYPE " Missing") + endif() else() set(PERL_LIBRARY_TYPE "Disabled") - set(PERL_LIBRARY_ENABLED OFF) endif() message(STATUS "") @@ -215,74 +147,33 @@ message(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *") message(STATUS "* zlib: ZLIB *") message(STATUS "**************************************************") + option(EQEMU_BUILD_LUA "Build Lua parser." ON) -if(EQEMU_BUILD_LUA) - add_definitions(-DLUA_EQEMU) - - include_directories(SYSTEM "${LUAJIT_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind") - - option(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON) - if(EQEMU_SANITIZE_LUA_LIBS) - add_definitions(-DSANITIZE_LUA_LIBS) - endif() -endif() - -set(SERVER_LIBS common) - -if(PERL_LIBRARY_ENABLED) - option(EQEMU_BUILD_PERL "Build Perl parser." ON) - if(EQEMU_BUILD_PERL) - set(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind) - INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}" "${CMAKE_CURRENT_SOURCE_DIR}/libs/perlbind/include") - add_definitions(-DEMBPERL) - add_definitions(-DEMBPERL_PLUGIN) - add_definitions(-DPERLBIND_NO_STRICT_SCALAR_TYPES) - endif() -endif() - -# silence obnoxious deprecation message -add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS) - -if(WIN32) - set(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv") -endif() - -if(UNIX) - set(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread") - if(NOT DARWIN) - set(SERVER_LIBS ${SERVER_LIBS} "rt") - endif() - # Freebsd provides uuids in the C library - if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") - set(SERVER_LIBS ${SERVER_LIBS} "uuid") - endif() -endif() - -set(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS}) - -if(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS) +if(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_CLIENT_FILES) add_subdirectory(common) add_subdirectory(libs) +else() + message(FATAL_ERROR "No targets were selected to build, we must build at least one target.") endif() -if(EQEMU_BUILD_SERVER) - add_subdirectory(shared_memory) - add_subdirectory(world) - add_subdirectory(zone) - add_subdirectory(ucs) - add_subdirectory(queryserv) - add_subdirectory(eqlaunch) -endif() - -if(EQEMU_BUILD_LOGIN) - add_subdirectory(loginserver) -endif() - -if(EQEMU_BUILD_TESTS) - add_subdirectory(tests) -endif() - -if(EQEMU_BUILD_CLIENT_FILES) - add_subdirectory(client_files) -endif() +#if(EQEMU_BUILD_SERVER) +# add_subdirectory(shared_memory) +# add_subdirectory(world) +# add_subdirectory(zone) +# add_subdirectory(ucs) +# add_subdirectory(queryserv) +# add_subdirectory(eqlaunch) +#endif() +# +#if(EQEMU_BUILD_LOGIN) +# add_subdirectory(loginserver) +#endif() +# +#if(EQEMU_BUILD_TESTS) +# add_subdirectory(tests) +#endif() +# +#if(EQEMU_BUILD_CLIENT_FILES) +# add_subdirectory(client_files) +#endif() diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index b0d9c0b46..f2328383e 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -817,6 +817,407 @@ source_group(Patches FILES patches/uf_limits.cpp ) +source_group(Repositories FILES + + # Criteria + repositories/criteria/content_filter_criteria.h + + repositories/base/base_grid_repository.h + repositories/base/base_grid_entries_repository.h + + # Base Repositories + repositories/base/base_aa_ability_repository.h + repositories/base/base_aa_ranks_repository.h + repositories/base/base_aa_rank_effects_repository.h + repositories/base/base_aa_rank_prereqs_repository.h + repositories/base/base_account_repository.h + repositories/base/base_account_flags_repository.h + repositories/base/base_account_ip_repository.h + repositories/base/base_account_rewards_repository.h + repositories/base/base_adventure_details_repository.h + repositories/base/base_adventure_members_repository.h + repositories/base/base_adventure_stats_repository.h + repositories/base/base_adventure_template_repository.h + repositories/base/base_adventure_template_entry_repository.h + repositories/base/base_adventure_template_entry_flavor_repository.h + repositories/base/base_alternate_currency_repository.h + repositories/base/base_auras_repository.h + repositories/base/base_base_data_repository.h + repositories/base/base_blocked_spells_repository.h + repositories/base/base_books_repository.h + repositories/base/base_bugs_repository.h + repositories/base/base_bug_reports_repository.h + repositories/base/base_buyer_repository.h + repositories/base/base_buyer_trade_items_repository.h + repositories/base/base_character_activities_repository.h + repositories/base/base_character_alternate_abilities_repository.h + repositories/base/base_character_alt_currency_repository.h + repositories/base/base_character_auras_repository.h + repositories/base/base_character_bandolier_repository.h + repositories/base/base_character_bind_repository.h + repositories/base/base_character_buffs_repository.h + repositories/base/base_character_corpses_repository.h + repositories/base/base_character_corpse_items_repository.h + repositories/base/base_character_currency_repository.h + repositories/base/base_character_data_repository.h + repositories/base/base_character_disciplines_repository.h + repositories/base/base_character_evolving_items_repository.h + repositories/base/base_character_expedition_lockouts_repository.h + repositories/base/base_character_exp_modifiers_repository.h + repositories/base/base_character_inspect_messages_repository.h + repositories/base/base_character_instance_safereturns_repository.h + repositories/base/base_character_item_recast_repository.h + repositories/base/base_character_languages_repository.h + repositories/base/base_character_leadership_abilities_repository.h + repositories/base/base_character_material_repository.h + repositories/base/base_character_memmed_spells_repository.h + repositories/base/base_character_parcels_repository.h + repositories/base/base_character_parcels_containers_repository.h + repositories/base/base_character_peqzone_flags_repository.h + repositories/base/base_character_pet_buffs_repository.h + repositories/base/base_character_pet_info_repository.h + repositories/base/base_character_pet_inventory_repository.h + repositories/base/base_character_potionbelt_repository.h + repositories/base/base_character_skills_repository.h + repositories/base/base_character_spells_repository.h + repositories/base/base_character_tasks_repository.h + repositories/base/base_character_task_timers_repository.h + repositories/base/base_char_create_combinations_repository.h + repositories/base/base_char_create_point_allocations_repository.h + repositories/base/base_char_recipe_list_repository.h + repositories/base/base_chatchannels_repository.h + repositories/base/base_chatchannel_reserved_names_repository.h + repositories/base/base_completed_shared_tasks_repository.h + repositories/base/base_completed_shared_task_activity_state_repository.h + repositories/base/base_completed_shared_task_members_repository.h + repositories/base/base_completed_tasks_repository.h + repositories/base/base_content_flags_repository.h + repositories/base/base_damageshieldtypes_repository.h + repositories/base/base_data_buckets_repository.h + repositories/base/base_db_str_repository.h + repositories/base/base_discord_webhooks_repository.h + repositories/base/base_discovered_items_repository.h + repositories/base/base_doors_repository.h + repositories/base/base_dynamic_zones_repository.h + repositories/base/base_dynamic_zone_lockouts_repository.h + repositories/base/base_dynamic_zone_members_repository.h + repositories/base/base_dynamic_zone_templates_repository.h + repositories/base/base_faction_association_repository.h + repositories/base/base_faction_base_data_repository.h + repositories/base/base_faction_list_repository.h + repositories/base/base_faction_list_mod_repository.h + repositories/base/base_faction_values_repository.h + repositories/base/base_fishing_repository.h + repositories/base/base_forage_repository.h + repositories/base/base_friends_repository.h + repositories/base/base_global_loot_repository.h + repositories/base/base_gm_ips_repository.h + repositories/base/base_graveyard_repository.h + repositories/base/base_ground_spawns_repository.h + repositories/base/base_group_id_repository.h + repositories/base/base_group_leaders_repository.h + repositories/base/base_guilds_repository.h + repositories/base/base_guild_ranks_repository.h + repositories/base/base_guild_permissions_repository.h + repositories/base/base_guild_members_repository.h + repositories/base/base_guild_bank_repository.h + repositories/base/base_guild_relations_repository.h + repositories/base/base_horses_repository.h + repositories/base/base_instance_list_repository.h + repositories/base/base_instance_list_player_repository.h + repositories/base/base_inventory_repository.h + repositories/base/base_inventory_snapshots_repository.h + repositories/base/base_ip_exemptions_repository.h + repositories/base/base_items_repository.h + repositories/base/base_items_evolving_details_repository.h + repositories/base/base_ldon_trap_entries_repository.h + repositories/base/base_ldon_trap_templates_repository.h + repositories/base/base_level_exp_mods_repository.h + repositories/base/base_lfguild_repository.h + repositories/base/base_login_accounts_repository.h + repositories/base/base_login_api_tokens_repository.h + repositories/base/base_login_server_admins_repository.h + repositories/base/base_login_server_list_types_repository.h + repositories/base/base_login_world_servers_repository.h + repositories/base/base_logsys_categories_repository.h + repositories/base/base_lootdrop_repository.h + repositories/base/base_lootdrop_entries_repository.h + repositories/base/base_loottable_repository.h + repositories/base/base_loottable_entries_repository.h + repositories/base/base_mail_repository.h + repositories/base/base_merchantlist_repository.h + repositories/base/base_merchantlist_temp_repository.h + repositories/base/base_name_filter_repository.h + repositories/base/base_npc_emotes_repository.h + repositories/base/base_npc_faction_repository.h + repositories/base/base_npc_faction_entries_repository.h + repositories/base/base_npc_scale_global_base_repository.h + repositories/base/base_npc_spells_repository.h + repositories/base/base_npc_spells_effects_repository.h + repositories/base/base_npc_spells_effects_entries_repository.h + repositories/base/base_npc_spells_entries_repository.h + repositories/base/base_npc_types_repository.h + repositories/base/base_npc_types_tint_repository.h + repositories/base/base_object_repository.h + repositories/base/base_object_contents_repository.h + repositories/base/base_perl_event_export_settings_repository.h + repositories/base/base_petitions_repository.h + repositories/base/base_pets_repository.h + repositories/base/base_pets_beastlord_data_repository.h + repositories/base/base_pets_equipmentset_repository.h + repositories/base/base_pets_equipmentset_entries_repository.h + repositories/base/base_player_titlesets_repository.h + repositories/base/base_player_event_aa_purchase_repository.h + repositories/base/base_player_event_killed_npc_repository.h + repositories/base/base_player_event_killed_named_npc_repository.h + repositories/base/base_player_event_killed_raid_npc_repository.h + repositories/base/base_player_event_log_settings_repository.h + repositories/base/base_player_event_logs_repository.h + repositories/base/base_player_event_loot_items_repository.h + repositories/base/base_player_event_merchant_purchase_repository.h + repositories/base/base_player_event_merchant_sell_repository.h + repositories/base/base_player_event_npc_handin_repository.h + repositories/base/base_player_event_npc_handin_entries_repository.h + repositories/base/base_player_event_speech_repository.h + repositories/base/base_player_event_trade_repository.h + repositories/base/base_player_event_trade_entries_repository.h + repositories/base/base_quest_globals_repository.h + repositories/base/base_raid_details_repository.h + repositories/base/base_raid_members_repository.h + repositories/base/base_reports_repository.h + repositories/base/base_respawn_times_repository.h + repositories/base/base_rule_sets_repository.h + repositories/base/base_rule_values_repository.h + repositories/base/base_saylink_repository.h + repositories/base/base_server_scheduled_events_repository.h + repositories/base/base_shared_tasks_repository.h + repositories/base/base_shared_task_activity_state_repository.h + repositories/base/base_shared_task_dynamic_zones_repository.h + repositories/base/base_shared_task_members_repository.h + repositories/base/base_skill_caps_repository.h + repositories/base/base_spawn2_repository.h + repositories/base/base_spawnentry_repository.h + repositories/base/base_spawngroup_repository.h + repositories/base/base_spawn_conditions_repository.h + repositories/base/base_spawn_condition_values_repository.h + repositories/base/base_spawn_events_repository.h + repositories/base/base_spells_new_repository.h + repositories/base/base_spell_buckets_repository.h + repositories/base/base_spell_globals_repository.h + repositories/base/base_starting_items_repository.h + repositories/base/base_start_zones_repository.h + repositories/base/base_tasks_repository.h + repositories/base/base_tasksets_repository.h + repositories/base/base_task_activities_repository.h + repositories/base/base_timers_repository.h + repositories/base/base_titles_repository.h + repositories/base/base_trader_repository.h + repositories/base/base_tradeskill_recipe_repository.h + repositories/base/base_tradeskill_recipe_entries_repository.h + repositories/base/base_traps_repository.h + repositories/base/base_tributes_repository.h + repositories/base/base_tribute_levels_repository.h + repositories/base/base_veteran_reward_templates_repository.h + repositories/base/base_zone_repository.h + repositories/base/base_zone_points_repository.h + + # Extended Repositories + repositories/aa_ability_repository.h + repositories/aa_ranks_repository.h + repositories/aa_rank_effects_repository.h + repositories/aa_rank_prereqs_repository.h + repositories/account_repository.h + repositories/account_flags_repository.h + repositories/account_ip_repository.h + repositories/account_rewards_repository.h + repositories/adventure_details_repository.h + repositories/adventure_members_repository.h + repositories/adventure_stats_repository.h + repositories/adventure_template_repository.h + repositories/adventure_template_entry_repository.h + repositories/adventure_template_entry_flavor_repository.h + repositories/alternate_currency_repository.h + repositories/auras_repository.h + repositories/base_data_repository.h + repositories/blocked_spells_repository.h + repositories/books_repository.h + repositories/bugs_repository.h + repositories/bug_reports_repository.h + repositories/buyer_buy_lines_repository.h + repositories/buyer_trade_items_repository.h + repositories/character_activities_repository.h + repositories/character_alternate_abilities_repository.h + repositories/character_alt_currency_repository.h + repositories/character_auras_repository.h + repositories/character_bandolier_repository.h + repositories/character_bind_repository.h + repositories/character_buffs_repository.h + repositories/character_corpses_repository.h + repositories/character_corpse_items_repository.h + repositories/character_currency_repository.h + repositories/character_data_repository.h + repositories/character_disciplines_repository.h + repositories/character_evolving_items_repository.h + repositories/character_expedition_lockouts_repository.h + repositories/character_exp_modifiers_repository.h + repositories/character_inspect_messages_repository.h + repositories/character_instance_safereturns_repository.h + repositories/character_item_recast_repository.h + repositories/character_languages_repository.h + repositories/character_leadership_abilities_repository.h + repositories/character_material_repository.h + repositories/character_memmed_spells_repository.h + repositories/character_parcels_repository.h + repositories/character_parcels_containers_repository.h + repositories/character_peqzone_flags_repository.h + repositories/character_pet_buffs_repository.h + repositories/character_pet_info_repository.h + repositories/character_pet_inventory_repository.h + repositories/character_potionbelt_repository.h + repositories/character_skills_repository.h + repositories/character_spells_repository.h + repositories/character_tasks_repository.h + repositories/character_task_timers_repository.h + repositories/char_create_combinations_repository.h + repositories/char_create_point_allocations_repository.h + repositories/char_recipe_list_repository.h + repositories/chatchannels_repository.h + repositories/chatchannel_reserved_names_repository.h + repositories/completed_shared_tasks_repository.h + repositories/completed_shared_task_activity_state_repository.h + repositories/completed_shared_task_members_repository.h + repositories/completed_tasks_repository.h + repositories/content_flags_repository.h + repositories/damageshieldtypes_repository.h + repositories/data_buckets_repository.h + repositories/db_str_repository.h + repositories/discord_webhooks_repository.h + repositories/discovered_items_repository.h + repositories/doors_repository.h + repositories/dynamic_zones_repository.h + repositories/dynamic_zone_lockouts_repository.h + repositories/dynamic_zone_members_repository.h + repositories/dynamic_zone_templates_repository.h + repositories/faction_association_repository.h + repositories/faction_base_data_repository.h + repositories/faction_list_repository.h + repositories/faction_list_mod_repository.h + repositories/faction_values_repository.h + repositories/fishing_repository.h + repositories/forage_repository.h + repositories/friends_repository.h + repositories/global_loot_repository.h + repositories/gm_ips_repository.h + repositories/graveyard_repository.h + repositories/ground_spawns_repository.h + repositories/group_id_repository.h + repositories/group_leaders_repository.h + repositories/guilds_repository.h + repositories/guild_ranks_repository.h + repositories/guild_permissions_repository.h + repositories/guild_members_repository.h + repositories/guild_bank_repository.h + repositories/guild_relations_repository.h + repositories/horses_repository.h + repositories/instance_list_repository.h + repositories/instance_list_player_repository.h + repositories/inventory_repository.h + repositories/inventory_snapshots_repository.h + repositories/ip_exemptions_repository.h + repositories/items_repository.h + repositories/items_evolving_details_repository.h + repositories/ldon_trap_entries_repository.h + repositories/ldon_trap_templates_repository.h + repositories/level_exp_mods_repository.h + repositories/lfguild_repository.h + repositories/login_accounts_repository.h + repositories/login_api_tokens_repository.h + repositories/login_server_admins_repository.h + repositories/login_server_list_types_repository.h + repositories/login_world_servers_repository.h + repositories/logsys_categories_repository.h + repositories/lootdrop_repository.h + repositories/lootdrop_entries_repository.h + repositories/loottable_repository.h + repositories/loottable_entries_repository.h + repositories/mail_repository.h + repositories/merchantlist_repository.h + repositories/merchantlist_temp_repository.h + repositories/name_filter_repository.h + repositories/npc_emotes_repository.h + repositories/npc_faction_repository.h + repositories/npc_faction_entries_repository.h + repositories/npc_scale_global_base_repository.h + repositories/npc_spells_repository.h + repositories/npc_spells_effects_repository.h + repositories/npc_spells_effects_entries_repository.h + repositories/npc_spells_entries_repository.h + repositories/npc_types_repository.h + repositories/npc_types_tint_repository.h + repositories/object_repository.h + repositories/object_contents_repository.h + repositories/perl_event_export_settings_repository.h + repositories/petitions_repository.h + repositories/pets_repository.h + repositories/pets_beastlord_data_repository.h + repositories/pets_equipmentset_repository.h + repositories/pets_equipmentset_entries_repository.h + repositories/player_titlesets_repository.h + repositories/player_event_aa_purchase_repository.h + repositories/player_event_killed_npc_repository.h + repositories/player_event_killed_named_npc_repository.h + repositories/player_event_killed_raid_npc_repository.h + repositories/player_event_log_settings_repository.h + repositories/player_event_logs_repository.h + repositories/player_event_loot_items_repository.h + repositories/player_event_merchant_purchase_repository.h + repositories/player_event_merchant_sell_repository.h + repositories/player_event_npc_handin_repository.h + repositories/player_event_npc_handin_entries_repository.h + repositories/player_event_speech_repository.h + repositories/player_event_trade_repository.h + repositories/player_event_trade_entries_repository.h + repositories/quest_globals_repository.h + repositories/raid_details_repository.h + repositories/raid_members_repository.h + repositories/reports_repository.h + repositories/respawn_times_repository.h + repositories/rule_sets_repository.h + repositories/rule_values_repository.h + repositories/saylink_repository.h + repositories/server_scheduled_events_repository.h + repositories/shared_tasks_repository.h + repositories/shared_task_activity_state_repository.h + repositories/shared_task_dynamic_zones_repository.h + repositories/shared_task_members_repository.h + repositories/skill_caps_repository.h + repositories/spawn2_repository.h + repositories/spawnentry_repository.h + repositories/spawngroup_repository.h + repositories/spawn_conditions_repository.h + repositories/spawn_condition_values_repository.h + repositories/spawn_events_repository.h + repositories/spells_new_repository.h + repositories/spell_buckets_repository.h + repositories/spell_globals_repository.h + repositories/starting_items_repository.h + repositories/start_zones_repository.h + repositories/tasks_repository.h + repositories/tasksets_repository.h + repositories/task_activities_repository.h + repositories/timers_repository.h + repositories/titles_repository.h + repositories/trader_repository.h + repositories/tradeskill_recipe_repository.h + repositories/tradeskill_recipe_entries_repository.h + repositories/traps_repository.h + repositories/tributes_repository.h + repositories/tribute_levels_repository.h + repositories/veteran_reward_templates_repository.h + repositories/zone_repository.h + repositories/zone_points_repository.h +) + source_group(StackWalker FILES StackWalker/StackWalker.h StackWalker/StackWalker.cpp @@ -830,12 +1231,65 @@ source_group(Util FILES util/uuid.h ) +option(EQEMU_ADD_PROFILER "Link with Google perftools profiler" OFF) +#PRNG options +option(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF) +mark_as_advanced(EQEMU_ADDITIVE_LFIB_PRNG) +option(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF) +mark_as_advanced(EQEMU_BIASED_INT_DIST) +set(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)") +mark_as_advanced(EQEMU_CUSTOM_PRNG_ENGINE) + +if(CMAKE_COMPILER_IS_GNUCXX) + option(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF) + mark_as_advanced(EQEMU_SFMT19937) +endif() + include_directories(Patches SocketLib StackWalker) add_library(common ${common_sources} ${common_headers} ${repositories}) +target_compile_definitions(common PUBLIC BOOST_BIND_GLOBAL_PLACEHOLDERS GLM_FORCE_RADIANS GLM_FORCE_CTOR_INIT GLM_ENABLE_EXPERIMENTAL) +target_include_directories(common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../submodules/websocketpp") target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $,libuv::uv_a,libuv::uv> OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) +# Requires libgoogle-perftools-dev google-perftools packages for linux (debian) +if(EQEMU_ADD_PROFILER) + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed") +endif() + +if(EQEMU_ADDITIVE_LFIB_PRNG) + target_compile_definitions(common PUBLIC USE_ADDITIVE_LFIB_PRNG) + if(EQEMU_SFMT19937) + message(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.") + set(EQEMU_SFMT19937 OFF) + endif() + if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + message(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.") + set(EQEMU_CUSTOM_PRNG_ENGINE "") + endif() +endif() + +if(EQEMU_SFMT19937) + target_compile_definitions(common PUBLIC USE_SFMT19937) + if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + message(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.") + set(EQEMU_CUSTOM_PRNG_ENGINE "") + endif() +endif() + +if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "") + target_compile_definitions(common PUBLIC USE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE}) +endif() + +if(EQEMU_BIASED_INT_DIST) + target_compile_definitions(common PUBLIC BIASED_INT_DIST) +endif() + +if(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") + target_compile_definitions(common PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT) +endif() + if(UNIX) set_source_files_properties("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0) diff --git a/libs/luabind/CMakeLists.txt b/libs/luabind/CMakeLists.txt index 982e7b7b5..ef93f9a03 100644 --- a/libs/luabind/CMakeLists.txt +++ b/libs/luabind/CMakeLists.txt @@ -20,12 +20,9 @@ set(lb_sources src/wrapper_base.cpp ) -set(lb_headers - -) - -add_library(luabind ${lb_sources} ${lb_headers}) -target_link_libraries(luabind PRIVATE Boost::dynamic_bitset Boost::tuple Boost::foreach ${LUAJIT_LIBRARY}) +add_library(luabind ${lb_sources}) +target_include_directories(luabind PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${LUAJIT_INCLUDE_DIR}) +target_link_libraries(luabind PUBLIC Boost::dynamic_bitset Boost::tuple Boost::foreach ${LUAJIT_LIBRARY}) if(UNIX) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) diff --git a/libs/perlbind/CMakeLists.txt b/libs/perlbind/CMakeLists.txt index 01d30a61b..9f505a329 100644 --- a/libs/perlbind/CMakeLists.txt +++ b/libs/perlbind/CMakeLists.txt @@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.20.0) project(perlbind LANGUAGES CXX) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".so" ".a") - -find_package(PerlLibs) - set(PERLBIND_HEADERS include/perlbind/array.h include/perlbind/forward.h @@ -45,6 +41,8 @@ target_include_directories(perlbind PUBLIC $ $) +target_compile_definitions(perlbind PUBLIC EMBPERL EMBPERL_PLUGIN PERLBIND_NO_STRICT_SCALAR_TYPES) + option(PERLBIND_BUILD_TESTS "Build tests" OFF) option(PERLBIND_ENABLE_ASAN "Build with address sanitizer" OFF) From 32e04ea74cd0976bea62e2cfcbf2d42538ed0f86 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 7 Dec 2025 17:13:01 -0800 Subject: [PATCH 30/44] Fix world, separate out data_buckets. --- CMakeLists.txt | 18 ++++----- common/CMakeLists.txt | 2 + common/data_bucket.cpp | 74 ++++++++++++++++-------------------- common/data_bucket.h | 25 ++++++------ shared_memory/CMakeLists.txt | 2 +- world/CMakeLists.txt | 4 +- world/client.cpp | 4 +- zone/lua_parser.cpp | 3 +- 8 files changed, 62 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 243ea485d..54ed1b3b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,15 +157,15 @@ else() message(FATAL_ERROR "No targets were selected to build, we must build at least one target.") endif() -#if(EQEMU_BUILD_SERVER) -# add_subdirectory(shared_memory) -# add_subdirectory(world) -# add_subdirectory(zone) -# add_subdirectory(ucs) -# add_subdirectory(queryserv) -# add_subdirectory(eqlaunch) -#endif() -# +if(EQEMU_BUILD_SERVER) + add_subdirectory(shared_memory) + add_subdirectory(world) + #add_subdirectory(zone) + #add_subdirectory(ucs) + #add_subdirectory(queryserv) + #add_subdirectory(eqlaunch) +endif() + #if(EQEMU_BUILD_LOGIN) # add_subdirectory(loginserver) #endif() diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index f2328383e..640257a92 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -20,6 +20,7 @@ set(common_sources database/database_update_manifest_custom.cpp database/database_update_manifest_bots.cpp database/database_update.cpp + data_bucket.cpp dbcore.cpp deity.cpp dynamic_zone_base.cpp @@ -554,6 +555,7 @@ set(common_headers database.h database_schema.h database/database_update.h + data_bucket.cpp dbcore.h deity.h discord/discord.h diff --git a/common/data_bucket.cpp b/common/data_bucket.cpp index bef06a124..0378c379f 100644 --- a/common/data_bucket.cpp +++ b/common/data_bucket.cpp @@ -9,17 +9,7 @@ using json = nlohmann::json; const std::string NESTED_KEY_DELIMITER = "."; std::vector g_data_bucket_cache = {}; -#if defined(ZONE) -#include "../zone/zonedb.h" -extern ZoneDatabase database; -#elif defined(WORLD) -#include "../world/worlddb.h" -extern WorldDatabase database; -#else -#error "You must define either ZONE or WORLD" -#endif - -void DataBucket::SetData(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time) +void DataBucket::SetData(SharedDatabase* database, const std::string &bucket_key, const std::string &bucket_value, std::string expires_time) { auto k = DataBucketKey{ .key = bucket_key, @@ -27,10 +17,10 @@ void DataBucket::SetData(const std::string &bucket_key, const std::string &bucke .expires = expires_time, }; - DataBucket::SetData(k); + DataBucket::SetData(database, k); } -void DataBucket::SetData(const DataBucketKey &k_) +void DataBucket::SetData(SharedDatabase *database, const DataBucketKey &k_) { DataBucketKey k = k_; // copy the key so we can modify it bool is_nested = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos; @@ -39,7 +29,7 @@ void DataBucket::SetData(const DataBucketKey &k_) } auto b = DataBucketsRepository::NewEntity(); - auto r = GetData(k, true); + auto r = GetData(database, k, true); // if we have an entry, use it if (r.id > 0) { b = r; @@ -149,10 +139,10 @@ void DataBucket::SetData(const DataBucketKey &k_) } } - DataBucketsRepository::UpdateOne(database, b); + DataBucketsRepository::UpdateOne(*database, b); } else { - b = DataBucketsRepository::InsertOne(database, b); + b = DataBucketsRepository::InsertOne(*database, b); // add to cache if it doesn't exist if (CanCache(k) && !ExistsInCache(b)) { @@ -162,9 +152,9 @@ void DataBucket::SetData(const DataBucketKey &k_) } } -std::string DataBucket::GetData(const std::string &bucket_key) +std::string DataBucket::GetData(SharedDatabase* database, const std::string &bucket_key) { - return GetData(DataBucketKey{.key = bucket_key}).value; + return GetData(database, DataBucketKey{.key = bucket_key}).value; } DataBucketsRepository::DataBuckets DataBucket::ExtractNestedValue( @@ -214,7 +204,7 @@ DataBucketsRepository::DataBuckets DataBucket::ExtractNestedValue( // if the bucket doesn't exist, it will be added to the cache as a miss // if ignore_misses_cache is true, the bucket will not be added to the cache as a miss // the only place we should be ignoring the misses cache is on the initial read during SetData -DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_, bool ignore_misses_cache) +DataBucketsRepository::DataBuckets DataBucket::GetData(SharedDatabase* database, const DataBucketKey &k_, bool ignore_misses_cache) { DataBucketKey k = k_; // Copy the key so we can modify it @@ -244,7 +234,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_, if (CheckBucketMatch(e, k)) { if (e.expires > 0 && e.expires < std::time(nullptr)) { LogDataBuckets("Attempted to read expired key [{}] removing from cache", e.key_); - DeleteData(k); + DeleteData(database, k); return DataBucketsRepository::NewEntity(); } @@ -261,7 +251,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_, // Fetch the value from the database auto r = DataBucketsRepository::GetWhere( - database, + *database, fmt::format( " {} `key` = '{}' LIMIT 1", DataBucket::GetScopedDbFilters(k), @@ -310,7 +300,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_, // If the entry has expired, delete it if (bucket.expires > 0 && bucket.expires < static_cast(std::time(nullptr))) { - DeleteData(k); + DeleteData(database, k); return DataBucketsRepository::NewEntity(); } @@ -337,22 +327,22 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_, return bucket; } -std::string DataBucket::GetDataExpires(const std::string &bucket_key) +std::string DataBucket::GetDataExpires(SharedDatabase* database, const std::string &bucket_key) { - return GetDataExpires(DataBucketKey{.key = bucket_key}); + return GetDataExpires(database, DataBucketKey{.key = bucket_key}); } -std::string DataBucket::GetDataRemaining(const std::string &bucket_key) +std::string DataBucket::GetDataRemaining(SharedDatabase* database, const std::string &bucket_key) { - return GetDataRemaining(DataBucketKey{.key = bucket_key}); + return GetDataRemaining(database, DataBucketKey{.key = bucket_key}); } -bool DataBucket::DeleteData(const std::string &bucket_key) +bool DataBucket::DeleteData(SharedDatabase* database, const std::string &bucket_key) { - return DeleteData(DataBucketKey{.key = bucket_key}); + return DeleteData(database, DataBucketKey{.key = bucket_key}); } -bool DataBucket::DeleteData(const DataBucketKey &k) +bool DataBucket::DeleteData(SharedDatabase* database, const DataBucketKey &k) { bool is_nested_key = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos; @@ -374,7 +364,7 @@ bool DataBucket::DeleteData(const DataBucketKey &k) // Regular key deletion, no nesting involved return DataBucketsRepository::DeleteWhere( - database, + *database, fmt::format("{} `key` = '{}'", DataBucket::GetScopedDbFilters(k), k.key) ); } @@ -384,7 +374,7 @@ bool DataBucket::DeleteData(const DataBucketKey &k) DataBucketKey top_level_k = k; top_level_k.key = top_level_key; - auto r = GetData(top_level_k); + auto r = GetData(database, top_level_k); if (r.id == 0 || r.value.empty() || !Strings::IsValidJson(r.value)) { LogDataBuckets("Attempted to delete nested key [{}] but parent key [{}] does not exist or is invalid JSON", k.key, top_level_key); return false; @@ -444,14 +434,14 @@ bool DataBucket::DeleteData(const DataBucketKey &k) } return DataBucketsRepository::DeleteWhere( - database, + *database, fmt::format("{} `key` = '{}'", DataBucket::GetScopedDbFilters(k), top_level_key) ); } // Otherwise, update the existing JSON without the deleted key r.value = json_value.dump(); - DataBucketsRepository::UpdateOne(database, r); + DataBucketsRepository::UpdateOne(*database, r); // Update cache if (CanCache(k)) { @@ -466,7 +456,7 @@ bool DataBucket::DeleteData(const DataBucketKey &k) return true; } -std::string DataBucket::GetDataExpires(const DataBucketKey &k) +std::string DataBucket::GetDataExpires(SharedDatabase* database, const DataBucketKey &k) { LogDataBuckets( "Getting bucket expiration key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}]", @@ -477,7 +467,7 @@ std::string DataBucket::GetDataExpires(const DataBucketKey &k) k.npc_id ); - auto r = GetData(k); + auto r = GetData(database, k); if (r.id == 0) { return {}; } @@ -485,7 +475,7 @@ std::string DataBucket::GetDataExpires(const DataBucketKey &k) return std::to_string(r.expires); } -std::string DataBucket::GetDataRemaining(const DataBucketKey &k) +std::string DataBucket::GetDataRemaining(SharedDatabase* database, const DataBucketKey &k) { LogDataBuckets( "Getting bucket remaining key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}] bot_id [{}] zone_id [{}] instance_id [{}]", @@ -499,7 +489,7 @@ std::string DataBucket::GetDataRemaining(const DataBucketKey &k) k.instance_id ); - auto r = GetData(k); + auto r = GetData(database, k); if (r.id == 0) { return "0"; } @@ -565,10 +555,10 @@ bool DataBucket::CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe, ); } -void DataBucket::LoadZoneCache(uint16 zone_id, uint16 instance_id) +void DataBucket::LoadZoneCache(SharedDatabase* database, uint16 zone_id, uint16 instance_id) { const auto &l = DataBucketsRepository::GetWhere( - database, + *database, fmt::format( "zone_id = {} AND instance_id = {} AND (`expires` > {} OR `expires` = 0)", zone_id, @@ -608,7 +598,7 @@ void DataBucket::LoadZoneCache(uint16 zone_id, uint16 instance_id) ); } -void DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector ids) +void DataBucket::BulkLoadEntitiesToCache(SharedDatabase* database, DataBucketLoadType::Type t, std::vector ids) { if (ids.empty()) { return; @@ -653,7 +643,7 @@ void DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector } const auto &l = DataBucketsRepository::GetWhere( - database, + *database, fmt::format( "{} IN ({}) AND (`expires` > {} OR `expires` = 0)", column, @@ -843,4 +833,4 @@ bool DataBucket::CanCache(const DataBucketKey &key) } return false; -} \ No newline at end of file +} diff --git a/common/data_bucket.h b/common/data_bucket.h index 6f5c1bcc6..c93d98b2c 100644 --- a/common/data_bucket.h +++ b/common/data_bucket.h @@ -5,6 +5,7 @@ #include "types.h" #include "repositories/data_buckets_repository.h" #include "json/json_archive_single_line.h" +#include "shareddb.h" struct DataBucketKey { std::string key; @@ -38,26 +39,26 @@ namespace DataBucketLoadType { class DataBucket { public: // non-scoped bucket methods (for global buckets) - static void SetData(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time = ""); - static bool DeleteData(const std::string &bucket_key); - static std::string GetData(const std::string &bucket_key); - static std::string GetDataExpires(const std::string &bucket_key); - static std::string GetDataRemaining(const std::string &bucket_key); + static void SetData(SharedDatabase *database, const std::string &bucket_key, const std::string &bucket_value, std::string expires_time = ""); + static bool DeleteData(SharedDatabase *database, const std::string &bucket_key); + static std::string GetData(SharedDatabase *database, const std::string &bucket_key); + static std::string GetDataExpires(SharedDatabase *database, const std::string &bucket_key); + static std::string GetDataRemaining(SharedDatabase *database, const std::string &bucket_key); // scoped bucket methods - static void SetData(const DataBucketKey &k_); - static bool DeleteData(const DataBucketKey &k); - static DataBucketsRepository::DataBuckets GetData(const DataBucketKey &k_, bool ignore_misses_cache = false); - static std::string GetDataExpires(const DataBucketKey &k); - static std::string GetDataRemaining(const DataBucketKey &k); + static void SetData(SharedDatabase *database, const DataBucketKey &k_); + static bool DeleteData(SharedDatabase *database, const DataBucketKey &k); + static DataBucketsRepository::DataBuckets GetData(SharedDatabase *database, const DataBucketKey &k_, bool ignore_misses_cache = false); + static std::string GetDataExpires(SharedDatabase *database, const DataBucketKey &k); + static std::string GetDataRemaining(SharedDatabase *database, const DataBucketKey &k); static std::string GetScopedDbFilters(const DataBucketKey &k); // bucket repository versus key matching static bool CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe, const DataBucketKey &k); static bool ExistsInCache(const DataBucketsRepository::DataBuckets &entry); - static void LoadZoneCache(uint16 zone_id, uint16 instance_id); - static void BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector ids); + static void LoadZoneCache(SharedDatabase* database, uint16 zone_id, uint16 instance_id); + static void BulkLoadEntitiesToCache(SharedDatabase* database, DataBucketLoadType::Type t, std::vector ids); static void DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id, uint32 secondary_id = 0); static void DeleteFromMissesCache(DataBucketsRepository::DataBuckets e); diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 92e8d17d6..099d27b5b 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -15,6 +15,6 @@ add_executable(shared_memory ${shared_memory_sources} ${shared_memory_headers}) install(TARGETS shared_memory RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -target_link_libraries(shared_memory ${SERVER_LIBS}) +target_link_libraries(shared_memory common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index 273a0a375..d980a458f 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -7,7 +7,6 @@ set(world_sources cliententry.cpp clientlist.cpp console.cpp - ../common/data_bucket.cpp dynamic_zone.cpp dynamic_zone_manager.cpp eql_config.cpp @@ -43,7 +42,6 @@ set(world_headers cliententry.h clientlist.h console.h - ../common/data_bucket.h dynamic_zone.h dynamic_zone_manager.h eql_config.h @@ -82,6 +80,6 @@ endif() add_definitions(-DWORLD) -target_link_libraries(world ${SERVER_LIBS}) +target_link_libraries(world common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/world/client.cpp b/world/client.cpp index 674d09639..91aaf3e9f 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -2530,9 +2530,9 @@ void Client::SendUnsupportedClientPacket(const std::string& message) void Client::LoadDataBucketsCache() { - DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Account, {GetAccountID()}); + DataBucket::BulkLoadEntitiesToCache(&database, DataBucketLoadType::Account, {GetAccountID()}); const auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID()); - DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Client, ids); + DataBucket::BulkLoadEntitiesToCache(&database, DataBucketLoadType::Client, ids); } void Client::ClearDataBucketsCache() diff --git a/zone/lua_parser.cpp b/zone/lua_parser.cpp index 3e3a5257f..00f89e6d6 100644 --- a/zone/lua_parser.cpp +++ b/zone/lua_parser.cpp @@ -434,7 +434,6 @@ LuaParser::LuaParser() { ZoneArgumentDispatch[EVENT_TIMER_RESUME] = handle_zone_timer_pause_resume_start; ZoneArgumentDispatch[EVENT_TIMER_START] = handle_zone_timer_pause_resume_start; ZoneArgumentDispatch[EVENT_TIMER_STOP] = handle_zone_timer_stop; -#endif L = nullptr; } @@ -2295,3 +2294,5 @@ void LuaParser::LoadZoneScript(std::string filename) { void LuaParser::LoadGlobalZoneScript(std::string filename) { LoadScript(filename, "global_zone"); } + +#endif From 1f37254f1ae3a853749de7dc9559ce25f19f5360 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 7 Dec 2025 18:28:46 -0800 Subject: [PATCH 31/44] add fixes for other servers --- CMakeLists.txt | 6 +++--- eqlaunch/CMakeLists.txt | 2 +- queryserv/CMakeLists.txt | 2 +- ucs/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54ed1b3b5..e044321aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,9 +161,9 @@ if(EQEMU_BUILD_SERVER) add_subdirectory(shared_memory) add_subdirectory(world) #add_subdirectory(zone) - #add_subdirectory(ucs) - #add_subdirectory(queryserv) - #add_subdirectory(eqlaunch) + add_subdirectory(ucs) + add_subdirectory(queryserv) + add_subdirectory(eqlaunch) endif() #if(EQEMU_BUILD_LOGIN) diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index f0cdc987d..beafeb7f0 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -15,6 +15,6 @@ add_executable(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) install(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -target_link_libraries(eqlaunch ${SERVER_LIBS}) +target_link_libraries(eqlaunch common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 093fa0bc1..39dc0b048 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -25,6 +25,6 @@ install(TARGETS queryserv RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) add_definitions(-DQSERV) -target_link_libraries(queryserv ${SERVER_LIBS}) +target_link_libraries(queryserv common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index e4238b0dd..188b79a93 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -23,6 +23,6 @@ install(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) add_definitions(-DUCS) -target_link_libraries(ucs ${SERVER_LIBS}) +target_link_libraries(ucs common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) From ccb3cef3d7b87b02fe132e5a214d377ac265a653 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 7 Dec 2025 19:37:23 -0800 Subject: [PATCH 32/44] fix zone --- CMakeLists.txt | 2 +- zone/CMakeLists.txt | 33 ++++++++++++++++++------------ zone/bonuses.cpp | 2 +- zone/bot.cpp | 4 ++-- zone/cli/benchmark_databuckets.cpp | 12 +++++------ zone/client.cpp | 33 +++++++++++++++--------------- zone/client_packet.cpp | 2 +- zone/client_process.cpp | 2 +- zone/exp.cpp | 2 +- zone/gm_commands/databuckets.cpp | 6 +++--- zone/gm_commands/gmzone.cpp | 3 ++- zone/lua_general.cpp | 12 +++++------ zone/mob.cpp | 16 +++++++-------- zone/spells.cpp | 2 +- zone/zone.cpp | 12 +++++------ 15 files changed, 76 insertions(+), 67 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e044321aa..29327f53c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,7 +160,7 @@ endif() if(EQEMU_BUILD_SERVER) add_subdirectory(shared_memory) add_subdirectory(world) - #add_subdirectory(zone) + add_subdirectory(zone) add_subdirectory(ucs) add_subdirectory(queryserv) add_subdirectory(eqlaunch) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index feac2f134..b2a222dac 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -23,7 +23,6 @@ set(zone_sources client_process.cpp combat_record.cpp corpse.cpp - ../common/data_bucket.cpp doors.cpp dialogue_window.cpp dynamic_zone.cpp @@ -139,7 +138,6 @@ set(zone_headers command.h common.h corpse.h - ../common/data_bucket.h doors.h dialogue_window.h dynamic_zone.h @@ -491,23 +489,32 @@ endif() add_definitions(-DZONE) # link lua_zone unity build against luabind -if(MSVC) - target_compile_options(lua_zone PRIVATE /utf-8) -endif() - -target_link_libraries(lua_zone PRIVATE luabind Boost::dynamic_bitset Boost::tuple Boost::foreach unofficial::libmariadb) -if (EQEMU_BUILD_STATIC AND LUA_LIBRARY) - target_link_libraries(zone PRIVATE ${LUA_LIBRARY}) +if(EQEMU_BUILD_LUA) + target_compile_definitions(lua_zone PUBLIC LUA_EQEMU) + target_link_libraries(lua_zone PRIVATE luabind Boost::dynamic_bitset Boost::tuple Boost::foreach common) + if (EQEMU_BUILD_STATIC AND LUA_LIBRARY) + target_link_libraries(zone PRIVATE ${LUA_LIBRARY}) + endif() endif() # perl unity build links against perl_zone -target_link_libraries(perl_zone PRIVATE perlbind fmt::fmt unofficial::libmariadb ${PERL_LIBRARY_LIBS}) -if (EQEMU_BUILD_STATIC AND PERL_LIBRARY) - target_link_libraries(zone PRIVATE ${PERL_LIBRARY}) +if(EQEMU_BUILD_PERL) + target_link_libraries(perl_zone PRIVATE perlbind common ${PERL_LIBRARY_LIBS}) + if (EQEMU_BUILD_STATIC AND PERL_LIBRARY) + target_link_libraries(zone PRIVATE ${PERL_LIBRARY}) + endif() endif() # link zone against common libraries -target_link_libraries(zone PRIVATE lua_zone perl_zone gm_commands_zone ${ZONE_LIBS} RecastNavigation::Detour) +target_link_libraries(zone PRIVATE gm_commands_zone common RecastNavigation::Detour) + +if(EQEMU_BUILD_LUA) + target_link_libraries(zone PRIVATE lua_zone) +endif() + +if(EQEMU_BUILD_PERL) + target_link_libraries(zone PRIVATE perl_zone) +endif() SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 0cc44cac3..c1beab76f 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -5901,7 +5901,7 @@ float Mob::CheckHeroicBonusesDataBuckets(std::string bucket_name) DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; if (IsOfClientBot()) { - bucket_value = DataBucket::GetData(k).value; + bucket_value = DataBucket::GetData(&database, k).value; } if (bucket_value.empty() || !Strings::IsNumber(bucket_value)) { diff --git a/zone/bot.cpp b/zone/bot.cpp index 1aeb0c09a..d0d83fbc8 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -8224,13 +8224,13 @@ bool Bot::CheckDataBucket(std::string bucket_name, const std::string& bucket_val DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; - auto b = DataBucket::GetData(k); + auto b = DataBucket::GetData(&database, k); if (b.value.empty() && GetBotOwner()) { // fetch from owner k = GetBotOwner()->GetScopedBucketKeys(); k.key = bucket_name; - b = DataBucket::GetData(k); + b = DataBucket::GetData(&database, k); if (b.value.empty()) { return false; } diff --git a/zone/cli/benchmark_databuckets.cpp b/zone/cli/benchmark_databuckets.cpp index af0dcb84a..65d6ead0b 100644 --- a/zone/cli/benchmark_databuckets.cpp +++ b/zone/cli/benchmark_databuckets.cpp @@ -116,7 +116,7 @@ void RunBenchmarkCycle(uint64_t target_rows) break; } - DataBucket::SetData(e); + DataBucket::SetData(&database, e); inserted_keys.emplace_back(e); } @@ -129,7 +129,7 @@ void RunBenchmarkCycle(uint64_t target_rows) auto update_start = std::chrono::high_resolution_clock::now(); for (auto &key: inserted_keys) { // 🔍 Retrieve existing bucket using scoped `GetData` - auto e = DataBucket::GetData(key); + auto e = DataBucket::GetData(&database, key); if (e.id > 0) { // create a new key object with the updated values DataBucketKey bucket_entry_key{ @@ -145,7 +145,7 @@ void RunBenchmarkCycle(uint64_t target_rows) }; // 🔄 Update using DataBucket class - DataBucket::SetData(bucket_entry_key); + DataBucket::SetData(&database, bucket_entry_key); } } auto update_end = std::chrono::high_resolution_clock::now(); @@ -188,7 +188,7 @@ void RunBenchmarkCycle(uint64_t target_rows) k.instance_id = entity_choice; } - DataBucket::GetData(key); + DataBucket::GetData(&database, key); } auto read_cached_end = std::chrono::high_resolution_clock::now(); std::chrono::duration read_cached_time = read_cached_end - read_cached_start; @@ -206,7 +206,7 @@ void RunBenchmarkCycle(uint64_t target_rows) .character_id = 999999999, // use scoped value }; - DataBucket::GetData(k); + DataBucket::GetData(&database, k); } auto read_client_cache_miss_end = std::chrono::high_resolution_clock::now(); std::chrono::duration read_client_cache_miss_time = read_client_cache_miss_end - read_client_cache_miss_start; @@ -260,7 +260,7 @@ void RunBenchmarkCycle(uint64_t target_rows) k.instance_id = entity_choice; } - DataBucket::DeleteData(k); + DataBucket::DeleteData(&database, k); } auto delete_end = std::chrono::high_resolution_clock::now(); std::chrono::duration delete_time = delete_end - delete_start; diff --git a/zone/client.cpp b/zone/client.cpp index 5ed9eddec..07fa25ba6 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4840,7 +4840,7 @@ bool Client::IsNameChangeAllowed() { auto k = GetScopedBucketKeys(); k.key = "name_change_allowed"; - auto b = DataBucket::GetData(k); + auto b = DataBucket::GetData(&database, k); if (!b.value.empty()) { return true; } @@ -4856,7 +4856,7 @@ bool Client::ClearNameChange() { auto k = GetScopedBucketKeys(); k.key = "name_change_allowed"; - DataBucket::DeleteData(k); + DataBucket::DeleteData(&database, k); return true; } @@ -4878,7 +4878,7 @@ void Client::GrantNameChange() { auto k = GetScopedBucketKeys(); k.key = "name_change_allowed"; k.value = "allowed"; // potentially put a timestamp here - DataBucket::SetData(k); + DataBucket::SetData(&database, k); InvokeChangeNameWindow(true); } @@ -4891,7 +4891,7 @@ bool Client::IsPetNameChangeAllowed() { DataBucketKey k = GetScopedBucketKeys(); k.key = "PetNameChangesAllowed"; - auto b = DataBucket::GetData(k); + auto b = DataBucket::GetData(&database, k); if (!b.value.empty()) { return true; } @@ -4915,7 +4915,7 @@ void Client::GrantPetNameChange() { DataBucketKey k = GetScopedBucketKeys(); k.key = "PetNameChangesAllowed"; k.value = "true"; - DataBucket::SetData(k); + DataBucket::SetData(&database, k); InvokeChangePetName(true); } @@ -4924,7 +4924,7 @@ void Client::ClearPetNameChange() { DataBucketKey k = GetScopedBucketKeys(); k.key = "PetNameChangesAllowed"; - DataBucket::DeleteData(k); + DataBucket::DeleteData(&database, k); } bool Client::ChangePetName(std::string new_name) @@ -9671,9 +9671,9 @@ void Client::SetDevToolsEnabled(bool in_dev_tools_enabled) const auto dev_tools_key = fmt::format("{}-dev-tools-disabled", AccountID()); if (in_dev_tools_enabled) { - DataBucket::DeleteData(dev_tools_key); + DataBucket::DeleteData(&database, dev_tools_key); } else { - DataBucket::SetData(dev_tools_key, "true"); + DataBucket::SetData(&database, dev_tools_key, "true"); } Client::dev_tools_enabled = in_dev_tools_enabled; @@ -9846,7 +9846,7 @@ void Client::SendToGuildHall() uint32 expiration_time = (RuleI(Instances, GuildHallExpirationDays) * 86400); uint16 instance_id = 0; std::string guild_hall_instance_key = fmt::format("guild-hall-instance-{}", GuildID()); - std::string instance_data = DataBucket::GetData(guild_hall_instance_key); + std::string instance_data = DataBucket::GetData(&database, guild_hall_instance_key); if (!instance_data.empty() && Strings::ToInt(instance_data) > 0) { instance_id = Strings::ToInt(instance_data); } @@ -9863,6 +9863,7 @@ void Client::SendToGuildHall() } DataBucket::SetData( + &database, guild_hall_instance_key, std::to_string(instance_id), std::to_string(expiration_time) @@ -10915,7 +10916,7 @@ void Client::SendToInstance(std::string instance_type, std::string zone_short_na instance_identifier, zone_short_name ); - std::string current_bucket_value = DataBucket::GetData(full_bucket_name); + std::string current_bucket_value = DataBucket::GetData(&database, full_bucket_name); uint16 instance_id = 0; if (current_bucket_value.length() > 0) { @@ -10931,7 +10932,7 @@ void Client::SendToInstance(std::string instance_type, std::string zone_short_na return; } - DataBucket::SetData(full_bucket_name, itoa(instance_id), itoa(duration)); + DataBucket::SetData(&database, full_bucket_name, itoa(instance_id), itoa(duration)); } AssignToInstance(instance_id); @@ -13149,7 +13150,7 @@ std::string Client::GetAccountBucket(std::string bucket_name) k.account_id = AccountID(); k.key = bucket_name; - return DataBucket::GetData(k).value; + return DataBucket::GetData(&database, k).value; } void Client::SetAccountBucket(std::string bucket_name, std::string bucket_value, std::string expiration) @@ -13160,7 +13161,7 @@ void Client::SetAccountBucket(std::string bucket_name, std::string bucket_value, k.expires = expiration; k.value = bucket_value; - DataBucket::SetData(k); + DataBucket::SetData(&database, k); } void Client::DeleteAccountBucket(std::string bucket_name) @@ -13169,7 +13170,7 @@ void Client::DeleteAccountBucket(std::string bucket_name) k.account_id = AccountID(); k.key = bucket_name; - DataBucket::DeleteData(k); + DataBucket::DeleteData(&database, k); } std::string Client::GetAccountBucketExpires(std::string bucket_name) @@ -13178,7 +13179,7 @@ std::string Client::GetAccountBucketExpires(std::string bucket_name) k.account_id = AccountID(); k.key = bucket_name; - return DataBucket::GetDataExpires(k); + return DataBucket::GetDataExpires(&database, k); } std::string Client::GetAccountBucketRemaining(std::string bucket_name) @@ -13187,7 +13188,7 @@ std::string Client::GetAccountBucketRemaining(std::string bucket_name) k.account_id = AccountID(); k.key = bucket_name; - return DataBucket::GetDataRemaining(k); + return DataBucket::GetDataRemaining(&database, k); } std::string Client::GetBandolierName(uint8 bandolier_slot) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index a059bef65..c7bb4a05c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1853,7 +1853,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) */ if (Admin() >= EQ::DevTools::GM_ACCOUNT_STATUS_LEVEL) { const auto dev_tools_key = fmt::format("{}-dev-tools-disabled", AccountID()); - if (DataBucket::GetData(dev_tools_key) == "true") { + if (DataBucket::GetData(&database, dev_tools_key) == "true") { dev_tools_enabled = false; } } diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e14985763..19440e3bb 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -874,7 +874,7 @@ void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; - auto b = DataBucket::GetData(k); + auto b = DataBucket::GetData(&database, k); if (b.value.empty()) { continue; } diff --git a/zone/exp.cpp b/zone/exp.cpp index e3016f8b2..1f64d8b71 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -1299,7 +1299,7 @@ uint8 Client::GetCharMaxLevelFromBucket() DataBucketKey k = GetScopedBucketKeys(); k.key = "CharMaxLevel"; - auto b = DataBucket::GetData(k); + auto b = DataBucket::GetData(&database, k); if (!b.value.empty()) { if (Strings::IsNumber(b.value)) { return static_cast(Strings::ToUnsignedInt(b.value)); diff --git a/zone/gm_commands/databuckets.cpp b/zone/gm_commands/databuckets.cpp index af78f528e..ca2b17808 100755 --- a/zone/gm_commands/databuckets.cpp +++ b/zone/gm_commands/databuckets.cpp @@ -50,7 +50,7 @@ void command_databuckets(Client *c, const Seperator *sep) !npc_id && !bot_id ) { - if (!DataBucket::DeleteData(key_filter)) { + if (!DataBucket::DeleteData(&database, key_filter)) { c->Message( Chat::White, fmt::format( @@ -76,7 +76,7 @@ void command_databuckets(Client *c, const Seperator *sep) k.npc_id = npc_id; k.bot_id = bot_id; - if (!DataBucket::DeleteData(k)) { + if (!DataBucket::DeleteData(&database, k)) { c->Message( Chat::White, fmt::format( @@ -123,7 +123,7 @@ void command_databuckets(Client *c, const Seperator *sep) const std::string& expires_string = expires == 0 ? "Never" : std::to_string(expires); - DataBucket::SetData(k); + DataBucket::SetData(&database, k); c->Message( Chat::White, diff --git a/zone/gm_commands/gmzone.cpp b/zone/gm_commands/gmzone.cpp index a26a09d05..9aefd58bc 100755 --- a/zone/gm_commands/gmzone.cpp +++ b/zone/gm_commands/gmzone.cpp @@ -58,7 +58,7 @@ void command_gmzone(Client *c, const Seperator *sep) zone_version ); - auto existing_zone_instance = DataBucket::GetData(bucket_key); + auto existing_zone_instance = DataBucket::GetData(&database, bucket_key); uint16 instance_id = 0; uint32 duration = 100000000; @@ -99,6 +99,7 @@ void command_gmzone(Client *c, const Seperator *sep) ); DataBucket::SetData( + &database, bucket_key, std::to_string(instance_id) ); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 1873aec0b..73a1e29ba 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -933,23 +933,23 @@ std::string lua_get_rule(std::string rule_name) { } std::string lua_get_data(std::string bucket_key) { - return DataBucket::GetData(bucket_key); + return DataBucket::GetData(&database, bucket_key); } std::string lua_get_data_expires(std::string bucket_key) { - return DataBucket::GetDataExpires(bucket_key); + return DataBucket::GetDataExpires(&database, bucket_key); } void lua_set_data(std::string bucket_key, std::string bucket_value) { - DataBucket::SetData(bucket_key, bucket_value); + DataBucket::SetData(&database, bucket_key, bucket_value); } void lua_set_data(std::string bucket_key, std::string bucket_value, std::string expires_at) { - DataBucket::SetData(bucket_key, bucket_value, expires_at); + DataBucket::SetData(&database, bucket_key, bucket_value, expires_at); } bool lua_delete_data(std::string bucket_key) { - return DataBucket::DeleteData(bucket_key); + return DataBucket::DeleteData(&database, bucket_key); } std::string lua_get_char_name_by_id(uint32 char_id) { @@ -2030,7 +2030,7 @@ void lua_rename(std::string name) { } std::string lua_get_data_remaining(std::string bucket_name) { - return DataBucket::GetDataRemaining(bucket_name); + return DataBucket::GetDataRemaining(&database, bucket_name); } const int lua_get_item_stat(uint32 item_id, std::string identifier) { diff --git a/zone/mob.cpp b/zone/mob.cpp index 1302246b2..69d1ce826 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -8161,7 +8161,7 @@ void Mob::DeleteBucket(std::string bucket_name) DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; - DataBucket::DeleteData(k); + DataBucket::DeleteData(&database, k); } std::string Mob::GetBucket(std::string bucket_name) @@ -8169,7 +8169,7 @@ std::string Mob::GetBucket(std::string bucket_name) DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; - auto b = DataBucket::GetData(k); + auto b = DataBucket::GetData(&database, k); if (!b.value.empty()) { return b.value; } @@ -8181,7 +8181,7 @@ std::string Mob::GetBucketExpires(std::string bucket_name) DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; - std::string bucket_expiration = DataBucket::GetDataExpires(k); + std::string bucket_expiration = DataBucket::GetDataExpires(&database, k); if (!bucket_expiration.empty()) { return bucket_expiration; } @@ -8194,7 +8194,7 @@ std::string Mob::GetBucketRemaining(std::string bucket_name) DataBucketKey k = GetScopedBucketKeys(); k.key = bucket_name; - std::string bucket_remaining = DataBucket::GetDataRemaining(k); + std::string bucket_remaining = DataBucket::GetDataRemaining(&database, k); if (!bucket_remaining.empty() && Strings::ToInt(bucket_remaining) > 0) { return bucket_remaining; } @@ -8212,7 +8212,7 @@ void Mob::SetBucket(std::string bucket_name, std::string bucket_value, std::stri k.expires = expiration; k.value = bucket_value; - DataBucket::SetData(k); + DataBucket::SetData(&database, k); } std::string Mob::GetMobDescription() @@ -8783,12 +8783,12 @@ bool Mob::LoadDataBucketsCache() } if (IsBot()) { - DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Bot, {id}); + DataBucket::BulkLoadEntitiesToCache(&database, DataBucketLoadType::Bot, {id}); } else if (IsClient()) { uint32 account_id = CastToClient()->AccountID(); - DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Account, {account_id}); - DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Client, {id}); + DataBucket::BulkLoadEntitiesToCache(&database, DataBucketLoadType::Account, {account_id}); + DataBucket::BulkLoadEntitiesToCache(&database, DataBucketLoadType::Client, {id}); } return true; diff --git a/zone/spells.cpp b/zone/spells.cpp index c37fa4467..6636a092c 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -6275,7 +6275,7 @@ bool Client::SpellBucketCheck(uint16 spell_id, uint32 character_id) k.key = e.bucket_name; - const auto& b = DataBucket::GetData(k); + const auto& b = DataBucket::GetData(&database, k); return zone->CompareDataBucket(e.bucket_comparison, e.bucket_value, b.value); } diff --git a/zone/zone.cpp b/zone/zone.cpp index eea9d8a97..4e4108720 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -170,7 +170,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) { zone->RequestUCSServerStatus(); zone->StartShutdownTimer(); - DataBucket::LoadZoneCache(iZoneID, iInstanceID); + DataBucket::LoadZoneCache(&database, iZoneID, iInstanceID); /* * Set Logging @@ -3186,7 +3186,7 @@ std::string Zone::GetBucket(const std::string& bucket_name) k.instance_id = instanceid; k.key = bucket_name; - return DataBucket::GetData(k).value; + return DataBucket::GetData(&database, k).value; } void Zone::SetBucket(const std::string& bucket_name, const std::string& bucket_value, const std::string& expiration) @@ -3198,7 +3198,7 @@ void Zone::SetBucket(const std::string& bucket_name, const std::string& bucket_v k.expires = expiration; k.value = bucket_value; - DataBucket::SetData(k); + DataBucket::SetData(&database, k); } void Zone::DeleteBucket(const std::string& bucket_name) @@ -3208,7 +3208,7 @@ void Zone::DeleteBucket(const std::string& bucket_name) k.instance_id = instanceid; k.key = bucket_name; - DataBucket::DeleteData(k); + DataBucket::DeleteData(&database, k); } std::string Zone::GetBucketExpires(const std::string& bucket_name) @@ -3218,7 +3218,7 @@ std::string Zone::GetBucketExpires(const std::string& bucket_name) k.instance_id = instanceid; k.key = bucket_name; - return DataBucket::GetDataExpires(k); + return DataBucket::GetDataExpires(&database, k); } std::string Zone::GetBucketRemaining(const std::string& bucket_name) @@ -3228,7 +3228,7 @@ std::string Zone::GetBucketRemaining(const std::string& bucket_name) k.instance_id = instanceid; k.key = bucket_name; - return DataBucket::GetDataRemaining(k); + return DataBucket::GetDataRemaining(&database, k); } void Zone::DisableRespawnTimers() From 1db4882cdae24a9ed85c4fcdf43ea2b5d53c086b Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 7 Dec 2025 19:40:35 -0800 Subject: [PATCH 33/44] Fix client files, loginserver and tests --- CMakeLists.txt | 22 +++++++++++----------- client_files/export/CMakeLists.txt | 2 +- client_files/import/CMakeLists.txt | 2 +- loginserver/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29327f53c..22c725dab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,14 +166,14 @@ if(EQEMU_BUILD_SERVER) add_subdirectory(eqlaunch) endif() -#if(EQEMU_BUILD_LOGIN) -# add_subdirectory(loginserver) -#endif() -# -#if(EQEMU_BUILD_TESTS) -# add_subdirectory(tests) -#endif() -# -#if(EQEMU_BUILD_CLIENT_FILES) -# add_subdirectory(client_files) -#endif() +if(EQEMU_BUILD_LOGIN) + add_subdirectory(loginserver) +endif() + +if(EQEMU_BUILD_TESTS) + add_subdirectory(tests) +endif() + +if(EQEMU_BUILD_CLIENT_FILES) + add_subdirectory(client_files) +endif() diff --git a/client_files/export/CMakeLists.txt b/client_files/export/CMakeLists.txt index a127963b6..c35a22efe 100644 --- a/client_files/export/CMakeLists.txt +++ b/client_files/export/CMakeLists.txt @@ -11,6 +11,6 @@ add_executable(export_client_files ${export_sources} ${export_headers}) install(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -target_link_libraries(export_client_files ${SERVER_LIBS}) +target_link_libraries(export_client_files common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/client_files/import/CMakeLists.txt b/client_files/import/CMakeLists.txt index 2643090af..af7f4da0c 100644 --- a/client_files/import/CMakeLists.txt +++ b/client_files/import/CMakeLists.txt @@ -11,6 +11,6 @@ add_executable(import_client_files ${import_sources} ${import_headers}) install(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -target_link_libraries(import_client_files ${SERVER_LIBS}) +target_link_libraries(import_client_files common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 67729481b..b576031dd 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -30,6 +30,6 @@ add_executable(loginserver ${eqlogin_sources} ${eqlogin_headers}) install(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -target_link_libraries(loginserver ${SERVER_LIBS}) +target_link_libraries(loginserver common) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e38dc7066..7fa45d2fc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,7 +21,7 @@ set(tests_headers add_executable(tests ${tests_sources} ${tests_headers}) -target_link_libraries(tests common cppunit ${SERVER_LIBS}) +target_link_libraries(tests common cppunit) install(TARGETS tests RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) From 04d947a40ec51bc952e83c152316e7fdfa88a8e1 Mon Sep 17 00:00:00 2001 From: KimLS Date: Sun, 7 Dec 2025 21:17:13 -0800 Subject: [PATCH 34/44] Newer versions of libmariadb default to tls forced on, return to the default of not forcing that. auto_login were breaking on linux builds loginserver wasn't setting proper openssl compile flag --- common/dbcore.cpp | 8 ++++++++ loginserver/CMakeLists.txt | 2 ++ zone/gm_commands/set/auto_login.cpp | 2 +- zone/gm_commands/show/auto_login.cpp | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/dbcore.cpp b/common/dbcore.cpp index ff0afac3a..bb233536c 100644 --- a/common/dbcore.cpp +++ b/common/dbcore.cpp @@ -258,9 +258,17 @@ bool DBcore::Open(uint32 *errnum, char *errbuf) if (pCompress) { flags |= CLIENT_COMPRESS; } + + //todo: we need to revisit this ssl handling later + //the whole connect code is ancient and tls is starting to come as a default requirement for many db setups if (pSSL) { flags |= CLIENT_SSL; } + else { + int off = 0; + mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &off); + mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &off); + } if (mysql_real_connect(mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) { pStatus = Connected; diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index b576031dd..ca89bd357 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -26,6 +26,8 @@ set(eqlogin_headers world_server.h ) +add_compile_definitions(EQEMU_USE_OPENSSL) + add_executable(loginserver ${eqlogin_sources} ${eqlogin_headers}) install(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) diff --git a/zone/gm_commands/set/auto_login.cpp b/zone/gm_commands/set/auto_login.cpp index 4cf219fe8..829c739e3 100755 --- a/zone/gm_commands/set/auto_login.cpp +++ b/zone/gm_commands/set/auto_login.cpp @@ -2,7 +2,7 @@ #include "../../groups.h" #include "../../raids.h" #include "../../raids.h" -#include "../../common/repositories/account_repository.h" +#include "../../../common/repositories/account_repository.h" void SetAutoLogin(Client* c, const Seperator* sep) { diff --git a/zone/gm_commands/show/auto_login.cpp b/zone/gm_commands/show/auto_login.cpp index 3a39230a5..2a82e5b0b 100644 --- a/zone/gm_commands/show/auto_login.cpp +++ b/zone/gm_commands/show/auto_login.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/account_repository.h" +#include "../../../common/repositories/account_repository.h" void ShowAutoLogin(Client* c, const Seperator* sep) { From daa9102cc638c548beafa2f1e33253eb6e90bb72 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 8 Dec 2025 20:00:04 -0800 Subject: [PATCH 35/44] Move set out of a giant cpp file include. --- zone/CMakeLists.txt | 114 ++++++++++++ zone/gm_commands/CMakeLists.txt | 169 ++++++++++++++++++ zone/gm_commands/set.cpp | 113 ++++++------ .../set/{aa_exp.cpp => set_aa_exp.cpp} | 0 .../set/{aa_points.cpp => set_aa_points.cpp} | 0 ...re_points.cpp => set_adventure_points.cpp} | 0 ...urrency.cpp => set_alternate_currency.cpp} | 0 .../set/{animation.cpp => set_animation.cpp} | 0 .../set/{anon.cpp => set_anon.cpp} | 0 .../{auto_login.cpp => set_auto_login.cpp} | 0 .../{bind_point.cpp => set_bind_point.cpp} | 0 .../set/{checksum.cpp => set_checksum.cpp} | 0 ..._permanent.cpp => set_class_permanent.cpp} | 0 .../set/{crystals.cpp => set_crystals.cpp} | 0 .../set/{date.cpp => set_date.cpp} | 0 .../set/{endurance.cpp => set_endurance.cpp} | 0 ...urance_full.cpp => set_endurance_full.cpp} | 0 zone/gm_commands/set/{exp.cpp => set_exp.cpp} | 0 .../set/{flymode.cpp => set_flymode.cpp} | 0 .../set/{frozen.cpp => set_frozen.cpp} | 0 .../set/{gender.cpp => set_gender.cpp} | 0 ...permanent.cpp => set_gender_permanent.cpp} | 0 zone/gm_commands/set/{gm.cpp => set_gm.cpp} | 0 .../set/{gm_speed.cpp => set_gm_speed.cpp} | 0 .../set/{gm_status.cpp => set_gm_status.cpp} | 0 .../set/{god_mode.cpp => set_god_mode.cpp} | 0 .../set/{haste.cpp => set_haste.cpp} | 0 .../{hero_model.cpp => set_hero_model.cpp} | 0 .../set/{hide_me.cpp => set_hide_me.cpp} | 0 zone/gm_commands/set/{hp.cpp => set_hp.cpp} | 0 .../set/{hp_full.cpp => set_hp_full.cpp} | 0 ...{invulnerable.cpp => set_invulnerable.cpp} | 0 .../set/{language.cpp => set_language.cpp} | 0 .../set/{last_name.cpp => set_last_name.cpp} | 0 .../set/{level.cpp => set_level.cpp} | 0 ...rver_info.cpp => set_loginserver_info.cpp} | 0 .../set/{mana.cpp => set_mana.cpp} | 0 .../set/{mana_full.cpp => set_mana_full.cpp} | 0 .../set/{motd.cpp => set_motd.cpp} | 0 .../set/{name.cpp => set_name.cpp} | 0 .../set/{ooc_mute.cpp => set_ooc_mute.cpp} | 0 .../set/{password.cpp => set_password.cpp} | 0 zone/gm_commands/set/{pvp.cpp => set_pvp.cpp} | 0 .../{pvp_points.cpp => set_pvp_points.cpp} | 0 .../set/{race.cpp => set_race.cpp} | 0 ...e_permanent.cpp => set_race_permanent.cpp} | 0 ...erver_locked.cpp => set_server_locked.cpp} | 0 .../set/{skill.cpp => set_skill.cpp} | 0 .../set/{skill_all.cpp => set_skill_all.cpp} | 0 ...kill_all_max.cpp => set_skill_all_max.cpp} | 0 .../{start_zone.cpp => set_start_zone.cpp} | 0 ...porary_name.cpp => set_temporary_name.cpp} | 0 .../set/{texture.cpp => set_texture.cpp} | 0 .../set/{time.cpp => set_time.cpp} | 0 .../set/{time_zone.cpp => set_time_zone.cpp} | 0 .../set/{title.cpp => set_title.cpp} | 0 ...{title_suffix.cpp => set_title_suffix.cpp} | 0 .../set/{weather.cpp => set_weather.cpp} | 0 .../set/{zone.cpp => set_zone.cpp} | 0 59 files changed, 340 insertions(+), 56 deletions(-) create mode 100644 zone/gm_commands/CMakeLists.txt rename zone/gm_commands/set/{aa_exp.cpp => set_aa_exp.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{aa_points.cpp => set_aa_points.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{adventure_points.cpp => set_adventure_points.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{alternate_currency.cpp => set_alternate_currency.cpp} (100%) rename zone/gm_commands/set/{animation.cpp => set_animation.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{anon.cpp => set_anon.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{auto_login.cpp => set_auto_login.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{bind_point.cpp => set_bind_point.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{checksum.cpp => set_checksum.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{class_permanent.cpp => set_class_permanent.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{crystals.cpp => set_crystals.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{date.cpp => set_date.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{endurance.cpp => set_endurance.cpp} (100%) rename zone/gm_commands/set/{endurance_full.cpp => set_endurance_full.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{exp.cpp => set_exp.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{flymode.cpp => set_flymode.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{frozen.cpp => set_frozen.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{gender.cpp => set_gender.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{gender_permanent.cpp => set_gender_permanent.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{gm.cpp => set_gm.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{gm_speed.cpp => set_gm_speed.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{gm_status.cpp => set_gm_status.cpp} (100%) rename zone/gm_commands/set/{god_mode.cpp => set_god_mode.cpp} (100%) rename zone/gm_commands/set/{haste.cpp => set_haste.cpp} (100%) rename zone/gm_commands/set/{hero_model.cpp => set_hero_model.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{hide_me.cpp => set_hide_me.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{hp.cpp => set_hp.cpp} (100%) rename zone/gm_commands/set/{hp_full.cpp => set_hp_full.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{invulnerable.cpp => set_invulnerable.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{language.cpp => set_language.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{last_name.cpp => set_last_name.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{level.cpp => set_level.cpp} (100%) rename zone/gm_commands/set/{loginserver_info.cpp => set_loginserver_info.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{mana.cpp => set_mana.cpp} (100%) rename zone/gm_commands/set/{mana_full.cpp => set_mana_full.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{motd.cpp => set_motd.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{name.cpp => set_name.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{ooc_mute.cpp => set_ooc_mute.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{password.cpp => set_password.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{pvp.cpp => set_pvp.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{pvp_points.cpp => set_pvp_points.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{race.cpp => set_race.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{race_permanent.cpp => set_race_permanent.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{server_locked.cpp => set_server_locked.cpp} (100%) rename zone/gm_commands/set/{skill.cpp => set_skill.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{skill_all.cpp => set_skill_all.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{skill_all_max.cpp => set_skill_all_max.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{start_zone.cpp => set_start_zone.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{temporary_name.cpp => set_temporary_name.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{texture.cpp => set_texture.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{time.cpp => set_time.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{time_zone.cpp => set_time_zone.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{title.cpp => set_title.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{title_suffix.cpp => set_title_suffix.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{weather.cpp => set_weather.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/set/{zone.cpp => set_zone.cpp} (100%) mode change 100755 => 100644 diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index b2a222dac..28f0a6eea 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -432,6 +432,62 @@ set(gm_command_sources gm_commands/sensetrap.cpp gm_commands/serverrules.cpp gm_commands/set.cpp + gm_commands/set/set_aa_exp.cpp + gm_commands/set/set_aa_points.cpp + gm_commands/set/set_adventure_points.cpp + gm_commands/set/set_alternate_currency.cpp + gm_commands/set/set_animation.cpp + gm_commands/set/set_anon.cpp + gm_commands/set/set_auto_login.cpp + gm_commands/set/set_bind_point.cpp + gm_commands/set/set_checksum.cpp + gm_commands/set/set_class_permanent.cpp + gm_commands/set/set_crystals.cpp + gm_commands/set/set_date.cpp + gm_commands/set/set_endurance.cpp + gm_commands/set/set_endurance_full.cpp + gm_commands/set/set_exp.cpp + gm_commands/set/set_flymode.cpp + gm_commands/set/set_frozen.cpp + gm_commands/set/set_gender.cpp + gm_commands/set/set_gender_permanent.cpp + gm_commands/set/set_gm.cpp + gm_commands/set/set_gm_speed.cpp + gm_commands/set/set_gm_status.cpp + gm_commands/set/set_god_mode.cpp + gm_commands/set/set_haste.cpp + gm_commands/set/set_hero_model.cpp + gm_commands/set/set_hide_me.cpp + gm_commands/set/set_hp.cpp + gm_commands/set/set_hp_full.cpp + gm_commands/set/set_invulnerable.cpp + gm_commands/set/set_language.cpp + gm_commands/set/set_last_name.cpp + gm_commands/set/set_level.cpp + gm_commands/set/set_loginserver_info.cpp + gm_commands/set/set_mana.cpp + gm_commands/set/set_mana_full.cpp + gm_commands/set/set_motd.cpp + gm_commands/set/set_name.cpp + gm_commands/set/set_ooc_mute.cpp + gm_commands/set/set_password.cpp + gm_commands/set/set_pvp.cpp + gm_commands/set/set_pvp_points.cpp + gm_commands/set/set_race.cpp + gm_commands/set/set_race_permanent.cpp + gm_commands/set/set_server_locked.cpp + gm_commands/set/set_skill.cpp + gm_commands/set/set_skill_all.cpp + gm_commands/set/set_skill_all_max.cpp + gm_commands/set/set_start_zone.cpp + gm_commands/set/set_temporary_name.cpp + gm_commands/set/set_texture.cpp + gm_commands/set/set_time.cpp + gm_commands/set/set_time_zone.cpp + gm_commands/set/set_title.cpp + gm_commands/set/set_title_suffix.cpp + gm_commands/set/set_weather.cpp + gm_commands/set/set_zone.cpp gm_commands/show.cpp gm_commands/shutdown.cpp gm_commands/spawn.cpp @@ -469,6 +525,64 @@ set(gm_command_sources gm_commands/zsave.cpp ) +source_group(set FILES + gm_commands/set/set_aa_exp.cpp + gm_commands/set/set_aa_points.cpp + gm_commands/set/set_adventure_points.cpp + gm_commands/set/set_alternate_currency.cpp + gm_commands/set/set_animation.cpp + gm_commands/set/set_anon.cpp + gm_commands/set/set_auto_login.cpp + gm_commands/set/set_bind_point.cpp + gm_commands/set/set_checksum.cpp + gm_commands/set/set_class_permanent.cpp + gm_commands/set/set_crystals.cpp + gm_commands/set/set_date.cpp + gm_commands/set/set_endurance.cpp + gm_commands/set/set_endurance_full.cpp + gm_commands/set/set_exp.cpp + gm_commands/set/set_flymode.cpp + gm_commands/set/set_frozen.cpp + gm_commands/set/set_gender.cpp + gm_commands/set/set_gender_permanent.cpp + gm_commands/set/set_gm.cpp + gm_commands/set/set_gm_speed.cpp + gm_commands/set/set_gm_status.cpp + gm_commands/set/set_god_mode.cpp + gm_commands/set/set_haste.cpp + gm_commands/set/set_hero_model.cpp + gm_commands/set/set_hide_me.cpp + gm_commands/set/set_hp.cpp + gm_commands/set/set_hp_full.cpp + gm_commands/set/set_invulnerable.cpp + gm_commands/set/set_language.cpp + gm_commands/set/set_last_name.cpp + gm_commands/set/set_level.cpp + gm_commands/set/set_loginserver_info.cpp + gm_commands/set/set_mana.cpp + gm_commands/set/set_mana_full.cpp + gm_commands/set/set_motd.cpp + gm_commands/set/set_name.cpp + gm_commands/set/set_ooc_mute.cpp + gm_commands/set/set_password.cpp + gm_commands/set/set_pvp.cpp + gm_commands/set/set_pvp_points.cpp + gm_commands/set/set_race.cpp + gm_commands/set/set_race_permanent.cpp + gm_commands/set/set_server_locked.cpp + gm_commands/set/set_skill.cpp + gm_commands/set/set_skill_all.cpp + gm_commands/set/set_skill_all_max.cpp + gm_commands/set/set_start_zone.cpp + gm_commands/set/set_temporary_name.cpp + gm_commands/set/set_texture.cpp + gm_commands/set/set_time.cpp + gm_commands/set/set_time_zone.cpp + gm_commands/set/set_title.cpp + gm_commands/set/set_title_suffix.cpp + gm_commands/set/set_weather.cpp + gm_commands/set/set_zone.cpp) + add_library(gm_commands_zone STATIC ${gm_command_sources}) target_link_libraries(gm_commands_zone PRIVATE cereal::cereal fmt::fmt $,libuv::uv_a,libuv::uv> unofficial::libmariadb) set_target_properties(gm_commands_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 32) diff --git a/zone/gm_commands/CMakeLists.txt b/zone/gm_commands/CMakeLists.txt new file mode 100644 index 000000000..01af3a426 --- /dev/null +++ b/zone/gm_commands/CMakeLists.txt @@ -0,0 +1,169 @@ +cmake_minimum_required(VERSION 3.20) + +# gm commands +set(gm_command_sources + command.cpp + bot_command.cpp + gm_commands/acceptrules.cpp + gm_commands/advnpcspawn.cpp + gm_commands/aggrozone.cpp + gm_commands/ai.cpp + gm_commands/appearance.cpp + gm_commands/appearanceeffects.cpp + gm_commands/attack.cpp + gm_commands/augmentitem.cpp + gm_commands/ban.cpp + gm_commands/bugs.cpp + gm_commands/camerashake.cpp + gm_commands/castspell.cpp + gm_commands/chat.cpp + gm_commands/clearxtargets.cpp + gm_commands/copycharacter.cpp + gm_commands/corpse.cpp + gm_commands/corpsefix.cpp + gm_commands/countitem.cpp + gm_commands/damage.cpp + gm_commands/databuckets.cpp + gm_commands/dbspawn2.cpp + gm_commands/delacct.cpp + gm_commands/delpetition.cpp + gm_commands/depop.cpp + gm_commands/depopzone.cpp + gm_commands/devtools.cpp + gm_commands/disablerecipe.cpp + gm_commands/disarmtrap.cpp + gm_commands/doanim.cpp + gm_commands/door.cpp + gm_commands/door_manipulation.cpp + gm_commands/dye.cpp + gm_commands/dz.cpp + gm_commands/dzkickplayers.cpp + gm_commands/editmassrespawn.cpp + gm_commands/emote.cpp + gm_commands/emptyinventory.cpp + gm_commands/enablerecipe.cpp + gm_commands/entityvariable.cpp + gm_commands/exptoggle.cpp + gm_commands/faction.cpp + gm_commands/evolving_items.cpp + gm_commands/feature.cpp + gm_commands/find.cpp + gm_commands/fish.cpp + gm_commands/fixmob.cpp + gm_commands/flagedit.cpp + gm_commands/fleeinfo.cpp + gm_commands/forage.cpp + gm_commands/gearup.cpp + gm_commands/giveitem.cpp + gm_commands/givemoney.cpp + gm_commands/gmzone.cpp + gm_commands/goto.cpp + gm_commands/grantaa.cpp + gm_commands/grid.cpp + gm_commands/guild.cpp + gm_commands/hp.cpp + gm_commands/illusion_block.cpp + gm_commands/instance.cpp + gm_commands/interrogateinv.cpp + gm_commands/interrupt.cpp + gm_commands/invsnapshot.cpp + gm_commands/ipban.cpp + gm_commands/kick.cpp + gm_commands/kill.cpp + gm_commands/killallnpcs.cpp + gm_commands/list.cpp + gm_commands/lootsim.cpp + gm_commands/loc.cpp + gm_commands/logs.cpp + gm_commands/makepet.cpp + gm_commands/memspell.cpp + gm_commands/merchantshop.cpp + gm_commands/modifynpcstat.cpp + gm_commands/movechar.cpp + gm_commands/movement.cpp + gm_commands/myskills.cpp + gm_commands/mysql.cpp + gm_commands/mystats.cpp + gm_commands/npccast.cpp + gm_commands/npcedit.cpp + gm_commands/npceditmass.cpp + gm_commands/npcemote.cpp + gm_commands/npcloot.cpp + gm_commands/npcsay.cpp + gm_commands/npcshout.cpp + gm_commands/npcspawn.cpp + gm_commands/npctypespawn.cpp + gm_commands/nudge.cpp + gm_commands/nukebuffs.cpp + gm_commands/nukeitem.cpp + gm_commands/object.cpp + gm_commands/object_manipulation.cpp + gm_commands/parcels.cpp + gm_commands/path.cpp + gm_commands/peqzone.cpp + gm_commands/petitems.cpp + gm_commands/petname.cpp + gm_commands/picklock.cpp + gm_commands/profanity.cpp + gm_commands/push.cpp + gm_commands/raidloot.cpp + gm_commands/randomfeatures.cpp + gm_commands/refreshgroup.cpp + gm_commands/reload.cpp + gm_commands/removeitem.cpp + gm_commands/repop.cpp + gm_commands/resetaa.cpp + gm_commands/resetaa_timer.cpp + gm_commands/resetdisc_timer.cpp + gm_commands/revoke.cpp + gm_commands/roambox.cpp + gm_commands/rules.cpp + gm_commands/save.cpp + gm_commands/scale.cpp + gm_commands/scribespell.cpp + gm_commands/scribespells.cpp + gm_commands/sendzonespawns.cpp + gm_commands/sensetrap.cpp + gm_commands/serverrules.cpp + gm_commands/set.cpp + gm_commands/show.cpp + gm_commands/shutdown.cpp + gm_commands/spawn.cpp + gm_commands/spawneditmass.cpp + gm_commands/spawnfix.cpp + gm_commands/faction_association.cpp + gm_commands/stun.cpp + gm_commands/summon.cpp + gm_commands/summonburiedplayercorpse.cpp + gm_commands/summonitem.cpp + gm_commands/suspend.cpp + gm_commands/suspendmulti.cpp + gm_commands/takeplatinum.cpp + gm_commands/task.cpp + gm_commands/traindisc.cpp + gm_commands/tune.cpp + gm_commands/undye.cpp + gm_commands/unmemspell.cpp + gm_commands/unmemspells.cpp + gm_commands/unscribespell.cpp + gm_commands/unscribespells.cpp + gm_commands/untraindisc.cpp + gm_commands/untraindiscs.cpp + gm_commands/wc.cpp + gm_commands/worldshutdown.cpp + gm_commands/worldwide.cpp + gm_commands/wp.cpp + gm_commands/wpadd.cpp + gm_commands/zone.cpp + gm_commands/zonebootup.cpp + gm_commands/zoneshutdown.cpp + gm_commands/zonevariable.cpp + gm_commands/zone_instance.cpp + gm_commands/zone_shard.cpp + gm_commands/zsave.cpp +) + +add_library(gm_commands_zone STATIC ${gm_command_sources}) +target_link_libraries(gm_commands_zone PRIVATE common) +set_target_properties(gm_commands_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 32) + diff --git a/zone/gm_commands/set.cpp b/zone/gm_commands/set.cpp index 654cab281..1460ea029 100644 --- a/zone/gm_commands/set.cpp +++ b/zone/gm_commands/set.cpp @@ -1,60 +1,61 @@ #include "../client.h" -#include "set/aa_exp.cpp" -#include "set/aa_points.cpp" -#include "set/adventure_points.cpp" -#include "set/alternate_currency.cpp" -#include "set/animation.cpp" -#include "set/anon.cpp" -#include "set/auto_login.cpp" -#include "set/bind_point.cpp" -#include "set/checksum.cpp" -#include "set/class_permanent.cpp" -#include "set/crystals.cpp" -#include "set/date.cpp" -#include "set/endurance.cpp" -#include "set/endurance_full.cpp" -#include "set/exp.cpp" -#include "set/flymode.cpp" -#include "set/frozen.cpp" -#include "set/gender.cpp" -#include "set/gender_permanent.cpp" -#include "set/gm.cpp" -#include "set/gm_speed.cpp" -#include "set/gm_status.cpp" -#include "set/god_mode.cpp" -#include "set/haste.cpp" -#include "set/hero_model.cpp" -#include "set/hide_me.cpp" -#include "set/hp.cpp" -#include "set/hp_full.cpp" -#include "set/invulnerable.cpp" -#include "set/language.cpp" -#include "set/last_name.cpp" -#include "set/level.cpp" -#include "set/loginserver_info.cpp" -#include "set/mana.cpp" -#include "set/mana_full.cpp" -#include "set/motd.cpp" -#include "set/name.cpp" -#include "set/ooc_mute.cpp" -#include "set/password.cpp" -#include "set/pvp.cpp" -#include "set/pvp_points.cpp" -#include "set/race.cpp" -#include "set/race_permanent.cpp" -#include "set/server_locked.cpp" -#include "set/skill.cpp" -#include "set/skill_all.cpp" -#include "set/skill_all_max.cpp" -#include "set/start_zone.cpp" -#include "set/temporary_name.cpp" -#include "set/texture.cpp" -#include "set/time.cpp" -#include "set/time_zone.cpp" -#include "set/title.cpp" -#include "set/title_suffix.cpp" -#include "set/weather.cpp" -#include "set/zone.cpp" + +void SetAAEXP(Client *c, const Seperator *sep); +void SetAAPoints(Client *c, const Seperator *sep); +void SetAdventurePoints(Client *c, const Seperator *sep); +void SetAlternateCurrency(Client *c, const Seperator *sep); +void SetAnimation(Client *c, const Seperator *sep); +void SetAnon(Client *c, const Seperator *sep); +void SetAutoLogin(Client *c, const Seperator *sep); +void SetBindPoint(Client *c, const Seperator *sep); +void SetChecksum(Client *c, const Seperator *sep); +void SetClassPermanent(Client *c, const Seperator *sep); +void SetCrystals(Client *c, const Seperator *sep); +void SetDate(Client *c, const Seperator *sep); +void SetEndurance(Client *c, const Seperator *sep); +void SetEnduranceFull(Client *c, const Seperator *sep); +void SetEXP(Client *c, const Seperator *sep); +void SetFlymode(Client *c, const Seperator *sep); +void SetFrozen(Client *c, const Seperator *sep); +void SetGender(Client *c, const Seperator *sep); +void SetGenderPermanent(Client *c, const Seperator *sep); +void SetGM(Client *c, const Seperator *sep); +void SetGMSpeed(Client *c, const Seperator *sep); +void SetGMStatus(Client *c, const Seperator *sep); +void SetGodMode(Client *c, const Seperator *sep); +void SetHaste(Client *c, const Seperator *sep); +void SetHideMe(Client *c, const Seperator *sep); +void SetHeroModel(Client *c, const Seperator *sep); +void SetHP(Client *c, const Seperator *sep); +void SetHPFull(Client *c, const Seperator *sep); +void SetInvulnerable(Client *c, const Seperator *sep); +void SetLanguage(Client *c, const Seperator *sep); +void SetLastName(Client *c, const Seperator *sep); +void SetLevel(Client *c, const Seperator *sep); +void SetLoginserverInfo(Client *c, const Seperator *sep); +void SetMana(Client *c, const Seperator *sep); +void SetManaFull(Client *c, const Seperator *sep); +void SetMOTD(Client *c, const Seperator *sep); +void SetName(Client *c, const Seperator *sep); +void SetOOCMute(Client *c, const Seperator *sep); +void SetPassword(Client *c, const Seperator *sep); +void SetPVP(Client *c, const Seperator *sep); +void SetPVPPoints(Client *c, const Seperator *sep); +void SetRace(Client *c, const Seperator *sep); +void SetRacePermanent(Client *c, const Seperator *sep); +void SetServerLocked(Client *c, const Seperator *sep); +void SetSkill(Client *c, const Seperator *sep); +void SetSkillAll(Client *c, const Seperator *sep); +void SetSkillAllMax(Client *c, const Seperator *sep); +void SetStartZone(Client *c, const Seperator *sep); +void SetTemporaryName(Client *c, const Seperator *sep); +void SetTexture(Client *c, const Seperator *sep); +void SetTime(Client *c, const Seperator *sep); +void SetTimeZone(Client *c, const Seperator *sep); +void SetTitle(Client *c, const Seperator *sep); +void SetTitleSuffix(Client *c, const Seperator *sep); +void SetWeather(Client *c, const Seperator *sep); +void SetZoneData(Client *c, const Seperator *sep); void command_set(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/set/aa_exp.cpp b/zone/gm_commands/set/set_aa_exp.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/aa_exp.cpp rename to zone/gm_commands/set/set_aa_exp.cpp diff --git a/zone/gm_commands/set/aa_points.cpp b/zone/gm_commands/set/set_aa_points.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/aa_points.cpp rename to zone/gm_commands/set/set_aa_points.cpp diff --git a/zone/gm_commands/set/adventure_points.cpp b/zone/gm_commands/set/set_adventure_points.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/adventure_points.cpp rename to zone/gm_commands/set/set_adventure_points.cpp diff --git a/zone/gm_commands/set/alternate_currency.cpp b/zone/gm_commands/set/set_alternate_currency.cpp similarity index 100% rename from zone/gm_commands/set/alternate_currency.cpp rename to zone/gm_commands/set/set_alternate_currency.cpp diff --git a/zone/gm_commands/set/animation.cpp b/zone/gm_commands/set/set_animation.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/animation.cpp rename to zone/gm_commands/set/set_animation.cpp diff --git a/zone/gm_commands/set/anon.cpp b/zone/gm_commands/set/set_anon.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/anon.cpp rename to zone/gm_commands/set/set_anon.cpp diff --git a/zone/gm_commands/set/auto_login.cpp b/zone/gm_commands/set/set_auto_login.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/auto_login.cpp rename to zone/gm_commands/set/set_auto_login.cpp diff --git a/zone/gm_commands/set/bind_point.cpp b/zone/gm_commands/set/set_bind_point.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/bind_point.cpp rename to zone/gm_commands/set/set_bind_point.cpp diff --git a/zone/gm_commands/set/checksum.cpp b/zone/gm_commands/set/set_checksum.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/checksum.cpp rename to zone/gm_commands/set/set_checksum.cpp diff --git a/zone/gm_commands/set/class_permanent.cpp b/zone/gm_commands/set/set_class_permanent.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/class_permanent.cpp rename to zone/gm_commands/set/set_class_permanent.cpp diff --git a/zone/gm_commands/set/crystals.cpp b/zone/gm_commands/set/set_crystals.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/crystals.cpp rename to zone/gm_commands/set/set_crystals.cpp diff --git a/zone/gm_commands/set/date.cpp b/zone/gm_commands/set/set_date.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/date.cpp rename to zone/gm_commands/set/set_date.cpp diff --git a/zone/gm_commands/set/endurance.cpp b/zone/gm_commands/set/set_endurance.cpp similarity index 100% rename from zone/gm_commands/set/endurance.cpp rename to zone/gm_commands/set/set_endurance.cpp diff --git a/zone/gm_commands/set/endurance_full.cpp b/zone/gm_commands/set/set_endurance_full.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/endurance_full.cpp rename to zone/gm_commands/set/set_endurance_full.cpp diff --git a/zone/gm_commands/set/exp.cpp b/zone/gm_commands/set/set_exp.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/exp.cpp rename to zone/gm_commands/set/set_exp.cpp diff --git a/zone/gm_commands/set/flymode.cpp b/zone/gm_commands/set/set_flymode.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/flymode.cpp rename to zone/gm_commands/set/set_flymode.cpp diff --git a/zone/gm_commands/set/frozen.cpp b/zone/gm_commands/set/set_frozen.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/frozen.cpp rename to zone/gm_commands/set/set_frozen.cpp diff --git a/zone/gm_commands/set/gender.cpp b/zone/gm_commands/set/set_gender.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/gender.cpp rename to zone/gm_commands/set/set_gender.cpp diff --git a/zone/gm_commands/set/gender_permanent.cpp b/zone/gm_commands/set/set_gender_permanent.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/gender_permanent.cpp rename to zone/gm_commands/set/set_gender_permanent.cpp diff --git a/zone/gm_commands/set/gm.cpp b/zone/gm_commands/set/set_gm.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/gm.cpp rename to zone/gm_commands/set/set_gm.cpp diff --git a/zone/gm_commands/set/gm_speed.cpp b/zone/gm_commands/set/set_gm_speed.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/gm_speed.cpp rename to zone/gm_commands/set/set_gm_speed.cpp diff --git a/zone/gm_commands/set/gm_status.cpp b/zone/gm_commands/set/set_gm_status.cpp similarity index 100% rename from zone/gm_commands/set/gm_status.cpp rename to zone/gm_commands/set/set_gm_status.cpp diff --git a/zone/gm_commands/set/god_mode.cpp b/zone/gm_commands/set/set_god_mode.cpp similarity index 100% rename from zone/gm_commands/set/god_mode.cpp rename to zone/gm_commands/set/set_god_mode.cpp diff --git a/zone/gm_commands/set/haste.cpp b/zone/gm_commands/set/set_haste.cpp similarity index 100% rename from zone/gm_commands/set/haste.cpp rename to zone/gm_commands/set/set_haste.cpp diff --git a/zone/gm_commands/set/hero_model.cpp b/zone/gm_commands/set/set_hero_model.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/hero_model.cpp rename to zone/gm_commands/set/set_hero_model.cpp diff --git a/zone/gm_commands/set/hide_me.cpp b/zone/gm_commands/set/set_hide_me.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/hide_me.cpp rename to zone/gm_commands/set/set_hide_me.cpp diff --git a/zone/gm_commands/set/hp.cpp b/zone/gm_commands/set/set_hp.cpp similarity index 100% rename from zone/gm_commands/set/hp.cpp rename to zone/gm_commands/set/set_hp.cpp diff --git a/zone/gm_commands/set/hp_full.cpp b/zone/gm_commands/set/set_hp_full.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/hp_full.cpp rename to zone/gm_commands/set/set_hp_full.cpp diff --git a/zone/gm_commands/set/invulnerable.cpp b/zone/gm_commands/set/set_invulnerable.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/invulnerable.cpp rename to zone/gm_commands/set/set_invulnerable.cpp diff --git a/zone/gm_commands/set/language.cpp b/zone/gm_commands/set/set_language.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/language.cpp rename to zone/gm_commands/set/set_language.cpp diff --git a/zone/gm_commands/set/last_name.cpp b/zone/gm_commands/set/set_last_name.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/last_name.cpp rename to zone/gm_commands/set/set_last_name.cpp diff --git a/zone/gm_commands/set/level.cpp b/zone/gm_commands/set/set_level.cpp similarity index 100% rename from zone/gm_commands/set/level.cpp rename to zone/gm_commands/set/set_level.cpp diff --git a/zone/gm_commands/set/loginserver_info.cpp b/zone/gm_commands/set/set_loginserver_info.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/loginserver_info.cpp rename to zone/gm_commands/set/set_loginserver_info.cpp diff --git a/zone/gm_commands/set/mana.cpp b/zone/gm_commands/set/set_mana.cpp similarity index 100% rename from zone/gm_commands/set/mana.cpp rename to zone/gm_commands/set/set_mana.cpp diff --git a/zone/gm_commands/set/mana_full.cpp b/zone/gm_commands/set/set_mana_full.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/mana_full.cpp rename to zone/gm_commands/set/set_mana_full.cpp diff --git a/zone/gm_commands/set/motd.cpp b/zone/gm_commands/set/set_motd.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/motd.cpp rename to zone/gm_commands/set/set_motd.cpp diff --git a/zone/gm_commands/set/name.cpp b/zone/gm_commands/set/set_name.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/name.cpp rename to zone/gm_commands/set/set_name.cpp diff --git a/zone/gm_commands/set/ooc_mute.cpp b/zone/gm_commands/set/set_ooc_mute.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/ooc_mute.cpp rename to zone/gm_commands/set/set_ooc_mute.cpp diff --git a/zone/gm_commands/set/password.cpp b/zone/gm_commands/set/set_password.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/password.cpp rename to zone/gm_commands/set/set_password.cpp diff --git a/zone/gm_commands/set/pvp.cpp b/zone/gm_commands/set/set_pvp.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/pvp.cpp rename to zone/gm_commands/set/set_pvp.cpp diff --git a/zone/gm_commands/set/pvp_points.cpp b/zone/gm_commands/set/set_pvp_points.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/pvp_points.cpp rename to zone/gm_commands/set/set_pvp_points.cpp diff --git a/zone/gm_commands/set/race.cpp b/zone/gm_commands/set/set_race.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/race.cpp rename to zone/gm_commands/set/set_race.cpp diff --git a/zone/gm_commands/set/race_permanent.cpp b/zone/gm_commands/set/set_race_permanent.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/race_permanent.cpp rename to zone/gm_commands/set/set_race_permanent.cpp diff --git a/zone/gm_commands/set/server_locked.cpp b/zone/gm_commands/set/set_server_locked.cpp similarity index 100% rename from zone/gm_commands/set/server_locked.cpp rename to zone/gm_commands/set/set_server_locked.cpp diff --git a/zone/gm_commands/set/skill.cpp b/zone/gm_commands/set/set_skill.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/skill.cpp rename to zone/gm_commands/set/set_skill.cpp diff --git a/zone/gm_commands/set/skill_all.cpp b/zone/gm_commands/set/set_skill_all.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/skill_all.cpp rename to zone/gm_commands/set/set_skill_all.cpp diff --git a/zone/gm_commands/set/skill_all_max.cpp b/zone/gm_commands/set/set_skill_all_max.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/skill_all_max.cpp rename to zone/gm_commands/set/set_skill_all_max.cpp diff --git a/zone/gm_commands/set/start_zone.cpp b/zone/gm_commands/set/set_start_zone.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/start_zone.cpp rename to zone/gm_commands/set/set_start_zone.cpp diff --git a/zone/gm_commands/set/temporary_name.cpp b/zone/gm_commands/set/set_temporary_name.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/temporary_name.cpp rename to zone/gm_commands/set/set_temporary_name.cpp diff --git a/zone/gm_commands/set/texture.cpp b/zone/gm_commands/set/set_texture.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/texture.cpp rename to zone/gm_commands/set/set_texture.cpp diff --git a/zone/gm_commands/set/time.cpp b/zone/gm_commands/set/set_time.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/time.cpp rename to zone/gm_commands/set/set_time.cpp diff --git a/zone/gm_commands/set/time_zone.cpp b/zone/gm_commands/set/set_time_zone.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/time_zone.cpp rename to zone/gm_commands/set/set_time_zone.cpp diff --git a/zone/gm_commands/set/title.cpp b/zone/gm_commands/set/set_title.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/title.cpp rename to zone/gm_commands/set/set_title.cpp diff --git a/zone/gm_commands/set/title_suffix.cpp b/zone/gm_commands/set/set_title_suffix.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/title_suffix.cpp rename to zone/gm_commands/set/set_title_suffix.cpp diff --git a/zone/gm_commands/set/weather.cpp b/zone/gm_commands/set/set_weather.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/weather.cpp rename to zone/gm_commands/set/set_weather.cpp diff --git a/zone/gm_commands/set/zone.cpp b/zone/gm_commands/set/set_zone.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/set/zone.cpp rename to zone/gm_commands/set/set_zone.cpp From d378f8b107f2a7ecb6916b7d6dd41835effd0797 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 8 Dec 2025 20:10:10 -0800 Subject: [PATCH 36/44] Convert show --- zone/CMakeLists.txt | 106 ++++++++++++++++++ zone/gm_commands/show.cpp | 105 ++++++++--------- .../{aa_points.cpp => show_aa_points.cpp} | 0 .../show/{aas.cpp => show_aas.cpp} | 0 .../show/{aggro.cpp => show_aggro.cpp} | 0 .../{auto_login.cpp => show_auto_login.cpp} | 0 .../show/{buffs.cpp => show_buffs.cpp} | 0 ...count.cpp => show_buried_corpse_count.cpp} | 0 ...ry.cpp => show_client_version_summary.cpp} | 0 ...ntent_flags.cpp => show_content_flags.cpp} | 0 .../{currencies.cpp => show_currencies.cpp} | 0 .../show/{distance.cpp => show_distance.cpp} | 0 .../show/{emotes.cpp => show_emotes.cpp} | 0 ...eld_of_view.cpp => show_field_of_view.cpp} | 0 .../show/{flags.cpp => show_flags.cpp} | 0 .../{group_info.cpp => show_group_info.cpp} | 0 .../show/{hatelist.cpp => show_hatelist.cpp} | 0 .../{inventory.cpp => show_inventory.cpp} | 0 .../{ip_lookup.cpp => show_ip_lookup.cpp} | 0 .../show/{keyring.cpp => show_keyring.cpp} | 0 ...ne_of_sight.cpp => show_line_of_sight.cpp} | 0 .../show/{network.cpp => show_network.cpp} | 0 ...twork_stats.cpp => show_network_stats.cpp} | 0 ...obal_loot.cpp => show_npc_global_loot.cpp} | 0 .../{npc_stats.cpp => show_npc_stats.cpp} | 0 .../show/{npc_type.cpp => show_npc_type.cpp} | 0 ...qzone_flags.cpp => show_peqzone_flags.cpp} | 0 .../show/{petition.cpp => show_petition.cpp} | 2 +- ...tition_info.cpp => show_petition_info.cpp} | 2 +- .../{proximity.cpp => show_proximity.cpp} | 0 ...quest_errors.cpp => show_quest_errors.cpp} | 0 ...est_globals.cpp => show_quest_globals.cpp} | 0 .../show/{recipe.cpp => show_recipe.cpp} | 4 +- .../{server_info.cpp => show_server_info.cpp} | 2 +- .../show/{skills.cpp => show_skills.cpp} | 0 ...spawn_status.cpp => show_spawn_status.cpp} | 0 ...ilities.cpp => show_special_abilities.cpp} | 0 .../show/{spells.cpp => show_spells.cpp} | 0 .../{spells_list.cpp => show_spells_list.cpp} | 0 .../show/{stats.cpp => show_stats.cpp} | 0 .../show/{timers.cpp => show_timers.cpp} | 0 .../show/{traps.cpp => show_traps.cpp} | 0 .../show/{uptime.cpp => show_uptime.cpp} | 0 .../show/{variable.cpp => show_variable.cpp} | 0 .../show/{version.cpp => show_version.cpp} | 0 .../{waypoints.cpp => show_waypoints.cpp} | 0 .../show/{who.cpp => show_who.cpp} | 0 .../show/{xtargets.cpp => show_xtargets.cpp} | 2 +- .../{zone_data.cpp => show_zone_data.cpp} | 0 ...bal_loot.cpp => show_zone_global_loot.cpp} | 0 .../{zone_loot.cpp => show_zone_loot.cpp} | 0 .../{zone_points.cpp => show_zone_points.cpp} | 0 .../{zone_status.cpp => show_zone_status.cpp} | 0 ..._variables.cpp => show_zone_variables.cpp} | 0 54 files changed, 165 insertions(+), 58 deletions(-) rename zone/gm_commands/show/{aa_points.cpp => show_aa_points.cpp} (100%) rename zone/gm_commands/show/{aas.cpp => show_aas.cpp} (100%) rename zone/gm_commands/show/{aggro.cpp => show_aggro.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/show/{auto_login.cpp => show_auto_login.cpp} (100%) rename zone/gm_commands/show/{buffs.cpp => show_buffs.cpp} (100%) rename zone/gm_commands/show/{buried_corpse_count.cpp => show_buried_corpse_count.cpp} (100%) rename zone/gm_commands/show/{client_version_summary.cpp => show_client_version_summary.cpp} (100%) rename zone/gm_commands/show/{content_flags.cpp => show_content_flags.cpp} (100%) rename zone/gm_commands/show/{currencies.cpp => show_currencies.cpp} (100%) rename zone/gm_commands/show/{distance.cpp => show_distance.cpp} (100%) rename zone/gm_commands/show/{emotes.cpp => show_emotes.cpp} (100%) rename zone/gm_commands/show/{field_of_view.cpp => show_field_of_view.cpp} (100%) rename zone/gm_commands/show/{flags.cpp => show_flags.cpp} (100%) rename zone/gm_commands/show/{group_info.cpp => show_group_info.cpp} (100%) rename zone/gm_commands/show/{hatelist.cpp => show_hatelist.cpp} (100%) rename zone/gm_commands/show/{inventory.cpp => show_inventory.cpp} (100%) rename zone/gm_commands/show/{ip_lookup.cpp => show_ip_lookup.cpp} (100%) rename zone/gm_commands/show/{keyring.cpp => show_keyring.cpp} (100%) rename zone/gm_commands/show/{line_of_sight.cpp => show_line_of_sight.cpp} (100%) rename zone/gm_commands/show/{network.cpp => show_network.cpp} (100%) rename zone/gm_commands/show/{network_stats.cpp => show_network_stats.cpp} (100%) rename zone/gm_commands/show/{npc_global_loot.cpp => show_npc_global_loot.cpp} (100%) rename zone/gm_commands/show/{npc_stats.cpp => show_npc_stats.cpp} (100%) rename zone/gm_commands/show/{npc_type.cpp => show_npc_type.cpp} (100%) rename zone/gm_commands/show/{peqzone_flags.cpp => show_peqzone_flags.cpp} (100%) rename zone/gm_commands/show/{petition.cpp => show_petition.cpp} (94%) rename zone/gm_commands/show/{petition_info.cpp => show_petition_info.cpp} (96%) rename zone/gm_commands/show/{proximity.cpp => show_proximity.cpp} (100%) rename zone/gm_commands/show/{quest_errors.cpp => show_quest_errors.cpp} (100%) rename zone/gm_commands/show/{quest_globals.cpp => show_quest_globals.cpp} (100%) rename zone/gm_commands/show/{recipe.cpp => show_recipe.cpp} (93%) rename zone/gm_commands/show/{server_info.cpp => show_server_info.cpp} (98%) rename zone/gm_commands/show/{skills.cpp => show_skills.cpp} (100%) rename zone/gm_commands/show/{spawn_status.cpp => show_spawn_status.cpp} (100%) rename zone/gm_commands/show/{special_abilities.cpp => show_special_abilities.cpp} (100%) rename zone/gm_commands/show/{spells.cpp => show_spells.cpp} (100%) rename zone/gm_commands/show/{spells_list.cpp => show_spells_list.cpp} (100%) rename zone/gm_commands/show/{stats.cpp => show_stats.cpp} (100%) rename zone/gm_commands/show/{timers.cpp => show_timers.cpp} (100%) rename zone/gm_commands/show/{traps.cpp => show_traps.cpp} (100%) rename zone/gm_commands/show/{uptime.cpp => show_uptime.cpp} (100%) rename zone/gm_commands/show/{variable.cpp => show_variable.cpp} (100%) rename zone/gm_commands/show/{version.cpp => show_version.cpp} (100%) rename zone/gm_commands/show/{waypoints.cpp => show_waypoints.cpp} (100%) rename zone/gm_commands/show/{who.cpp => show_who.cpp} (100%) mode change 100755 => 100644 rename zone/gm_commands/show/{xtargets.cpp => show_xtargets.cpp} (94%) rename zone/gm_commands/show/{zone_data.cpp => show_zone_data.cpp} (100%) rename zone/gm_commands/show/{zone_global_loot.cpp => show_zone_global_loot.cpp} (100%) rename zone/gm_commands/show/{zone_loot.cpp => show_zone_loot.cpp} (100%) rename zone/gm_commands/show/{zone_points.cpp => show_zone_points.cpp} (100%) rename zone/gm_commands/show/{zone_status.cpp => show_zone_status.cpp} (100%) rename zone/gm_commands/show/{zone_variables.cpp => show_zone_variables.cpp} (100%) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 28f0a6eea..53a072fb7 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -489,6 +489,58 @@ set(gm_command_sources gm_commands/set/set_weather.cpp gm_commands/set/set_zone.cpp gm_commands/show.cpp + gm_commands/show/show_aas.cpp + gm_commands/show/show_aa_points.cpp + gm_commands/show/show_aggro.cpp + gm_commands/show/show_auto_login.cpp + gm_commands/show/show_buffs.cpp + gm_commands/show/show_buried_corpse_count.cpp + gm_commands/show/show_client_version_summary.cpp + gm_commands/show/show_content_flags.cpp + gm_commands/show/show_currencies.cpp + gm_commands/show/show_distance.cpp + gm_commands/show/show_emotes.cpp + gm_commands/show/show_field_of_view.cpp + gm_commands/show/show_flags.cpp + gm_commands/show/show_group_info.cpp + gm_commands/show/show_hatelist.cpp + gm_commands/show/show_inventory.cpp + gm_commands/show/show_ip_lookup.cpp + gm_commands/show/show_keyring.cpp + gm_commands/show/show_line_of_sight.cpp + gm_commands/show/show_network.cpp + gm_commands/show/show_network_stats.cpp + gm_commands/show/show_npc_global_loot.cpp + gm_commands/show/show_npc_stats.cpp + gm_commands/show/show_npc_type.cpp + gm_commands/show/show_peqzone_flags.cpp + gm_commands/show/show_petition.cpp + gm_commands/show/show_petition_info.cpp + gm_commands/show/show_proximity.cpp + gm_commands/show/show_quest_errors.cpp + gm_commands/show/show_quest_globals.cpp + gm_commands/show/show_recipe.cpp + gm_commands/show/show_server_info.cpp + gm_commands/show/show_skills.cpp + gm_commands/show/show_spawn_status.cpp + gm_commands/show/show_special_abilities.cpp + gm_commands/show/show_spells.cpp + gm_commands/show/show_spells_list.cpp + gm_commands/show/show_stats.cpp + gm_commands/show/show_timers.cpp + gm_commands/show/show_traps.cpp + gm_commands/show/show_uptime.cpp + gm_commands/show/show_variable.cpp + gm_commands/show/show_version.cpp + gm_commands/show/show_waypoints.cpp + gm_commands/show/show_who.cpp + gm_commands/show/show_xtargets.cpp + gm_commands/show/show_zone_data.cpp + gm_commands/show/show_zone_global_loot.cpp + gm_commands/show/show_zone_loot.cpp + gm_commands/show/show_zone_points.cpp + gm_commands/show/show_zone_status.cpp + gm_commands/show/show_zone_variables.cpp gm_commands/shutdown.cpp gm_commands/spawn.cpp gm_commands/spawneditmass.cpp @@ -583,6 +635,60 @@ source_group(set FILES gm_commands/set/set_weather.cpp gm_commands/set/set_zone.cpp) +source_group(show FILES + gm_commands/show/show_aas.cpp + gm_commands/show/show_aa_points.cpp + gm_commands/show/show_aggro.cpp + gm_commands/show/show_auto_login.cpp + gm_commands/show/show_buffs.cpp + gm_commands/show/show_buried_corpse_count.cpp + gm_commands/show/show_client_version_summary.cpp + gm_commands/show/show_content_flags.cpp + gm_commands/show/show_currencies.cpp + gm_commands/show/show_distance.cpp + gm_commands/show/show_emotes.cpp + gm_commands/show/show_field_of_view.cpp + gm_commands/show/show_flags.cpp + gm_commands/show/show_group_info.cpp + gm_commands/show/show_hatelist.cpp + gm_commands/show/show_inventory.cpp + gm_commands/show/show_ip_lookup.cpp + gm_commands/show/show_keyring.cpp + gm_commands/show/show_line_of_sight.cpp + gm_commands/show/show_network.cpp + gm_commands/show/show_network_stats.cpp + gm_commands/show/show_npc_global_loot.cpp + gm_commands/show/show_npc_stats.cpp + gm_commands/show/show_npc_type.cpp + gm_commands/show/show_peqzone_flags.cpp + gm_commands/show/show_petition.cpp + gm_commands/show/show_petition_info.cpp + gm_commands/show/show_proximity.cpp + gm_commands/show/show_quest_errors.cpp + gm_commands/show/show_quest_globals.cpp + gm_commands/show/show_recipe.cpp + gm_commands/show/show_server_info.cpp + gm_commands/show/show_skills.cpp + gm_commands/show/show_spawn_status.cpp + gm_commands/show/show_special_abilities.cpp + gm_commands/show/show_spells.cpp + gm_commands/show/show_spells_list.cpp + gm_commands/show/show_stats.cpp + gm_commands/show/show_timers.cpp + gm_commands/show/show_traps.cpp + gm_commands/show/show_uptime.cpp + gm_commands/show/show_variable.cpp + gm_commands/show/show_version.cpp + gm_commands/show/show_waypoints.cpp + gm_commands/show/show_who.cpp + gm_commands/show/show_xtargets.cpp + gm_commands/show/show_zone_data.cpp + gm_commands/show/show_zone_global_loot.cpp + gm_commands/show/show_zone_loot.cpp + gm_commands/show/show_zone_points.cpp + gm_commands/show/show_zone_status.cpp + gm_commands/show/show_zone_variables.cpp) + add_library(gm_commands_zone STATIC ${gm_command_sources}) target_link_libraries(gm_commands_zone PRIVATE cereal::cereal fmt::fmt $,libuv::uv_a,libuv::uv> unofficial::libmariadb) set_target_properties(gm_commands_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 32) diff --git a/zone/gm_commands/show.cpp b/zone/gm_commands/show.cpp index 5a5de4560..651cde537 100755 --- a/zone/gm_commands/show.cpp +++ b/zone/gm_commands/show.cpp @@ -1,56 +1,57 @@ #include "../client.h" -#include "show/aas.cpp" -#include "show/aa_points.cpp" -#include "show/aggro.cpp" -#include "show/auto_login.cpp" -#include "show/buffs.cpp" -#include "show/buried_corpse_count.cpp" -#include "show/client_version_summary.cpp" -#include "show/content_flags.cpp" -#include "show/currencies.cpp" -#include "show/distance.cpp" -#include "show/emotes.cpp" -#include "show/field_of_view.cpp" -#include "show/flags.cpp" -#include "show/group_info.cpp" -#include "show/hatelist.cpp" -#include "show/inventory.cpp" -#include "show/keyring.cpp" -#include "show/ip_lookup.cpp" -#include "show/line_of_sight.cpp" -#include "show/network.cpp" -#include "show/network_stats.cpp" -#include "show/npc_global_loot.cpp" -#include "show/npc_stats.cpp" -#include "show/npc_type.cpp" -#include "show/peqzone_flags.cpp" -#include "show/petition.cpp" -#include "show/petition_info.cpp" -#include "show/proximity.cpp" -#include "show/quest_errors.cpp" -#include "show/quest_globals.cpp" -#include "show/recipe.cpp" -#include "show/server_info.cpp" -#include "show/skills.cpp" -#include "show/spawn_status.cpp" -#include "show/special_abilities.cpp" -#include "show/spells.cpp" -#include "show/spells_list.cpp" -#include "show/stats.cpp" -#include "show/timers.cpp" -#include "show/traps.cpp" -#include "show/uptime.cpp" -#include "show/variable.cpp" -#include "show/version.cpp" -#include "show/waypoints.cpp" -#include "show/who.cpp" -#include "show/xtargets.cpp" -#include "show/zone_data.cpp" -#include "show/zone_global_loot.cpp" -#include "show/zone_loot.cpp" -#include "show/zone_points.cpp" -#include "show/zone_status.cpp" -#include "show/zone_variables.cpp" + +void ShowAAs(Client* c, const Seperator* sep); +void ShowAAPoints(Client* c, const Seperator* sep); +void ShowAggro(Client* c, const Seperator* sep); +void ShowAutoLogin(Client* c, const Seperator* sep); +void ShowBuffs(Client* c, const Seperator* sep); +void ShowBuriedCorpseCount(Client* c, const Seperator* sep); +void ShowClientVersionSummary(Client* c, const Seperator* sep); +void ShowContentFlags(Client* c, const Seperator* sep); +void ShowCurrencies(Client* c, const Seperator* sep); +void ShowDistance(Client* c, const Seperator* sep); +void ShowEmotes(Client* c, const Seperator* sep); +void ShowFieldOfView(Client* c, const Seperator* sep); +void ShowFlags(Client* c, const Seperator* sep); +void ShowGroupInfo(Client* c, const Seperator* sep); +void ShowHateList(Client* c, const Seperator* sep); +void ShowInventory(Client* c, const Seperator* sep); +void ShowIPLookup(Client* c, const Seperator* sep); +void ShowKeyring(Client* c, const Seperator* sep); +void ShowLineOfSight(Client* c, const Seperator* sep); +void ShowNetwork(Client* c, const Seperator* sep); +void ShowNetworkStats(Client* c, const Seperator* sep); +void ShowNPCGlobalLoot(Client* c, const Seperator* sep); +void ShowNPCStats(Client* c, const Seperator* sep); +void ShowNPCType(Client* c, const Seperator* sep); +void ShowPEQZoneFlags(Client* c, const Seperator* sep); +void ShowPetition(Client* c, const Seperator* sep); +void ShowPetitionInfo(Client* c, const Seperator* sep); +void ShowProximity(Client* c, const Seperator* sep); +void ShowQuestErrors(Client* c, const Seperator* sep); +void ShowQuestGlobals(Client* c, const Seperator* sep); +void ShowRecipe(Client* c, const Seperator* sep); +void ShowServerInfo(Client* c, const Seperator* sep); +void ShowSkills(Client* c, const Seperator* sep); +void ShowSpawnStatus(Client* c, const Seperator* sep); +void ShowSpecialAbilities(Client* c, const Seperator* sep); +void ShowSpells(Client* c, const Seperator* sep); +void ShowSpellsList(Client* c, const Seperator* sep); +void ShowStats(Client* c, const Seperator* sep); +void ShowTimers(Client* c, const Seperator* sep); +void ShowTraps(Client* c, const Seperator* sep); +void ShowUptime(Client* c, const Seperator* sep); +void ShowVariable(Client* c, const Seperator* sep); +void ShowVersion(Client* c, const Seperator* sep); +void ShowWaypoints(Client* c, const Seperator* sep); +void ShowWho(Client* c, const Seperator* sep); +void ShowXTargets(Client* c, const Seperator* sep); +void ShowZoneData(Client* c, const Seperator* sep); +void ShowZoneGlobalLoot(Client* c, const Seperator* sep); +void ShowZoneLoot(Client* c, const Seperator* sep); +void ShowZonePoints(Client* c, const Seperator* sep); +void ShowZoneStatus(Client* c, const Seperator* sep); +void ShowZoneVariables(Client* c, const Seperator* sep); void command_show(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/show/aa_points.cpp b/zone/gm_commands/show/show_aa_points.cpp similarity index 100% rename from zone/gm_commands/show/aa_points.cpp rename to zone/gm_commands/show/show_aa_points.cpp diff --git a/zone/gm_commands/show/aas.cpp b/zone/gm_commands/show/show_aas.cpp similarity index 100% rename from zone/gm_commands/show/aas.cpp rename to zone/gm_commands/show/show_aas.cpp diff --git a/zone/gm_commands/show/aggro.cpp b/zone/gm_commands/show/show_aggro.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/show/aggro.cpp rename to zone/gm_commands/show/show_aggro.cpp diff --git a/zone/gm_commands/show/auto_login.cpp b/zone/gm_commands/show/show_auto_login.cpp similarity index 100% rename from zone/gm_commands/show/auto_login.cpp rename to zone/gm_commands/show/show_auto_login.cpp diff --git a/zone/gm_commands/show/buffs.cpp b/zone/gm_commands/show/show_buffs.cpp similarity index 100% rename from zone/gm_commands/show/buffs.cpp rename to zone/gm_commands/show/show_buffs.cpp diff --git a/zone/gm_commands/show/buried_corpse_count.cpp b/zone/gm_commands/show/show_buried_corpse_count.cpp similarity index 100% rename from zone/gm_commands/show/buried_corpse_count.cpp rename to zone/gm_commands/show/show_buried_corpse_count.cpp diff --git a/zone/gm_commands/show/client_version_summary.cpp b/zone/gm_commands/show/show_client_version_summary.cpp similarity index 100% rename from zone/gm_commands/show/client_version_summary.cpp rename to zone/gm_commands/show/show_client_version_summary.cpp diff --git a/zone/gm_commands/show/content_flags.cpp b/zone/gm_commands/show/show_content_flags.cpp similarity index 100% rename from zone/gm_commands/show/content_flags.cpp rename to zone/gm_commands/show/show_content_flags.cpp diff --git a/zone/gm_commands/show/currencies.cpp b/zone/gm_commands/show/show_currencies.cpp similarity index 100% rename from zone/gm_commands/show/currencies.cpp rename to zone/gm_commands/show/show_currencies.cpp diff --git a/zone/gm_commands/show/distance.cpp b/zone/gm_commands/show/show_distance.cpp similarity index 100% rename from zone/gm_commands/show/distance.cpp rename to zone/gm_commands/show/show_distance.cpp diff --git a/zone/gm_commands/show/emotes.cpp b/zone/gm_commands/show/show_emotes.cpp similarity index 100% rename from zone/gm_commands/show/emotes.cpp rename to zone/gm_commands/show/show_emotes.cpp diff --git a/zone/gm_commands/show/field_of_view.cpp b/zone/gm_commands/show/show_field_of_view.cpp similarity index 100% rename from zone/gm_commands/show/field_of_view.cpp rename to zone/gm_commands/show/show_field_of_view.cpp diff --git a/zone/gm_commands/show/flags.cpp b/zone/gm_commands/show/show_flags.cpp similarity index 100% rename from zone/gm_commands/show/flags.cpp rename to zone/gm_commands/show/show_flags.cpp diff --git a/zone/gm_commands/show/group_info.cpp b/zone/gm_commands/show/show_group_info.cpp similarity index 100% rename from zone/gm_commands/show/group_info.cpp rename to zone/gm_commands/show/show_group_info.cpp diff --git a/zone/gm_commands/show/hatelist.cpp b/zone/gm_commands/show/show_hatelist.cpp similarity index 100% rename from zone/gm_commands/show/hatelist.cpp rename to zone/gm_commands/show/show_hatelist.cpp diff --git a/zone/gm_commands/show/inventory.cpp b/zone/gm_commands/show/show_inventory.cpp similarity index 100% rename from zone/gm_commands/show/inventory.cpp rename to zone/gm_commands/show/show_inventory.cpp diff --git a/zone/gm_commands/show/ip_lookup.cpp b/zone/gm_commands/show/show_ip_lookup.cpp similarity index 100% rename from zone/gm_commands/show/ip_lookup.cpp rename to zone/gm_commands/show/show_ip_lookup.cpp diff --git a/zone/gm_commands/show/keyring.cpp b/zone/gm_commands/show/show_keyring.cpp similarity index 100% rename from zone/gm_commands/show/keyring.cpp rename to zone/gm_commands/show/show_keyring.cpp diff --git a/zone/gm_commands/show/line_of_sight.cpp b/zone/gm_commands/show/show_line_of_sight.cpp similarity index 100% rename from zone/gm_commands/show/line_of_sight.cpp rename to zone/gm_commands/show/show_line_of_sight.cpp diff --git a/zone/gm_commands/show/network.cpp b/zone/gm_commands/show/show_network.cpp similarity index 100% rename from zone/gm_commands/show/network.cpp rename to zone/gm_commands/show/show_network.cpp diff --git a/zone/gm_commands/show/network_stats.cpp b/zone/gm_commands/show/show_network_stats.cpp similarity index 100% rename from zone/gm_commands/show/network_stats.cpp rename to zone/gm_commands/show/show_network_stats.cpp diff --git a/zone/gm_commands/show/npc_global_loot.cpp b/zone/gm_commands/show/show_npc_global_loot.cpp similarity index 100% rename from zone/gm_commands/show/npc_global_loot.cpp rename to zone/gm_commands/show/show_npc_global_loot.cpp diff --git a/zone/gm_commands/show/npc_stats.cpp b/zone/gm_commands/show/show_npc_stats.cpp similarity index 100% rename from zone/gm_commands/show/npc_stats.cpp rename to zone/gm_commands/show/show_npc_stats.cpp diff --git a/zone/gm_commands/show/npc_type.cpp b/zone/gm_commands/show/show_npc_type.cpp similarity index 100% rename from zone/gm_commands/show/npc_type.cpp rename to zone/gm_commands/show/show_npc_type.cpp diff --git a/zone/gm_commands/show/peqzone_flags.cpp b/zone/gm_commands/show/show_peqzone_flags.cpp similarity index 100% rename from zone/gm_commands/show/peqzone_flags.cpp rename to zone/gm_commands/show/show_peqzone_flags.cpp diff --git a/zone/gm_commands/show/petition.cpp b/zone/gm_commands/show/show_petition.cpp similarity index 94% rename from zone/gm_commands/show/petition.cpp rename to zone/gm_commands/show/show_petition.cpp index f93338ec0..1c15036a9 100644 --- a/zone/gm_commands/show/petition.cpp +++ b/zone/gm_commands/show/show_petition.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/petitions_repository.h" +#include "../../../common/repositories/petitions_repository.h" void ShowPetition(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/show/petition_info.cpp b/zone/gm_commands/show/show_petition_info.cpp similarity index 96% rename from zone/gm_commands/show/petition_info.cpp rename to zone/gm_commands/show/show_petition_info.cpp index fa1616dde..d4a45599b 100644 --- a/zone/gm_commands/show/petition_info.cpp +++ b/zone/gm_commands/show/show_petition_info.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/petitions_repository.h" +#include "../../../common/repositories/petitions_repository.h" void ShowPetitionInfo(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/show/proximity.cpp b/zone/gm_commands/show/show_proximity.cpp similarity index 100% rename from zone/gm_commands/show/proximity.cpp rename to zone/gm_commands/show/show_proximity.cpp diff --git a/zone/gm_commands/show/quest_errors.cpp b/zone/gm_commands/show/show_quest_errors.cpp similarity index 100% rename from zone/gm_commands/show/quest_errors.cpp rename to zone/gm_commands/show/show_quest_errors.cpp diff --git a/zone/gm_commands/show/quest_globals.cpp b/zone/gm_commands/show/show_quest_globals.cpp similarity index 100% rename from zone/gm_commands/show/quest_globals.cpp rename to zone/gm_commands/show/show_quest_globals.cpp diff --git a/zone/gm_commands/show/recipe.cpp b/zone/gm_commands/show/show_recipe.cpp similarity index 93% rename from zone/gm_commands/show/recipe.cpp rename to zone/gm_commands/show/show_recipe.cpp index e9f8db666..c66e25218 100644 --- a/zone/gm_commands/show/recipe.cpp +++ b/zone/gm_commands/show/show_recipe.cpp @@ -1,7 +1,7 @@ #include "../../client.h" #include "../../command.h" -#include "../../common/repositories/tradeskill_recipe_repository.h" -#include "../../common/repositories/tradeskill_recipe_entries_repository.h" +#include "../../../common/repositories/tradeskill_recipe_repository.h" +#include "../../../common/repositories/tradeskill_recipe_entries_repository.h" void ShowRecipe(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/show/server_info.cpp b/zone/gm_commands/show/show_server_info.cpp similarity index 98% rename from zone/gm_commands/show/server_info.cpp rename to zone/gm_commands/show/show_server_info.cpp index ff3070aa7..6a8d8b717 100644 --- a/zone/gm_commands/show/server_info.cpp +++ b/zone/gm_commands/show/show_server_info.cpp @@ -1,6 +1,6 @@ #include "../../client.h" #include "../../dialogue_window.h" -#include "../../common/serverinfo.h" +#include "../../../common/serverinfo.h" void ShowServerInfo(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/show/skills.cpp b/zone/gm_commands/show/show_skills.cpp similarity index 100% rename from zone/gm_commands/show/skills.cpp rename to zone/gm_commands/show/show_skills.cpp diff --git a/zone/gm_commands/show/spawn_status.cpp b/zone/gm_commands/show/show_spawn_status.cpp similarity index 100% rename from zone/gm_commands/show/spawn_status.cpp rename to zone/gm_commands/show/show_spawn_status.cpp diff --git a/zone/gm_commands/show/special_abilities.cpp b/zone/gm_commands/show/show_special_abilities.cpp similarity index 100% rename from zone/gm_commands/show/special_abilities.cpp rename to zone/gm_commands/show/show_special_abilities.cpp diff --git a/zone/gm_commands/show/spells.cpp b/zone/gm_commands/show/show_spells.cpp similarity index 100% rename from zone/gm_commands/show/spells.cpp rename to zone/gm_commands/show/show_spells.cpp diff --git a/zone/gm_commands/show/spells_list.cpp b/zone/gm_commands/show/show_spells_list.cpp similarity index 100% rename from zone/gm_commands/show/spells_list.cpp rename to zone/gm_commands/show/show_spells_list.cpp diff --git a/zone/gm_commands/show/stats.cpp b/zone/gm_commands/show/show_stats.cpp similarity index 100% rename from zone/gm_commands/show/stats.cpp rename to zone/gm_commands/show/show_stats.cpp diff --git a/zone/gm_commands/show/timers.cpp b/zone/gm_commands/show/show_timers.cpp similarity index 100% rename from zone/gm_commands/show/timers.cpp rename to zone/gm_commands/show/show_timers.cpp diff --git a/zone/gm_commands/show/traps.cpp b/zone/gm_commands/show/show_traps.cpp similarity index 100% rename from zone/gm_commands/show/traps.cpp rename to zone/gm_commands/show/show_traps.cpp diff --git a/zone/gm_commands/show/uptime.cpp b/zone/gm_commands/show/show_uptime.cpp similarity index 100% rename from zone/gm_commands/show/uptime.cpp rename to zone/gm_commands/show/show_uptime.cpp diff --git a/zone/gm_commands/show/variable.cpp b/zone/gm_commands/show/show_variable.cpp similarity index 100% rename from zone/gm_commands/show/variable.cpp rename to zone/gm_commands/show/show_variable.cpp diff --git a/zone/gm_commands/show/version.cpp b/zone/gm_commands/show/show_version.cpp similarity index 100% rename from zone/gm_commands/show/version.cpp rename to zone/gm_commands/show/show_version.cpp diff --git a/zone/gm_commands/show/waypoints.cpp b/zone/gm_commands/show/show_waypoints.cpp similarity index 100% rename from zone/gm_commands/show/waypoints.cpp rename to zone/gm_commands/show/show_waypoints.cpp diff --git a/zone/gm_commands/show/who.cpp b/zone/gm_commands/show/show_who.cpp old mode 100755 new mode 100644 similarity index 100% rename from zone/gm_commands/show/who.cpp rename to zone/gm_commands/show/show_who.cpp diff --git a/zone/gm_commands/show/xtargets.cpp b/zone/gm_commands/show/show_xtargets.cpp similarity index 94% rename from zone/gm_commands/show/xtargets.cpp rename to zone/gm_commands/show/show_xtargets.cpp index b3416b561..f9d07387e 100644 --- a/zone/gm_commands/show/xtargets.cpp +++ b/zone/gm_commands/show/show_xtargets.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/data_verification.h" +#include "../../../common/data_verification.h" void ShowXTargets(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/show/zone_data.cpp b/zone/gm_commands/show/show_zone_data.cpp similarity index 100% rename from zone/gm_commands/show/zone_data.cpp rename to zone/gm_commands/show/show_zone_data.cpp diff --git a/zone/gm_commands/show/zone_global_loot.cpp b/zone/gm_commands/show/show_zone_global_loot.cpp similarity index 100% rename from zone/gm_commands/show/zone_global_loot.cpp rename to zone/gm_commands/show/show_zone_global_loot.cpp diff --git a/zone/gm_commands/show/zone_loot.cpp b/zone/gm_commands/show/show_zone_loot.cpp similarity index 100% rename from zone/gm_commands/show/zone_loot.cpp rename to zone/gm_commands/show/show_zone_loot.cpp diff --git a/zone/gm_commands/show/zone_points.cpp b/zone/gm_commands/show/show_zone_points.cpp similarity index 100% rename from zone/gm_commands/show/zone_points.cpp rename to zone/gm_commands/show/show_zone_points.cpp diff --git a/zone/gm_commands/show/zone_status.cpp b/zone/gm_commands/show/show_zone_status.cpp similarity index 100% rename from zone/gm_commands/show/zone_status.cpp rename to zone/gm_commands/show/show_zone_status.cpp diff --git a/zone/gm_commands/show/zone_variables.cpp b/zone/gm_commands/show/show_zone_variables.cpp similarity index 100% rename from zone/gm_commands/show/zone_variables.cpp rename to zone/gm_commands/show/show_zone_variables.cpp From 408bd653bcd178051d16757f79f9e5f0fda4472b Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 8 Dec 2025 20:56:28 -0800 Subject: [PATCH 37/44] convert find --- zone/CMakeLists.txt | 53 +++++++++++++++++++ zone/gm_commands/find.cpp | 51 +++++++++--------- zone/gm_commands/find/{aa.cpp => find_aa.cpp} | 0 .../find/{account.cpp => find_account.cpp} | 2 +- .../{body_type.cpp => find_body_type.cpp} | 0 .../find/{bot.cpp => find_bot.cpp} | 2 +- ...bug_category.cpp => find_bug_category.cpp} | 0 .../{character.cpp => find_character.cpp} | 2 +- .../find/{class.cpp => find_class.cpp} | 0 ...ison_type.cpp => find_comparison_type.cpp} | 0 .../find/{currency.cpp => find_currency.cpp} | 0 .../find/{deity.cpp => find_deity.cpp} | 0 .../find/{emote.cpp => find_emote.cpp} | 0 .../find/{faction.cpp => find_faction.cpp} | 0 .../find/{item.cpp => find_item.cpp} | 2 +- .../find/{language.cpp => find_language.cpp} | 0 .../{ldon_theme.cpp => find_ldon_theme.cpp} | 0 .../find/{npctype.cpp => find_npctype.cpp} | 0 .../{object_type.cpp => find_object_type.cpp} | 0 .../find/{race.cpp => find_race.cpp} | 0 .../find/{recipe.cpp => find_recipe.cpp} | 2 +- .../find/{skill.cpp => find_skill.cpp} | 0 ...l_ability.cpp => find_special_ability.cpp} | 0 .../find/{spell.cpp => find_spell.cpp} | 0 .../find/{stance.cpp => find_stance.cpp} | 0 .../find/{task.cpp => find_task.cpp} | 0 .../find/{zone.cpp => find_zone.cpp} | 2 +- 27 files changed, 85 insertions(+), 31 deletions(-) rename zone/gm_commands/find/{aa.cpp => find_aa.cpp} (100%) rename zone/gm_commands/find/{account.cpp => find_account.cpp} (94%) rename zone/gm_commands/find/{body_type.cpp => find_body_type.cpp} (100%) rename zone/gm_commands/find/{bot.cpp => find_bot.cpp} (96%) rename zone/gm_commands/find/{bug_category.cpp => find_bug_category.cpp} (100%) rename zone/gm_commands/find/{character.cpp => find_character.cpp} (95%) rename zone/gm_commands/find/{class.cpp => find_class.cpp} (100%) rename zone/gm_commands/find/{comparison_type.cpp => find_comparison_type.cpp} (100%) rename zone/gm_commands/find/{currency.cpp => find_currency.cpp} (100%) rename zone/gm_commands/find/{deity.cpp => find_deity.cpp} (100%) rename zone/gm_commands/find/{emote.cpp => find_emote.cpp} (100%) rename zone/gm_commands/find/{faction.cpp => find_faction.cpp} (100%) rename zone/gm_commands/find/{item.cpp => find_item.cpp} (97%) rename zone/gm_commands/find/{language.cpp => find_language.cpp} (100%) rename zone/gm_commands/find/{ldon_theme.cpp => find_ldon_theme.cpp} (100%) rename zone/gm_commands/find/{npctype.cpp => find_npctype.cpp} (100%) rename zone/gm_commands/find/{object_type.cpp => find_object_type.cpp} (100%) rename zone/gm_commands/find/{race.cpp => find_race.cpp} (100%) rename zone/gm_commands/find/{recipe.cpp => find_recipe.cpp} (96%) rename zone/gm_commands/find/{skill.cpp => find_skill.cpp} (100%) rename zone/gm_commands/find/{special_ability.cpp => find_special_ability.cpp} (100%) rename zone/gm_commands/find/{spell.cpp => find_spell.cpp} (100%) rename zone/gm_commands/find/{stance.cpp => find_stance.cpp} (100%) rename zone/gm_commands/find/{task.cpp => find_task.cpp} (100%) rename zone/gm_commands/find/{zone.cpp => find_zone.cpp} (98%) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 53a072fb7..86037d73b 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -354,6 +354,31 @@ set(gm_command_sources gm_commands/evolving_items.cpp gm_commands/feature.cpp gm_commands/find.cpp + gm_commands/find/find_aa.cpp + gm_commands/find/find_account.cpp + gm_commands/find/find_body_type.cpp + gm_commands/find/find_bot.cpp + gm_commands/find/find_bug_category.cpp + gm_commands/find/find_character.cpp + gm_commands/find/find_class.cpp + gm_commands/find/find_comparison_type.cpp + gm_commands/find/find_currency.cpp + gm_commands/find/find_deity.cpp + gm_commands/find/find_emote.cpp + gm_commands/find/find_faction.cpp + gm_commands/find/find_item.cpp + gm_commands/find/find_language.cpp + gm_commands/find/find_ldon_theme.cpp + gm_commands/find/find_npctype.cpp + gm_commands/find/find_object_type.cpp + gm_commands/find/find_race.cpp + gm_commands/find/find_recipe.cpp + gm_commands/find/find_skill.cpp + gm_commands/find/find_special_ability.cpp + gm_commands/find/find_spell.cpp + gm_commands/find/find_stance.cpp + gm_commands/find/find_task.cpp + gm_commands/find/find_zone.cpp gm_commands/fish.cpp gm_commands/fixmob.cpp gm_commands/flagedit.cpp @@ -577,6 +602,34 @@ set(gm_command_sources gm_commands/zsave.cpp ) +source_group(find FILES + gm_commands/find/find_aa.cpp + gm_commands/find/find_account.cpp + gm_commands/find/find_body_type.cpp + gm_commands/find/find_bot.cpp + gm_commands/find/find_bug_category.cpp + gm_commands/find/find_character.cpp + gm_commands/find/find_class.cpp + gm_commands/find/find_comparison_type.cpp + gm_commands/find/find_currency.cpp + gm_commands/find/find_deity.cpp + gm_commands/find/find_emote.cpp + gm_commands/find/find_faction.cpp + gm_commands/find/find_item.cpp + gm_commands/find/find_language.cpp + gm_commands/find/find_ldon_theme.cpp + gm_commands/find/find_npctype.cpp + gm_commands/find/find_object_type.cpp + gm_commands/find/find_race.cpp + gm_commands/find/find_recipe.cpp + gm_commands/find/find_skill.cpp + gm_commands/find/find_special_ability.cpp + gm_commands/find/find_spell.cpp + gm_commands/find/find_stance.cpp + gm_commands/find/find_task.cpp + gm_commands/find/find_zone.cpp +) + source_group(set FILES gm_commands/set/set_aa_exp.cpp gm_commands/set/set_aa_points.cpp diff --git a/zone/gm_commands/find.cpp b/zone/gm_commands/find.cpp index 6ee5815cb..a5e2bad3d 100644 --- a/zone/gm_commands/find.cpp +++ b/zone/gm_commands/find.cpp @@ -1,29 +1,30 @@ #include "../client.h" -#include "find/aa.cpp" -#include "find/account.cpp" -#include "find/body_type.cpp" -#include "find/bot.cpp" -#include "find/bug_category.cpp" -#include "find/character.cpp" -#include "find/class.cpp" -#include "find/comparison_type.cpp" -#include "find/currency.cpp" -#include "find/deity.cpp" -#include "find/emote.cpp" -#include "find/faction.cpp" -#include "find/item.cpp" -#include "find/language.cpp" -#include "find/ldon_theme.cpp" -#include "find/npctype.cpp" -#include "find/object_type.cpp" -#include "find/race.cpp" -#include "find/recipe.cpp" -#include "find/skill.cpp" -#include "find/stance.cpp" -#include "find/spell.cpp" -#include "find/special_ability.cpp" -#include "find/task.cpp" -#include "find/zone.cpp" + +void FindAA(Client* c, const Seperator* sep); +void FindAccount(Client* c, const Seperator* sep); +void FindBodyType(Client* c, const Seperator* sep); +void FindBot(Client* c, const Seperator* sep); +void FindBugCategory(Client* c, const Seperator* sep); +void FindCharacter(Client* c, const Seperator* sep); +void FindClass(Client* c, const Seperator* sep); +void FindComparisonType(Client* c, const Seperator* sep); +void FindCurrency(Client* c, const Seperator* sep); +void FindDeity(Client* c, const Seperator* sep); +void FindEmote(Client* c, const Seperator* sep); +void FindFaction(Client* c, const Seperator* sep); +void FindItem(Client* c, const Seperator* sep); +void FindLanguage(Client* c, const Seperator* sep); +void FindLDoNTheme(Client* c, const Seperator* sep); +void FindNPCType(Client* c, const Seperator* sep); +void FindObjectType(Client* c, const Seperator* sep); +void FindRace(Client* c, const Seperator* sep); +void FindRecipe(Client* c, const Seperator* sep); +void FindSkill(Client* c, const Seperator* sep); +void FindSpecialAbility(Client* c, const Seperator* sep); +void FindStance(Client* c, const Seperator* sep); +void FindSpell(Client* c, const Seperator* sep); +void FindTask(Client* c, const Seperator* sep); +void FindZone(Client* c, const Seperator* sep); void command_find(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/find/aa.cpp b/zone/gm_commands/find/find_aa.cpp similarity index 100% rename from zone/gm_commands/find/aa.cpp rename to zone/gm_commands/find/find_aa.cpp diff --git a/zone/gm_commands/find/account.cpp b/zone/gm_commands/find/find_account.cpp similarity index 94% rename from zone/gm_commands/find/account.cpp rename to zone/gm_commands/find/find_account.cpp index 1265c8431..17512b2a8 100644 --- a/zone/gm_commands/find/account.cpp +++ b/zone/gm_commands/find/find_account.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/account_repository.h" +#include "../../../common/repositories/account_repository.h" void FindAccount(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/find/body_type.cpp b/zone/gm_commands/find/find_body_type.cpp similarity index 100% rename from zone/gm_commands/find/body_type.cpp rename to zone/gm_commands/find/find_body_type.cpp diff --git a/zone/gm_commands/find/bot.cpp b/zone/gm_commands/find/find_bot.cpp similarity index 96% rename from zone/gm_commands/find/bot.cpp rename to zone/gm_commands/find/find_bot.cpp index 061d4c428..fd403d670 100644 --- a/zone/gm_commands/find/bot.cpp +++ b/zone/gm_commands/find/find_bot.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/bot_data_repository.h" +#include "../../../common/repositories/bot_data_repository.h" void FindBot(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/find/bug_category.cpp b/zone/gm_commands/find/find_bug_category.cpp similarity index 100% rename from zone/gm_commands/find/bug_category.cpp rename to zone/gm_commands/find/find_bug_category.cpp diff --git a/zone/gm_commands/find/character.cpp b/zone/gm_commands/find/find_character.cpp similarity index 95% rename from zone/gm_commands/find/character.cpp rename to zone/gm_commands/find/find_character.cpp index 9029c252e..0c1842eff 100644 --- a/zone/gm_commands/find/character.cpp +++ b/zone/gm_commands/find/find_character.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/character_data_repository.h" +#include "../../../common/repositories/character_data_repository.h" void FindCharacter(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/find/class.cpp b/zone/gm_commands/find/find_class.cpp similarity index 100% rename from zone/gm_commands/find/class.cpp rename to zone/gm_commands/find/find_class.cpp diff --git a/zone/gm_commands/find/comparison_type.cpp b/zone/gm_commands/find/find_comparison_type.cpp similarity index 100% rename from zone/gm_commands/find/comparison_type.cpp rename to zone/gm_commands/find/find_comparison_type.cpp diff --git a/zone/gm_commands/find/currency.cpp b/zone/gm_commands/find/find_currency.cpp similarity index 100% rename from zone/gm_commands/find/currency.cpp rename to zone/gm_commands/find/find_currency.cpp diff --git a/zone/gm_commands/find/deity.cpp b/zone/gm_commands/find/find_deity.cpp similarity index 100% rename from zone/gm_commands/find/deity.cpp rename to zone/gm_commands/find/find_deity.cpp diff --git a/zone/gm_commands/find/emote.cpp b/zone/gm_commands/find/find_emote.cpp similarity index 100% rename from zone/gm_commands/find/emote.cpp rename to zone/gm_commands/find/find_emote.cpp diff --git a/zone/gm_commands/find/faction.cpp b/zone/gm_commands/find/find_faction.cpp similarity index 100% rename from zone/gm_commands/find/faction.cpp rename to zone/gm_commands/find/find_faction.cpp diff --git a/zone/gm_commands/find/item.cpp b/zone/gm_commands/find/find_item.cpp similarity index 97% rename from zone/gm_commands/find/item.cpp rename to zone/gm_commands/find/find_item.cpp index 7963e8cb6..0f4870701 100644 --- a/zone/gm_commands/find/item.cpp +++ b/zone/gm_commands/find/find_item.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/repositories/items_repository.h" +#include "../../../common/repositories/items_repository.h" void FindItem(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/find/language.cpp b/zone/gm_commands/find/find_language.cpp similarity index 100% rename from zone/gm_commands/find/language.cpp rename to zone/gm_commands/find/find_language.cpp diff --git a/zone/gm_commands/find/ldon_theme.cpp b/zone/gm_commands/find/find_ldon_theme.cpp similarity index 100% rename from zone/gm_commands/find/ldon_theme.cpp rename to zone/gm_commands/find/find_ldon_theme.cpp diff --git a/zone/gm_commands/find/npctype.cpp b/zone/gm_commands/find/find_npctype.cpp similarity index 100% rename from zone/gm_commands/find/npctype.cpp rename to zone/gm_commands/find/find_npctype.cpp diff --git a/zone/gm_commands/find/object_type.cpp b/zone/gm_commands/find/find_object_type.cpp similarity index 100% rename from zone/gm_commands/find/object_type.cpp rename to zone/gm_commands/find/find_object_type.cpp diff --git a/zone/gm_commands/find/race.cpp b/zone/gm_commands/find/find_race.cpp similarity index 100% rename from zone/gm_commands/find/race.cpp rename to zone/gm_commands/find/find_race.cpp diff --git a/zone/gm_commands/find/recipe.cpp b/zone/gm_commands/find/find_recipe.cpp similarity index 96% rename from zone/gm_commands/find/recipe.cpp rename to zone/gm_commands/find/find_recipe.cpp index 5aefe1044..260c6dccf 100644 --- a/zone/gm_commands/find/recipe.cpp +++ b/zone/gm_commands/find/find_recipe.cpp @@ -1,6 +1,6 @@ #include "../../client.h" #include "../../command.h" -#include "../../common/repositories/tradeskill_recipe_repository.h" +#include "../../../common/repositories/tradeskill_recipe_repository.h" void FindRecipe(Client *c, const Seperator *sep) { diff --git a/zone/gm_commands/find/skill.cpp b/zone/gm_commands/find/find_skill.cpp similarity index 100% rename from zone/gm_commands/find/skill.cpp rename to zone/gm_commands/find/find_skill.cpp diff --git a/zone/gm_commands/find/special_ability.cpp b/zone/gm_commands/find/find_special_ability.cpp similarity index 100% rename from zone/gm_commands/find/special_ability.cpp rename to zone/gm_commands/find/find_special_ability.cpp diff --git a/zone/gm_commands/find/spell.cpp b/zone/gm_commands/find/find_spell.cpp similarity index 100% rename from zone/gm_commands/find/spell.cpp rename to zone/gm_commands/find/find_spell.cpp diff --git a/zone/gm_commands/find/stance.cpp b/zone/gm_commands/find/find_stance.cpp similarity index 100% rename from zone/gm_commands/find/stance.cpp rename to zone/gm_commands/find/find_stance.cpp diff --git a/zone/gm_commands/find/task.cpp b/zone/gm_commands/find/find_task.cpp similarity index 100% rename from zone/gm_commands/find/task.cpp rename to zone/gm_commands/find/find_task.cpp diff --git a/zone/gm_commands/find/zone.cpp b/zone/gm_commands/find/find_zone.cpp similarity index 98% rename from zone/gm_commands/find/zone.cpp rename to zone/gm_commands/find/find_zone.cpp index c943f3e1d..6715649d9 100644 --- a/zone/gm_commands/find/zone.cpp +++ b/zone/gm_commands/find/find_zone.cpp @@ -1,5 +1,5 @@ #include "../../client.h" -#include "../../common/content/world_content_service.h" +#include "../../../common/content/world_content_service.h" void FindZone(Client* c, const Seperator* sep) { From a648d09b1b5fd5304f70d756a672de2295c427b6 Mon Sep 17 00:00:00 2001 From: KimLS Date: Mon, 8 Dec 2025 21:30:30 -0800 Subject: [PATCH 38/44] Add uuid to unix builds --- common/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 640257a92..f471f58b5 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1293,6 +1293,7 @@ if(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1") endif() if(UNIX) + target_link_libraries(common PUBLIC uuid) set_source_files_properties("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result) set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0) endif() From 5843ff052418f38a5dc17314563b0a68da145ce8 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 9 Dec 2025 20:04:34 -0800 Subject: [PATCH 39/44] Remove some cpp includes. --- common/CMakeLists.txt | 2 ++ common/strings.cpp | 5 ----- zone/CMakeLists.txt | 1 + zone/zone.cpp | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index f471f58b5..b65ab7311 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -93,6 +93,8 @@ set(common_sources spdat.cpp spdat_bot.cpp strings.cpp + strings_legacy.cpp + strings_misc.cpp struct_strategy.cpp textures.cpp timer.cpp diff --git a/common/strings.cpp b/common/strings.cpp index cdb754cad..62aec2975 100644 --- a/common/strings.cpp +++ b/common/strings.cpp @@ -48,14 +48,9 @@ #include #include -//Const char based -#include "strings_legacy.cpp" // legacy c functions -#include "strings_misc.cpp" // anything non "Strings" scoped - #ifdef _WINDOWS #include #include -#include #endif std::string Strings::Random(size_t length) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 86037d73b..66a789cc2 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -111,6 +111,7 @@ set(zone_sources xtargetautohaters.cpp zone.cpp zone_config.cpp + zone_loot.cpp zonedb.cpp zone_base_data.cpp zone_event_scheduler.cpp diff --git a/zone/zone.cpp b/zone/zone.cpp index 4e4108720..771ac9538 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -3584,5 +3584,3 @@ std::vector Zone::GetTimers() return v; } - -#include "zone_loot.cpp" From 4c7964524db5a3c704bc7794ac58947504502d82 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 9 Dec 2025 20:18:45 -0800 Subject: [PATCH 40/44] Restructure to remove more things. --- zone/CMakeLists.txt | 62 +++++++++++++++++++ zone/bot_command.cpp | 62 ------------------- .../{actionable.cpp => bot_actionable.cpp} | 0 .../{appearance.cpp => bot_appearance.cpp} | 0 ...{apply_poison.cpp => bot_apply_poison.cpp} | 0 ...{apply_potion.cpp => bot_apply_potion.cpp} | 0 .../{attack.cpp => bot_attack.cpp} | 0 .../{behind_mob.cpp => bot_behind_mob.cpp} | 0 ...locked_buffs.cpp => bot_blocked_buffs.cpp} | 0 zone/bot_commands/{bot.cpp => bot_bot.cpp} | 0 ...{bot_settings.cpp => bot_bot_settings.cpp} | 0 zone/bot_commands/{cast.cpp => bot_cast.cpp} | 0 ..._race_list.cpp => bot_class_race_list.cpp} | 0 .../{click_item.cpp => bot_click_item.cpp} | 0 ...opy_settings.cpp => bot_copy_settings.cpp} | 0 ..._settings.cpp => bot_default_settings.cpp} | 0 .../{depart.cpp => bot_depart.cpp} | 0 .../{discipline.cpp => bot_discipline.cpp} | 0 ...nce_ranged.cpp => bot_distance_ranged.cpp} | 0 ...{find_aliases.cpp => bot_find_aliases.cpp} | 0 .../{follow.cpp => bot_follow.cpp} | 0 .../bot_commands/{guard.cpp => bot_guard.cpp} | 0 ...eal_rotation.cpp => bot_heal_rotation.cpp} | 0 zone/bot_commands/{help.cpp => bot_help.cpp} | 0 zone/bot_commands/{hold.cpp => bot_hold.cpp} | 0 ...usion_block.cpp => bot_illusion_block.cpp} | 0 .../{inventory.cpp => bot_inventory.cpp} | 0 .../{item_use.cpp => bot_item_use.cpp} | 0 ...elee_range.cpp => bot_max_melee_range.cpp} | 0 zone/bot_commands/{name.cpp => bot_name.cpp} | 0 ...{owner_option.cpp => bot_owner_option.cpp} | 0 zone/bot_commands/{pet.cpp => bot_pet.cpp} | 0 .../{pick_lock.cpp => bot_pick_lock.cpp} | 1 + .../{pickpocket.cpp => bot_pickpocket.cpp} | 0 .../{precombat.cpp => bot_precombat.cpp} | 0 zone/bot_commands/{pull.cpp => bot_pull.cpp} | 0 .../{release.cpp => bot_release.cpp} | 0 ...{set_assistee.cpp => bot_set_assistee.cpp} | 0 ..._hp_percent.cpp => bot_sit_hp_percent.cpp} | 0 ...it_in_combat.cpp => bot_sit_in_combat.cpp} | 0 ...a_percent.cpp => bot_sit_mana_percent.cpp} | 0 .../bot_commands/{spell.cpp => bot_spell.cpp} | 0 ..._checks.cpp => bot_spell_aggro_checks.cpp} | 0 ...e_cast.cpp => bot_spell_announce_cast.cpp} | 0 ...{spell_delays.cpp => bot_spell_delays.cpp} | 0 ...ity.cpp => bot_spell_engaged_priority.cpp} | 0 .../{spell_holds.cpp => bot_spell_holds.cpp} | 0 ...iority.cpp => bot_spell_idle_priority.cpp} | 0 ...ax_hp_pct.cpp => bot_spell_max_hp_pct.cpp} | 0 ...ana_pct.cpp => bot_spell_max_mana_pct.cpp} | 0 ...holds.cpp => bot_spell_max_thresholds.cpp} | 0 ...in_hp_pct.cpp => bot_spell_min_hp_pct.cpp} | 0 ...ana_pct.cpp => bot_spell_min_mana_pct.cpp} | 0 ...holds.cpp => bot_spell_min_thresholds.cpp} | 0 ...rity.cpp => bot_spell_pursue_priority.cpp} | 0 ...limits.cpp => bot_spell_resist_limits.cpp} | 0 ...t_count.cpp => bot_spell_target_count.cpp} | 0 .../{spelltypes.cpp => bot_spelltypes.cpp} | 0 .../{summon.cpp => bot_summon.cpp} | 0 .../{suspend.cpp => bot_suspend.cpp} | 0 .../bot_commands/{taunt.cpp => bot_taunt.cpp} | 0 .../bot_commands/{timer.cpp => bot_timer.cpp} | 0 .../bot_commands/{track.cpp => bot_track.cpp} | 0 .../{view_combos.cpp => bot_view_combos.cpp} | 0 zone/gm_commands/find/find_spell.cpp | 2 + zone/gm_commands/find/find_task.cpp | 2 + zone/gm_commands/fixmob.cpp | 31 +++++----- zone/gm_commands/set/set_zone.cpp | 3 + 68 files changed, 86 insertions(+), 77 deletions(-) rename zone/bot_commands/{actionable.cpp => bot_actionable.cpp} (100%) rename zone/bot_commands/{appearance.cpp => bot_appearance.cpp} (100%) rename zone/bot_commands/{apply_poison.cpp => bot_apply_poison.cpp} (100%) rename zone/bot_commands/{apply_potion.cpp => bot_apply_potion.cpp} (100%) rename zone/bot_commands/{attack.cpp => bot_attack.cpp} (100%) rename zone/bot_commands/{behind_mob.cpp => bot_behind_mob.cpp} (100%) rename zone/bot_commands/{blocked_buffs.cpp => bot_blocked_buffs.cpp} (100%) rename zone/bot_commands/{bot.cpp => bot_bot.cpp} (100%) rename zone/bot_commands/{bot_settings.cpp => bot_bot_settings.cpp} (100%) rename zone/bot_commands/{cast.cpp => bot_cast.cpp} (100%) rename zone/bot_commands/{class_race_list.cpp => bot_class_race_list.cpp} (100%) rename zone/bot_commands/{click_item.cpp => bot_click_item.cpp} (100%) rename zone/bot_commands/{copy_settings.cpp => bot_copy_settings.cpp} (100%) rename zone/bot_commands/{default_settings.cpp => bot_default_settings.cpp} (100%) rename zone/bot_commands/{depart.cpp => bot_depart.cpp} (100%) rename zone/bot_commands/{discipline.cpp => bot_discipline.cpp} (100%) rename zone/bot_commands/{distance_ranged.cpp => bot_distance_ranged.cpp} (100%) rename zone/bot_commands/{find_aliases.cpp => bot_find_aliases.cpp} (100%) rename zone/bot_commands/{follow.cpp => bot_follow.cpp} (100%) rename zone/bot_commands/{guard.cpp => bot_guard.cpp} (100%) rename zone/bot_commands/{heal_rotation.cpp => bot_heal_rotation.cpp} (100%) rename zone/bot_commands/{help.cpp => bot_help.cpp} (100%) rename zone/bot_commands/{hold.cpp => bot_hold.cpp} (100%) rename zone/bot_commands/{illusion_block.cpp => bot_illusion_block.cpp} (100%) rename zone/bot_commands/{inventory.cpp => bot_inventory.cpp} (100%) rename zone/bot_commands/{item_use.cpp => bot_item_use.cpp} (100%) rename zone/bot_commands/{max_melee_range.cpp => bot_max_melee_range.cpp} (100%) rename zone/bot_commands/{name.cpp => bot_name.cpp} (100%) rename zone/bot_commands/{owner_option.cpp => bot_owner_option.cpp} (100%) rename zone/bot_commands/{pet.cpp => bot_pet.cpp} (100%) rename zone/bot_commands/{pick_lock.cpp => bot_pick_lock.cpp} (98%) rename zone/bot_commands/{pickpocket.cpp => bot_pickpocket.cpp} (100%) rename zone/bot_commands/{precombat.cpp => bot_precombat.cpp} (100%) rename zone/bot_commands/{pull.cpp => bot_pull.cpp} (100%) rename zone/bot_commands/{release.cpp => bot_release.cpp} (100%) rename zone/bot_commands/{set_assistee.cpp => bot_set_assistee.cpp} (100%) rename zone/bot_commands/{sit_hp_percent.cpp => bot_sit_hp_percent.cpp} (100%) rename zone/bot_commands/{sit_in_combat.cpp => bot_sit_in_combat.cpp} (100%) rename zone/bot_commands/{sit_mana_percent.cpp => bot_sit_mana_percent.cpp} (100%) rename zone/bot_commands/{spell.cpp => bot_spell.cpp} (100%) rename zone/bot_commands/{spell_aggro_checks.cpp => bot_spell_aggro_checks.cpp} (100%) rename zone/bot_commands/{spell_announce_cast.cpp => bot_spell_announce_cast.cpp} (100%) rename zone/bot_commands/{spell_delays.cpp => bot_spell_delays.cpp} (100%) rename zone/bot_commands/{spell_engaged_priority.cpp => bot_spell_engaged_priority.cpp} (100%) rename zone/bot_commands/{spell_holds.cpp => bot_spell_holds.cpp} (100%) rename zone/bot_commands/{spell_idle_priority.cpp => bot_spell_idle_priority.cpp} (100%) rename zone/bot_commands/{spell_max_hp_pct.cpp => bot_spell_max_hp_pct.cpp} (100%) rename zone/bot_commands/{spell_max_mana_pct.cpp => bot_spell_max_mana_pct.cpp} (100%) rename zone/bot_commands/{spell_max_thresholds.cpp => bot_spell_max_thresholds.cpp} (100%) rename zone/bot_commands/{spell_min_hp_pct.cpp => bot_spell_min_hp_pct.cpp} (100%) rename zone/bot_commands/{spell_min_mana_pct.cpp => bot_spell_min_mana_pct.cpp} (100%) rename zone/bot_commands/{spell_min_thresholds.cpp => bot_spell_min_thresholds.cpp} (100%) rename zone/bot_commands/{spell_pursue_priority.cpp => bot_spell_pursue_priority.cpp} (100%) rename zone/bot_commands/{spell_resist_limits.cpp => bot_spell_resist_limits.cpp} (100%) rename zone/bot_commands/{spell_target_count.cpp => bot_spell_target_count.cpp} (100%) rename zone/bot_commands/{spelltypes.cpp => bot_spelltypes.cpp} (100%) rename zone/bot_commands/{summon.cpp => bot_summon.cpp} (100%) rename zone/bot_commands/{suspend.cpp => bot_suspend.cpp} (100%) rename zone/bot_commands/{taunt.cpp => bot_taunt.cpp} (100%) rename zone/bot_commands/{timer.cpp => bot_timer.cpp} (100%) rename zone/bot_commands/{track.cpp => bot_track.cpp} (100%) rename zone/bot_commands/{view_combos.cpp => bot_view_combos.cpp} (100%) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 66a789cc2..30a3206c0 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -311,6 +311,68 @@ set_target_properties(perl_zone PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE set(gm_command_sources command.cpp bot_command.cpp + bot_commands/bot_actionable.cpp + bot_commands/bot_appearance.cpp + bot_commands/bot_apply_poison.cpp + bot_commands/bot_apply_potion.cpp + bot_commands/bot_attack.cpp + bot_commands/bot_behind_mob.cpp + bot_commands/bot_blocked_buffs.cpp + bot_commands/bot_bot.cpp + bot_commands/bot_bot_settings.cpp + bot_commands/bot_cast.cpp + bot_commands/bot_class_race_list.cpp + bot_commands/bot_click_item.cpp + bot_commands/bot_copy_settings.cpp + bot_commands/bot_default_settings.cpp + bot_commands/bot_depart.cpp + bot_commands/bot_discipline.cpp + bot_commands/bot_distance_ranged.cpp + bot_commands/bot_find_aliases.cpp + bot_commands/bot_follow.cpp + bot_commands/bot_guard.cpp + bot_commands/bot_heal_rotation.cpp + bot_commands/bot_help.cpp + bot_commands/bot_hold.cpp + bot_commands/bot_illusion_block.cpp + bot_commands/bot_inventory.cpp + bot_commands/bot_item_use.cpp + bot_commands/bot_max_melee_range.cpp + bot_commands/bot_name.cpp + bot_commands/bot_owner_option.cpp + bot_commands/bot_pet.cpp + bot_commands/bot_pick_lock.cpp + bot_commands/bot_pickpocket.cpp + bot_commands/bot_precombat.cpp + bot_commands/bot_pull.cpp + bot_commands/bot_release.cpp + bot_commands/bot_set_assistee.cpp + bot_commands/bot_sit_hp_percent.cpp + bot_commands/bot_sit_in_combat.cpp + bot_commands/bot_sit_mana_percent.cpp + bot_commands/bot_spell.cpp + bot_commands/bot_spell_aggro_checks.cpp + bot_commands/bot_spell_announce_cast.cpp + bot_commands/bot_spell_delays.cpp + bot_commands/bot_spell_engaged_priority.cpp + bot_commands/bot_spell_holds.cpp + bot_commands/bot_spell_idle_priority.cpp + bot_commands/bot_spell_max_hp_pct.cpp + bot_commands/bot_spell_max_mana_pct.cpp + bot_commands/bot_spell_max_thresholds.cpp + bot_commands/bot_spell_min_hp_pct.cpp + bot_commands/bot_spell_min_mana_pct.cpp + bot_commands/bot_spell_min_thresholds.cpp + bot_commands/bot_spell_pursue_priority.cpp + bot_commands/bot_spell_resist_limits.cpp + bot_commands/bot_spell_target_count.cpp + bot_commands/bot_spelltypes.cpp + bot_commands/bot_summon.cpp + bot_commands/bot_suspend.cpp + bot_commands/bot_taunt.cpp + bot_commands/bot_timer.cpp + bot_commands/bot_track.cpp + bot_commands/bot_view_combos.cpp gm_commands/acceptrules.cpp gm_commands/advnpcspawn.cpp gm_commands/aggrozone.cpp diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index a697fc6bb..0e202540c 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -863,65 +863,3 @@ void SendSpellTypeWindow(Client* c, const Seperator* sep) { c->SendPopupToClient("Spell Types", popup_text.c_str()); } -#include "bot_commands/actionable.cpp" -#include "bot_commands/appearance.cpp" -#include "bot_commands/apply_poison.cpp" -#include "bot_commands/apply_potion.cpp" -#include "bot_commands/attack.cpp" -#include "bot_commands/behind_mob.cpp" -#include "bot_commands/blocked_buffs.cpp" -#include "bot_commands/bot.cpp" -#include "bot_commands/bot_settings.cpp" -#include "bot_commands/cast.cpp" -#include "bot_commands/class_race_list.cpp" -#include "bot_commands/click_item.cpp" -#include "bot_commands/copy_settings.cpp" -#include "bot_commands/default_settings.cpp" -#include "bot_commands/depart.cpp" -#include "bot_commands/discipline.cpp" -#include "bot_commands/distance_ranged.cpp" -#include "bot_commands/find_aliases.cpp" -#include "bot_commands/follow.cpp" -#include "bot_commands/guard.cpp" -#include "bot_commands/heal_rotation.cpp" -#include "bot_commands/help.cpp" -#include "bot_commands/hold.cpp" -#include "bot_commands/illusion_block.cpp" -#include "bot_commands/inventory.cpp" -#include "bot_commands/item_use.cpp" -#include "bot_commands/max_melee_range.cpp" -#include "bot_commands/name.cpp" -#include "bot_commands/owner_option.cpp" -#include "bot_commands/pet.cpp" -#include "bot_commands/pick_lock.cpp" -#include "bot_commands/pickpocket.cpp" -#include "bot_commands/precombat.cpp" -#include "bot_commands/pull.cpp" -#include "bot_commands/release.cpp" -#include "bot_commands/set_assistee.cpp" -#include "bot_commands/sit_hp_percent.cpp" -#include "bot_commands/sit_in_combat.cpp" -#include "bot_commands/sit_mana_percent.cpp" -#include "bot_commands/spell.cpp" -#include "bot_commands/spell_aggro_checks.cpp" -#include "bot_commands/spell_announce_cast.cpp" -#include "bot_commands/spell_delays.cpp" -#include "bot_commands/spell_engaged_priority.cpp" -#include "bot_commands/spell_holds.cpp" -#include "bot_commands/spell_idle_priority.cpp" -#include "bot_commands/spell_max_hp_pct.cpp" -#include "bot_commands/spell_max_mana_pct.cpp" -#include "bot_commands/spell_max_thresholds.cpp" -#include "bot_commands/spell_min_hp_pct.cpp" -#include "bot_commands/spell_min_mana_pct.cpp" -#include "bot_commands/spell_min_thresholds.cpp" -#include "bot_commands/spell_pursue_priority.cpp" -#include "bot_commands/spell_resist_limits.cpp" -#include "bot_commands/spell_target_count.cpp" -#include "bot_commands/spelltypes.cpp" -#include "bot_commands/summon.cpp" -#include "bot_commands/suspend.cpp" -#include "bot_commands/taunt.cpp" -#include "bot_commands/timer.cpp" -#include "bot_commands/track.cpp" -#include "bot_commands/view_combos.cpp" diff --git a/zone/bot_commands/actionable.cpp b/zone/bot_commands/bot_actionable.cpp similarity index 100% rename from zone/bot_commands/actionable.cpp rename to zone/bot_commands/bot_actionable.cpp diff --git a/zone/bot_commands/appearance.cpp b/zone/bot_commands/bot_appearance.cpp similarity index 100% rename from zone/bot_commands/appearance.cpp rename to zone/bot_commands/bot_appearance.cpp diff --git a/zone/bot_commands/apply_poison.cpp b/zone/bot_commands/bot_apply_poison.cpp similarity index 100% rename from zone/bot_commands/apply_poison.cpp rename to zone/bot_commands/bot_apply_poison.cpp diff --git a/zone/bot_commands/apply_potion.cpp b/zone/bot_commands/bot_apply_potion.cpp similarity index 100% rename from zone/bot_commands/apply_potion.cpp rename to zone/bot_commands/bot_apply_potion.cpp diff --git a/zone/bot_commands/attack.cpp b/zone/bot_commands/bot_attack.cpp similarity index 100% rename from zone/bot_commands/attack.cpp rename to zone/bot_commands/bot_attack.cpp diff --git a/zone/bot_commands/behind_mob.cpp b/zone/bot_commands/bot_behind_mob.cpp similarity index 100% rename from zone/bot_commands/behind_mob.cpp rename to zone/bot_commands/bot_behind_mob.cpp diff --git a/zone/bot_commands/blocked_buffs.cpp b/zone/bot_commands/bot_blocked_buffs.cpp similarity index 100% rename from zone/bot_commands/blocked_buffs.cpp rename to zone/bot_commands/bot_blocked_buffs.cpp diff --git a/zone/bot_commands/bot.cpp b/zone/bot_commands/bot_bot.cpp similarity index 100% rename from zone/bot_commands/bot.cpp rename to zone/bot_commands/bot_bot.cpp diff --git a/zone/bot_commands/bot_settings.cpp b/zone/bot_commands/bot_bot_settings.cpp similarity index 100% rename from zone/bot_commands/bot_settings.cpp rename to zone/bot_commands/bot_bot_settings.cpp diff --git a/zone/bot_commands/cast.cpp b/zone/bot_commands/bot_cast.cpp similarity index 100% rename from zone/bot_commands/cast.cpp rename to zone/bot_commands/bot_cast.cpp diff --git a/zone/bot_commands/class_race_list.cpp b/zone/bot_commands/bot_class_race_list.cpp similarity index 100% rename from zone/bot_commands/class_race_list.cpp rename to zone/bot_commands/bot_class_race_list.cpp diff --git a/zone/bot_commands/click_item.cpp b/zone/bot_commands/bot_click_item.cpp similarity index 100% rename from zone/bot_commands/click_item.cpp rename to zone/bot_commands/bot_click_item.cpp diff --git a/zone/bot_commands/copy_settings.cpp b/zone/bot_commands/bot_copy_settings.cpp similarity index 100% rename from zone/bot_commands/copy_settings.cpp rename to zone/bot_commands/bot_copy_settings.cpp diff --git a/zone/bot_commands/default_settings.cpp b/zone/bot_commands/bot_default_settings.cpp similarity index 100% rename from zone/bot_commands/default_settings.cpp rename to zone/bot_commands/bot_default_settings.cpp diff --git a/zone/bot_commands/depart.cpp b/zone/bot_commands/bot_depart.cpp similarity index 100% rename from zone/bot_commands/depart.cpp rename to zone/bot_commands/bot_depart.cpp diff --git a/zone/bot_commands/discipline.cpp b/zone/bot_commands/bot_discipline.cpp similarity index 100% rename from zone/bot_commands/discipline.cpp rename to zone/bot_commands/bot_discipline.cpp diff --git a/zone/bot_commands/distance_ranged.cpp b/zone/bot_commands/bot_distance_ranged.cpp similarity index 100% rename from zone/bot_commands/distance_ranged.cpp rename to zone/bot_commands/bot_distance_ranged.cpp diff --git a/zone/bot_commands/find_aliases.cpp b/zone/bot_commands/bot_find_aliases.cpp similarity index 100% rename from zone/bot_commands/find_aliases.cpp rename to zone/bot_commands/bot_find_aliases.cpp diff --git a/zone/bot_commands/follow.cpp b/zone/bot_commands/bot_follow.cpp similarity index 100% rename from zone/bot_commands/follow.cpp rename to zone/bot_commands/bot_follow.cpp diff --git a/zone/bot_commands/guard.cpp b/zone/bot_commands/bot_guard.cpp similarity index 100% rename from zone/bot_commands/guard.cpp rename to zone/bot_commands/bot_guard.cpp diff --git a/zone/bot_commands/heal_rotation.cpp b/zone/bot_commands/bot_heal_rotation.cpp similarity index 100% rename from zone/bot_commands/heal_rotation.cpp rename to zone/bot_commands/bot_heal_rotation.cpp diff --git a/zone/bot_commands/help.cpp b/zone/bot_commands/bot_help.cpp similarity index 100% rename from zone/bot_commands/help.cpp rename to zone/bot_commands/bot_help.cpp diff --git a/zone/bot_commands/hold.cpp b/zone/bot_commands/bot_hold.cpp similarity index 100% rename from zone/bot_commands/hold.cpp rename to zone/bot_commands/bot_hold.cpp diff --git a/zone/bot_commands/illusion_block.cpp b/zone/bot_commands/bot_illusion_block.cpp similarity index 100% rename from zone/bot_commands/illusion_block.cpp rename to zone/bot_commands/bot_illusion_block.cpp diff --git a/zone/bot_commands/inventory.cpp b/zone/bot_commands/bot_inventory.cpp similarity index 100% rename from zone/bot_commands/inventory.cpp rename to zone/bot_commands/bot_inventory.cpp diff --git a/zone/bot_commands/item_use.cpp b/zone/bot_commands/bot_item_use.cpp similarity index 100% rename from zone/bot_commands/item_use.cpp rename to zone/bot_commands/bot_item_use.cpp diff --git a/zone/bot_commands/max_melee_range.cpp b/zone/bot_commands/bot_max_melee_range.cpp similarity index 100% rename from zone/bot_commands/max_melee_range.cpp rename to zone/bot_commands/bot_max_melee_range.cpp diff --git a/zone/bot_commands/name.cpp b/zone/bot_commands/bot_name.cpp similarity index 100% rename from zone/bot_commands/name.cpp rename to zone/bot_commands/bot_name.cpp diff --git a/zone/bot_commands/owner_option.cpp b/zone/bot_commands/bot_owner_option.cpp similarity index 100% rename from zone/bot_commands/owner_option.cpp rename to zone/bot_commands/bot_owner_option.cpp diff --git a/zone/bot_commands/pet.cpp b/zone/bot_commands/bot_pet.cpp similarity index 100% rename from zone/bot_commands/pet.cpp rename to zone/bot_commands/bot_pet.cpp diff --git a/zone/bot_commands/pick_lock.cpp b/zone/bot_commands/bot_pick_lock.cpp similarity index 98% rename from zone/bot_commands/pick_lock.cpp rename to zone/bot_commands/bot_pick_lock.cpp index 7815833ee..49096a8f5 100644 --- a/zone/bot_commands/pick_lock.cpp +++ b/zone/bot_commands/bot_pick_lock.cpp @@ -1,4 +1,5 @@ #include "../bot_command.h" +#include "../doors.h" void bot_command_pick_lock(Client *c, const Seperator *sep) { diff --git a/zone/bot_commands/pickpocket.cpp b/zone/bot_commands/bot_pickpocket.cpp similarity index 100% rename from zone/bot_commands/pickpocket.cpp rename to zone/bot_commands/bot_pickpocket.cpp diff --git a/zone/bot_commands/precombat.cpp b/zone/bot_commands/bot_precombat.cpp similarity index 100% rename from zone/bot_commands/precombat.cpp rename to zone/bot_commands/bot_precombat.cpp diff --git a/zone/bot_commands/pull.cpp b/zone/bot_commands/bot_pull.cpp similarity index 100% rename from zone/bot_commands/pull.cpp rename to zone/bot_commands/bot_pull.cpp diff --git a/zone/bot_commands/release.cpp b/zone/bot_commands/bot_release.cpp similarity index 100% rename from zone/bot_commands/release.cpp rename to zone/bot_commands/bot_release.cpp diff --git a/zone/bot_commands/set_assistee.cpp b/zone/bot_commands/bot_set_assistee.cpp similarity index 100% rename from zone/bot_commands/set_assistee.cpp rename to zone/bot_commands/bot_set_assistee.cpp diff --git a/zone/bot_commands/sit_hp_percent.cpp b/zone/bot_commands/bot_sit_hp_percent.cpp similarity index 100% rename from zone/bot_commands/sit_hp_percent.cpp rename to zone/bot_commands/bot_sit_hp_percent.cpp diff --git a/zone/bot_commands/sit_in_combat.cpp b/zone/bot_commands/bot_sit_in_combat.cpp similarity index 100% rename from zone/bot_commands/sit_in_combat.cpp rename to zone/bot_commands/bot_sit_in_combat.cpp diff --git a/zone/bot_commands/sit_mana_percent.cpp b/zone/bot_commands/bot_sit_mana_percent.cpp similarity index 100% rename from zone/bot_commands/sit_mana_percent.cpp rename to zone/bot_commands/bot_sit_mana_percent.cpp diff --git a/zone/bot_commands/spell.cpp b/zone/bot_commands/bot_spell.cpp similarity index 100% rename from zone/bot_commands/spell.cpp rename to zone/bot_commands/bot_spell.cpp diff --git a/zone/bot_commands/spell_aggro_checks.cpp b/zone/bot_commands/bot_spell_aggro_checks.cpp similarity index 100% rename from zone/bot_commands/spell_aggro_checks.cpp rename to zone/bot_commands/bot_spell_aggro_checks.cpp diff --git a/zone/bot_commands/spell_announce_cast.cpp b/zone/bot_commands/bot_spell_announce_cast.cpp similarity index 100% rename from zone/bot_commands/spell_announce_cast.cpp rename to zone/bot_commands/bot_spell_announce_cast.cpp diff --git a/zone/bot_commands/spell_delays.cpp b/zone/bot_commands/bot_spell_delays.cpp similarity index 100% rename from zone/bot_commands/spell_delays.cpp rename to zone/bot_commands/bot_spell_delays.cpp diff --git a/zone/bot_commands/spell_engaged_priority.cpp b/zone/bot_commands/bot_spell_engaged_priority.cpp similarity index 100% rename from zone/bot_commands/spell_engaged_priority.cpp rename to zone/bot_commands/bot_spell_engaged_priority.cpp diff --git a/zone/bot_commands/spell_holds.cpp b/zone/bot_commands/bot_spell_holds.cpp similarity index 100% rename from zone/bot_commands/spell_holds.cpp rename to zone/bot_commands/bot_spell_holds.cpp diff --git a/zone/bot_commands/spell_idle_priority.cpp b/zone/bot_commands/bot_spell_idle_priority.cpp similarity index 100% rename from zone/bot_commands/spell_idle_priority.cpp rename to zone/bot_commands/bot_spell_idle_priority.cpp diff --git a/zone/bot_commands/spell_max_hp_pct.cpp b/zone/bot_commands/bot_spell_max_hp_pct.cpp similarity index 100% rename from zone/bot_commands/spell_max_hp_pct.cpp rename to zone/bot_commands/bot_spell_max_hp_pct.cpp diff --git a/zone/bot_commands/spell_max_mana_pct.cpp b/zone/bot_commands/bot_spell_max_mana_pct.cpp similarity index 100% rename from zone/bot_commands/spell_max_mana_pct.cpp rename to zone/bot_commands/bot_spell_max_mana_pct.cpp diff --git a/zone/bot_commands/spell_max_thresholds.cpp b/zone/bot_commands/bot_spell_max_thresholds.cpp similarity index 100% rename from zone/bot_commands/spell_max_thresholds.cpp rename to zone/bot_commands/bot_spell_max_thresholds.cpp diff --git a/zone/bot_commands/spell_min_hp_pct.cpp b/zone/bot_commands/bot_spell_min_hp_pct.cpp similarity index 100% rename from zone/bot_commands/spell_min_hp_pct.cpp rename to zone/bot_commands/bot_spell_min_hp_pct.cpp diff --git a/zone/bot_commands/spell_min_mana_pct.cpp b/zone/bot_commands/bot_spell_min_mana_pct.cpp similarity index 100% rename from zone/bot_commands/spell_min_mana_pct.cpp rename to zone/bot_commands/bot_spell_min_mana_pct.cpp diff --git a/zone/bot_commands/spell_min_thresholds.cpp b/zone/bot_commands/bot_spell_min_thresholds.cpp similarity index 100% rename from zone/bot_commands/spell_min_thresholds.cpp rename to zone/bot_commands/bot_spell_min_thresholds.cpp diff --git a/zone/bot_commands/spell_pursue_priority.cpp b/zone/bot_commands/bot_spell_pursue_priority.cpp similarity index 100% rename from zone/bot_commands/spell_pursue_priority.cpp rename to zone/bot_commands/bot_spell_pursue_priority.cpp diff --git a/zone/bot_commands/spell_resist_limits.cpp b/zone/bot_commands/bot_spell_resist_limits.cpp similarity index 100% rename from zone/bot_commands/spell_resist_limits.cpp rename to zone/bot_commands/bot_spell_resist_limits.cpp diff --git a/zone/bot_commands/spell_target_count.cpp b/zone/bot_commands/bot_spell_target_count.cpp similarity index 100% rename from zone/bot_commands/spell_target_count.cpp rename to zone/bot_commands/bot_spell_target_count.cpp diff --git a/zone/bot_commands/spelltypes.cpp b/zone/bot_commands/bot_spelltypes.cpp similarity index 100% rename from zone/bot_commands/spelltypes.cpp rename to zone/bot_commands/bot_spelltypes.cpp diff --git a/zone/bot_commands/summon.cpp b/zone/bot_commands/bot_summon.cpp similarity index 100% rename from zone/bot_commands/summon.cpp rename to zone/bot_commands/bot_summon.cpp diff --git a/zone/bot_commands/suspend.cpp b/zone/bot_commands/bot_suspend.cpp similarity index 100% rename from zone/bot_commands/suspend.cpp rename to zone/bot_commands/bot_suspend.cpp diff --git a/zone/bot_commands/taunt.cpp b/zone/bot_commands/bot_taunt.cpp similarity index 100% rename from zone/bot_commands/taunt.cpp rename to zone/bot_commands/bot_taunt.cpp diff --git a/zone/bot_commands/timer.cpp b/zone/bot_commands/bot_timer.cpp similarity index 100% rename from zone/bot_commands/timer.cpp rename to zone/bot_commands/bot_timer.cpp diff --git a/zone/bot_commands/track.cpp b/zone/bot_commands/bot_track.cpp similarity index 100% rename from zone/bot_commands/track.cpp rename to zone/bot_commands/bot_track.cpp diff --git a/zone/bot_commands/view_combos.cpp b/zone/bot_commands/bot_view_combos.cpp similarity index 100% rename from zone/bot_commands/view_combos.cpp rename to zone/bot_commands/bot_view_combos.cpp diff --git a/zone/gm_commands/find/find_spell.cpp b/zone/gm_commands/find/find_spell.cpp index ddfc83270..b5f1a88e8 100644 --- a/zone/gm_commands/find/find_spell.cpp +++ b/zone/gm_commands/find/find_spell.cpp @@ -1,5 +1,7 @@ #include "../../client.h" +uint8 GetCommandStatus(std::string command_name); + void FindSpell(Client *c, const Seperator *sep) { if (SPDAT_RECORDS <= 0) { diff --git a/zone/gm_commands/find/find_task.cpp b/zone/gm_commands/find/find_task.cpp index c51f1892d..0873ebe30 100644 --- a/zone/gm_commands/find/find_task.cpp +++ b/zone/gm_commands/find/find_task.cpp @@ -1,5 +1,7 @@ #include "../../client.h" +uint8 GetCommandStatus(std::string command_name); + void FindTask(Client *c, const Seperator *sep) { if (!RuleB(TaskSystem, EnableTaskSystem)) { diff --git a/zone/gm_commands/fixmob.cpp b/zone/gm_commands/fixmob.cpp index 14cf3e980..d691b0f2e 100755 --- a/zone/gm_commands/fixmob.cpp +++ b/zone/gm_commands/fixmob.cpp @@ -1,5 +1,21 @@ #include "../client.h" +void SendFixMobSubCommands(Client* c) +{ + c->Message(Chat::White, "Usage: #fixmob beard [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob beard_color [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob drakkin_details [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob drakkin_heritage [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob drakkin_tattoo [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob face [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob gender [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob hair [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob hair_color [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob helm [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob race [Next|Previous]"); + c->Message(Chat::White, "Usage: #fixmob texture [Next|Previous]"); +} + void command_fixmob(Client *c, const Seperator *sep) { const int arguments = sep->argnum; @@ -269,18 +285,3 @@ void command_fixmob(Client *c, const Seperator *sep) ); } -void SendFixMobSubCommands(Client *c) -{ - c->Message(Chat::White, "Usage: #fixmob beard [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob beard_color [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob drakkin_details [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob drakkin_heritage [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob drakkin_tattoo [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob face [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob gender [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob hair [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob hair_color [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob helm [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob race [Next|Previous]"); - c->Message(Chat::White, "Usage: #fixmob texture [Next|Previous]"); -} diff --git a/zone/gm_commands/set/set_zone.cpp b/zone/gm_commands/set/set_zone.cpp index 0ff3c24cb..d2bfecaed 100644 --- a/zone/gm_commands/set/set_zone.cpp +++ b/zone/gm_commands/set/set_zone.cpp @@ -1,4 +1,7 @@ #include "../../client.h" +#include "../../worldserver.h" + +extern WorldServer worldserver; void SetZoneData(Client *c, const Seperator *sep) { From 012c54c2775faec26bf469e90a95a9013092b1f5 Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 9 Dec 2025 23:01:03 -0800 Subject: [PATCH 41/44] change db update manifest to header change build yml --- .github/workflows/build.yaml | 4 ++-- common/CMakeLists.txt | 6 +++--- common/database/database_update.cpp | 7 +++---- ...base_update_manifest.cpp => database_update_manifest.h} | 2 +- ...e_manifest_bots.cpp => database_update_manifest_bots.h} | 2 +- ...nifest_custom.cpp => database_update_manifest_custom.h} | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) rename common/database/{database_update_manifest.cpp => database_update_manifest.h} (99%) rename common/database/{database_update_manifest_bots.cpp => database_update_manifest_bots.h} (99%) rename common/database/{database_update_manifest_custom.cpp => database_update_manifest_custom.h} (98%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c9650cf56..4247d5c55 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential ninja-build ccache libmariadb-dev libmariadb-dev-compat libboost-all-dev libperl-dev liblua5.1-0-dev libluajit-5.1-dev zlib1g-dev uuid-dev libssl-dev libsodium-dev libmbedtls-dev + sudo apt-get install -y build-essential ninja-build ccache - name: Configure run: | @@ -74,7 +74,7 @@ jobs: - name: Build shell: pwsh - run: cmake --build build --config RelWithDebInfo --target ALL_BUILD -- /m + run: cmake --build build --parallel --config RelWithDebInfo --target ALL_BUILD -- /m - name: Test working-directory: build diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index b65ab7311..b21d131fe 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -16,9 +16,6 @@ set(common_sources database/database_dump_service.cpp database.cpp database_instances.cpp - database/database_update_manifest.cpp - database/database_update_manifest_custom.cpp - database/database_update_manifest_bots.cpp database/database_update.cpp data_bucket.cpp dbcore.cpp @@ -557,6 +554,9 @@ set(common_headers database.h database_schema.h database/database_update.h + database/database_update_manifest.h + database/database_update_manifest_custom.h + database/database_update_manifest_bots.h data_bucket.cpp dbcore.h deity.h diff --git a/common/database/database_update.cpp b/common/database/database_update.cpp index d296aa92b..d1837b448 100644 --- a/common/database/database_update.cpp +++ b/common/database/database_update.cpp @@ -5,11 +5,10 @@ #include "../strings.h" #include "../rulesys.h" #include "../http/httplib.h" - -#include "database_update_manifest.cpp" -#include "database_update_manifest_custom.cpp" -#include "database_update_manifest_bots.cpp" #include "database_dump_service.h" +#include "database_update_manifest.h" +#include "database_update_manifest_custom.h" +#include "database_update_manifest_bots.h" constexpr int BREAK_LENGTH = 70; diff --git a/common/database/database_update_manifest.cpp b/common/database/database_update_manifest.h similarity index 99% rename from common/database/database_update_manifest.cpp rename to common/database/database_update_manifest.h index 15dc4a27f..6e88d0481 100644 --- a/common/database/database_update_manifest.cpp +++ b/common/database/database_update_manifest.h @@ -1,4 +1,4 @@ -#include "database_update.h" +#pragma once std::vector manifest_entries = { ManifestEntry{ diff --git a/common/database/database_update_manifest_bots.cpp b/common/database/database_update_manifest_bots.h similarity index 99% rename from common/database/database_update_manifest_bots.cpp rename to common/database/database_update_manifest_bots.h index c2da0fd70..4f492bda7 100644 --- a/common/database/database_update_manifest_bots.cpp +++ b/common/database/database_update_manifest_bots.h @@ -1,4 +1,4 @@ -#include "database_update.h" +#pragma once std::vector bot_manifest_entries = { ManifestEntry{ diff --git a/common/database/database_update_manifest_custom.cpp b/common/database/database_update_manifest_custom.h similarity index 98% rename from common/database/database_update_manifest_custom.cpp rename to common/database/database_update_manifest_custom.h index e441d600c..61bc10296 100644 --- a/common/database/database_update_manifest_custom.cpp +++ b/common/database/database_update_manifest_custom.h @@ -1,4 +1,4 @@ -#include "database_update.h" +#pragma once std::vector manifest_entries_custom = { ManifestEntry{ From 7acff368ea908fdb01419f205d18964c8c8a16ed Mon Sep 17 00:00:00 2001 From: KimLS Date: Tue, 9 Dec 2025 23:17:03 -0800 Subject: [PATCH 42/44] Move world CLI include cpps to cmake. --- world/CMakeLists.txt | 43 ++++++++++++++++++- ...{bots_disable.cpp => cli_bots_disable.cpp} | 1 + .../{bots_enable.cpp => cli_bots_enable.cpp} | 1 + ...y_character.cpp => cli_copy_character.cpp} | 2 + ...rency.cpp => cli_database_concurrency.cpp} | 1 + ...atabase_dump.cpp => cli_database_dump.cpp} | 1 + ...schema.cpp => cli_database_get_schema.cpp} | 1 + ...pp => cli_database_set_account_status.cpp} | 1 + ...e_updates.cpp => cli_database_updates.cpp} | 2 + ...e_version.cpp => cli_database_version.cpp} | 1 + ..._settings.cpp => cli_etl_get_settings.cpp} | 2 + ...ercs_disable.cpp => cli_mercs_disable.cpp} | 1 + ...{mercs_enable.cpp => cli_mercs_enable.cpp} | 1 + world/cli/{test.cpp => cli_test.cpp} | 1 + .../{test_colors.cpp => cli_test_colors.cpp} | 1 + ...t_expansion.cpp => cli_test_expansion.cpp} | 1 + ...repository.cpp => cli_test_repository.cpp} | 1 + ...sitory_2.cpp => cli_test_repository_2.cpp} | 2 + ...mark.cpp => cli_test_string_benchmark.cpp} | 1 + world/cli/{version.cpp => cli_version.cpp} | 1 + world/world_server_cli.cpp | 19 -------- 21 files changed, 65 insertions(+), 20 deletions(-) rename world/cli/{bots_disable.cpp => cli_bots_disable.cpp} (96%) rename world/cli/{bots_enable.cpp => cli_bots_enable.cpp} (95%) rename world/cli/{copy_character.cpp => cli_copy_character.cpp} (93%) rename world/cli/{database_concurrency.cpp => cli_database_concurrency.cpp} (97%) rename world/cli/{database_dump.cpp => cli_database_dump.cpp} (98%) rename world/cli/{database_get_schema.cpp => cli_database_get_schema.cpp} (98%) rename world/cli/{database_set_account_status.cpp => cli_database_set_account_status.cpp} (93%) rename world/cli/{database_updates.cpp => cli_database_updates.cpp} (89%) rename world/cli/{database_version.cpp => cli_database_version.cpp} (95%) rename world/cli/{etl_get_settings.cpp => cli_etl_get_settings.cpp} (96%) rename world/cli/{mercs_disable.cpp => cli_mercs_disable.cpp} (96%) rename world/cli/{mercs_enable.cpp => cli_mercs_enable.cpp} (97%) rename world/cli/{test.cpp => cli_test.cpp} (96%) rename world/cli/{test_colors.cpp => cli_test_colors.cpp} (99%) rename world/cli/{test_expansion.cpp => cli_test_expansion.cpp} (97%) rename world/cli/{test_repository.cpp => cli_test_repository.cpp} (98%) rename world/cli/{test_repository_2.cpp => cli_test_repository_2.cpp} (88%) rename world/cli/{test_string_benchmark.cpp => cli_test_string_benchmark.cpp} (98%) rename world/cli/{version.cpp => cli_version.cpp} (95%) diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index d980a458f..5a490f3b9 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -6,6 +6,25 @@ set(world_sources client.cpp cliententry.cpp clientlist.cpp + cli/cli_database_concurrency.cpp + cli/cli_bots_enable.cpp + cli/cli_bots_disable.cpp + cli/cli_mercs_enable.cpp + cli/cli_mercs_disable.cpp + cli/cli_copy_character.cpp + cli/cli_database_updates.cpp + cli/cli_database_dump.cpp + cli/cli_database_get_schema.cpp + cli/cli_database_set_account_status.cpp + cli/cli_database_version.cpp + cli/cli_test.cpp + cli/cli_test_colors.cpp + cli/cli_test_expansion.cpp + cli/cli_test_repository.cpp + cli/cli_test_repository_2.cpp + cli/cli_test_string_benchmark.cpp + cli/cli_version.cpp + cli/cli_etl_get_settings.cpp console.cpp dynamic_zone.cpp dynamic_zone_manager.cpp @@ -68,7 +87,29 @@ set(world_headers world_event_scheduler.h zonelist.h zoneserver.h - ) +) + +source_group(cli FILES + cli/cli_database_concurrency.cpp + cli/cli_bots_enable.cpp + cli/cli_bots_disable.cpp + cli/cli_mercs_enable.cpp + cli/cli_mercs_disable.cpp + cli/cli_copy_character.cpp + cli/cli_database_updates.cpp + cli/cli_database_dump.cpp + cli/cli_database_get_schema.cpp + cli/cli_database_set_account_status.cpp + cli/cli_database_version.cpp + cli/cli_test.cpp + cli/cli_test_colors.cpp + cli/cli_test_expansion.cpp + cli/cli_test_repository.cpp + cli/cli_test_repository_2.cpp + cli/cli_test_string_benchmark.cpp + cli/cli_version.cpp + cli/cli_etl_get_settings.cpp +) add_executable(world ${world_sources} ${world_headers}) diff --git a/world/cli/bots_disable.cpp b/world/cli/cli_bots_disable.cpp similarity index 96% rename from world/cli/bots_disable.cpp rename to world/cli/cli_bots_disable.cpp index b8b36dcc7..0df7b9873 100644 --- a/world/cli/bots_disable.cpp +++ b/world/cli/cli_bots_disable.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../worlddb.h" #include "../../common/database_schema.h" diff --git a/world/cli/bots_enable.cpp b/world/cli/cli_bots_enable.cpp similarity index 95% rename from world/cli/bots_enable.cpp rename to world/cli/cli_bots_enable.cpp index f02950742..e503f93c9 100644 --- a/world/cli/bots_enable.cpp +++ b/world/cli/cli_bots_enable.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../worlddb.h" #include "../../common/rulesys.h" diff --git a/world/cli/copy_character.cpp b/world/cli/cli_copy_character.cpp similarity index 93% rename from world/cli/copy_character.cpp rename to world/cli/cli_copy_character.cpp index ebe8e1831..047b81944 100644 --- a/world/cli/copy_character.cpp +++ b/world/cli/cli_copy_character.cpp @@ -1,3 +1,5 @@ +#include "../world_server_cli.h" +#include "../../common/eqemu_logsys.h" #include "../../common/eqemu_logsys_log_aliases.h" #include "../worlddb.h" diff --git a/world/cli/database_concurrency.cpp b/world/cli/cli_database_concurrency.cpp similarity index 97% rename from world/cli/database_concurrency.cpp rename to world/cli/cli_database_concurrency.cpp index bb20f4eba..0479a90a1 100644 --- a/world/cli/database_concurrency.cpp +++ b/world/cli/cli_database_concurrency.cpp @@ -1,4 +1,5 @@ #include +#include "../world_server_cli.h" #include "../../common/repositories/zone_repository.h" #include "../../common/eqemu_config.h" #include diff --git a/world/cli/database_dump.cpp b/world/cli/cli_database_dump.cpp similarity index 98% rename from world/cli/database_dump.cpp rename to world/cli/cli_database_dump.cpp index 67a591fb0..2cedd6392 100644 --- a/world/cli/database_dump.cpp +++ b/world/cli/cli_database_dump.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/database/database_dump_service.h" void WorldserverCLI::DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description) diff --git a/world/cli/database_get_schema.cpp b/world/cli/cli_database_get_schema.cpp similarity index 98% rename from world/cli/database_get_schema.cpp rename to world/cli/cli_database_get_schema.cpp index b71139358..d4b71c1c4 100644 --- a/world/cli/database_get_schema.cpp +++ b/world/cli/cli_database_get_schema.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/database_schema.h" #include "../../common/json/json.h" diff --git a/world/cli/database_set_account_status.cpp b/world/cli/cli_database_set_account_status.cpp similarity index 93% rename from world/cli/database_set_account_status.cpp rename to world/cli/cli_database_set_account_status.cpp index 39dbeeb28..d0e94b23c 100644 --- a/world/cli/database_set_account_status.cpp +++ b/world/cli/cli_database_set_account_status.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../worlddb.h" void WorldserverCLI::DatabaseSetAccountStatus(int argc, char **argv, argh::parser &cmd, std::string &description) diff --git a/world/cli/database_updates.cpp b/world/cli/cli_database_updates.cpp similarity index 89% rename from world/cli/database_updates.cpp rename to world/cli/cli_database_updates.cpp index f967349fa..763a1f3c3 100644 --- a/world/cli/database_updates.cpp +++ b/world/cli/cli_database_updates.cpp @@ -1,3 +1,5 @@ +#include "../world_server_cli.h" +#include "../worlddb.h" #include "../../common/database/database_update.h" void WorldserverCLI::DatabaseUpdates(int argc, char **argv, argh::parser &cmd, std::string &description) diff --git a/world/cli/database_version.cpp b/world/cli/cli_database_version.cpp similarity index 95% rename from world/cli/database_version.cpp rename to world/cli/cli_database_version.cpp index 2426d9d72..ee11bb7b1 100644 --- a/world/cli/database_version.cpp +++ b/world/cli/cli_database_version.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/version.h" #include "../../common/json/json.h" #include "../../common/rulesys.h" diff --git a/world/cli/etl_get_settings.cpp b/world/cli/cli_etl_get_settings.cpp similarity index 96% rename from world/cli/etl_get_settings.cpp rename to world/cli/cli_etl_get_settings.cpp index eb1d873ac..c17d0b8e8 100644 --- a/world/cli/etl_get_settings.cpp +++ b/world/cli/cli_etl_get_settings.cpp @@ -1,3 +1,5 @@ +#include "../world_server_cli.h" +#include "../worlddb.h" #include "../../common/events/player_event_logs.h" #include "../../common/json/json.h" diff --git a/world/cli/mercs_disable.cpp b/world/cli/cli_mercs_disable.cpp similarity index 96% rename from world/cli/mercs_disable.cpp rename to world/cli/cli_mercs_disable.cpp index 0af5d4b0e..9018d271b 100644 --- a/world/cli/mercs_disable.cpp +++ b/world/cli/cli_mercs_disable.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../worlddb.h" #include "../../common/database_schema.h" diff --git a/world/cli/mercs_enable.cpp b/world/cli/cli_mercs_enable.cpp similarity index 97% rename from world/cli/mercs_enable.cpp rename to world/cli/cli_mercs_enable.cpp index efb005421..2e69472d5 100644 --- a/world/cli/mercs_enable.cpp +++ b/world/cli/cli_mercs_enable.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../worlddb.h" #include "../../common/database_schema.h" diff --git a/world/cli/test.cpp b/world/cli/cli_test.cpp similarity index 96% rename from world/cli/test.cpp rename to world/cli/cli_test.cpp index 172d46d21..305f22d2f 100644 --- a/world/cli/test.cpp +++ b/world/cli/cli_test.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include #include #include diff --git a/world/cli/test_colors.cpp b/world/cli/cli_test_colors.cpp similarity index 99% rename from world/cli/test_colors.cpp rename to world/cli/cli_test_colors.cpp index aeff8d61b..477c13333 100644 --- a/world/cli/test_colors.cpp +++ b/world/cli/cli_test_colors.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/zone_store.h" #include "../../common/termcolor/rang.hpp" diff --git a/world/cli/test_expansion.cpp b/world/cli/cli_test_expansion.cpp similarity index 97% rename from world/cli/test_expansion.cpp rename to world/cli/cli_test_expansion.cpp index 856e053d8..24e227472 100644 --- a/world/cli/test_expansion.cpp +++ b/world/cli/cli_test_expansion.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/rulesys.h" #include "../../common/repositories/content_flags_repository.h" #include "../../common/content/world_content_service.h" diff --git a/world/cli/test_repository.cpp b/world/cli/cli_test_repository.cpp similarity index 98% rename from world/cli/test_repository.cpp rename to world/cli/cli_test_repository.cpp index a4c8f59b1..bd2ee5449 100644 --- a/world/cli/test_repository.cpp +++ b/world/cli/cli_test_repository.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/repositories/instance_list_repository.h" #include "../worlddb.h" diff --git a/world/cli/test_repository_2.cpp b/world/cli/cli_test_repository_2.cpp similarity index 88% rename from world/cli/test_repository_2.cpp rename to world/cli/cli_test_repository_2.cpp index 06a2a624b..6091b0220 100644 --- a/world/cli/test_repository_2.cpp +++ b/world/cli/cli_test_repository_2.cpp @@ -1,3 +1,5 @@ +#include "../world_server_cli.h" +#include "../worlddb.h" #include "../../common/repositories/zone_repository.h" void WorldserverCLI::TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description) diff --git a/world/cli/test_string_benchmark.cpp b/world/cli/cli_test_string_benchmark.cpp similarity index 98% rename from world/cli/test_string_benchmark.cpp rename to world/cli/cli_test_string_benchmark.cpp index 32d5e9020..e064a266a 100644 --- a/world/cli/test_string_benchmark.cpp +++ b/world/cli/cli_test_string_benchmark.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include #include #include "../../common/events/player_events.h" diff --git a/world/cli/version.cpp b/world/cli/cli_version.cpp similarity index 95% rename from world/cli/version.cpp rename to world/cli/cli_version.cpp index 383b69ac7..c82ea9967 100644 --- a/world/cli/version.cpp +++ b/world/cli/cli_version.cpp @@ -1,3 +1,4 @@ +#include "../world_server_cli.h" #include "../../common/json/json.h" #include "../../common/version.h" diff --git a/world/world_server_cli.cpp b/world/world_server_cli.cpp index 3af88f953..111929a0c 100644 --- a/world/world_server_cli.cpp +++ b/world/world_server_cli.cpp @@ -39,22 +39,3 @@ void WorldserverCLI::CommandHandler(int argc, char **argv) EQEmuCommand::HandleMenu(function_map, cmd, argc, argv); } -#include "cli/database_concurrency.cpp" -#include "cli/bots_enable.cpp" -#include "cli/bots_disable.cpp" -#include "cli/mercs_enable.cpp" -#include "cli/mercs_disable.cpp" -#include "cli/copy_character.cpp" -#include "cli/database_updates.cpp" -#include "cli/database_dump.cpp" -#include "cli/database_get_schema.cpp" -#include "cli/database_set_account_status.cpp" -#include "cli/database_version.cpp" -#include "cli/test.cpp" -#include "cli/test_colors.cpp" -#include "cli/test_expansion.cpp" -#include "cli/test_repository.cpp" -#include "cli/test_repository_2.cpp" -#include "cli/test_string_benchmark.cpp" -#include "cli/version.cpp" -#include "cli/etl_get_settings.cpp" From 76f8f1fb950304b6c2f0e49f095bb1888c6f773f Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 10 Dec 2025 00:02:38 -0800 Subject: [PATCH 43/44] Move zone cli out of source and into cmake --- zone/CMakeLists.txt | 7 +++++++ ..._databuckets.cpp => cli_benchmark_databuckets.cpp} | 2 ++ ...ecar_serve_http.cpp => cli_sidecar_serve_http.cpp} | 2 ++ .../tests/{databuckets.cpp => cli_databuckets.cpp} | 6 ++++++ .../tests/{npc_handins.cpp => cli_npc_handins.cpp} | 6 ++++++ ..._multiquest.cpp => cli_npc_handins_multiquest.cpp} | 6 ++++++ zone/cli/tests/{_test_util.cpp => cli_test_util.cpp} | 8 ++++---- zone/cli/tests/{zone_state.cpp => cli_zone_state.cpp} | 11 +++++++++-- zone/zone_cli.cpp | 10 ---------- 9 files changed, 42 insertions(+), 16 deletions(-) rename zone/cli/{benchmark_databuckets.cpp => cli_benchmark_databuckets.cpp} (99%) rename zone/cli/{sidecar_serve_http.cpp => cli_sidecar_serve_http.cpp} (88%) rename zone/cli/tests/{databuckets.cpp => cli_databuckets.cpp} (97%) rename zone/cli/tests/{npc_handins.cpp => cli_npc_handins.cpp} (97%) rename zone/cli/tests/{npc_handins_multiquest.cpp => cli_npc_handins_multiquest.cpp} (93%) rename zone/cli/tests/{_test_util.cpp => cli_test_util.cpp} (81%) rename zone/cli/tests/{zone_state.cpp => cli_zone_state.cpp} (98%) diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 30a3206c0..25182d5f4 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -21,6 +21,13 @@ set(zone_sources client_mods.cpp client_packet.cpp client_process.cpp + cli/cli_benchmark_databuckets.cpp + cli/cli_sidecar_serve_http.cpp + cli/tests/cli_test_util.cpp + cli/tests/cli_databuckets.cpp + cli/tests/cli_npc_handins.cpp + cli/tests/cli_npc_handins_multiquest.cpp + cli/tests/cli_zone_state.cpp combat_record.cpp corpse.cpp doors.cpp diff --git a/zone/cli/benchmark_databuckets.cpp b/zone/cli/cli_benchmark_databuckets.cpp similarity index 99% rename from zone/cli/benchmark_databuckets.cpp rename to zone/cli/cli_benchmark_databuckets.cpp index 65d6ead0b..d2d1dc01c 100644 --- a/zone/cli/benchmark_databuckets.cpp +++ b/zone/cli/cli_benchmark_databuckets.cpp @@ -1,6 +1,8 @@ #include #include #include +#include "../zone_cli.h" +#include "../../common/cli/eqemu_command_handler.h" #include "../../common/http/httplib.h" #include "../../common/eqemu_logsys.h" #include "../sidecar_api/sidecar_api.h" diff --git a/zone/cli/sidecar_serve_http.cpp b/zone/cli/cli_sidecar_serve_http.cpp similarity index 88% rename from zone/cli/sidecar_serve_http.cpp rename to zone/cli/cli_sidecar_serve_http.cpp index 334ef3eff..7e82f8943 100644 --- a/zone/cli/sidecar_serve_http.cpp +++ b/zone/cli/cli_sidecar_serve_http.cpp @@ -1,3 +1,5 @@ +#include "../zone_cli.h" +#include "../../common/cli/eqemu_command_handler.h" #include "../../common/http/httplib.h" #include "../../common/eqemu_logsys.h" #include "../sidecar_api/sidecar_api.h" diff --git a/zone/cli/tests/databuckets.cpp b/zone/cli/tests/cli_databuckets.cpp similarity index 97% rename from zone/cli/tests/databuckets.cpp rename to zone/cli/tests/cli_databuckets.cpp index 28a3604d4..7974c06d2 100644 --- a/zone/cli/tests/databuckets.cpp +++ b/zone/cli/tests/cli_databuckets.cpp @@ -1,3 +1,5 @@ +#include "../../zone_cli.h" +#include "../../common/cli/eqemu_command_handler.h" #include "../../common/http/httplib.h" #include "../../common/eqemu_logsys.h" #include "../../common/platform.h" @@ -7,6 +9,10 @@ extern Zone* zone; +void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual); +void RunTest(const std::string& test_name, bool expected, bool actual); +void RunTest(const std::string& test_name, int expected, int actual); + void ZoneCLI::TestDataBuckets(int argc, char** argv, argh::parser& cmd, std::string& description) { if (cmd[{"-h", "--help"}]) { diff --git a/zone/cli/tests/npc_handins.cpp b/zone/cli/tests/cli_npc_handins.cpp similarity index 97% rename from zone/cli/tests/npc_handins.cpp rename to zone/cli/tests/cli_npc_handins.cpp index c9eed484d..da606cf23 100644 --- a/zone/cli/tests/npc_handins.cpp +++ b/zone/cli/tests/cli_npc_handins.cpp @@ -1,3 +1,5 @@ +#include "../../zone_cli.h" +#include "../../common/cli/eqemu_command_handler.h" #include "../../common/http/httplib.h" #include "../../common/eqemu_logsys.h" #include "../../common/platform.h" @@ -9,6 +11,10 @@ extern Zone *zone; using json = nlohmann::json; +void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual); +void RunTest(const std::string& test_name, bool expected, bool actual); +void RunTest(const std::string& test_name, int expected, int actual); + struct HandinEntry { std::string item_id = "0"; uint32 count = 0; diff --git a/zone/cli/tests/npc_handins_multiquest.cpp b/zone/cli/tests/cli_npc_handins_multiquest.cpp similarity index 93% rename from zone/cli/tests/npc_handins_multiquest.cpp rename to zone/cli/tests/cli_npc_handins_multiquest.cpp index 1c560cdc9..faaffb765 100644 --- a/zone/cli/tests/npc_handins_multiquest.cpp +++ b/zone/cli/tests/cli_npc_handins_multiquest.cpp @@ -1,3 +1,5 @@ +#include "../../zone_cli.h" +#include "../../common/cli/eqemu_command_handler.h" #include "../../common/eqemu_logsys.h" #include "../../common/platform.h" #include "../../zone.h" @@ -6,6 +8,10 @@ extern Zone *zone; +void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual); +void RunTest(const std::string& test_name, bool expected, bool actual); +void RunTest(const std::string& test_name, int expected, int actual); + void ZoneCLI::TestNpcHandinsMultiQuest(int argc, char **argv, argh::parser &cmd, std::string &description) { if (cmd[{"-h", "--help"}]) { diff --git a/zone/cli/tests/_test_util.cpp b/zone/cli/tests/cli_test_util.cpp similarity index 81% rename from zone/cli/tests/_test_util.cpp rename to zone/cli/tests/cli_test_util.cpp index 0bd118166..3f6e7fe2e 100644 --- a/zone/cli/tests/_test_util.cpp +++ b/zone/cli/tests/cli_test_util.cpp @@ -1,6 +1,6 @@ #include "../../zone.h" -inline void RunTest(const std::string &test_name, const std::string &expected, const std::string &actual) +void RunTest(const std::string &test_name, const std::string &expected, const std::string &actual) { if (expected == actual) { std::cout << "[✅] " << test_name << " PASSED\n"; @@ -12,7 +12,7 @@ inline void RunTest(const std::string &test_name, const std::string &expected, c } } -inline void RunTest(const std::string &test_name, bool expected, bool actual) +void RunTest(const std::string &test_name, bool expected, bool actual) { if (expected == actual) { std::cout << "[✅] " << test_name << " PASSED\n"; @@ -25,7 +25,7 @@ inline void RunTest(const std::string &test_name, bool expected, bool actual) } } -inline void RunTest(const std::string &test_name, int expected, int actual) +void RunTest(const std::string &test_name, int expected, int actual) { if (expected == actual) { std::cout << "[✅] " << test_name << " PASSED\n"; @@ -40,7 +40,7 @@ inline void RunTest(const std::string &test_name, int expected, int actual) extern Zone *zone; -inline void SetupZone(std::string zone_short_name, uint32 instance_id = 0) { +void SetupZone(std::string zone_short_name, uint32 instance_id = 0) { EQEmuLogSys::Instance()->SilenceConsoleLogging(); EQEmuLogSys::Instance()->log_settings[Logs::ZoneState].log_to_console = std::getenv("DEBUG") ? 3 : 0; diff --git a/zone/cli/tests/zone_state.cpp b/zone/cli/tests/cli_zone_state.cpp similarity index 98% rename from zone/cli/tests/zone_state.cpp rename to zone/cli/tests/cli_zone_state.cpp index b527f5a4f..235891fa5 100644 --- a/zone/cli/tests/zone_state.cpp +++ b/zone/cli/tests/cli_zone_state.cpp @@ -1,11 +1,18 @@ -extern Zone *zone; - +#include "../../zone_cli.h" +#include "../../common/cli/eqemu_command_handler.h" #include #include #include "../../common/repositories/npc_types_repository.h" #include "../../corpse.h" #include "../../../common/repositories/respawn_times_repository.h" +extern Zone* zone; + +void RunTest(const std::string& test_name, const std::string& expected, const std::string& actual); +void RunTest(const std::string& test_name, bool expected, bool actual); +void RunTest(const std::string& test_name, int expected, int actual); +void SetupZone(std::string zone_short_name, uint32 instance_id = 0); + inline void ClearState() { ZoneStateSpawnsRepository::DeleteWhere(database, "zone_id = 32 and instance_id = 0"); diff --git a/zone/zone_cli.cpp b/zone/zone_cli.cpp index 33177e8f6..59ddee18d 100644 --- a/zone/zone_cli.cpp +++ b/zone/zone_cli.cpp @@ -39,13 +39,3 @@ void ZoneCLI::CommandHandler(int argc, char **argv) EQEmuCommand::HandleMenu(function_map, cmd, argc, argv); } -// cli -#include "cli/benchmark_databuckets.cpp" -#include "cli/sidecar_serve_http.cpp" - -// tests -#include "cli/tests/_test_util.cpp" -#include "cli/tests/databuckets.cpp" -#include "cli/tests/npc_handins.cpp" -#include "cli/tests/npc_handins_multiquest.cpp" -#include "cli/tests/zone_state.cpp" From 0815aea6fd78a84d2db9131ef6614fb467e83ba3 Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 10 Dec 2025 00:05:58 -0800 Subject: [PATCH 44/44] Sidecar stuff wont directly include cpp files now too. --- zone/sidecar_api/log_handler.cpp | 18 ----------- zone/sidecar_api/map_best_z_controller.cpp | 4 --- zone/sidecar_api/sidecar_api.cpp | 36 ++++++++++++++++++++-- zone/sidecar_api/test_controller.cpp | 10 ------ 4 files changed, 33 insertions(+), 35 deletions(-) delete mode 100644 zone/sidecar_api/log_handler.cpp delete mode 100644 zone/sidecar_api/map_best_z_controller.cpp delete mode 100644 zone/sidecar_api/test_controller.cpp diff --git a/zone/sidecar_api/log_handler.cpp b/zone/sidecar_api/log_handler.cpp deleted file mode 100644 index 5c0e47c01..000000000 --- a/zone/sidecar_api/log_handler.cpp +++ /dev/null @@ -1,18 +0,0 @@ -void SidecarApi::RequestLogHandler(const httplib::Request &req, const httplib::Response &res) -{ - if (!req.path.empty()) { - std::vector params; - for (auto &p: req.params) { - params.emplace_back(fmt::format("{}={}", p.first, p.second)); - } - - LogInfo( - "[API] Request [{}] [{}{}] via [{}:{}]", - res.status, - req.path, - (!params.empty() ? "?" + Strings::Join(params, "&") : ""), - req.remote_addr, - req.remote_port - ); - } -} diff --git a/zone/sidecar_api/map_best_z_controller.cpp b/zone/sidecar_api/map_best_z_controller.cpp deleted file mode 100644 index abb714ac5..000000000 --- a/zone/sidecar_api/map_best_z_controller.cpp +++ /dev/null @@ -1,4 +0,0 @@ -void SidecarApi::MapBestZController(const httplib::Request &req, httplib::Response &res) -{ - -} diff --git a/zone/sidecar_api/sidecar_api.cpp b/zone/sidecar_api/sidecar_api.cpp index d6e6596c9..583506798 100644 --- a/zone/sidecar_api/sidecar_api.cpp +++ b/zone/sidecar_api/sidecar_api.cpp @@ -16,9 +16,39 @@ void CatchSidecarSignal(int sig_num) std::exit(0); } -#include "log_handler.cpp" -#include "test_controller.cpp" -#include "map_best_z_controller.cpp" +void SidecarApi::RequestLogHandler(const httplib::Request& req, const httplib::Response& res) +{ + if (!req.path.empty()) { + std::vector params; + for (auto& p : req.params) { + params.emplace_back(fmt::format("{}={}", p.first, p.second)); + } + + LogInfo( + "[API] Request [{}] [{}{}] via [{}:{}]", + res.status, + req.path, + (!params.empty() ? "?" + Strings::Join(params, "&") : ""), + req.remote_addr, + req.remote_port + ); + } +} + +void SidecarApi::TestController(const httplib::Request& req, httplib::Response& res) +{ + nlohmann::json j; + + j["data"]["test"] = "test"; + + res.set_content(j.dump(), "application/json"); +} + +void SidecarApi::MapBestZController(const httplib::Request& req, httplib::Response& res) +{ + +} + #include "../../common/file.h" constexpr static int HTTP_RESPONSE_OK = 200; diff --git a/zone/sidecar_api/test_controller.cpp b/zone/sidecar_api/test_controller.cpp deleted file mode 100644 index a1cb7d4a7..000000000 --- a/zone/sidecar_api/test_controller.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "sidecar_api.h" - -void SidecarApi::TestController(const httplib::Request &req, httplib::Response &res) -{ - nlohmann::json j; - - j["data"]["test"] = "test"; - - res.set_content(j.dump(), "application/json"); -}