Update local deps

This commit is contained in:
Ahrimdon 2024-02-25 14:26:13 -05:00
parent 85abd2b6d8
commit 61b6161768
75 changed files with 743 additions and 500 deletions

View File

@ -12,7 +12,7 @@ jobs:
run: run:
working-directory: build working-directory: build
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Create build directory - name: Create build directory
run: mkdir -p build run: mkdir -p build

View File

@ -13,7 +13,7 @@ jobs:
matrix: matrix:
os: [ ubuntu-latest, macos-latest ] os: [ ubuntu-latest, macos-latest ]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: lukka/get-cmake@latest - uses: lukka/get-cmake@latest
with: with:
cmakeVersion: 3.14.0 cmakeVersion: 3.14.0

View File

@ -12,7 +12,7 @@ jobs:
run: run:
working-directory: build working-directory: build
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: Create build directory - name: Create build directory
run: mkdir -p build run: mkdir -p build

View File

@ -167,7 +167,7 @@ constexpr byte to_byte(T t) noexcept
{ {
static_assert(std::is_same<T, unsigned char>::value, static_assert(std::is_same<T, unsigned char>::value,
"gsl::to_byte(t) must be provided an unsigned char, otherwise data loss may occur. " "gsl::to_byte(t) must be provided an unsigned char, otherwise data loss may occur. "
"If you are calling to_byte with an integer contant use: gsl::to_byte<t>() version."); "If you are calling to_byte with an integer constant use: gsl::to_byte<t>() version.");
return byte(t); return byte(t);
} }

View File

@ -100,19 +100,19 @@ public:
static_assert(details::is_comparable_to_nullptr<T>::value, "T cannot be compared to nullptr."); static_assert(details::is_comparable_to_nullptr<T>::value, "T cannot be compared to nullptr.");
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>> template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
constexpr not_null(U&& u) : ptr_(std::forward<U>(u)) constexpr not_null(U&& u) noexcept(std::is_nothrow_move_constructible<T>::value) : ptr_(std::forward<U>(u))
{ {
Expects(ptr_ != nullptr); Expects(ptr_ != nullptr);
} }
template <typename = std::enable_if_t<!std::is_same<std::nullptr_t, T>::value>> template <typename = std::enable_if_t<!std::is_same<std::nullptr_t, T>::value>>
constexpr not_null(T u) : ptr_(std::move(u)) constexpr not_null(T u) noexcept(std::is_nothrow_move_constructible<T>::value) : ptr_(std::move(u))
{ {
Expects(ptr_ != nullptr); Expects(ptr_ != nullptr);
} }
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>> template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
constexpr not_null(const not_null<U>& other) : not_null(other.get()) constexpr not_null(const not_null<U>& other) noexcept(std::is_nothrow_move_constructible<T>::value) : not_null(other.get())
{} {}
not_null(const not_null& other) = default; not_null(const not_null& other) = default;

View File

@ -42,7 +42,7 @@
#pragma warning(disable : 4702) // unreachable code #pragma warning(disable : 4702) // unreachable code
// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool. // Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool.
#pragma warning(disable : 26495) // uninitalized member when constructor calls constructor #pragma warning(disable : 26495) // uninitialized member when constructor calls constructor
#pragma warning(disable : 26446) // parser bug does not allow attributes on some templates #pragma warning(disable : 26446) // parser bug does not allow attributes on some templates
#endif // _MSC_VER #endif // _MSC_VER
@ -53,7 +53,7 @@
#define GSL_USE_STATIC_CONSTEXPR_WORKAROUND #define GSL_USE_STATIC_CONSTEXPR_WORKAROUND
#endif // !(defined(__cplusplus) && (__cplusplus >= 201703L)) #endif // !(defined(__cplusplus) && (__cplusplus >= 201703L))
// GCC 7 does not like the signed unsigned missmatch (size_t ptrdiff_t) // GCC 7 does not like the signed unsigned mismatch (size_t ptrdiff_t)
// While there is a conversion from signed to unsigned, it happens at // While there is a conversion from signed to unsigned, it happens at
// compiletime, so the compiler wouldn't have to warn indiscriminately, but // compiletime, so the compiler wouldn't have to warn indiscriminately, but
// could check if the source value actually doesn't fit into the target type // could check if the source value actually doesn't fit into the target type

View File

@ -24,6 +24,7 @@
#include <sstream> // for operator<<, ostringstream, basic_ostream:... #include <sstream> // for operator<<, ostringstream, basic_ostream:...
#include <string> // for basic_string, operator==, string, operator<< #include <string> // for basic_string, operator==, string, operator<<
#include <typeinfo> // for type_info #include <typeinfo> // for type_info
#include <variant> // for variant, monostate, get
#include "deathTestCommon.h" #include "deathTestCommon.h"
using namespace gsl; using namespace gsl;
@ -514,6 +515,17 @@ TEST(notnull_tests, TestNotNullConstructorTypeDeduction)
} }
#endif #endif
} }
TEST(notnull_tests, TestVariantEmplace)
{
int i = 0;
std::variant<std::monostate, not_null<int*>> v;
v.emplace<not_null<int*>>(&i);
EXPECT_FALSE(v.valueless_by_exception());
EXPECT_TRUE(v.index() == 1);
EXPECT_TRUE(std::get<not_null<int*>>(v) == &i);
}
#endif // #if defined(__cplusplus) && (__cplusplus >= 201703L) #endif // #if defined(__cplusplus) && (__cplusplus >= 201703L)
TEST(notnull_tests, TestMakeNotNull) TEST(notnull_tests, TestMakeNotNull)

View File

@ -615,7 +615,7 @@ public:
RAPIDJSON_ASSERT(regex_.IsValid()); RAPIDJSON_ASSERT(regex_.IsValid());
if (!allocator_) if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)(); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
stateSet_ = static_cast<unsigned*>(allocator_->Malloc(GetStateSetSize())); stateSet_ = static_cast<uint32_t*>(allocator_->Malloc(GetStateSetSize()));
state0_.template Reserve<SizeType>(regex_.stateCount_); state0_.template Reserve<SizeType>(regex_.stateCount_);
state1_.template Reserve<SizeType>(regex_.stateCount_); state1_.template Reserve<SizeType>(regex_.stateCount_);
} }

View File

@ -24,13 +24,9 @@
#if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX) #if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX)
#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1 #define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1
#else
#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 0
#endif #endif
#if !RAPIDJSON_SCHEMA_USE_INTERNALREGEX && defined(RAPIDJSON_SCHEMA_USE_STDREGEX) && (__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)) #if !defined(RAPIDJSON_SCHEMA_USE_STDREGEX) || !(__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800))
#define RAPIDJSON_SCHEMA_USE_STDREGEX 1
#else
#define RAPIDJSON_SCHEMA_USE_STDREGEX 0 #define RAPIDJSON_SCHEMA_USE_STDREGEX 0
#endif #endif
@ -1645,9 +1641,13 @@ private:
bool CheckDoubleMultipleOf(Context& context, double d) const { bool CheckDoubleMultipleOf(Context& context, double d) const {
double a = std::abs(d), b = std::abs(multipleOf_.GetDouble()); double a = std::abs(d), b = std::abs(multipleOf_.GetDouble());
double q = std::floor(a / b); double q = a / b;
double r = a - q * b; double qRounded = std::floor(q + 0.5);
if (r > 0.0) { double scaledEpsilon = (q + qRounded) * std::numeric_limits<double>::epsilon();
double difference = std::abs(qRounded - q);
bool isMultiple = (difference <= scaledEpsilon)
|| (difference < std::numeric_limits<double>::min());
if (!isMultiple) {
context.error_handler.NotMultipleOf(d, multipleOf_); context.error_handler.NotMultipleOf(d, multipleOf_);
RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMultipleOf); RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMultipleOf);
} }

208
deps/zlib/.github/workflows/c-std.yml vendored Normal file
View File

@ -0,0 +1,208 @@
name: C Standard
# Compile with as many C standards as possible.
# The worflow is setup to fail on any compilation warnings.
on:
workflow_dispatch:
push:
pull_request:
jobs:
main:
name: ${{ matrix.os.name }} ${{ matrix.compiler }} ${{ matrix.arch.name }} ${{ matrix.std.name }} ${{ matrix.builder }}
runs-on: ${{ matrix.os.value }}
strategy:
fail-fast: false
matrix:
os:
- name: Linux
value: ubuntu-latest
- name: MacOS
value: macos-latest
- name: Windows
value: windows-latest
cmake-opt: -G Ninja
compiler:
- gcc
- clang
arch:
- name: 64-bit
tag: amd64
compiler-opt: -m64
cmake-opt: -A x64
- name: 32-bit
tag: i386
compiler-opt: -m32
cmake-opt: -A Win32
builder:
- configure
- cmake
std:
- name: c89
value: c89
- name: gnu89
value: gnu89
- name: c94
value: iso9899:199409
- name: c99
value: c99
- name: gnu99
value: gnu99
- name: c11
value: c11
- name: gnu11
value: gnu11
- name: c17
value: c17
- name: gnu17
value: gnu17
- name: c2x
value: c2x
- name: gnu2x
value: gnu2x
exclude:
# Don't run 32-bit on MacOS
- { os: { name: MacOS },
arch: { tag: i386 } }
# Don't run configure on Windows
- { os: { name: Windows },
builder: configure }
# Don't run gcc 32-bit on Windows
- { os: { name: Windows },
arch: { tag: i386 } }
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: 'false'
- name: Install packages (Linux)
if: runner.os == 'Linux' && matrix.arch.tag == 'i386'
run: |
sudo apt-get update
sudo apt install gcc-multilib libc6-dev-i386-cross
- name: Install packages (Windows)
if: runner.os == 'Windows'
run: |
choco install --no-progress ninja
- name: Generate project files (configure)
if: matrix.builder == 'configure'
run: |
./configure
env:
CC: ${{ matrix.compiler }}
CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra
- name: Compile source code (configure)
if: matrix.builder == 'configure'
run: make -j2
- name: Run test cases (configure)
if: matrix.builder == 'configure'
run: |
make test
make cover
- name: Generate project files (cmake)
if: matrix.builder == 'cmake'
run: |
cmake -S . -B . -D CMAKE_BUILD_TYPE=Release -D ZLIB_BUILD_EXAMPLES=OFF ${{ matrix.os.cmake-opt }}
env:
CC: ${{ matrix.compiler }}
CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra
- name: Compile source code (cmake)
if: matrix.builder == 'cmake'
run: cmake --build . --config Release
- name: Run test cases (cmake)
if: matrix.builder == 'cmake'
run: ctest -C Release --output-on-failure --max-width 120
msvc:
name: ${{ matrix.os.name }} ${{ matrix.compiler }} ${{ matrix.arch.name }} ${{ matrix.std.name }} ${{ matrix.builder }}
runs-on: ${{ matrix.os.value }}
strategy:
fail-fast: false
matrix:
os:
- name: Windows
value: windows-latest
compiler:
- cl
arch:
- name: 32-bit
value: -A Win32
- name: 64-bit
value: -A x64
builder:
- cmake
std:
- name: default
value: ""
- name: C11
value: /std:c11
- name: C17
value: /std:c17
# not available on the runner yet
# - name: C20
# value: /std:c20
- name: latest
value: /std:clatest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: 'false'
- name: Generate project files (cmake)
run: |
cmake -S . -B . ${{ matrix.arch.value }} -D CMAKE_BUILD_TYPE=Release
env:
CC: ${{ matrix.compiler }}
CFLAGS: /WX ${{ matrix.std.value }}
- name: Compile source code (cmake)
run: cmake --build . --config Release -v
- name: Run test cases (cmake)
run: ctest -C Release --output-on-failure --max-width 120

View File

@ -11,54 +11,63 @@ jobs:
- name: Ubuntu GCC - name: Ubuntu GCC
os: ubuntu-latest os: ubuntu-latest
compiler: gcc compiler: gcc
cflags: -Werror -Wall -Wextra
# Test out of source builds # Test out of source builds
- name: Ubuntu GCC OSB - name: Ubuntu GCC OSB
os: ubuntu-latest os: ubuntu-latest
compiler: gcc compiler: gcc
cflags: -Werror -Wall -Wextra
build-dir: ../build build-dir: ../build
src-dir: ../zlib src-dir: ../zlib
- name: Ubuntu GCC -O3 - name: Ubuntu GCC -O3
os: ubuntu-latest os: ubuntu-latest
compiler: gcc compiler: gcc
cflags: -O3 cflags: -O3 -Werror -Wall -Wextra
- name: Ubuntu Clang - name: Ubuntu Clang
os: ubuntu-latest os: ubuntu-latest
compiler: clang compiler: clang
cflags: -Werror -Wall -Wextra
- name: Ubuntu Clang Debug - name: Ubuntu Clang Debug
os: ubuntu-latest os: ubuntu-latest
compiler: clang compiler: clang
cflags: -Werror -Wall -Wextra
build-config: Debug build-config: Debug
- name: Windows MSVC Win32 - name: Windows MSVC Win32
os: windows-latest os: windows-latest
compiler: cl compiler: cl
cflags: /WX /W3
cmake-args: -A Win32 cmake-args: -A Win32
- name: Windows MSVC Win64 - name: Windows MSVC Win64
os: windows-latest os: windows-latest
compiler: cl compiler: cl
cflags: /WX /W3
cmake-args: -A x64 cmake-args: -A x64
- name: Windows GCC - name: Windows GCC
os: windows-latest os: windows-latest
compiler: gcc compiler: gcc
cflags: -Werror -Wall -Wextra
cmake-args: -G Ninja cmake-args: -G Ninja
- name: macOS Clang - name: macOS Clang
os: macos-latest os: macos-latest
compiler: clang compiler: clang
cflags: -Werror -Wall -Wextra
- name: macOS GCC - name: macOS GCC
os: macos-latest os: macos-latest
compiler: gcc-11 compiler: gcc-11
cflags: -Werror -Wall -Wextra
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install packages (Windows) - name: Install packages (Windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
@ -79,7 +88,7 @@ jobs:
working-directory: ${{ matrix.build-dir || '.' }} working-directory: ${{ matrix.build-dir || '.' }}
- name: Upload build errors - name: Upload build errors
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: ${{ matrix.name }} (cmake) name: ${{ matrix.name }} (cmake)

View File

@ -95,7 +95,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install packages (Ubuntu) - name: Install packages (Ubuntu)
if: runner.os == 'Linux' && matrix.packages if: runner.os == 'Linux' && matrix.packages
@ -110,7 +110,7 @@ jobs:
${{ matrix.src-dir || '.' }}/configure ${{ matrix.configure-args }} ${{ matrix.src-dir || '.' }}/configure ${{ matrix.configure-args }}
env: env:
CC: ${{ matrix.compiler }} CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }} CFLAGS: ${{ matrix.cflags }} -Werror
LDFLAGS: ${{ matrix.ldflags }} LDFLAGS: ${{ matrix.ldflags }}
CHOST: ${{ matrix.chost }} CHOST: ${{ matrix.chost }}
@ -127,7 +127,7 @@ jobs:
QEMU_RUN: ${{ matrix.qemu-run }} QEMU_RUN: ${{ matrix.qemu-run }}
- name: Upload build errors - name: Upload build errors
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: ${{ matrix.name }} (configure) name: ${{ matrix.name }} (configure)

View File

@ -18,7 +18,7 @@ jobs:
dry-run: false dry-run: false
- name: Upload Crash - name: Upload Crash
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
if: failure() if: failure()
with: with:
name: artifacts name: artifacts

View File

@ -3,7 +3,9 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C) project(zlib C)
set(VERSION "1.3.0.1") set(VERSION "1.3.1.1")
option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON)
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
@ -63,7 +65,8 @@ if(MSVC)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
endif() endif()
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) option(RENAME_ZCONF "Rename the zconf when building out of source" ON)
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND RENAME_ZCONF)
# If we're doing an out of source build and the user has a zconf.h # If we're doing an out of source build and the user has a zconf.h
# in their source tree... # in their source tree...
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
@ -148,7 +151,13 @@ if(MINGW)
endif(MINGW) endif(MINGW)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
target_include_directories(zlib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
target_include_directories(zlibstatic PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1) set_target_properties(zlib PROPERTIES SOVERSION 1)
@ -166,7 +175,7 @@ endif()
if(UNIX) if(UNIX)
# On unix-like platforms the library is almost always called libz # On unix-like platforms the library is almost always called libz
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
if(NOT APPLE) if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif() endif()
elseif(BUILD_SHARED_LIBS AND WIN32) elseif(BUILD_SHARED_LIBS AND WIN32)
@ -193,21 +202,22 @@ endif()
#============================================================================ #============================================================================
# Example binaries # Example binaries
#============================================================================ #============================================================================
if(ZLIB_BUILD_EXAMPLES)
add_executable(example test/example.c)
target_link_libraries(example zlib)
add_test(example example)
add_executable(example test/example.c) add_executable(minigzip test/minigzip.c)
target_link_libraries(example zlib) target_link_libraries(minigzip zlib)
add_test(example example)
add_executable(minigzip test/minigzip.c) if(HAVE_OFF64_T)
target_link_libraries(minigzip zlib) add_executable(example64 test/example.c)
target_link_libraries(example64 zlib)
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
add_test(example64 example64)
if(HAVE_OFF64_T) add_executable(minigzip64 test/minigzip.c)
add_executable(example64 test/example.c) target_link_libraries(minigzip64 zlib)
target_link_libraries(example64 zlib) set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") endif()
add_test(example64 example64)
add_executable(minigzip64 test/minigzip.c)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif() endif()

12
deps/zlib/ChangeLog vendored
View File

@ -1,9 +1,19 @@
ChangeLog file for zlib ChangeLog file for zlib
Changes in 1.3.0.1 (xx Aug 2023) Changes in 1.3.1.1 (xx Jan 2024)
- -
Changes in 1.3.1 (22 Jan 2024)
- Reject overflows of zip header fields in minizip
- Fix bug in inflateSync() for data held in bit buffer
- Add LIT_MEM define to use more memory for a small deflate speedup
- Fix decision on the emission of Zip64 end records in minizip
- Add bounds checking to ERR_MSG() macro, used by zError()
- Neutralize zip file traversal attacks in miniunz
- Fix a bug in ZLIB_DEBUG compiles in check_match()
- Various portability and appearance improvements
Changes in 1.3 (18 Aug 2023) Changes in 1.3 (18 Aug 2023)
- Remove K&R function definitions and zlib2ansi - Remove K&R function definitions and zlib2ansi
- Fix bug in deflateBound() for level 0 and memLevel 9 - Fix bug in deflateBound() for level 0 and memLevel 9

5
deps/zlib/FAQ vendored
View File

@ -14,13 +14,12 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html
2. Where can I get a Windows DLL version? 2. Where can I get a Windows DLL version?
The zlib sources can be compiled without change to produce a DLL. See the 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 file win32/DLL_FAQ.txt in the zlib distribution.
precompiled DLL are found in the zlib web site at http://zlib.net/ .
3. Where can I get a Visual Basic interface to zlib? 3. Where can I get a Visual Basic interface to zlib?
See See
* http://marknelson.us/1997/01/01/zlib-engine/ * https://marknelson.us/posts/1997/01/01/zlib-engine.html
* win32/DLL_FAQ.txt in the zlib distribution * win32/DLL_FAQ.txt in the zlib distribution
4. compress() returns Z_BUF_ERROR. 4. compress() returns Z_BUF_ERROR.

2
deps/zlib/LICENSE vendored
View File

@ -1,6 +1,6 @@
Copyright notice: Copyright notice:
(C) 1995-2022 Jean-loup Gailly and Mark Adler (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

16
deps/zlib/Makefile.in vendored
View File

@ -1,5 +1,5 @@
# Makefile for zlib # Makefile for zlib
# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler # Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
# For conditions of distribution and use, see copyright notice in zlib.h # For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type: # To compile and test, type:
@ -22,13 +22,13 @@ CFLAGS=-O
SFLAGS=-O SFLAGS=-O
LDFLAGS= LDFLAGS=
TEST_LDFLAGS=$(LDFLAGS) -L. libz.a TEST_LIBS=-L. libz.a
LDSHARED=$(CC) LDSHARED=$(CC)
CPP=$(CC) -E CPP=$(CC) -E
STATICLIB=libz.a STATICLIB=libz.a
SHAREDLIB=libz.so SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.3.0.1 SHAREDLIBV=libz.so.1.3.1.1
SHAREDLIBM=libz.so.1 SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV) LIBS=$(STATICLIB) $(SHAREDLIBV)
@ -282,10 +282,10 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
-@rmdir objs -@rmdir objs
example$(EXE): example.o $(STATICLIB) example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
minigzip$(EXE): minigzip.o $(STATICLIB) minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS)
examplesh$(EXE): example.o $(SHAREDLIBV) examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
@ -294,10 +294,10 @@ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
example64$(EXE): example64.o $(STATICLIB) example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS)
minigzip64$(EXE): minigzip64.o $(STATICLIB) minigzip64$(EXE): minigzip64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS)
install-libs: $(LIBS) install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
@ -360,7 +360,7 @@ zconf: $(SRCDIR)zconf.h.in
cp -p $(SRCDIR)zconf.h.in zconf.h cp -p $(SRCDIR)zconf.h.in zconf.h
minizip-test: static minizip-test: static
cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
minizip-clean: minizip-clean:
cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; } cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }

8
deps/zlib/README vendored
View File

@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY ZLIB DATA COMPRESSION LIBRARY
zlib 1.3.0.1 is a general purpose data compression library. All the code is zlib 1.3.1.1 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 thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files (Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at issue of Dr. Dobb's Journal; a copy of the article is available at
https://marknelson.us/posts/1997/01/01/zlib-engine.html . https://marknelson.us/posts/1997/01/01/zlib-engine.html .
The changes made in version 1.3.0.1 are documented in the file ChangeLog. The changes made in version 1.3.1.1 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ . Unsupported third party contributions are provided in directory contrib/ .
@ -69,8 +69,6 @@ Notes for some targets:
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
other compilers. Use "make test" to check your compiler. other compilers. Use "make test" to check your compiler.
- gzdopen is not supported on RISCOS or BEOS.
- For PalmOs, see http://palmzlib.sourceforge.net/ - For PalmOs, see http://palmzlib.sourceforge.net/
@ -83,7 +81,7 @@ Acknowledgments:
Copyright notice: Copyright notice:
(C) 1995-2023 Jean-loup Gailly and Mark Adler (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

14
deps/zlib/configure vendored
View File

@ -25,7 +25,7 @@ if test $SRCDIR = "."; then
ZINCOUT="-I." ZINCOUT="-I."
SRCDIR="" SRCDIR=""
else else
ZINC='-include zconf.h' ZINC='-I. -include zconf.h'
ZINCOUT='-I. -I$(SRCDIR)' ZINCOUT='-I. -I$(SRCDIR)'
SRCDIR="$SRCDIR/" SRCDIR="$SRCDIR/"
fi fi
@ -91,6 +91,7 @@ warn=0
debug=0 debug=0
address=0 address=0
memory=0 memory=0
unknown=0
old_cc="$CC" old_cc="$CC"
old_cflags="$CFLAGS" old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)' OBJC='$(OBJZ) $(OBJG)'
@ -144,12 +145,12 @@ case "$1" in
--sanitize) address=1; shift ;; --sanitize) address=1; shift ;;
--address) address=1; shift ;; --address) address=1; shift ;;
--memory) memory=1; shift ;; --memory) memory=1; shift ;;
*) *) unknown=1; echo "unknown option ignored: $1" | tee -a configure.log; shift;;
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
leave 1;;
esac esac
done done
if test $unknown -eq 1; then
echo "$0 --help for help" | tee -a configure.log
fi
# temporary file name # temporary file name
test=ztest$$ test=ztest$$
@ -258,6 +259,7 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
SHAREDLIB='libz.sl' ;; SHAREDLIB='libz.sl' ;;
esac ;; esac ;;
AIX*) AIX*)
LDSHARED=${LDSHARED-"$cc -shared"}
LDFLAGS="${LDFLAGS} -Wl,-brtl" ;; LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
Darwin* | darwin* | *-darwin*) Darwin* | darwin* | *-darwin*)
shared_ext='.dylib' shared_ext='.dylib'
@ -442,7 +444,7 @@ EOF
if test $shared -eq 1; then if test $shared -eq 1; then
echo Checking for shared library support... | tee -a configure.log echo Checking for shared library support... | tee -a configure.log
# we must test in two steps (cc then ld), required at least on SunOS 4.x # we must test in two steps (cc then ld), required at least on SunOS 4.x
if try $CC -w -c $SFLAGS $test.c && if try $CC -c $SFLAGS $test.c &&
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
elif test -z "$old_cc" -a -z "$old_cflags"; then elif test -z "$old_cc" -a -z "$old_cflags"; then

View File

@ -2,7 +2,7 @@
Release 1.3 Release 1.3
ZLib.Ada is a thick binding interface to the popular ZLib data ZLib.Ada is a thick binding interface to the popular ZLib data
compression library, available at http://www.gzip.org/zlib/. compression library, available at https://zlib.net/.
It provides Ada-style access to the ZLib C library. It provides Ada-style access to the ZLib C library.

View File

@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
const OutBuf: Pointer; BufSize: Integer); const OutBuf: Pointer; BufSize: Integer);
const const
zlib_version = '1.3.0'; zlib_version = '1.3.1.1';
type type
EZlibError = class(Exception); EZlibError = class(Exception);

View File

@ -34,7 +34,7 @@ namespace DotZLib
} }
/// <summary> /// <summary>
/// Initializes a new instance of the checksum generator basewith a specified value /// Initializes a new instance of the checksum generator base with a specified value
/// </summary> /// </summary>
/// <param name="initialValue">The value to set the current checksum to</param> /// <param name="initialValue">The value to set the current checksum to</param>
public ChecksumGeneratorBase(uint initialValue) public ChecksumGeneratorBase(uint initialValue)

View File

@ -156,7 +156,7 @@ namespace DotZLibTests
public void Info_Version() public void Info_Version()
{ {
Info info = new Info(); Info info = new Info();
Assert.AreEqual("1.3.0", Info.Version); Assert.AreEqual("1.3.1.1", Info.Version);
Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfUInt);
Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfULong);
Assert.AreEqual(32, info.SizeOfPointer); Assert.AreEqual(32, info.SizeOfPointer);

View File

@ -177,7 +177,7 @@ printf("#define dsNiceMatch %u\n",(int)(((char*)&(s->nice_match))-((char*)s)
; ;
; gcc on macosx-linux: ; gcc on macosx-linux:
; see http://www.x86-64.org/documentation/abi-0.99.pdf ; see https://refspecs.linuxbase.org/elf/x86_64-abi-0.99.pdf
; param 1 in rdi, param 2 in rsi ; param 1 in rdi, param 2 in rsi
; rbx, rsp, rbp, r12 to r15 must be preserved ; rbx, rsp, rbp, r12 to r15 must be preserved

View File

@ -1,5 +1,5 @@
/* inftree9.c -- generate Huffman trees for efficient decoding /* inftree9.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2023 Mark Adler * Copyright (C) 1995-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -9,7 +9,7 @@
#define MAXBITS 15 #define MAXBITS 15
const char inflate9_copyright[] = const char inflate9_copyright[] =
" inflate9 1.3.0.1 Copyright 1995-2023 Mark Adler "; " inflate9 1.3.1.1 Copyright 1995-2024 Mark Adler ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot
@ -59,7 +59,7 @@ int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes,
static const unsigned short lext[31] = { /* Length codes 257..285 extra */ static const unsigned short lext[31] = { /* Length codes 257..285 extra */
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
133, 133, 133, 133, 144, 70, 200}; 133, 133, 133, 133, 144, 73, 200};
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,

View File

@ -413,7 +413,7 @@ template<typename T1, typename T2>
class gzomanip2 class gzomanip2
{ {
public: public:
// Allows insertor to peek at internals // Allows inserter to peek at internals
template <typename Ta, typename Tb> template <typename Ta, typename Tb>
friend gzofstream& friend gzofstream&
operator<<(gzofstream&, operator<<(gzofstream&,
@ -452,7 +452,7 @@ template<typename T1, typename T2>
: func(f), val1(v1), val2(v2) : func(f), val1(v1), val2(v2)
{ } { }
// Insertor applies underlying manipulator function to stream // Inserter applies underlying manipulator function to stream
template<typename T1, typename T2> template<typename T1, typename T2>
inline gzofstream& inline gzofstream&
operator<<(gzofstream& s, const gzomanip2<T1,T2>& m) operator<<(gzofstream& s, const gzomanip2<T1,T2>& m)

View File

@ -1,4 +1,4 @@
CC=cc CC?=cc
CFLAGS := $(CFLAGS) -O -I../.. CFLAGS := $(CFLAGS) -O -I../..
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a

View File

@ -1,7 +1,7 @@
# -*- Autoconf -*- # -*- Autoconf -*-
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
AC_INIT([minizip], [1.3.0.1], [bugzilla.redhat.com]) AC_INIT([minizip], [1.3.1.1], [bugzilla.redhat.com])
AC_CONFIG_SRCDIR([minizip.c]) AC_CONFIG_SRCDIR([minizip.c])
AM_INIT_AUTOMAKE([foreign]) AM_INIT_AUTOMAKE([foreign])
LT_INIT LT_INIT

View File

@ -79,7 +79,7 @@
/* change_file_date : change the date/time of a file /* change_file_date : change the date/time of a file
filename : the filename of the file where date/time must be modified filename : the filename of the file where date/time must be modified
dosdate : the new date at the MSDos format (4 bytes) dosdate : the new date at the MSDOS format (4 bytes)
tmu_date : the SAME new date at the tm_unz format */ tmu_date : the SAME new date at the tm_unz format */
static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
#ifdef _WIN32 #ifdef _WIN32
@ -240,7 +240,7 @@ static int do_list(unzFile uf) {
printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
for (i=0;i<gi.number_entry;i++) for (i=0;i<gi.number_entry;i++)
{ {
char filename_inzip[256]; char filename_inzip[65536+1];
unz_file_info64 file_info; unz_file_info64 file_info;
uLong ratio=0; uLong ratio=0;
const char *string_method = ""; const char *string_method = "";
@ -305,7 +305,7 @@ static int do_list(unzFile uf) {
static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) { static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
char filename_inzip[256]; char filename_inzip[65536+1];
char* filename_withoutpath; char* filename_withoutpath;
char* p; char* p;
int err=UNZ_OK; int err=UNZ_OK;
@ -356,6 +356,20 @@ static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_pa
else else
write_filename = filename_withoutpath; write_filename = filename_withoutpath;
if (write_filename[0]!='\0')
{
const char* relative_check = write_filename;
while (relative_check[1]!='\0')
{
if (relative_check[0]=='.' && relative_check[1]=='.')
write_filename = relative_check;
relative_check++;
}
}
while (write_filename[0]=='/' || write_filename[0]=='.')
write_filename++;
err = unzOpenCurrentFilePassword(uf,password); err = unzOpenCurrentFilePassword(uf,password);
if (err!=UNZ_OK) if (err!=UNZ_OK)
{ {

View File

@ -68,10 +68,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef NOUNCRYPT
#define NOUNCRYPT
#endif
#include "zlib.h" #include "zlib.h"
#include "unzip.h" #include "unzip.h"
@ -117,7 +113,7 @@
const char unz_copyright[] = const char unz_copyright[] =
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
/* unz_file_info_interntal contain internal info about a file in zipfile*/ /* unz_file_info64_internal contain internal info about a file in zipfile*/
typedef struct unz_file_info64_internal_s typedef struct unz_file_info64_internal_s
{ {
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
@ -450,7 +446,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
return CENTRALDIRINVALID; return CENTRALDIRINVALID;
/* number of the disk with the start of the zip64 end of central directory */ /* number of the disk with the start of the zip64 end of central directory */
if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK)
return CENTRALDIRINVALID; return CENTRALDIRINVALID;
if (uL != 0) if (uL != 0)
@ -497,9 +493,9 @@ local unzFile unzOpenInternal(const void *path,
ZPOS64_T central_pos; ZPOS64_T central_pos;
uLong uL; uLong uL;
uLong number_disk; /* number of the current dist, used for uLong number_disk; /* number of the current disk, used for
spanning ZIP, unsupported, always 0*/ spanning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used uLong number_disk_with_CD; /* number the disk with central dir, used
for spanning ZIP, unsupported, always 0*/ for spanning ZIP, unsupported, always 0*/
ZPOS64_T number_entry_CD; /* total number of entries in ZPOS64_T number_entry_CD; /* total number of entries in
the central dir the central dir

View File

@ -306,13 +306,17 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
Get Info about the current file Get Info about the current file
if pfile_info!=NULL, the *pfile_info structure will contain some info about if pfile_info!=NULL, the *pfile_info structure will contain some info about
the current file the current file
if szFileName!=NULL, the filemane string will be copied in szFileName if szFileName!=NULL, the filename string will be copied in szFileName
(fileNameBufferSize is the size of the buffer) (fileNameBufferSize is the size of the buffer)
if extraField!=NULL, the extra field information will be copied in extraField if extraField!=NULL, the extra field information will be copied in extraField
(extraFieldBufferSize is the size of the buffer). (extraFieldBufferSize is the size of the buffer).
This is the Central-header version of the extra field This is the Central-header version of the extra field
if szComment!=NULL, the comment string of the file will be copied in szComment if szComment!=NULL, the comment string of the file will be copied in szComment
(commentBufferSize is the size of the buffer) (commentBufferSize is the size of the buffer)
The file name and comment will be zero-terminated if there is room in the
provided buffer. Otherwise the buffer will contain as much as will fit. If at
least 65537 bytes of room is provided, then the result will always be
complete and zero-terminated.
*/ */

View File

@ -575,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
return 0; return 0;
/* number of the disk with the start of the zip64 end of central directory */ /* number of the disk with the start of the zip64 end of central directory */
if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK)
return 0; return 0;
if (uL != 0) if (uL != 0)
@ -1027,7 +1027,6 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c
int err = ZIP_OK; int err = ZIP_OK;
# ifdef NOCRYPT # ifdef NOCRYPT
(crcForCrypting);
if (password != NULL) if (password != NULL)
return ZIP_PARAMERROR; return ZIP_PARAMERROR;
# endif # endif
@ -1608,7 +1607,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si
if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree)
{ {
// we can not write more data to the buffer that we have room for. // we cannot write more data to the buffer that we have room for.
return ZIP_BADZIPFILE; return ZIP_BADZIPFILE;
} }

View File

@ -6,8 +6,8 @@
<PackageId Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(PackageId).win</PackageId> <PackageId Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(PackageId).win</PackageId>
<PackageId Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(PackageId).linux</PackageId> <PackageId Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(PackageId).linux</PackageId>
<PackageId Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(PackageId).osx</PackageId> <PackageId Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(PackageId).osx</PackageId>
<Copyright>(C) 1995-2023 Jean-loup Gailly and Mark Adler</Copyright> <Copyright>(C) 1995-2024 Jean-loup Gailly and Mark Adler</Copyright>
<version>1.3.0.1</version> <version>1.3.1.1</version>
<PackageDescription>NuGet Package for consuming native builds of zlib into .NET without complexity.</PackageDescription> <PackageDescription>NuGet Package for consuming native builds of zlib into .NET without complexity.</PackageDescription>
<!-- <!--
Warns about not having any lib or ref assemblies (.NET Assemblies) in those directories. Warns about not having any lib or ref assemblies (.NET Assemblies) in those directories.

View File

@ -10,7 +10,7 @@ unit zlibpas;
interface interface
const const
ZLIB_VERSION = '1.3.0.1'; ZLIB_VERSION = '1.3.1.1';
ZLIB_VERNUM = $12a0; ZLIB_VERNUM = $12a0;
type type

View File

@ -593,10 +593,10 @@ local int fixed(struct state *s)
* provided for each of the literal/length symbols, and for each of the * provided for each of the literal/length symbols, and for each of the
* distance symbols. * distance symbols.
* *
* - If a symbol is not used in the block, this is represented by a zero as * - If a symbol is not used in the block, this is represented by a zero as the
* as the code length. This does not mean a zero-length code, but rather * code length. This does not mean a zero-length code, but rather that no
* that no code should be created for this symbol. There is no way in the * code should be created for this symbol. There is no way in the deflate
* deflate format to represent a zero-length code. * format to represent a zero-length code.
* *
* - The maximum number of bits in a code is 15, so the possible lengths for * - The maximum number of bits in a code is 15, so the possible lengths for
* any code are 1..15. * any code are 1..15.

View File

@ -16,6 +16,10 @@
testing, and causes pufftest to fail with not enough output space (-f does testing, and causes pufftest to fail with not enough output space (-f does
a write like -w, so -w is not required). */ a write like -w, so -w is not required). */
#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "puff.h" #include "puff.h"

View File

@ -1,4 +1,4 @@
Building instructions for the DLL versions of Zlib 1.3.0.1 Building instructions for the DLL versions of Zlib 1.3.1.1
======================================================== ========================================================
This directory contains projects that build zlib and minizip using This directory contains projects that build zlib and minizip using

View File

@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1, 3, 0, 1 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 3, 0, 1 PRODUCTVERSION 1, 3, 1, 1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
VALUE "FileVersion", "1.3.0.1\0" VALUE "FileVersion", "1.3.1.1\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "OriginalFilename", "zlibwapi.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1, 3, 0, 1 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 3, 0, 1 PRODUCTVERSION 1, 3, 1, 1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
VALUE "FileVersion", "1.3.0.1\0" VALUE "FileVersion", "1.3.1.1\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "OriginalFilename", "zlibwapi.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1, 3, 0, 1 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 3, 0, 1 PRODUCTVERSION 1, 3, 1, 1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
VALUE "FileVersion", "1.3.0.1\0" VALUE "FileVersion", "1.3.1.1\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "OriginalFilename", "zlibwapi.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1, 3, 0, 1 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 3, 0, 1 PRODUCTVERSION 1, 3, 1, 1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
VALUE "FileVersion", "1.3.0.1\0" VALUE "FileVersion", "1.3.1.1\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "OriginalFilename", "zlibwapi.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1, 3, 0, 1 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 3, 0, 1 PRODUCTVERSION 1, 3, 1, 1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
VALUE "FileVersion", "1.3.0.1\0" VALUE "FileVersion", "1.3.1.1\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "OriginalFilename", "zlibwapi.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -2,8 +2,8 @@
#define IDR_VERSION1 1 #define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
FILEVERSION 1, 3, 0, 1 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 3, 0, 1 PRODUCTVERSION 1, 3, 1, 1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32 FILEOS VOS_DOS_WINDOWS32
@ -17,12 +17,12 @@ BEGIN
BEGIN BEGIN
VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"
VALUE "FileVersion", "1.3.0.1\0" VALUE "FileVersion", "1.3.1.1\0"
VALUE "InternalName", "zlib\0" VALUE "InternalName", "zlib\0"
VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "OriginalFilename", "zlibwapi.dll\0"
VALUE "ProductName", "ZLib.DLL\0" VALUE "ProductName", "ZLib.DLL\0"
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

45
deps/zlib/deflate.c vendored
View File

@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm /* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -52,7 +52,7 @@
#include "deflate.h" #include "deflate.h"
const char deflate_copyright[] = const char deflate_copyright[] =
" deflate 1.3.0.1 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; " deflate 1.3.1.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot
@ -493,11 +493,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
* symbols from which it is being constructed. * symbols from which it is being constructed.
*/ */
#ifdef LIT_MEM s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 5);
#else
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
#endif
s->pending_buf_size = (ulg)s->lit_bufsize * 4; s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
@ -1310,7 +1306,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) { ds->pending_buf == Z_NULL) {
@ -1321,7 +1317,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
#ifdef LIT_MEM #ifdef LIT_MEM
@ -1560,13 +1556,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) {
*/ */
local void check_match(deflate_state *s, IPos start, IPos match, int length) { local void check_match(deflate_state *s, IPos start, IPos match, int length) {
/* check that the match is indeed a match */ /* check that the match is indeed a match */
if (zmemcmp(s->window + match, Bytef *back = s->window + (int)match, *here = s->window + start;
s->window + start, length) != EQUAL) { IPos len = length;
fprintf(stderr, " start %u, match %u, length %d\n", if (match == (IPos)-1) {
start, match, length); /* match starts one byte before the current window -- just compare the
subsequent length-1 bytes */
back++;
here++;
len--;
}
if (zmemcmp(back, here, len) != EQUAL) {
fprintf(stderr, " start %u, match %d, length %d\n",
start, (int)match, length);
do { do {
fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); fprintf(stderr, "(%02x %02x)", *back++, *here++);
} while (--length != 0); } while (--len != 0);
z_error("invalid match"); z_error("invalid match");
} }
if (z_verbose > 1) { if (z_verbose > 1) {
@ -1631,7 +1635,8 @@ local block_state deflate_stored(deflate_state *s, int flush) {
* possible. If flushing, copy the remaining available input to next_out as * possible. If flushing, copy the remaining available input to next_out as
* stored blocks, if there is enough space. * stored blocks, if there is enough space.
*/ */
unsigned len, left, have, last = 0; int last = 0;
unsigned len, left, have;
unsigned used = s->strm->avail_in; unsigned used = s->strm->avail_in;
do { do {
/* Set len to the maximum size block that we can copy directly with the /* Set len to the maximum size block that we can copy directly with the
@ -1667,10 +1672,10 @@ local block_state deflate_stored(deflate_state *s, int flush) {
_tr_stored_block(s, (char *)0, 0L, last); _tr_stored_block(s, (char *)0, 0L, last);
/* Replace the lengths in the dummy stored block with len. */ /* Replace the lengths in the dummy stored block with len. */
s->pending_buf[s->pending - 4] = len; s->pending_buf[s->pending - 4] = (Bytef)len;
s->pending_buf[s->pending - 3] = len >> 8; s->pending_buf[s->pending - 3] = (Bytef)(len >> 8);
s->pending_buf[s->pending - 2] = ~len; s->pending_buf[s->pending - 2] = (Bytef)~len;
s->pending_buf[s->pending - 1] = ~len >> 8; s->pending_buf[s->pending - 1] = (Bytef)(~len >> 8);
/* Write the stored block header bytes. */ /* Write the stored block header bytes. */
flush_pending(s->strm); flush_pending(s->strm);

4
deps/zlib/deflate.h vendored
View File

@ -1,5 +1,5 @@
/* deflate.h -- internal compression state /* deflate.h -- internal compression state
* Copyright (C) 1995-2018 Jean-loup Gailly * Copyright (C) 1995-2024 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -222,9 +222,11 @@ typedef struct internal_state {
*/ */
#ifdef LIT_MEM #ifdef LIT_MEM
# define LIT_BUFS 5
ushf *d_buf; /* buffer for distances */ ushf *d_buf; /* buffer for distances */
uchf *l_buf; /* buffer for literals/lengths */ uchf *l_buf; /* buffer for literals/lengths */
#else #else
# define LIT_BUFS 4
uchf *sym_buf; /* buffer for distances and literals/lengths */ uchf *sym_buf; /* buffer for distances and literals/lengths */
#endif #endif

View File

@ -77,7 +77,7 @@ 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, 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 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 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 simply to make the number of bits in the first table a variable, and then
to set that variable for the maximum speed. to set that variable for the maximum speed.
For inflate, which has 286 possible codes for the literal/length tree, the size For inflate, which has 286 possible codes for the literal/length tree, the size

View File

@ -212,8 +212,8 @@
to the appropriate recovery below. If there is no foo.add file, provide to the appropriate recovery below. If there is no foo.add file, provide
a zero data length to the recovery. In that case, the append recovery a zero data length to the recovery. In that case, the append recovery
restores the foo.gz to the previous compressed + uncompressed data state. restores the foo.gz to the previous compressed + uncompressed data state.
For the the compress recovery, a missing foo.add file results in foo.gz For the compress recovery, a missing foo.add file results in foo.gz being
being restored to the previous compressed-only data state. restored to the previous compressed-only data state.
- Append recovery: - Append recovery:
- Pick up append at + step above - Pick up append at + step above
- Compress recovery: - Compress recovery:

View File

@ -10,6 +10,10 @@
// the data, so it is fast, but no advantage is gained from the history that // the data, so it is fast, but no advantage is gained from the history that
// could be available across member boundaries. // could be available across member boundaries.
#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include <stdio.h> // fread, fwrite, putc, fflush, ferror, fprintf, #include <stdio.h> // fread, fwrite, putc, fflush, ferror, fprintf,
// vsnprintf, stdout, stderr, NULL, FILE // vsnprintf, stdout, stderr, NULL, FILE
#include <stdlib.h> // malloc, free #include <stdlib.h> // malloc, free

View File

@ -12,6 +12,10 @@
Avoid some compiler warnings for input and output buffers Avoid some compiler warnings for input and output buffers
*/ */
#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>

View File

@ -1,7 +1,7 @@
/* zran.c -- example of deflate stream indexing and random access /* zran.c -- example of deflate stream indexing and random access
* Copyright (C) 2005, 2012, 2018, 2023 Mark Adler * Copyright (C) 2005, 2012, 2018, 2023, 2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
* Version 1.4 13 Apr 2023 Mark Adler */ * Version 1.5 4 Feb 2024 Mark Adler */
/* Version History: /* Version History:
1.0 29 May 2005 First version 1.0 29 May 2005 First version
@ -14,6 +14,10 @@
Do a binary search over the index for an access point Do a binary search over the index for an access point
Expose the access point type to enable save and load Expose the access point type to enable save and load
1.4 13 Apr 2023 Add a NOPRIME define to not use inflatePrime() 1.4 13 Apr 2023 Add a NOPRIME define to not use inflatePrime()
1.5 4 Feb 2024 Set returned index to NULL on an index build error
Stop decoding once request is satisfied
Provide a reusable inflate engine in the index
Allocate the dictionaries to reduce memory usage
*/ */
// Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() // Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary()
@ -67,7 +71,11 @@
// See comments in zran.h. // See comments in zran.h.
void deflate_index_free(struct deflate_index *index) { void deflate_index_free(struct deflate_index *index) {
if (index != NULL) { if (index != NULL) {
size_t i = index->have;
while (i)
free(index->list[--i].window);
free(index->list); free(index->list);
inflateEnd(&index->strm);
free(index); free(index);
} }
} }
@ -76,26 +84,12 @@ void deflate_index_free(struct deflate_index *index) {
// list and return NULL. index->mode is temporarily the allocated number of // list and return NULL. index->mode is temporarily the allocated number of
// access points, until it is time for deflate_index_build() to return. Then // access points, until it is time for deflate_index_build() to return. Then
// index->mode is set to the mode of inflation. // index->mode is set to the mode of inflation.
static struct deflate_index *add_point(struct deflate_index *index, int bits, static struct deflate_index *add_point(struct deflate_index *index, off_t in,
off_t in, off_t out, unsigned left, off_t out, off_t beg,
unsigned char *window) { unsigned char *window) {
if (index == NULL) { if (index->have == index->mode) {
// The list is empty. Create it, starting with eight access points.
index = malloc(sizeof(struct deflate_index));
if (index == NULL)
return NULL;
index->have = 0;
index->mode = 8;
index->list = malloc(sizeof(point_t) * index->mode);
if (index->list == NULL) {
free(index);
return NULL;
}
}
else if (index->have == index->mode) {
// The list is full. Make it bigger. // The list is full. Make it bigger.
index->mode <<= 1; index->mode = index->mode ? index->mode << 1 : 8;
point_t *next = realloc(index->list, sizeof(point_t) * index->mode); point_t *next = realloc(index->list, sizeof(point_t) * index->mode);
if (next == NULL) { if (next == NULL) {
deflate_index_free(index); deflate_index_free(index);
@ -113,11 +107,18 @@ static struct deflate_index *add_point(struct deflate_index *index, int bits,
} }
next->out = out; next->out = out;
next->in = in; next->in = in;
next->bits = bits; next->bits = index->strm.data_type & 7;
if (left) next->dict = out - beg > WINSIZE ? WINSIZE : (unsigned)(out - beg);
memcpy(next->window, window + WINSIZE - left, left); next->window = malloc(next->dict);
if (left < WINSIZE) if (next->window == NULL) {
memcpy(next->window + left, window, WINSIZE - left); deflate_index_free(index);
return NULL;
}
unsigned recent = WINSIZE - index->strm.avail_out;
unsigned copy = recent > next->dict ? next->dict : recent;
memcpy(next->window + next->dict - copy, window + recent - copy, copy);
copy = next->dict - copy;
memcpy(next->window, window + WINSIZE - copy, copy);
// Return the index, which may have been newly allocated or destroyed. // Return the index, which may have been newly allocated or destroyed.
return index; return index;
@ -130,25 +131,39 @@ static struct deflate_index *add_point(struct deflate_index *index, int bits,
// See comments in zran.h. // See comments in zran.h.
int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) { int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) {
// Set up inflation state. // If this returns with an error, any attempt to use the index will cleanly
z_stream strm = {0}; // inflate engine (gets fired up later) // return an error.
*built = NULL;
// Create and initialize the index list.
struct deflate_index *index = malloc(sizeof(struct deflate_index));
if (index == NULL)
return Z_MEM_ERROR;
index->have = 0;
index->mode = 0; // entries in index->list allocation
index->list = NULL;
index->strm.state = Z_NULL; // so inflateEnd() can work
// Set up the inflation state.
index->strm.avail_in = 0;
index->strm.avail_out = 0;
unsigned char buf[CHUNK]; // input buffer unsigned char buf[CHUNK]; // input buffer
unsigned char win[WINSIZE] = {0}; // output sliding window unsigned char win[WINSIZE] = {0}; // output sliding window
off_t totin = 0; // total bytes read from input off_t totin = 0; // total bytes read from input
off_t totout = 0; // total bytes uncompressed off_t totout = 0; // total bytes uncompressed
off_t beg = 0; // starting offset of last history reset
int mode = 0; // mode: RAW, ZLIB, or GZIP (0 => not set yet) int mode = 0; // mode: RAW, ZLIB, or GZIP (0 => not set yet)
// Decompress from in, generating access points along the way. // Decompress from in, generating access points along the way.
int ret; // the return value from zlib, or Z_ERRNO int ret; // the return value from zlib, or Z_ERRNO
off_t last; // last access point uncompressed offset off_t last; // last access point uncompressed offset
struct deflate_index *index = NULL; // list of access points
do { do {
// Assure available input, at least until reaching EOF. // Assure available input, at least until reaching EOF.
if (strm.avail_in == 0) { if (index->strm.avail_in == 0) {
strm.avail_in = fread(buf, 1, sizeof(buf), in); index->strm.avail_in = fread(buf, 1, sizeof(buf), in);
totin += strm.avail_in; totin += index->strm.avail_in;
strm.next_in = buf; index->strm.next_in = buf;
if (strm.avail_in < sizeof(buf) && ferror(in)) { if (index->strm.avail_in < sizeof(buf) && ferror(in)) {
ret = Z_ERRNO; ret = Z_ERRNO;
break; break;
} }
@ -159,11 +174,14 @@ int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) {
// in a false positive for zlib, but in practice the fill bits // in a false positive for zlib, but in practice the fill bits
// after a stored block are always zeros, so a raw stream won't // after a stored block are always zeros, so a raw stream won't
// start with an 8 in the low nybble. // start with an 8 in the low nybble.
mode = strm.avail_in == 0 ? RAW : // empty -- will fail mode = index->strm.avail_in == 0 ? RAW : // will fail
(strm.next_in[0] & 0xf) == 8 ? ZLIB : (index->strm.next_in[0] & 0xf) == 8 ? ZLIB :
strm.next_in[0] == 0x1f ? GZIP : index->strm.next_in[0] == 0x1f ? GZIP :
/* else */ RAW; /* else */ RAW;
ret = inflateInit2(&strm, mode); index->strm.zalloc = Z_NULL;
index->strm.zfree = Z_NULL;
index->strm.opaque = Z_NULL;
ret = inflateInit2(&index->strm, mode);
if (ret != Z_OK) if (ret != Z_OK)
break; break;
} }
@ -171,32 +189,32 @@ int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) {
// Assure available output. This rotates the output through, for use as // Assure available output. This rotates the output through, for use as
// a sliding window on the uncompressed data. // a sliding window on the uncompressed data.
if (strm.avail_out == 0) { if (index->strm.avail_out == 0) {
strm.avail_out = sizeof(win); index->strm.avail_out = sizeof(win);
strm.next_out = win; index->strm.next_out = win;
} }
if (mode == RAW && index == NULL) if (mode == RAW && index->have == 0)
// We skip the inflate() call at the start of raw deflate data in // We skip the inflate() call at the start of raw deflate data in
// order generate an access point there. Set data_type to imitate // order generate an access point there. Set data_type to imitate
// the end of a header. // the end of a header.
strm.data_type = 0x80; index->strm.data_type = 0x80;
else { else {
// Inflate and update the number of uncompressed bytes. // Inflate and update the number of uncompressed bytes.
unsigned before = strm.avail_out; unsigned before = index->strm.avail_out;
ret = inflate(&strm, Z_BLOCK); ret = inflate(&index->strm, Z_BLOCK);
totout += before - strm.avail_out; totout += before - index->strm.avail_out;
} }
if ((strm.data_type & 0xc0) == 0x80 && if ((index->strm.data_type & 0xc0) == 0x80 &&
(index == NULL || totout - last >= span)) { (index->have == 0 || totout - last >= span)) {
// We are at the end of a header or a non-last deflate block, so we // We are at the end of a header or a non-last deflate block, so we
// can add an access point here. Furthermore, we are either at the // can add an access point here. Furthermore, we are either at the
// very start for the first access point, or there has been span or // very start for the first access point, or there has been span or
// more uncompressed bytes since the last access point, so we want // more uncompressed bytes since the last access point, so we want
// to add an access point here. // to add an access point here.
index = add_point(index, strm.data_type & 7, totin - strm.avail_in, index = add_point(index, totin - index->strm.avail_in, totout, beg,
totout, strm.avail_out, win); win);
if (index == NULL) { if (index == NULL) {
ret = Z_MEM_ERROR; ret = Z_MEM_ERROR;
break; break;
@ -205,16 +223,17 @@ int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) {
} }
if (ret == Z_STREAM_END && mode == GZIP && if (ret == Z_STREAM_END && mode == GZIP &&
(strm.avail_in || ungetc(getc(in), in) != EOF)) (index->strm.avail_in || ungetc(getc(in), in) != EOF)) {
// There is more input after the end of a gzip member. Reset the // There is more input after the end of a gzip member. Reset the
// inflate state to read another gzip member. On success, this will // inflate state to read another gzip member. On success, this will
// set ret to Z_OK to continue decompressing. // set ret to Z_OK to continue decompressing.
ret = inflateReset2(&strm, GZIP); ret = inflateReset2(&index->strm, GZIP);
beg = totout; // reset history
}
// Keep going until Z_STREAM_END or error. If the compressed data ends // Keep going until Z_STREAM_END or error. If the compressed data ends
// prematurely without a file read error, Z_BUF_ERROR is returned. // prematurely without a file read error, Z_BUF_ERROR is returned.
} while (ret == Z_OK); } while (ret == Z_OK);
inflateEnd(&strm);
if (ret != Z_STREAM_END) { if (ret != Z_STREAM_END) {
// An error was encountered. Discard the index and return a negative // An error was encountered. Discard the index and return a negative
@ -223,17 +242,9 @@ int deflate_index_build(FILE *in, off_t span, struct deflate_index **built) {
return ret == Z_NEED_DICT ? Z_DATA_ERROR : ret; return ret == Z_NEED_DICT ? Z_DATA_ERROR : ret;
} }
// Shrink the index to only the occupied access points and return it. // Return the index.
index->mode = mode; index->mode = mode;
index->length = totout; index->length = totout;
point_t *list = realloc(index->list, sizeof(point_t) * index->have);
if (list == NULL) {
// Seems like a realloc() to make something smaller should always work,
// but just in case.
deflate_index_free(index);
return Z_MEM_ERROR;
}
index->list = list;
*built = index; *built = index;
return index->have; return index->have;
} }
@ -267,7 +278,7 @@ static inline void append_bits(unsigned value, int bits,
} }
} }
// Insert enough bits in the form of empty deflate blocks in front of the the // Insert enough bits in the form of empty deflate blocks in front of the
// low bits bits of value, in order to bring the sequence to a byte boundary. // low bits bits of value, in order to bring the sequence to a byte boundary.
// Then feed that to inflate(). This does what inflatePrime() does, except that // Then feed that to inflate(). This does what inflatePrime() does, except that
// a negative value of bits is not supported. bits must be in 0..16. If the // a negative value of bits is not supported. bits must be in 0..16. If the
@ -330,7 +341,8 @@ static int inflatePreface(z_stream *strm, int bits, int value) {
ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index, ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index,
off_t offset, unsigned char *buf, size_t len) { off_t offset, unsigned char *buf, size_t len) {
// Do a quick sanity check on the index. // Do a quick sanity check on the index.
if (index == NULL || index->have < 1 || index->list[0].out != 0) if (index == NULL || index->have < 1 || index->list[0].out != 0 ||
index->strm.state == Z_NULL)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
// If nothing to extract, return zero bytes extracted. // If nothing to extract, return zero bytes extracted.
@ -356,13 +368,13 @@ ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index,
int ch = 0; int ch = 0;
if (point->bits && (ch = getc(in)) == EOF) if (point->bits && (ch = getc(in)) == EOF)
return ferror(in) ? Z_ERRNO : Z_BUF_ERROR; return ferror(in) ? Z_ERRNO : Z_BUF_ERROR;
z_stream strm = {0}; index->strm.avail_in = 0;
ret = inflateInit2(&strm, RAW); ret = inflateReset2(&index->strm, RAW);
if (ret != Z_OK) if (ret != Z_OK)
return ret; return ret;
if (point->bits) if (point->bits)
INFLATEPRIME(&strm, point->bits, ch >> (8 - point->bits)); INFLATEPRIME(&index->strm, point->bits, ch >> (8 - point->bits));
inflateSetDictionary(&strm, point->window, WINSIZE); inflateSetDictionary(&index->strm, point->window, point->dict);
// Skip uncompressed bytes until offset reached, then satisfy request. // Skip uncompressed bytes until offset reached, then satisfy request.
unsigned char input[CHUNK]; unsigned char input[CHUNK];
@ -372,48 +384,54 @@ ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index,
do { do {
if (offset) { if (offset) {
// Discard up to offset uncompressed bytes. // Discard up to offset uncompressed bytes.
strm.avail_out = offset < WINSIZE ? (unsigned)offset : WINSIZE; index->strm.avail_out = offset < WINSIZE ? (unsigned)offset :
strm.next_out = discard; WINSIZE;
index->strm.next_out = discard;
} }
else { else {
// Uncompress up to left bytes into buf. // Uncompress up to left bytes into buf.
strm.avail_out = left < UINT_MAX ? (unsigned)left : UINT_MAX; index->strm.avail_out = left < UINT_MAX ? (unsigned)left :
strm.next_out = buf + len - left; UINT_MAX;
index->strm.next_out = buf + len - left;
} }
// Uncompress, setting got to the number of bytes uncompressed. // Uncompress, setting got to the number of bytes uncompressed.
if (strm.avail_in == 0) { if (index->strm.avail_in == 0) {
// Assure available input. // Assure available input.
strm.avail_in = fread(input, 1, CHUNK, in); index->strm.avail_in = fread(input, 1, CHUNK, in);
if (strm.avail_in < CHUNK && ferror(in)) { if (index->strm.avail_in < CHUNK && ferror(in)) {
ret = Z_ERRNO; ret = Z_ERRNO;
break; break;
} }
strm.next_in = input; index->strm.next_in = input;
} }
unsigned got = strm.avail_out; unsigned got = index->strm.avail_out;
ret = inflate(&strm, Z_NO_FLUSH); ret = inflate(&index->strm, Z_NO_FLUSH);
got -= strm.avail_out; got -= index->strm.avail_out;
// Update the appropriate count. // Update the appropriate count.
if (offset) if (offset)
offset -= got; offset -= got;
else else {
left -= got; left -= got;
if (left == 0)
// Request satisfied.
break;
}
// If we're at the end of a gzip member and there's more to read, // If we're at the end of a gzip member and there's more to read,
// continue to the next gzip member. // continue to the next gzip member.
if (ret == Z_STREAM_END && index->mode == GZIP) { if (ret == Z_STREAM_END && index->mode == GZIP) {
// Discard the gzip trailer. // Discard the gzip trailer.
unsigned drop = 8; // length of gzip trailer unsigned drop = 8; // length of gzip trailer
if (strm.avail_in >= drop) { if (index->strm.avail_in >= drop) {
strm.avail_in -= drop; index->strm.avail_in -= drop;
strm.next_in += drop; index->strm.next_in += drop;
} }
else { else {
// Read and discard the remainder of the gzip trailer. // Read and discard the remainder of the gzip trailer.
drop -= strm.avail_in; drop -= index->strm.avail_in;
strm.avail_in = 0; index->strm.avail_in = 0;
do { do {
if (getc(in) == EOF) if (getc(in) == EOF)
// The input does not have a complete trailer. // The input does not have a complete trailer.
@ -421,33 +439,32 @@ ptrdiff_t deflate_index_extract(FILE *in, struct deflate_index *index,
} while (--drop); } while (--drop);
} }
if (strm.avail_in || ungetc(getc(in), in) != EOF) { if (index->strm.avail_in || ungetc(getc(in), in) != EOF) {
// There's more after the gzip trailer. Use inflate to skip the // There's more after the gzip trailer. Use inflate to skip the
// gzip header and resume the raw inflate there. // gzip header and resume the raw inflate there.
inflateReset2(&strm, GZIP); inflateReset2(&index->strm, GZIP);
do { do {
if (strm.avail_in == 0) { if (index->strm.avail_in == 0) {
strm.avail_in = fread(input, 1, CHUNK, in); index->strm.avail_in = fread(input, 1, CHUNK, in);
if (strm.avail_in < CHUNK && ferror(in)) { if (index->strm.avail_in < CHUNK && ferror(in)) {
ret = Z_ERRNO; ret = Z_ERRNO;
break; break;
} }
strm.next_in = input; index->strm.next_in = input;
} }
strm.avail_out = WINSIZE; index->strm.avail_out = WINSIZE;
strm.next_out = discard; index->strm.next_out = discard;
ret = inflate(&strm, Z_BLOCK); // stop at end of header ret = inflate(&index->strm, Z_BLOCK); // stop after header
} while (ret == Z_OK && (strm.data_type & 0x80) == 0); } while (ret == Z_OK && (index->strm.data_type & 0x80) == 0);
if (ret != Z_OK) if (ret != Z_OK)
break; break;
inflateReset2(&strm, RAW); inflateReset2(&index->strm, RAW);
} }
} }
// Continue until we have the requested data, the deflate data has // Continue until we have the requested data, the deflate data has
// ended, or an error is encountered. // ended, or an error is encountered.
} while (ret == Z_OK && left); } while (ret == Z_OK);
inflateEnd(&strm);
// Return the number of uncompressed bytes read into buf, or the error. // Return the number of uncompressed bytes read into buf, or the error.
return ret == Z_OK || ret == Z_STREAM_END ? len - left : ret; return ret == Z_OK || ret == Z_STREAM_END ? len - left : ret;

View File

@ -1,7 +1,7 @@
/* zran.h -- example of deflated stream indexing and random access /* zran.h -- example of deflated stream indexing and random access
* Copyright (C) 2005, 2012, 2018, 2023 Mark Adler * Copyright (C) 2005, 2012, 2018, 2023, 2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
* Version 1.3 18 Feb 2023 Mark Adler */ * Version 1.5 4 Feb 2024 Mark Adler */
#include <stdio.h> #include <stdio.h>
#include "zlib.h" #include "zlib.h"
@ -11,7 +11,8 @@ typedef struct point {
off_t out; // offset in uncompressed data off_t out; // offset in uncompressed data
off_t in; // offset in compressed file of first full byte off_t in; // offset in compressed file of first full byte
int bits; // 0, or number of bits (1-7) from byte at in-1 int bits; // 0, or number of bits (1-7) from byte at in-1
unsigned char window[32768]; // preceding 32K of uncompressed data unsigned dict; // number of bytes in window to use as a dictionary
unsigned char *window; // preceding 32K (or less) of uncompressed data
} point_t; } point_t;
// Access point list. // Access point list.
@ -20,6 +21,7 @@ struct deflate_index {
int mode; // -15 for raw, 15 for zlib, or 31 for gzip int mode; // -15 for raw, 15 for zlib, or 31 for gzip
off_t length; // total length of uncompressed data off_t length; // total length of uncompressed data
point_t *list; // allocated list of access points point_t *list; // allocated list of access points
z_stream strm; // re-usable inflate engine for extraction
}; };
// Make one pass through a zlib, gzip, or raw deflate compressed stream and // Make one pass through a zlib, gzip, or raw deflate compressed stream and
@ -30,7 +32,7 @@ struct deflate_index {
// the number of access points on success (>= 1), Z_MEM_ERROR for out of // the number of access points on success (>= 1), Z_MEM_ERROR for out of
// memory, Z_BUF_ERROR for a premature end of input, Z_DATA_ERROR for a format // memory, Z_BUF_ERROR for a premature end of input, Z_DATA_ERROR for a format
// or verification error in the input file, or Z_ERRNO for a file read error. // or verification error in the input file, or Z_ERRNO for a file read error.
// On success, *built points to the resulting index. // On success, *built points to the resulting index, otherwise it's NULL.
int deflate_index_build(FILE *in, off_t span, struct deflate_index **built); int deflate_index_build(FILE *in, off_t span, struct deflate_index **built);
// Use the index to read len bytes from offset into buf. Return the number of // Use the index to read len bytes from offset into buf. Return the number of

62
deps/zlib/gzguts.h vendored
View File

@ -1,5 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations /* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004-2019 Mark Adler * Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -17,6 +17,13 @@
# define ZLIB_INTERNAL # define ZLIB_INTERNAL
#endif #endif
#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS)
# define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include <stdio.h> #include <stdio.h>
#include "zlib.h" #include "zlib.h"
#ifdef STDC #ifdef STDC
@ -25,8 +32,8 @@
# include <limits.h> # include <limits.h>
#endif #endif
#ifndef _POSIX_SOURCE #ifndef _POSIX_C_SOURCE
# define _POSIX_SOURCE # define _POSIX_C_SOURCE 200112L
#endif #endif
#include <fcntl.h> #include <fcntl.h>
@ -36,19 +43,13 @@
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h> # include <io.h>
# include <sys/stat.h>
#endif #endif
#if defined(_WIN32) #if defined(_WIN32) && !defined(WIDECHAR)
# define WIDECHAR # define WIDECHAR
#endif #endif
#ifdef WINAPI_FAMILY
# define open _open
# define read _read
# define write _write
# define close _close
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */ #ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS # define NO_GZCOMPRESS
#endif #endif
@ -72,33 +73,28 @@
#endif #endif
#ifndef HAVE_VSNPRINTF #ifndef HAVE_VSNPRINTF
# ifdef MSDOS # if !defined(NO_vsnprintf) && \
(defined(MSDOS) || defined(__TURBOC__) || defined(__SASC) || \
defined(VMS) || defined(__OS400) || defined(__MVS__))
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */ but for now we just assume it doesn't. */
# define NO_vsnprintf # define NO_vsnprintf
# endif # endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
# ifdef WIN32 # ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(NO_vsnprintf) # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) # ifndef vsnprintf
# define vsnprintf _vsnprintf # define vsnprintf _vsnprintf
# endif # endif
# endif # endif
# endif # elif !defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L
# ifdef __SASC /* Otherwise if C89/90, assume no C99 snprintf() or vsnprintf() */
# define NO_vsnprintf # ifndef NO_snprintf
# endif # define NO_snprintf
# ifdef VMS # endif
# define NO_vsnprintf # ifndef NO_vsnprintf
# endif # define NO_vsnprintf
# ifdef __OS400__ # endif
# define NO_vsnprintf
# endif
# ifdef __MVS__
# define NO_vsnprintf
# endif # endif
#endif #endif
@ -210,9 +206,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t /* 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 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) */ (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 ZLIB_INTERNAL gz_intmax(void); unsigned ZLIB_INTERNAL gz_intmax(void);
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) #define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif

43
deps/zlib/gzlib.c vendored
View File

@ -1,19 +1,21 @@
/* gzlib.c -- zlib functions common to reading and writing gzip files /* gzlib.c -- zlib functions common to reading and writing gzip files
* Copyright (C) 2004-2019 Mark Adler * Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#include "gzguts.h" #include "gzguts.h"
#if defined(_WIN32) && !defined(__BORLANDC__) #if defined(UNDER_CE)
# define LSEEK _wcelseek
#elif defined(__DJGPP__)
# define LSEEK llseek
#elif defined(_WIN32) && !defined(__BORLANDC__)
# define LSEEK _lseeki64 # define LSEEK _lseeki64
#else #elif defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define LSEEK lseek64 # define LSEEK lseek64
#else #else
# define LSEEK lseek # define LSEEK lseek
#endif #endif
#endif
#if defined UNDER_CE #if defined UNDER_CE
@ -52,7 +54,7 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
msgbuf[chars] = 0; msgbuf[chars] = 0;
} }
wcstombs(buf, msgbuf, chars + 1); wcstombs(buf, msgbuf, chars + 1); // assumes buf is big enough
LocalFree(msgbuf); LocalFree(msgbuf);
} }
else { else {
@ -179,11 +181,8 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
/* save the path name for error messages */ /* save the path name for error messages */
#ifdef WIDECHAR #ifdef WIDECHAR
if (fd == -2) { if (fd == -2)
len = wcstombs(NULL, path, 0); len = wcstombs(NULL, path, 0);
if (len == (z_size_t)-1)
len = 0;
}
else else
#endif #endif
len = strlen((const char *)path); len = strlen((const char *)path);
@ -193,18 +192,21 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
return NULL; return NULL;
} }
#ifdef WIDECHAR #ifdef WIDECHAR
if (fd == -2) if (fd == -2) {
if (len) if (len)
wcstombs(state->path, path, len + 1); wcstombs(state->path, path, len + 1);
else else
*(state->path) = 0; *(state->path) = 0;
}
else else
#endif #endif
{
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
(void)snprintf(state->path, len + 1, "%s", (const char *)path); (void)snprintf(state->path, len + 1, "%s", (const char *)path);
#else #else
strcpy(state->path, path); strcpy(state->path, path);
#endif #endif
}
/* compute the flags for open() */ /* compute the flags for open() */
oflag = oflag =
@ -228,11 +230,14 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
O_APPEND))); O_APPEND)));
/* open the file with the appropriate flags (or just use fd) */ /* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : ( if (fd == -1)
state->fd = open((const char *)path, oflag, 0666);
#ifdef WIDECHAR #ifdef WIDECHAR
fd == -2 ? _wopen(path, oflag, 0666) : else if (fd == -2)
state->fd = _wopen(path, oflag, _S_IREAD | _S_IWRITE);
#endif #endif
open((const char *)path, oflag, 0666)); else
state->fd = fd;
if (state->fd == -1) { if (state->fd == -1) {
free(state->path); free(state->path);
free(state); free(state);
@ -563,20 +568,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
#endif #endif
} }
#ifndef INT_MAX
/* portably return maximum value for an int (when limits.h presumed not /* 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 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, used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */ otherwise we could just use ((unsigned)-1) >> 1 */
unsigned ZLIB_INTERNAL gz_intmax(void) { unsigned ZLIB_INTERNAL gz_intmax(void) {
unsigned p, q; #ifdef INT_MAX
return INT_MAX;
p = 1; #else
unsigned p = 1, q;
do { do {
q = p; q = p;
p <<= 1; p <<= 1;
p++; p++;
} while (p > q); } while (p > q);
return q >> 1; return q >> 1;
}
#endif #endif
}

3
deps/zlib/gzread.c vendored
View File

@ -374,7 +374,8 @@ int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) { z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
gzFile file) {
z_size_t len; z_size_t len;
gz_statep state; gz_statep state;

View File

@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding /* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2023 Mark Adler * Copyright (C) 1995-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -9,7 +9,7 @@
#define MAXBITS 15 #define MAXBITS 15
const char inflate_copyright[] = const char inflate_copyright[] =
" inflate 1.3.0.1 Copyright 1995-2023 Mark Adler "; " inflate 1.3.1.1 Copyright 1995-2024 Mark Adler ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot
@ -57,7 +57,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */ static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 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, 70, 200}; 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 200};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 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, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

View File

@ -3,7 +3,7 @@
# test works out-of-the-box, installs `somewhere' on demand # test works out-of-the-box, installs `somewhere' on demand
# Toolflags: # Toolflags:
CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah CCflags = -c -depend !Depend -IC: -g -throwback -fah
C++flags = -c -depend !Depend -IC: -throwback C++flags = -c -depend !Depend -IC: -throwback
Linkflags = -aif -c++ -o $@ Linkflags = -aif -c++ -o $@
ObjAsmflags = -throwback -NoCache -depend !Depend ObjAsmflags = -throwback -NoCache -depend !Depend

View File

@ -115,7 +115,7 @@ SUCCESS Then
ReDim Preserve bytaryCpr(lngCprSiz - 1) ReDim Preserve bytaryCpr(lngCprSiz - 1)
Open strCprPth For Binary Access Write As #1 Open strCprPth For Binary Access Write As #1
Put #1, , bytaryCpr() Put #1, , bytaryCpr()
Put #1, , lngOriSiz 'Add the the original size value to the end Put #1, , lngOriSiz 'Add the original size value to the end
(last 4 bytes) (last 4 bytes)
Close #1 Close #1
Else Else

View File

@ -1,4 +1,4 @@
ZLIB version 1.3.0.1 for OS/400 installation instructions ZLIB version 1.3.1.1 for OS/400 installation instructions
1) Download and unpack the zlib tarball to some IFS directory. 1) Download and unpack the zlib tarball to some IFS directory.
(i.e.: /path/to/the/zlib/ifs/source/directory) (i.e.: /path/to/the/zlib/ifs/source/directory)

View File

@ -1,7 +1,7 @@
* ZLIB.INC - Interface to the general purpose compression library * ZLIB.INC - Interface to the general purpose compression library
* *
* ILE RPG400 version by Patrick Monnerat, DATASPHERE. * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
* Version 1.3.0.1 * Version 1.3.1.1
* *
* *
* WARNING: * WARNING:
@ -22,12 +22,12 @@
* *
* Versioning information. * Versioning information.
* *
D ZLIB_VERSION C '1.3.0.1' D ZLIB_VERSION C '1.3.1.1'
D ZLIB_VERNUM C X'12a0' D ZLIB_VERNUM C X'12a0'
D ZLIB_VER_MAJOR C 1 D ZLIB_VER_MAJOR C 1
D ZLIB_VER_MINOR C 3 D ZLIB_VER_MINOR C 3
D ZLIB_VER_REVISION... D ZLIB_VER_REVISION...
D C 0 D C 1
D ZLIB_VER_SUBREVISION... D ZLIB_VER_SUBREVISION...
D C 1 D C 1
* *

View File

@ -25,10 +25,10 @@
<QPG:Files> <QPG:Files>
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/> <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
<QPG:Add file="../libz.so.1.3.0.1" install="/opt/lib/" user="root:bin" permission="644"/> <QPG:Add file="../libz.so.1.3.1.1" install="/opt/lib/" user="root:bin" permission="644"/>
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.3.0.1"/> <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.3.1.1"/>
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.3.0.1"/> <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.3.1.1"/>
<QPG:Add file="../libz.so.1.3.0.1" install="/opt/lib/" component="slib"/> <QPG:Add file="../libz.so.1.3.1.1" install="/opt/lib/" component="slib"/>
</QPG:Files> </QPG:Files>
<QPG:PackageFilter> <QPG:PackageFilter>
@ -58,12 +58,12 @@
<QPM:ProductIconLarge></QPM:ProductIconLarge> <QPM:ProductIconLarge></QPM:ProductIconLarge>
<QPM:ProductDescriptionShort>A massively spiffy yet delicately unobtrusive compression library.</QPM:ProductDescriptionShort> <QPM:ProductDescriptionShort>A massively spiffy yet delicately unobtrusive compression library.</QPM:ProductDescriptionShort>
<QPM:ProductDescriptionLong>zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system.</QPM:ProductDescriptionLong> <QPM:ProductDescriptionLong>zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system.</QPM:ProductDescriptionLong>
<QPM:ProductDescriptionURL>http://www.gzip.org/zlib</QPM:ProductDescriptionURL> <QPM:ProductDescriptionURL>https://zlib.net/</QPM:ProductDescriptionURL>
<QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL> <QPM:ProductDescriptionEmbedURL></QPM:ProductDescriptionEmbedURL>
</QPM:ProductDescription> </QPM:ProductDescription>
<QPM:ReleaseDescription> <QPM:ReleaseDescription>
<QPM:ReleaseVersion>1.3.0.1</QPM:ReleaseVersion> <QPM:ReleaseVersion>1.3.1.1</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability> <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>

View File

@ -5,6 +5,10 @@
/* @(#) $Id$ */ /* @(#) $Id$ */
#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS)
# define _CRT_SECURE_NO_WARNINGS
#endif
#include "zlib.h" #include "zlib.h"
#include <stdio.h> #include <stdio.h>
@ -13,8 +17,10 @@
# include <stdlib.h> # include <stdlib.h>
#endif #endif
#if defined(VMS) || defined(RISCOS) #if defined(VMS)
# define TESTFILE "foo-gz" # define TESTFILE "foo-gz"
#elif defined(__riscos) && !defined(__TARGET_UNIXLIB__)
# define TESTFILE "foo/gz"
#else #else
# define TESTFILE "foo.gz" # define TESTFILE "foo.gz"
#endif #endif

View File

@ -185,7 +185,7 @@ local void mem_used(z_stream *strm, char *prefix)
{ {
struct mem_zone *zone = strm->opaque; struct mem_zone *zone = strm->opaque;
fprintf(stderr, "%s: %lu allocated\n", prefix, zone->total); fprintf(stderr, "%s: %zu allocated\n", prefix, zone->total);
} }
/* show the high water allocation in bytes */ /* show the high water allocation in bytes */
@ -193,7 +193,7 @@ local void mem_high(z_stream *strm, char *prefix)
{ {
struct mem_zone *zone = strm->opaque; struct mem_zone *zone = strm->opaque;
fprintf(stderr, "%s: %lu high water mark\n", prefix, zone->highwater); fprintf(stderr, "%s: %zu high water mark\n", prefix, zone->highwater);
} }
/* release the memory allocation zone -- if there are any surprises, notify */ /* release the memory allocation zone -- if there are any surprises, notify */
@ -218,7 +218,7 @@ local void mem_done(z_stream *strm, char *prefix)
/* issue alerts about anything unexpected */ /* issue alerts about anything unexpected */
if (count || zone->total) if (count || zone->total)
fprintf(stderr, "** %s: %lu bytes in %d blocks not freed\n", fprintf(stderr, "** %s: %zu bytes in %d blocks not freed\n",
prefix, zone->total, count); prefix, zone->total, count);
if (zone->notlifo) if (zone->notlifo)
fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo); fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo);

View File

@ -15,6 +15,17 @@
/* @(#) $Id$ */ /* @(#) $Id$ */
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200112L
#endif
#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS)
# define _CRT_SECURE_NO_WARNINGS
#endif
#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
#include "zlib.h" #include "zlib.h"
#include <stdio.h> #include <stdio.h>
@ -40,18 +51,16 @@
# define SET_BINARY_MODE(file) # define SET_BINARY_MODE(file)
#endif #endif
#if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
#endif
#ifdef VMS #ifdef VMS
# define unlink delete # define unlink delete
# define GZ_SUFFIX "-gz" # define GZ_SUFFIX "-gz"
#endif #endif
#ifdef RISCOS #if defined(__riscos) && !defined(__TARGET_UNIXLIB__)
# define unlink remove # define GZ_SUFFIX "/gz"
# define GZ_SUFFIX "-gz" # ifndef __GNUC__
# define fileno(file) file->__file # define unlink remove
# define fileno(file) file->__file
# endif
#endif #endif
#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os #if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fileno */ # include <unix.h> /* for fileno */
@ -142,6 +151,25 @@ static void pwinerror (s)
# define local # define local
#endif #endif
/* ===========================================================================
* Safe string copy. Copy up to len bytes from src to dst, if src terminates
* with a null by then. If not, copy len-1 bytes from src, terminating it with
* a null in dst[len-1], cutting src short. Return a pointer to the terminating
* null. If len is zero, nothing is written to *dst and NULL is returned.
*/
static char *string_copy(char *dst, char const *src, z_size_t len) {
if (len == 0)
return NULL;
while (--len) {
*dst = *src++;
if (*dst == 0)
return dst;
dst++;
}
*dst = 0;
return dst;
}
#ifdef Z_SOLO #ifdef Z_SOLO
/* for Z_SOLO, create simplified gz* functions using deflate and inflate */ /* for Z_SOLO, create simplified gz* functions using deflate and inflate */
@ -303,7 +331,7 @@ static void error(const char *msg) {
#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */ #ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
/* Try compressing the input file at once using mmap. Return Z_OK if /* Try compressing the input file at once using mmap. Return Z_OK if
* if success, Z_ERRNO otherwise. * success, Z_ERRNO otherwise.
*/ */
static int gz_compress_mmap(FILE *in, gzFile out) { static int gz_compress_mmap(FILE *in, gzFile out) {
int len; int len;
@ -391,7 +419,7 @@ static void gz_uncompress(gzFile in, FILE *out) {
* original. * original.
*/ */
static void file_compress(char *file, char *mode) { static void file_compress(char *file, char *mode) {
local char outfile[MAX_NAME_LEN]; local char outfile[MAX_NAME_LEN+1], *end;
FILE *in; FILE *in;
gzFile out; gzFile out;
@ -400,12 +428,8 @@ static void file_compress(char *file, char *mode) {
exit(1); exit(1);
} }
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) end = string_copy(outfile, file, sizeof(outfile));
snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); string_copy(end, GZ_SUFFIX, sizeof(outfile) - (z_size_t)(end - outfile));
#else
strcpy(outfile, file);
strcat(outfile, GZ_SUFFIX);
#endif
in = fopen(file, "rb"); in = fopen(file, "rb");
if (in == NULL) { if (in == NULL) {
@ -427,7 +451,7 @@ static void file_compress(char *file, char *mode) {
* Uncompress the given file and remove the original. * Uncompress the given file and remove the original.
*/ */
static void file_uncompress(char *file) { static void file_uncompress(char *file) {
local char buf[MAX_NAME_LEN]; local char buf[MAX_NAME_LEN+1];
char *infile, *outfile; char *infile, *outfile;
FILE *out; FILE *out;
gzFile in; gzFile in;
@ -438,11 +462,7 @@ static void file_uncompress(char *file) {
exit(1); exit(1);
} }
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) string_copy(buf, file, sizeof(buf));
snprintf(buf, sizeof(buf), "%s", file);
#else
strcpy(buf, file);
#endif
if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
infile = file; infile = file;
@ -451,11 +471,7 @@ static void file_uncompress(char *file) {
} else { } else {
outfile = file; outfile = file;
infile = buf; infile = buf;
#if !defined(NO_snprintf) && !defined(NO_vsnprintf) string_copy(buf + len, GZ_SUFFIX, sizeof(buf) - len);
snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX);
#else
strcat(infile, GZ_SUFFIX);
#endif
} }
in = gzopen(infile, "rb"); in = gzopen(infile, "rb");
if (in == NULL) { if (in == NULL) {
@ -488,14 +504,9 @@ int main(int argc, char *argv[]) {
int copyout = 0; int copyout = 0;
int uncompr = 0; int uncompr = 0;
gzFile file; gzFile file;
char *bname, outmode[20]; char *bname, outmode[5];
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(outmode, sizeof(outmode), "%s", "wb6 ");
#else
strcpy(outmode, "wb6 ");
#endif
string_copy(outmode, "wb6 ", sizeof(outmode));
prog = argv[0]; prog = argv[0];
bname = strrchr(argv[0], '/'); bname = strrchr(argv[0], '/');
if (bname) if (bname)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" ?> <?xml version="1.0" ?>
<package name="zlib" version="1.3.0.1"> <package name="zlib" version="1.3.1.1">
<library name="zlib" dlversion="1.3.0.1" dlname="z"> <library name="zlib" dlversion="1.3.1.1" dlname="z">
<property name="description"> zip compression library </property> <property name="description"> zip compression library </property>
<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" /> <property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />

6
deps/zlib/trees.c vendored
View File

@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding /* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-2021 Jean-loup Gailly * Copyright (C) 1995-2024 Jean-loup Gailly
* detect_data_type() function provided freely by Cosmin Truta, 2006 * detect_data_type() function provided freely by Cosmin Truta, 2006
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -724,7 +724,7 @@ local void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
if (++count < max_count && curlen == nextlen) { if (++count < max_count && curlen == nextlen) {
continue; continue;
} else if (count < min_count) { } else if (count < min_count) {
s->bl_tree[curlen].Freq += count; s->bl_tree[curlen].Freq += (ush)count;
} else if (curlen != 0) { } else if (curlen != 0) {
if (curlen != prevlen) s->bl_tree[curlen].Freq++; if (curlen != prevlen) s->bl_tree[curlen].Freq++;
s->bl_tree[REP_3_6].Freq++; s->bl_tree[REP_3_6].Freq++;
@ -938,7 +938,7 @@ local void compress_block(deflate_state *s, const ct_data *ltree,
/* Check for no overlay of pending_buf on needed symbols */ /* Check for no overlay of pending_buf on needed symbols */
#ifdef LIT_MEM #ifdef LIT_MEM
Assert(s->pending < (s->lit_bufsize << 1) + sx, "pendingBuf overflow"); Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow");
#else #else
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
#endif #endif

View File

@ -3,21 +3,17 @@
This document describes the design, the rationale, and the usage This document describes the design, the rationale, and the usage
of the official DLL build of zlib, named ZLIB1.DLL. If you have of the common DLL build of zlib, named ZLIB1.DLL. If you have
general questions about zlib, you should see the file "FAQ" found general questions about zlib, you should see the file "FAQ" found
in the zlib distribution, or at the following location: in the zlib distribution, or at the following location:
http://www.gzip.org/zlib/zlib_faq.html https://www.zlib.net/zlib_faq.html
1. What is ZLIB1.DLL, and how can I get it? 1. What is ZLIB1.DLL, and how can I get it?
- ZLIB1.DLL is the official build of zlib as a DLL. - ZLIB1.DLL is the common build of zlib as a DLL.
(Please remark the character '1' in the name.) (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 Applications that link to ZLIB1.DLL can rely on the following
specification: specification:
@ -379,18 +375,6 @@ in the zlib distribution, or at the following location:
code. But you can make your own private DLL build, under a code. But you can make your own private DLL build, under a
different file name, as suggested in the previous answer. 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 This document is written and maintained by

View File

@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY ZLIB DATA COMPRESSION LIBRARY
zlib 1.3.0.1 is a general purpose data compression library. All the code is zlib 1.3.1.1 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 thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files (Request for Comments) 1950 to 1952 in the files
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@ -22,7 +22,7 @@ asking for help.
Manifest: Manifest:
The package zlib-1.3.0.1-win32-x86.zip will contain the following files: The package zlib-1.3.1.1-win32-x86.zip will contain the following files:
README-WIN32.txt This document README-WIN32.txt This document
ChangeLog Changes since previous zlib packages ChangeLog Changes since previous zlib packages

28
deps/zlib/zconf.h vendored
View File

@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -300,14 +300,6 @@
# endif # endif
#endif #endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed /* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations). * model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have * This was tested only with MSC; for other MSDOS compilers you may have
@ -478,12 +470,8 @@ typedef uLong FAR uLongf;
#endif #endif
#ifndef Z_HAVE_UNISTD_H #ifndef Z_HAVE_UNISTD_H
# ifdef __WATCOMC__ # if defined(__WATCOMC__) || defined(__GO32__) || \
# define Z_HAVE_UNISTD_H (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32))
# endif
#endif
#ifndef Z_HAVE_UNISTD_H
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
# define Z_HAVE_UNISTD_H # define Z_HAVE_UNISTD_H
# endif # endif
#endif #endif
@ -523,12 +511,12 @@ typedef uLong FAR uLongf;
#if !defined(_WIN32) && defined(Z_LARGE64) #if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t # define z_off64_t off64_t
#elif defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
#elif defined(__GO32__)
# define z_off64_t offset_t
#else #else
# if defined(_WIN32) && !defined(__GNUC__) # define z_off64_t z_off_t
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif #endif
/* MVS linker does not support external names larger than 8 bytes */ /* MVS linker does not support external names larger than 8 bytes */

View File

@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -302,14 +302,6 @@
# endif # endif
#endif #endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed /* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations). * model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have * This was tested only with MSC; for other MSDOS compilers you may have
@ -480,12 +472,8 @@ typedef uLong FAR uLongf;
#endif #endif
#ifndef Z_HAVE_UNISTD_H #ifndef Z_HAVE_UNISTD_H
# ifdef __WATCOMC__ # if defined(__WATCOMC__) || defined(__GO32__) || \
# define Z_HAVE_UNISTD_H (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32))
# endif
#endif
#ifndef Z_HAVE_UNISTD_H
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
# define Z_HAVE_UNISTD_H # define Z_HAVE_UNISTD_H
# endif # endif
#endif #endif
@ -525,12 +513,12 @@ typedef uLong FAR uLongf;
#if !defined(_WIN32) && defined(Z_LARGE64) #if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t # define z_off64_t off64_t
#elif defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
#elif defined(__GO32__)
# define z_off64_t offset_t
#else #else
# if defined(_WIN32) && !defined(__GNUC__) # define z_off64_t z_off_t
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif #endif
/* MVS linker does not support external names larger than 8 bytes */ /* MVS linker does not support external names larger than 8 bytes */

28
deps/zlib/zconf.h.in vendored
View File

@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -300,14 +300,6 @@
# endif # endif
#endif #endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed /* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations). * model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have * This was tested only with MSC; for other MSDOS compilers you may have
@ -478,12 +470,8 @@ typedef uLong FAR uLongf;
#endif #endif
#ifndef Z_HAVE_UNISTD_H #ifndef Z_HAVE_UNISTD_H
# ifdef __WATCOMC__ # if defined(__WATCOMC__) || defined(__GO32__) || \
# define Z_HAVE_UNISTD_H (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32))
# endif
#endif
#ifndef Z_HAVE_UNISTD_H
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
# define Z_HAVE_UNISTD_H # define Z_HAVE_UNISTD_H
# endif # endif
#endif #endif
@ -523,12 +511,12 @@ typedef uLong FAR uLongf;
#if !defined(_WIN32) && defined(Z_LARGE64) #if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t # define z_off64_t off64_t
#elif defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
#elif defined(__GO32__)
# define z_off64_t offset_t
#else #else
# if defined(_WIN32) && !defined(__GNUC__) # define z_off64_t z_off_t
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif #endif
/* MVS linker does not support external names larger than 8 bytes */ /* MVS linker does not support external names larger than 8 bytes */

8
deps/zlib/zlib.3 vendored
View File

@ -1,4 +1,4 @@
.TH ZLIB 3 "xx Aug 2023" .TH ZLIB 3 "xx Jan 2024"
.SH NAME .SH NAME
zlib \- compression/decompression library zlib \- compression/decompression library
.SH SYNOPSIS .SH SYNOPSIS
@ -86,7 +86,7 @@ Mark Nelson wrote an article about
for the Jan. 1997 issue of Dr. Dobb's Journal; for the Jan. 1997 issue of Dr. Dobb's Journal;
a copy of the article is available at: a copy of the article is available at:
.IP .IP
http://marknelson.us/1997/01/01/zlib-engine/ https://marknelson.us/posts/1997/01/01/zlib-engine.html
.SH "REPORTING PROBLEMS" .SH "REPORTING PROBLEMS"
Before reporting a problem, Before reporting a problem,
please check the please check the
@ -105,9 +105,9 @@ before asking for help.
Send questions and/or comments to zlib@gzip.org, Send questions and/or comments to zlib@gzip.org,
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
.SH AUTHORS AND LICENSE .SH AUTHORS AND LICENSE
Version 1.3.0.1 Version 1.3.1.1
.LP .LP
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
.LP .LP
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

BIN
deps/zlib/zlib.3.pdf vendored

Binary file not shown.

47
deps/zlib/zlib.h vendored
View File

@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library /* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.3.0.1, August xxth, 2023 version 1.3.1.1, January xxth, 2024
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -37,11 +37,11 @@
extern "C" { extern "C" {
#endif #endif
#define ZLIB_VERSION "1.3.0.1-motley" #define ZLIB_VERSION "1.3.1.1-motley"
#define ZLIB_VERNUM 0x1301 #define ZLIB_VERNUM 0x1311
#define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 3 #define ZLIB_VER_MINOR 3
#define ZLIB_VER_REVISION 0 #define ZLIB_VER_REVISION 1
#define ZLIB_VER_SUBREVISION 1 #define ZLIB_VER_SUBREVISION 1
/* /*
@ -587,18 +587,21 @@ ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
The strategy parameter is used to tune the compression algorithm. Use the 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 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 filter (or predictor), Z_RLE to limit match distances to one (run-length
string match), or Z_RLE to limit match distances to one (run-length encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string
encoding). Filtered data consists mostly of small values with a somewhat matching). Filtered data consists mostly of small values with a somewhat
random distribution. In this case, the compression algorithm is tuned to random distribution, as produced by the PNG filters. In this case, the
compress them better. The effect of Z_FILTERED is to force more Huffman compression algorithm is tuned to compress them better. The effect of
coding and less string matching; it is somewhat intermediate between Z_FILTERED is to force more Huffman coding and less string matching than the
Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.
fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better
strategy parameter only affects the compression ratio but not the compression for PNG image data than Huffman only. The degree of string
correctness of the compressed output even if it is not set appropriately. matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then
Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler Z_HUFFMAN. The strategy parameter affects the compression ratio but never
decoder for special applications. the correctness of the compressed output, even if it is not set optimally
for the given data. Z_FIXED uses the default string matching, but 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 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 memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
@ -1758,14 +1761,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were 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 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
len2. len2. len2 must be non-negative.
*/ */
/* /*
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
Return the operator corresponding to length len2, to be used with Return the operator corresponding to length len2, to be used with
crc32_combine_op(). crc32_combine_op(). len2 must be non-negative.
*/ */
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
@ -1888,9 +1891,9 @@ ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int); ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
ZEXTERN z_off_t ZEXPORT gztell64(gzFile); ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile); ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t); ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t); ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t); ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
# endif # endif
#else #else
ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *); ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);

38
deps/zlib/zutil.h vendored
View File

@ -1,5 +1,5 @@
/* zutil.h -- internal interface and configuration of the compression library /* zutil.h -- internal interface and configuration of the compression library
* Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -56,7 +56,7 @@ typedef unsigned long ulg;
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */ /* (size given to avoid silly warnings with Visual C++) */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
#define ERR_RETURN(strm,err) \ #define ERR_RETURN(strm,err) \
return (strm->msg = ERR_MSG(err), (err)) return (strm->msg = ERR_MSG(err), (err))
@ -137,20 +137,11 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# endif # endif
#endif #endif
#if defined(MACOS) || defined(TARGET_OS_MAC) #if defined(MACOS)
# define OS_CODE 7 # define OS_CODE 7
# ifndef Z_SOLO
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fdopen */
# else
# ifndef fdopen
# define fdopen(fd,mode) NULL /* No fdopen() */
# endif
# endif
# endif
#endif #endif
#ifdef __acorn #if defined(__acorn) || defined(__riscos)
# define OS_CODE 13 # define OS_CODE 13
#endif #endif
@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 19 # define OS_CODE 19
#endif #endif
#if defined(_BEOS_) || defined(RISCOS)
# define fdopen(fd,mode) NULL /* No fdopen() */
#endif
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
# if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL /* No fdopen() */
# else
# define fdopen(fd,type) _fdopen(fd,type)
# endif
#endif
#if defined(__BORLANDC__) && !defined(MSDOS) #if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004 #pragma warn -8004
#pragma warn -8008 #pragma warn -8008
@ -189,11 +168,10 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#endif #endif
/* provide prototypes for these when building zlib without LFS */ /* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \ #ifndef Z_LARGE64
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t); ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t); ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
#endif #endif
/* common defaults */ /* common defaults */