1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-10 08:38:11 +00:00

update zlib to 1.3.1, commit 5a82f71

This commit is contained in:
Gabriele Gristina 2025-04-18 14:53:52 +02:00
parent 6716447dfc
commit 16d117d470
200 changed files with 22714 additions and 13538 deletions

245
deps/zlib/.cmake-format.yaml vendored Normal file
View File

@ -0,0 +1,245 @@
_help_parse: Options affecting listfile parsing
parse:
_help_additional_commands:
- Specify structure for custom cmake functions
additional_commands:
foo:
flags:
- BAR
- BAZ
kwargs:
HEADERS: '*'
SOURCES: '*'
DEPENDS: '*'
_help_override_spec:
- Override configurations per-command where available
override_spec: {}
_help_vartags:
- Specify variable tags.
vartags: []
_help_proptags:
- Specify property tags.
proptags: []
_help_format: Options affecting formatting.
format:
_help_disable:
- Disable formatting entirely, making cmake-format a no-op
disable: false
_help_line_width:
- How wide to allow formatted cmake files
line_width: 80
_help_tab_size:
- How many spaces to tab for indent
tab_size: 4
_help_use_tabchars:
- If true, lines are indented using tab characters (utf-8
- 0x09) instead of <tab_size> space characters (utf-8 0x20).
- In cases where the layout would require a fractional tab
- character, the behavior of the fractional indentation is
- governed by <fractional_tab_policy>
use_tabchars: false
_help_fractional_tab_policy:
- If <use_tabchars> is True, then the value of this variable
- indicates how fractional indentions are handled during
- whitespace replacement. If set to 'use-space', fractional
- indentation is left as spaces (utf-8 0x20). If set to
- '`round-up` fractional indentation is replaced with a single'
- tab character (utf-8 0x09) effectively shifting the column
- to the next tabstop
fractional_tab_policy: use-space
_help_max_subgroups_hwrap:
- If an argument group contains more than this many sub-groups
- (parg or kwarg groups) then force it to a vertical layout.
max_subgroups_hwrap: 2
_help_max_pargs_hwrap:
- If a positional argument group contains more than this many
- arguments, then force it to a vertical layout.
max_pargs_hwrap: 6
_help_max_rows_cmdline:
- If a cmdline positional group consumes more than this many
- lines without nesting, then invalidate the layout (and nest)
max_rows_cmdline: 2
_help_separate_ctrl_name_with_space:
- If true, separate flow control names from their parentheses
- with a space
separate_ctrl_name_with_space: false
_help_separate_fn_name_with_space:
- If true, separate function names from parentheses with a
- space
separate_fn_name_with_space: false
_help_dangle_parens:
- If a statement is wrapped to more than one line, than dangle
- the closing parenthesis on its own line.
dangle_parens: false
_help_dangle_align:
- If the trailing parenthesis must be 'dangled' on its on
- 'line, then align it to this reference: `prefix`: the start'
- 'of the statement, `prefix-indent`: the start of the'
- 'statement, plus one indentation level, `child`: align to'
- the column of the arguments
dangle_align: prefix
_help_min_prefix_chars:
- If the statement spelling length (including space and
- parenthesis) is smaller than this amount, then force reject
- nested layouts.
min_prefix_chars: 4
_help_max_prefix_chars:
- If the statement spelling length (including space and
- parenthesis) is larger than the tab width by more than this
- amount, then force reject un-nested layouts.
max_prefix_chars: 10
_help_max_lines_hwrap:
- If a candidate layout is wrapped horizontally but it exceeds
- this many lines, then reject the layout.
max_lines_hwrap: 2
_help_line_ending:
- What style line endings to use in the output.
line_ending: unix
_help_command_case:
- Format command names consistently as 'lower' or 'upper' case
command_case: canonical
_help_keyword_case:
- Format keywords consistently as 'lower' or 'upper' case
keyword_case: unchanged
_help_always_wrap:
- A list of command names which should always be wrapped
always_wrap: []
_help_enable_sort:
- If true, the argument lists which are known to be sortable
- will be sorted lexicographicall
enable_sort: true
_help_autosort:
- If true, the parsers may infer whether or not an argument
- list is sortable (without annotation).
autosort: false
_help_require_valid_layout:
- By default, if cmake-format cannot successfully fit
- everything into the desired linewidth it will apply the
- last, most aggressive attempt that it made. If this flag is
- True, however, cmake-format will print error, exit with non-
- zero status code, and write-out nothing
require_valid_layout: false
_help_layout_passes:
- A dictionary mapping layout nodes to a list of wrap
- decisions. See the documentation for more information.
layout_passes: {}
_help_markup: Options affecting comment reflow and formatting.
markup:
_help_bullet_char:
- What character to use for bulleted lists
bullet_char: '*'
_help_enum_char:
- What character to use as punctuation after numerals in an
- enumerated list
enum_char: .
_help_first_comment_is_literal:
- If comment markup is enabled, don't reflow the first comment
- block in each listfile. Use this to preserve formatting of
- your copyright/license statements.
first_comment_is_literal: false
_help_literal_comment_pattern:
- If comment markup is enabled, don't reflow any comment block
- which matches this (regex) pattern. Default is `None`
- (disabled).
literal_comment_pattern: null
_help_fence_pattern:
- Regular expression to match preformat fences in comments
- default= ``r'^\s*([`~]{3}[`~]*)(.*)$'``
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
_help_ruler_pattern:
- Regular expression to match rulers in comments default=
- '``r''^\s*[^\w\s]{3}.*[^\w\s]{3}$''``'
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
_help_explicit_trailing_pattern:
- If a comment line matches starts with this pattern then it
- is explicitly a trailing comment for the preceding argument.
- Default is '#<'
explicit_trailing_pattern: '#<'
_help_hashruler_min_length:
- If a comment line starts with at least this many consecutive
- hash characters, then don't lstrip() them off. This allows
- for lazy hash rulers where the first hash char is not
- separated by space
hashruler_min_length: 10
_help_canonicalize_hashrulers:
- If true, then insert a space between the first hash char and
- remaining hash chars in a hash ruler, and normalize its
- length to fill the column
canonicalize_hashrulers: true
_help_enable_markup:
- enable comment markup parsing and reflow
enable_markup: true
_help_lint: Options affecting the linter
lint:
_help_disabled_codes:
- a list of lint codes to disable
disabled_codes: []
_help_function_pattern:
- regular expression pattern describing valid function names
function_pattern: '[0-9a-z_]+'
_help_macro_pattern:
- regular expression pattern describing valid macro names
macro_pattern: '[0-9A-Z_]+'
_help_global_var_pattern:
- regular expression pattern describing valid names for
- variables with global (cache) scope
global_var_pattern: '[A-Z][0-9A-Z_]+'
_help_internal_var_pattern:
- regular expression pattern describing valid names for
- variables with global scope (but internal semantic)
internal_var_pattern: _[A-Z][0-9A-Z_]+
_help_local_var_pattern:
- regular expression pattern describing valid names for
- variables with local scope
local_var_pattern: '[a-z][a-z0-9_]+'
_help_private_var_pattern:
- regular expression pattern describing valid names for
- privatedirectory variables
private_var_pattern: _[0-9a-z_]+
_help_public_var_pattern:
- regular expression pattern describing valid names for public
- directory variables
public_var_pattern: '[A-Z][0-9A-Z_]+'
_help_argument_var_pattern:
- regular expression pattern describing valid names for
- function/macro arguments and loop variables.
argument_var_pattern: '[a-z][a-z0-9_]+'
_help_keyword_pattern:
- regular expression pattern describing valid names for
- keywords used in functions or macros
keyword_pattern: '[A-Z][0-9A-Z_]+'
_help_max_conditionals_custom_parser:
- In the heuristic for C0201, how many conditionals to match
- within a loop in before considering the loop a parser.
max_conditionals_custom_parser: 2
_help_min_statement_spacing:
- Require at least this many newlines between statements
min_statement_spacing: 1
_help_max_statement_spacing:
- Require no more than this many newlines between statements
max_statement_spacing: 2
max_returns: 6
max_branches: 12
max_arguments: 5
max_localvars: 15
max_statements: 50
_help_encode: Options affecting file encoding
encode:
_help_emit_byteorder_mark:
- If true, emit the unicode byte-order mark (BOM) at the start
- of the file
emit_byteorder_mark: false
_help_input_encoding:
- Specify the encoding of the input file. Defaults to utf-8
input_encoding: utf-8
_help_output_encoding:
- Specify the encoding of the output file. Defaults to utf-8.
- Note that cmake only claims to support utf-8 so be careful
- when using anything else
output_encoding: utf-8
_help_misc: Miscellaneous configurations options.
misc:
_help_per_command:
- A dictionary containing any per-command configuration
- overrides. Currently only `command_case` is supported.
per_command: {}

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

@ -0,0 +1,230 @@
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 ./build1 -D CMAKE_BUILD_TYPE=Release ${{ matrix.os.cmake-opt }} -DZLIB_BUILD_TESTING=OFF
env:
CC: ${{ matrix.compiler }}
CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Werror -Wall -Wextra
- name: Generate project files with tests (cmake)
if: matrix.builder == 'cmake'
run: |
cmake -S . -B ./build2 -D CMAKE_BUILD_TYPE=Release ${{ matrix.os.cmake-opt }} -DZLIB_BUILD_MINIZIP=ON -DMINIZIP_ENABLE_BZIP2=OFF
env:
CC: ${{ matrix.compiler }}
CFLAGS: -std=${{ matrix.std.value }} ${{ matrix.arch.compiler-opt }} -Wall -Wextra
- name: Compile source code (cmake)
if: matrix.builder == 'cmake'
run: cmake --build ./build1 --config Release
- name: Compile source code with tests (cmake)
if: matrix.builder == 'cmake'
run: cmake --build ./build2 --config Release
- name: Run test cases (cmake)
if: matrix.builder == 'cmake'
run: ctest ./build2 -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 ./build1 ${{ matrix.arch.value }} -D CMAKE_BUILD_TYPE=Release -DZLIB_BUILD_TESTING=OFF
env:
CC: ${{ matrix.compiler }}
CFLAGS: /WX ${{ matrix.std.value }}
- name: Generate project files with tests (cmake)
run: |
cmake -S . -B ./build2 ${{ matrix.arch.value }} -D CMAKE_BUILD_TYPE=Release -DZLIB_BUILD_MINIZIP=ON -DMINIZIP_ENABLE_BZIP2=OFF
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.std.value }}
- name: Compile source code (cmake)
run: cmake --build ./build1 --config Release -v
- name: Compile source code with tests(cmake)
run: cmake --build ./build2 --config Release -v
- name: Run test cases (cmake)
run: ctest ./build2 -C Release --output-on-failure --max-width 120

112
deps/zlib/.github/workflows/cmake.yml vendored Normal file
View File

@ -0,0 +1,112 @@
name: CMake
on: [push, pull_request]
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
cflags: -Wall -Wextra
pkgtgt: package package_source
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
- name: Ubuntu GCC -O3
os: ubuntu-latest
compiler: gcc
cflags: -O3 -Wall -Wextra
pkgtgt: package package_source
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
- name: Ubuntu Clang
os: ubuntu-latest
compiler: clang
cflags: -Wall -Wextra
pkgtgt: package package_source
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
- name: Ubuntu Clang Debug
os: ubuntu-latest
compiler: clang
cflags: -Wall -Wextra
build-config: Debug
pkgtgt: package package_source
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
- name: Windows MSVC Win32
os: windows-latest
compiler: cl
cflags: /W3
cmake-args: -A Win32
pkgtgt: PACKAGE
- name: Windows MSVC Win64
os: windows-latest
compiler: cl
cflags: /W3
cmake-args: -A x64 -DMINIZIP_ENABLE_BZIP2=OFF
pkgtgt: PACKAGE
- name: Windows GCC
os: windows-latest
compiler: gcc
cflags: -Wall -Wextra
cmake-args: -G Ninja -DMINIZIP_ENABLE_BZIP2=OFF
pkgtgt: package
- name: macOS Clang
os: macos-latest
compiler: clang
cflags: -Wall -Wextra
pkgtgt: package
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
- name: macOS GCC
os: macos-latest
compiler: gcc-12
cflags: -Wall -Wextra
pkgtgt: package
cmake-args: -DMINIZIP_ENABLE_BZIP2=ON
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install packages (Windows)
if: runner.os == 'Windows'
run: |
choco install --no-progress ninja
- name: Install packages (Linux)
if: runner.os == 'Linux'
run: |
sudo apt install libbz2-dev
- name: Generate project files
run: cmake -S . -B ../build ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DZLIB_BUILD_MINIZIP=ON
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
- name: Compile source code
run: cmake --build ../build --config ${{ matrix.build-config || 'Release' }}
- name: Run test cases
run: ctest -C Release --output-on-failure --max-width 120
working-directory: ../build
- name: create packages
run: cmake --build ../build --config ${{ matrix.build-config || 'Release' }} -t ${{ matrix.pkgtgt }}
- name: Upload build errors
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.name }} (cmake)
path: |
../build/CMakeFiles/CMakeOutput.log
../build/CMakeFiles/CMakeError.log
retention-days: 7

View File

@ -0,0 +1,136 @@
name: Configure
on: [push, pull_request]
jobs:
ci-configure:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
configure-args: --warn
# Test out of source builds
- name: Ubuntu GCC OSB
os: ubuntu-latest
compiler: gcc
configure-args: --warn
build-dir: ../build
src-dir: ../zlib
- name: Ubuntu GCC ARM SF
os: ubuntu-latest
compiler: arm-linux-gnueabi-gcc
configure-args: --warn
chost: arm-linux-gnueabi
packages: qemu-system qemu-user gcc-arm-linux-gnueabi libc-dev-armel-cross
qemu-run: qemu-arm -L /usr/arm-linux-gnueabi
- name: Ubuntu GCC ARM HF
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
configure-args: --warn
chost: arm-linux-gnueabihf
packages: qemu-system qemu-user gcc-arm-linux-gnueabihf libc-dev-armhf-cross
qemu-run: qemu-arm -L /usr/arm-linux-gnueabihf
- name: Ubuntu GCC AARCH64
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
configure-args: --warn
chost: aarch64-linux-gnu
packages: qemu-system qemu-user gcc-aarch64-linux-gnu libc-dev-arm64-cross
qemu-run: qemu-aarch64 -L /usr/aarch64-linux-gnu
- name: Ubuntu GCC PPC
os: ubuntu-latest
compiler: powerpc-linux-gnu-gcc
configure-args: --warn --static
chost: powerpc-linux-gnu
packages: qemu-system qemu-user gcc-powerpc-linux-gnu libc-dev-powerpc-cross
qemu-run: qemu-ppc -L /usr/powerpc-linux-gnu
cflags: -static
ldflags: -static
- name: Ubuntu GCC PPC64
os: ubuntu-latest
compiler: powerpc64-linux-gnu-gcc
configure-args: --warn --static
chost: powerpc-linux-gnu
packages: qemu-system qemu-user gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
qemu-run: qemu-ppc64 -L /usr/powerpc64-linux-gnu
cflags: -static
ldflags: -static
- name: Ubuntu GCC PPC64LE
os: ubuntu-latest
compiler: powerpc64le-linux-gnu-gcc
configure-args: --warn
chost: powerpc64le-linux-gnu
packages: qemu-system qemu-user gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
qemu-run: qemu-ppc64le -L /usr/powerpc64le-linux-gnu
- name: Ubuntu GCC S390X
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
configure-args: --warn --static
chost: s390x-linux-gnu
packages: qemu-system qemu-user gcc-s390x-linux-gnu libc-dev-s390x-cross
qemu-run: qemu-s390x -L /usr/s390x-linux-gnu
cflags: -static
ldflags: -static
- name: macOS GCC
os: macos-latest
compiler: gcc-12
configure-args: --warn
- name: macOS Clang
os: macos-latest
compiler: clang
configure-args: --warn
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install packages (Ubuntu)
if: runner.os == 'Linux' && matrix.packages
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.packages }}
- name: Generate project files
run: |
[ -d ${{ matrix.build-dir || '.' }} ] || mkdir ${{ matrix.build-dir || '.' }}
cd ${{ matrix.build-dir || '.' }}
${{ matrix.src-dir || '.' }}/configure ${{ matrix.configure-args }}
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}
CHOST: ${{ matrix.chost }}
- name: Compile source code
run: make -j2
working-directory: ${{ matrix.build-dir }}
- name: Run test cases
run: |
make test
make cover
working-directory: ${{ matrix.build-dir }}
env:
QEMU_RUN: ${{ matrix.qemu-run }}
- name: Upload build errors
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ matrix.name }} (configure)
path: |
${{ matrix.build-dir || '.' }}/configure.log
retention-days: 7

25
deps/zlib/.github/workflows/fuzz.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: OSS-Fuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'zlib'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'zlib'
fuzz-seconds: 300
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v4
if: failure()
with:
name: artifacts
path: ./out/artifacts

View File

@ -0,0 +1,77 @@
name: mingw/cygwin
on: [push, pull_request]
jobs:
MSys:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys: [mingw32, mingw64, ucrt64, clang64]
name: MSys - ${{ matrix.sys }}
defaults:
run:
shell: msys2 {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
make
pacboy: >-
toolchain:p
cmake:p
- name: Configure
run: |
cmake -G"Unix Makefiles" \
-S . \
-B build \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DMINIZIP_ENABLE_BZIP2=ON
- name: Build
run: cmake --build build --config Release
- name: Run tests
run: ctest --output-on-failure --test-dir build -C Release
cygwin:
strategy:
fail-fast: false
runs-on: windows-latest
defaults:
run:
shell: C:\cygwin\bin\bash.exe --login -o igncr '{0}'
name: Cygwin
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup cygwin
uses: cygwin/cygwin-install-action@master
with:
packages: >-
cmake
cygwin-devel
gcc-core
gcc-g++
ninja
- name: Configure
run: |
cmake /cygdrive/d/a/zlib/zlib \
-B build \
-DCMAKE_BUILD_TYPE=Release \
-DZLIB_BUILD_MINIZIP=ON \
-DMINIZIP_ENABLE_BZIP2=OFF \
-G Ninja
- name: Build
run: cmake --build build --config Release -v -j1
- name: Run tests
run: ctest --output-on-failure --test-dir build -C Release

51
deps/zlib/.gitignore vendored Normal file
View File

@ -0,0 +1,51 @@
*.diff
*.patch
*.orig
*.rej
*~
*.a
*.lo
*.o
*.dylib
*.gcda
*.gcno
*.gcov
/zconf.h
/Makefile
/example
/example64
/examplesh
**/libz.so*
/minigzip
/minigzip64
/minigzipsh
/zlib.pc
/configure.log
/build
.DS_Store
.vs
*.user
*.nupkg
contrib/vstudio/vc143/x86
contrib/vstudio/vc143/x64
contrib/vstudio/vc143/arm
contrib/vstudio/vc143/arm64
contrib/nuget/bin
contrib/nuget/obj
*.included
# Bazel directories
/bazel-*
/bazel-bin
/bazel-genfiles
/bazel-out
/bazel-testlogs
user.bazelrc
# MODULE.bazel.lock is ignored for now as per this recommendation:
# https://github.com/bazelbuild/bazel/issues/20369
MODULE.bazel.lock

134
deps/zlib/BUILD.bazel vendored Normal file
View File

@ -0,0 +1,134 @@
# Copied from https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/zlib/1.3.1.bcr.4/patches
# Adapted from https://github.com/protocolbuffers/protobuf/blob/master/third_party/zlib.BUILD
# Copyright 2008 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Code generated by the Protocol Buffer compiler is owned by the owner
# of the input file used when generating it. This code is not
# standalone and requires a support library to be linked with it. This
# support library is itself covered by the above license.
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_license//rules:license.bzl", "license")
package(
default_applicable_licenses = [":license"],
)
license(
name = "license",
license_kinds = ["@rules_license//licenses/spdx:Zlib"],
license_text = "LICENSE",
)
exports_files([
"LICENSE",
])
_ZLIB_HEADERS = [
"crc32.h",
"deflate.h",
"gzguts.h",
"inffast.h",
"inffixed.h",
"inflate.h",
"inftrees.h",
"trees.h",
"zconf.h",
"zlib.h",
"zutil.h",
]
_ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS]
# In order to limit the damage from the `includes` propagation
# via `:zlib`, copy the public headers to a subdirectory and
# expose those.
genrule(
name = "copy_public_headers",
srcs = _ZLIB_HEADERS,
outs = _ZLIB_PREFIXED_HEADERS,
cmd_bash = "cp $(SRCS) $(@D)/zlib/include/",
cmd_bat = " && ".join(
["@copy /Y \"$(location %s)\" \"$(@D)\\zlib\\include\\\" >NUL" %
s for s in _ZLIB_HEADERS],
),
)
config_setting(
name = "mingw_gcc_compiler",
flag_values = {
"@bazel_tools//tools/cpp:compiler": "mingw-gcc",
},
visibility = [":__subpackages__"],
)
cc_library(
name = "z",
srcs = [
"adler32.c",
"compress.c",
"crc32.c",
"deflate.c",
"gzclose.c",
"gzlib.c",
"gzread.c",
"gzwrite.c",
"infback.c",
"inffast.c",
"inflate.c",
"inftrees.c",
"trees.c",
"uncompr.c",
"zutil.c",
# Include the un-prefixed headers in srcs to work
# around the fact that zlib isn't consistent in its
# choice of <> or "" delimiter when including itself.
] + _ZLIB_HEADERS,
hdrs = _ZLIB_PREFIXED_HEADERS,
copts = select({
":mingw_gcc_compiler": [
"-fpermissive",
],
"@platforms//os:windows": [],
"//conditions:default": [
"-Wno-deprecated-non-prototype",
"-Wno-unused-variable",
"-Wno-implicit-function-declaration",
],
}),
includes = ["zlib/include/"],
visibility = ["//visibility:public"],
)
alias(
name = "zlib",
actual = ":z",
visibility = ["//visibility:public"],
)

View File

@ -1,99 +1,131 @@
cmake_minimum_required(VERSION 2.4.4) cmake_minimum_required(VERSION 3.12...3.31)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C) project(
zlib
LANGUAGES C
VERSION 1.4.1.1
HOMEPAGE_URL "https://zlib.net/"
DESCRIPTION "a general-purpose lossless data-compression library")
set(VERSION "1.2.11") # ============================================================================
# CPack
# ============================================================================
set(CPACK_PACKAGE_VENDOR "zlib-Project")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${zlib_SOURCE_DIR}/README)
set(CPACK_RESOURCE_FILE_LICENSE ${zlib_SOURCE_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README ${zlib_SOURCE_DIR}/README)
option(ASM686 "Enable building i686 assembly implementation") # ============================================================================
option(AMD64 "Enable building amd64 assembly implementation") # configuration
# ============================================================================
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") option(ZLIB_BUILD_TESTING "Enable Zlib Examples as tests" ON)
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") option(ZLIB_BUILD_SHARED "Enable building zlib shared library" ON)
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") option(ZLIB_BUILD_STATIC "Enable building zlib static library" ON)
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") option(ZLIB_BUILD_MINIZIP "Enable building libminizip contrib library" OFF)
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") option(ZLIB_INSTALL "Enable installation of zlib" ON)
option(ZLIB_PREFIX "prefix for all types and library functions, see zconf.h.in"
OFF)
mark_as_advanced(ZLIB_PREFIX)
include(CheckTypeSize) if(WIN32)
option(ZLIB_INSTALL_COMPAT_DLL "Install a copy as zlib1.dll" ON)
endif(WIN32)
get_property(IS_MULTI GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
message(STATUS "No CMAKE_BUILD_TYPE set -- using Release")
set(CMAKE_BUILD_TYPE Release)
endif(NOT DEFINED CMAKE_BUILD_TYPE AND NOT IS_MULTI)
include(CheckCSourceCompiles)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckIncludeFile) include(CheckIncludeFile)
include(CheckCSourceCompiles) include(CMakePackageConfigHelpers)
enable_testing() include(CheckTypeSize)
include(CPack)
include(GNUInstallDirs)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) set(CPACK_INCLUDED TRUE)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H) if(NOT ZLIB_CONF_WRITTEN)
set(Z_PREFIX ${ZLIB_PREFIX})
set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein)
file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT LIMIT 245)
file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT})
file(APPEND ${CONF_OUT_FILE} "#cmakedefine Z_PREFIX 1\n")
file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_STDARG_H 1\n")
file(APPEND ${CONF_OUT_FILE} "#cmakedefine HAVE_UNISTD_H 1\n")
file(READ ${zlib_SOURCE_DIR}/zconf.h ZCONF_CONTENT OFFSET 244)
set(FIRST_ITEM TRUE)
foreach(item IN LISTS ZCONF_CONTENT)
if(FIRST_ITEM)
string(APPEND OUT_CONTENT ${item})
set(FIRST_ITEM FALSE)
else(FIRST_ITEM)
string(APPEND OUT_CONTENT "\;" ${item})
endif(FIRST_ITEM)
endforeach(item IN LISTS ${ZCONF_CONTENT})
file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT})
set(ZLIB_CONF_WRITTEN
TRUE
CACHE BOOL "zconf.h.cmakein was created")
mark_as_advanced(ZLIB_CONF_WRITTEN)
endif(NOT ZLIB_CONF_WRITTEN)
# #
# Check to see if we have large file support # Check to see if we have large file support
# #
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
if(HAVE_SYS_TYPES_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
endif()
if(HAVE_STDINT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
endif()
if(HAVE_STDDEF_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
endif()
check_type_size(off64_t OFF64_T) check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T) unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
# #
# Check for fseeko # Check for fseeko
# #
check_function_exists(fseeko HAVE_FSEEKO) check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO) #
endif() # Check for stdarg.h
#
check_include_file(stdarg.h HAVE_STDARG_H)
# #
# Check for unistd.h # Check for unistd.h
# #
check_include_file(unistd.h Z_HAVE_UNISTD_H) check_include_file(unistd.h HAVE_UNISTD_H)
#
# Check visibility attribute is supported
#
if(MSVC) if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d") set(CMAKE_REQUIRED_FLAGS "-WX")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) else(MSVC)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) set(CMAKE_REQUIRED_FLAGS "-WError")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) endif(MSVC)
endif()
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) check_c_source_compiles(
# If we're doing an out of source build and the user has a zconf.h "
# in their source tree... #include <stdlib.h>
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) static void f(void) __attribute__ ((visibility(\"hidden\")));
message(STATUS "Renaming") int main(void) {return 0;}
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") "
message(STATUS "to 'zconf.h.included' because this file is included with zlib") HAVE___ATTR__VIS_HIDDEN)
message(STATUS "but CMake generates it automatically in the build directory.")
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
endif()
endif()
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) unset(CMAKE_COMPILE_FLAGS)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc)
${ZLIB_PC} @ONLY) configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein ${zlib_BINARY_DIR}/zconf.h)
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
# ============================================================================
#============================================================================
# zlib # zlib
#============================================================================ # ============================================================================
set(ZLIB_PUBLIC_HDRS ${zlib_BINARY_DIR}/zconf.h zlib.h)
set(ZLIB_PUBLIC_HDRS
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
zlib.h
)
set(ZLIB_PRIVATE_HDRS set(ZLIB_PRIVATE_HDRS
crc32.h crc32.h
deflate.h deflate.h
@ -103,8 +135,8 @@ set(ZLIB_PRIVATE_HDRS
inflate.h inflate.h
inftrees.h inftrees.h
trees.h trees.h
zutil.h zutil.h)
)
set(ZLIB_SRCS set(ZLIB_SRCS
adler32.c adler32.c
compress.c compress.c
@ -120,130 +152,179 @@ set(ZLIB_SRCS
inffast.c inffast.c
trees.c trees.c
uncompr.c uncompr.c
zutil.c zutil.c)
)
if(NOT MINGW) if(WIN32)
set(ZLIB_DLL_SRCS set(zlib_static_suffix "s")
win32/zlib1.rc # If present will override custom build rule below. set(CMAKE_DEBUG_POSTFIX "d")
) endif(WIN32)
endif()
if(CMAKE_COMPILER_IS_GNUCC) if(ZLIB_BUILD_SHARED)
if(ASM686) add_library(
set(ZLIB_ASMS contrib/asm686/match.S) zlib SHARED ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}
elseif (AMD64) $<$<OR:$<BOOL:${WIN32}>,$<BOOL:${CYGWIN}>>:win32/zlib1.rc>)
set(ZLIB_ASMS contrib/amd64/amd64-match.S) add_library(ZLIB::ZLIB ALIAS zlib)
endif () target_include_directories(
zlib
PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_definitions(
zlib
PRIVATE ZLIB_BUILD
$<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
set(INSTALL_VERSION ${zlib_VERSION})
if(ZLIB_ASMS) if(NOT CYGWIN)
add_definitions(-DASMV) set_target_properties(zlib PROPERTIES SOVERSION ${zlib_VERSION_MAJOR}
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) VERSION ${INSTALL_VERSION})
endif() endif(NOT CYGWIN)
endif()
if(MSVC) set_target_properties(
if(ASM686) zlib
ENABLE_LANGUAGE(ASM_MASM) PROPERTIES DEFINE_SYMBOL ZLIB_DLL
set(ZLIB_ASMS EXPORT_NAME ZLIB
contrib/masmx86/inffas32.asm OUTPUT_NAME z)
contrib/masmx86/match686.asm if(UNIX
) AND NOT APPLE
elseif (AMD64) AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX))
ENABLE_LANGUAGE(ASM_MASM) # On unix-like platforms the library is almost always called libz
set(ZLIB_ASMS set_target_properties(
contrib/masmx64/gvmat64.asm zlib
contrib/masmx64/inffasx64.asm PROPERTIES LINK_FLAGS
) "-Wl,--version-script,\"${zlib_SOURCE_DIR}/zlib.map\"")
endif() endif(
UNIX
AND NOT APPLE
AND NOT (CMAKE_SYSTEM_NAME STREQUAL AIX))
endif(ZLIB_BUILD_SHARED)
if(ZLIB_ASMS) if(ZLIB_BUILD_STATIC)
add_definitions(-DASMV -DASMINF) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS}
endif() ${ZLIB_PRIVATE_HDRS})
endif() add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic)
target_include_directories(
zlibstatic
PUBLIC $<BUILD_INTERFACE:${zlib_BINARY_DIR}>
$<BUILD_INTERFACE:${zlib_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_definitions(
zlibstatic
PRIVATE ZLIB_BUILD
$<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
$<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE>
$<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>)
set_target_properties(
zlibstatic PROPERTIES EXPORT_NAME ZLIBSTATIC OUTPUT_NAME
z${zlib_static_suffix})
endif(ZLIB_BUILD_STATIC)
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION if(ZLIB_INSTALL)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) if(ZLIB_BUILD_SHARED)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" install(
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) TARGETS zlib
COMPONENT Runtime
EXPORT zlibSharedExport
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(
EXPORT zlibSharedExport
FILE ZLIB-shared.cmake
NAMESPACE ZLIB::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
if(ZLIB_INSTALL_COMPAT_DLL)
install(
FILES $<TARGET_FILE:zlib>
COMPONENT Runtime
RENAME zlib1.dll
DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif(ZLIB_INSTALL_COMPAT_DLL)
if(MINGW) if(MSVC)
# This gets us DLL resource information when compiling on MinGW. install(
if(NOT CMAKE_RC_COMPILER) FILES $<TARGET_PDB_FILE:zlib>
set(CMAKE_RC_COMPILER windres.exe) COMPONENT Runtime
endif() DESTINATION ${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS Debug OR RelWithDebInfo
OPTIONAL)
endif(MSVC)
endif(ZLIB_BUILD_SHARED)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj if(ZLIB_BUILD_STATIC)
COMMAND ${CMAKE_RC_COMPILER} install(
-D GCC_WINDRES TARGETS zlibstatic
-I ${CMAKE_CURRENT_SOURCE_DIR} COMPONENT Development
-I ${CMAKE_CURRENT_BINARY_DIR} EXPORT zlibStaticExport
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif(MINGW) install(
EXPORT zlibStaticExport
FILE ZLIB-static.cmake
NAMESPACE ZLIB::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) if(ZLIB_INSTALL_COMPAT_DLL AND MINGW)
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) install(
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) FILES $<TARGET_FILE:zlibstatic>
set_target_properties(zlib PROPERTIES SOVERSION 1) COMPONENT Development
RENAME libz.dll.a
DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif(ZLIB_INSTALL_COMPAT_DLL AND MINGW)
endif(ZLIB_BUILD_STATIC)
if(NOT CYGWIN) configure_package_config_file(
# This property causes shared libraries on Linux to have the full version ${zlib_SOURCE_DIR}/zlibConfig.cmake.in
# encoded into their final filename. We disable this on Cygwin because ${zlib_BINARY_DIR}/ZLIBConfig.cmake
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
# seems to be the default.
#
# This has no effect with MSVC, on that platform the version info for
# the DLL comes from the resource file win32/zlib1.rc
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
endif()
if(UNIX) write_basic_package_version_file(
# On unix-like platforms the library is almost always called libz "${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake"
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) VERSION "${zlib_VERSION}"
if(NOT APPLE) COMPATIBILITY AnyNewerVersion)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
elseif(BUILD_SHARED_LIBS AND WIN32)
# Creates zlib1.dll when building shared library version
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
endif()
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) install(FILES ${zlib_BINARY_DIR}/ZLIBConfig.cmake
install(TARGETS zlib zlibstatic ${zlib_BINARY_DIR}/ZLIBConfigVersion.cmake
RUNTIME DESTINATION "${INSTALL_BIN_DIR}" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/zlib)
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" install(
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) FILES ${ZLIB_PUBLIC_HDRS}
endif() COMPONENT Development
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") install(
endif() FILES zlib.3
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) COMPONENT Docs
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3") DESTINATION "${CMAKE_INSTALL_MANDIR}/man3")
endif() install(
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) FILES LICENSE
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") doc/algorithm.txt
endif() doc/crc-doc.1.0.pdf
doc/rfc1950.txt
doc/rfc1951.txt
doc/rfc1952.txt
doc/txtvsbin.txt
COMPONENT Docs
DESTINATION "${CMAKE_INSTALL_DOCDIR}/zlib")
install(
FILES ${ZLIB_PC}
COMPONENT Development
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif(ZLIB_INSTALL)
#============================================================================ # ============================================================================
# Example binaries # Tests
#============================================================================ # ============================================================================
if(ZLIB_BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif(ZLIB_BUILD_TESTING)
add_executable(example test/example.c) if(ZLIB_BUILD_MINIZIP)
target_link_libraries(example zlib) add_subdirectory(contrib/minizip/)
add_test(example example) endif(ZLIB_BUILD_MINIZIP)
add_executable(minigzip test/minigzip.c)
target_link_libraries(minigzip zlib)
if(HAVE_OFF64_T)
add_executable(example64 test/example.c)
target_link_libraries(example64 zlib)
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
add_test(example64 example64)
add_executable(minigzip64 test/minigzip.c)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()

218
deps/zlib/ChangeLog vendored
View File

@ -1,6 +1,112 @@
ChangeLog file for zlib ChangeLog file for zlib
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)
- Remove K&R function definitions and zlib2ansi
- Fix bug in deflateBound() for level 0 and memLevel 9
- Fix bug when gzungetc() is used immediately after gzopen()
- Fix bug when using gzflush() with a very small buffer
- Fix crash when gzsetparams() attempted for transparent write
- Fix test/example.c to work with FORCE_STORED
- Rewrite of zran in examples (see zran.c version history)
- Fix minizip to allow it to open an empty zip file
- Fix reading disk number start on zip64 files in minizip
- Fix logic error in minizip argument processing
- Add minizip testing to Makefile
- Read multiple bytes instead of byte-by-byte in minizip unzip.c
- Add memory sanitizer to configure (--memory)
- Various portability improvements
- Various documentation improvements
- Various spelling and typo corrections
Changes in 1.2.13 (13 Oct 2022)
- Fix configure issue that discarded provided CC definition
- Correct incorrect inputs provided to the CRC functions
- Repair prototypes and exporting of new CRC functions
- Fix inflateBack to detect invalid input with distances too far
- Have infback() deliver all of the available output up to any error
- Fix a bug when getting a gzip header extra field with inflate()
- Fix bug in block type selection when Z_FIXED used
- Tighten deflateBound bounds
- Remove deleted assembler code references
- Various portability and appearance improvements
Changes in 1.2.12 (27 Mar 2022)
- Cygwin does not have _wopen(), so do not create gzopen_w() there
- Permit a deflateParams() parameter change as soon as possible
- Limit hash table inserts after switch from stored deflate
- Fix bug when window full in deflate_stored()
- Fix CLEAR_HASH macro to be usable as a single statement
- Avoid a conversion error in gzseek when off_t type too small
- Have Makefile return non-zero error code on test failure
- Avoid some conversion warnings in gzread.c and gzwrite.c
- Update use of errno for newer Windows CE versions
- Small speedup to inflate [psumbera]
- Return an error if the gzputs string length can't fit in an int
- Add address checking in clang to -w option of configure
- Don't compute check value for raw inflate if asked to validate
- Handle case where inflateSync used when header never processed
- Avoid the use of ptrdiff_t
- Avoid an undefined behavior of memcpy() in gzappend()
- Avoid undefined behaviors of memcpy() in gz*printf()
- Avoid an undefined behavior of memcpy() in _tr_stored_block()
- Make the names in functions declarations identical to definitions
- Remove old assembler code in which bugs have manifested
- Fix deflateEnd() to not report an error at start of raw deflate
- Add legal disclaimer to README
- Emphasize the need to continue decompressing gzip members
- Correct the initialization requirements for deflateInit2()
- Fix a bug that can crash deflate on some input when using Z_FIXED
- Assure that the number of bits for deflatePrime() is valid
- Use a structure to make globals in enough.c evident
- Use a macro for the printf format of big_t in enough.c
- Clean up code style in enough.c, update version
- Use inline function instead of macro for index in enough.c
- Clarify that prefix codes are counted in enough.c
- Show all the codes for the maximum tables size in enough.c
- Add gznorm.c example, which normalizes gzip files
- Fix the zran.c example to work on a multiple-member gzip file
- Add tables for crc32_combine(), to speed it up by a factor of 200
- Add crc32_combine_gen() and crc32_combine_op() for fast combines
- Speed up software CRC-32 computation by a factor of 1.5 to 3
- Use atomic test and set, if available, for dynamic CRC tables
- Don't bother computing check value after successful inflateSync()
- Correct comment in crc32.c
- Add use of the ARMv8 crc32 instructions when requested
- Use ARM crc32 instructions if the ARM architecture has them
- Explicitly note that the 32-bit check values are 32 bits
- Avoid adding empty gzip member after gzflush with Z_FINISH
- Fix memory leak on error in gzlog.c
- Fix error in comment on the polynomial representation of a byte
- Clarify gz* function interfaces, referring to parameter names
- Change macro name in inflate.c to avoid collision in VxWorks
- Correct typo in blast.c
- Improve portability of contrib/minizip
- Fix indentation in minizip's zip.c
- Replace black/white with allow/block. (theresa-m)
- minizip warning fix if MAXU32 already defined. (gvollant)
- Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner)
- Clean up minizip to reduce warnings for testing
- Add fallthrough comments for gcc
- Eliminate use of ULL constants
- Separate out address sanitizing from warnings in configure
- Remove destructive aspects of make distclean
- Check for cc masquerading as gcc or clang in configure
- Fix crc32.c to compile local functions only if used
Changes in 1.2.11 (15 Jan 2017) Changes in 1.2.11 (15 Jan 2017)
- Fix deflate stored bug when pulling last block from window - Fix deflate stored bug when pulling last block from window
- Permit immediate deflateParams changes before any deflate input - Permit immediate deflateParams changes before any deflate input
@ -96,7 +202,7 @@ Changes in 1.2.7.1 (24 Mar 2013)
- Fix types in contrib/minizip to match result of get_crc_table() - Fix types in contrib/minizip to match result of get_crc_table()
- Simplify contrib/vstudio/vc10 with 'd' suffix - Simplify contrib/vstudio/vc10 with 'd' suffix
- Add TOP support to win32/Makefile.msc - Add TOP support to win32/Makefile.msc
- Suport i686 and amd64 assembler builds in CMakeLists.txt - Support i686 and amd64 assembler builds in CMakeLists.txt
- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h - Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
- Add vc11 and vc12 build files to contrib/vstudio - Add vc11 and vc12 build files to contrib/vstudio
- Add gzvprintf() as an undocumented function in zlib - Add gzvprintf() as an undocumented function in zlib
@ -296,14 +402,14 @@ Changes in 1.2.5.1 (10 Sep 2011)
- Use u4 type for crc_table to avoid conversion warnings - Use u4 type for crc_table to avoid conversion warnings
- Apply casts in zlib.h to avoid conversion warnings - Apply casts in zlib.h to avoid conversion warnings
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] - Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
- Improve inflateSync() documentation to note indeterminancy - Improve inflateSync() documentation to note indeterminacy
- Add deflatePending() function to return the amount of pending output - Add deflatePending() function to return the amount of pending output
- Correct the spelling of "specification" in FAQ [Randers-Pehrson] - Correct the spelling of "specification" in FAQ [Randers-Pehrson]
- Add a check in configure for stdarg.h, use for gzprintf() - Add a check in configure for stdarg.h, use for gzprintf()
- Check that pointers fit in ints when gzprint() compiled old style - Check that pointers fit in ints when gzprint() compiled old style
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] - Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] - Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
- Add debug records in assmebler code [Londer] - Add debug records in assembler code [Londer]
- Update RFC references to use http://tools.ietf.org/html/... [Li] - Update RFC references to use http://tools.ietf.org/html/... [Li]
- Add --archs option, use of libtool to configure for Mac OS X [Borstel] - Add --archs option, use of libtool to configure for Mac OS X [Borstel]
@ -511,7 +617,7 @@ Changes in 1.2.3.5 (8 Jan 2010)
- Don't use _vsnprintf on later versions of MSVC [Lowman] - Don't use _vsnprintf on later versions of MSVC [Lowman]
- Add CMake build script and input file [Lowman] - Add CMake build script and input file [Lowman]
- Update contrib/minizip to 1.1 [Svensson, Vollant] - Update contrib/minizip to 1.1 [Svensson, Vollant]
- Moved nintendods directory from contrib to . - Moved nintendods directory from contrib to root
- Replace gzio.c with a new set of routines with the same functionality - Replace gzio.c with a new set of routines with the same functionality
- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above - Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
- Update contrib/minizip to 1.1b - Update contrib/minizip to 1.1b
@ -685,7 +791,7 @@ Changes in 1.2.2.4 (11 July 2005)
- Be more strict on incomplete code sets in inflate_table() and increase - Be more strict on incomplete code sets in inflate_table() and increase
ENOUGH and MAXD -- this repairs a possible security vulnerability for ENOUGH and MAXD -- this repairs a possible security vulnerability for
invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for
discovering the vulnerability and providing test cases. discovering the vulnerability and providing test cases
- Add ia64 support to configure for HP-UX [Smith] - Add ia64 support to configure for HP-UX [Smith]
- Add error return to gzread() for format or i/o error [Levin] - Add error return to gzread() for format or i/o error [Levin]
- Use malloc.h for OS/2 [Necasek] - Use malloc.h for OS/2 [Necasek]
@ -721,7 +827,7 @@ Changes in 1.2.2.2 (30 December 2004)
- Add Z_FIXED strategy option to deflateInit2() to force fixed trees - Add Z_FIXED strategy option to deflateInit2() to force fixed trees
- Add updated make_vms.com [Coghlan], update README - Add updated make_vms.com [Coghlan], update README
- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - Create a new "examples" directory, move gzappend.c there, add zpipe.c,
fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html
- Add FAQ entry and comments in deflate.c on uninitialized memory access - Add FAQ entry and comments in deflate.c on uninitialized memory access
- Add Solaris 9 make options in configure [Gilbert] - Add Solaris 9 make options in configure [Gilbert]
- Allow strerror() usage in gzio.c for STDC - Allow strerror() usage in gzio.c for STDC
@ -792,7 +898,7 @@ Changes in 1.2.1.1 (9 January 2004)
- Fix a big fat bug in inftrees.c that prevented decoding valid - Fix a big fat bug in inftrees.c that prevented decoding valid
dynamic blocks with only literals and no distance codes -- dynamic blocks with only literals and no distance codes --
Thanks to "Hot Emu" for the bug report and sample file Thanks to "Hot Emu" for the bug report and sample file
- Add a note to puff.c on no distance codes case. - Add a note to puff.c on no distance codes case
Changes in 1.2.1 (17 November 2003) Changes in 1.2.1 (17 November 2003)
- Remove a tab in contrib/gzappend/gzappend.c - Remove a tab in contrib/gzappend/gzappend.c
@ -970,7 +1076,7 @@ Changes in 1.2.0.1 (17 March 2003)
- Include additional header file on VMS for off_t typedef - Include additional header file on VMS for off_t typedef
- Try to use _vsnprintf where it supplants vsprintf [Vollant] - Try to use _vsnprintf where it supplants vsprintf [Vollant]
- Add some casts in inffast.c - Add some casts in inffast.c
- Enchance comments in zlib.h on what happens if gzprintf() tries to - Enhance comments in zlib.h on what happens if gzprintf() tries to
write more than 4095 bytes before compression write more than 4095 bytes before compression
- Remove unused state from inflateBackEnd() - Remove unused state from inflateBackEnd()
- Remove exit(0) from minigzip.c, example.c - Remove exit(0) from minigzip.c, example.c
@ -1036,14 +1142,14 @@ Changes in 1.2.0 (9 March 2003)
- Add contrib/puff/ simple inflate for deflate format description - Add contrib/puff/ simple inflate for deflate format description
Changes in 1.1.4 (11 March 2002) Changes in 1.1.4 (11 March 2002)
- ZFREE was repeated on same allocation on some error conditions. - ZFREE was repeated on same allocation on some error conditions
This creates a security problem described in This creates a security problem described in
http://www.zlib.org/advisory-2002-03-11.txt http://www.zlib.org/advisory-2002-03-11.txt
- Returned incorrect error (Z_MEM_ERROR) on some invalid data - Returned incorrect error (Z_MEM_ERROR) on some invalid data
- Avoid accesses before window for invalid distances with inflate window - Avoid accesses before window for invalid distances with inflate window
less than 32K. less than 32K
- force windowBits > 8 to avoid a bug in the encoder for a window size - force windowBits > 8 to avoid a bug in the encoder for a window size
of 256 bytes. (A complete fix will be available in 1.1.5). of 256 bytes. (A complete fix will be available in 1.1.5)
Changes in 1.1.3 (9 July 1998) Changes in 1.1.3 (9 July 1998)
- fix "an inflate input buffer bug that shows up on rare but persistent - fix "an inflate input buffer bug that shows up on rare but persistent
@ -1117,7 +1223,7 @@ Changes in 1.1.1 (27 Feb 98)
- remove block truncation heuristic which had very marginal effect for zlib - remove block truncation heuristic which had very marginal effect for zlib
(smaller lit_bufsize than in gzip 1.2.4) and degraded a little the (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
compression ratio on some files. This also allows inlining _tr_tally for compression ratio on some files. This also allows inlining _tr_tally for
matches in deflate_slow. matches in deflate_slow
- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
Changes in 1.1.0 (24 Feb 98) Changes in 1.1.0 (24 Feb 98)
@ -1148,7 +1254,7 @@ Changes in 1.0.9 (17 Feb 1998)
- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 - Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) - in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
the declaration of FAR (Gilles VOllant) the declaration of FAR (Gilles Vollant)
- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) - install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
- read_buf buf parameter of type Bytef* instead of charf* - read_buf buf parameter of type Bytef* instead of charf*
- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) - zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
@ -1162,7 +1268,7 @@ Changes in 1.0.8 (27 Jan 1998)
- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) - include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
- use constant arrays for the static trees in trees.c instead of computing - use constant arrays for the static trees in trees.c instead of computing
them at run time (thanks to Ken Raeburn for this suggestion). To create them at run time (thanks to Ken Raeburn for this suggestion). To create
trees.h, compile with GEN_TREES_H and run "make test". trees.h, compile with GEN_TREES_H and run "make test"
- check return code of example in "make test" and display result - check return code of example in "make test" and display result
- pass minigzip command line options to file_compress - pass minigzip command line options to file_compress
- simplifying code of inflateSync to avoid gcc 2.8 bug - simplifying code of inflateSync to avoid gcc 2.8 bug
@ -1201,12 +1307,12 @@ Changes in 1.0.6 (19 Jan 1998)
- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
- Fix a deflate bug occurring only with compression level 0 (thanks to - Fix a deflate bug occurring only with compression level 0 (thanks to
Andy Buckler for finding this one). Andy Buckler for finding this one)
- In minigzip, pass transparently also the first byte for .Z files. - In minigzip, pass transparently also the first byte for .Z files
- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() - return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
- check Z_FINISH in inflate (thanks to Marc Schluper) - check Z_FINISH in inflate (thanks to Marc Schluper)
- Implement deflateCopy (thanks to Adam Costello) - Implement deflateCopy (thanks to Adam Costello)
- make static libraries by default in configure, add --shared option. - make static libraries by default in configure, add --shared option
- move MSDOS or Windows specific files to directory msdos - move MSDOS or Windows specific files to directory msdos
- suppress the notion of partial flush to simplify the interface - suppress the notion of partial flush to simplify the interface
(but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
@ -1218,7 +1324,7 @@ Changes in 1.0.6 (19 Jan 1998)
- added Makefile.nt (thanks to Stephen Williams) - added Makefile.nt (thanks to Stephen Williams)
- added the unsupported "contrib" directory: - added the unsupported "contrib" directory:
contrib/asm386/ by Gilles Vollant <info@winimage.com> contrib/asm386/ by Gilles Vollant <info@winimage.com>
386 asm code replacing longest_match(). 386 asm code replacing longest_match()
contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu> contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions A C++ I/O streams interface to the zlib gz* functions
contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no> contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
@ -1226,7 +1332,7 @@ Changes in 1.0.6 (19 Jan 1998)
contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es> contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
A very simple tar.gz file extractor using zlib A very simple tar.gz file extractor using zlib
contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl> contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
How to use compress(), uncompress() and the gz* functions from VB. How to use compress(), uncompress() and the gz* functions from VB
- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
level) in minigzip (thanks to Tom Lane) level) in minigzip (thanks to Tom Lane)
@ -1235,8 +1341,8 @@ Changes in 1.0.6 (19 Jan 1998)
- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) - add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
- add undocumented function zError to convert error code to string - add undocumented function zError to convert error code to string
(for Tim Smithers) (for Tim Smithers)
- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. - Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code
- Use default memcpy for Symantec MSDOS compiler. - Use default memcpy for Symantec MSDOS compiler
- Add EXPORT keyword for check_func (needed for Windows DLL) - Add EXPORT keyword for check_func (needed for Windows DLL)
- add current directory to LD_LIBRARY_PATH for "make test" - add current directory to LD_LIBRARY_PATH for "make test"
- create also a link for libz.so.1 - create also a link for libz.so.1
@ -1249,7 +1355,7 @@ Changes in 1.0.6 (19 Jan 1998)
- allow compilation with ANSI keywords only enabled for TurboC in large model - allow compilation with ANSI keywords only enabled for TurboC in large model
- avoid "versionString"[0] (Borland bug) - avoid "versionString"[0] (Borland bug)
- add NEED_DUMMY_RETURN for Borland - add NEED_DUMMY_RETURN for Borland
- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). - use variable z_verbose for tracing in debug mode (L. Peter Deutsch)
- allow compilation with CC - allow compilation with CC
- defined STDC for OS/2 (David Charlap) - defined STDC for OS/2 (David Charlap)
- limit external names to 8 chars for MVS (Thomas Lund) - limit external names to 8 chars for MVS (Thomas Lund)
@ -1259,7 +1365,7 @@ Changes in 1.0.6 (19 Jan 1998)
- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) - use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
- added makelcc.bat for lcc-win32 (Tom St Denis) - added makelcc.bat for lcc-win32 (Tom St Denis)
- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) - in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. - Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion
- check for unistd.h in configure (for off_t) - check for unistd.h in configure (for off_t)
- remove useless check parameter in inflate_blocks_free - remove useless check parameter in inflate_blocks_free
- avoid useless assignment of s->check to itself in inflate_blocks_new - avoid useless assignment of s->check to itself in inflate_blocks_new
@ -1280,7 +1386,7 @@ Changes in 1.0.5 (3 Jan 98)
Changes in 1.0.4 (24 Jul 96) Changes in 1.0.4 (24 Jul 96)
- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
bit, so the decompressor could decompress all the correct data but went bit, so the decompressor could decompress all the correct data but went
on to attempt decompressing extra garbage data. This affected minigzip too. on to attempt decompressing extra garbage data. This affected minigzip too
- zlibVersion and gzerror return const char* (needed for DLL) - zlibVersion and gzerror return const char* (needed for DLL)
- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) - port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
- use z_error only for DEBUG (avoid problem with DLLs) - use z_error only for DEBUG (avoid problem with DLLs)
@ -1310,7 +1416,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
- fix array overlay in deflate.c which sometimes caused bad compressed data - fix array overlay in deflate.c which sometimes caused bad compressed data
- fix inflate bug with empty stored block - fix inflate bug with empty stored block
- fix MSDOS medium model which was broken in 0.99 - fix MSDOS medium model which was broken in 0.99
- fix deflateParams() which could generate bad compressed data. - fix deflateParams() which could generate bad compressed data
- Bytef is define'd instead of typedef'ed (work around Borland bug) - Bytef is define'd instead of typedef'ed (work around Borland bug)
- added an INDEX file - added an INDEX file
- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
@ -1331,7 +1437,7 @@ Changes in 0.99 (27 Jan 96)
- allow preset dictionary shared between compressor and decompressor - allow preset dictionary shared between compressor and decompressor
- allow compression level 0 (no compression) - allow compression level 0 (no compression)
- add deflateParams in zlib.h: allow dynamic change of compression level - add deflateParams in zlib.h: allow dynamic change of compression level
and compression strategy. and compression strategy
- test large buffers and deflateParams in example.c - test large buffers and deflateParams in example.c
- add optional "configure" to build zlib as a shared library - add optional "configure" to build zlib as a shared library
- suppress Makefile.qnx, use configure instead - suppress Makefile.qnx, use configure instead
@ -1370,33 +1476,33 @@ Changes in 0.99 (27 Jan 96)
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) - fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
- in fcalloc, normalize pointer if size > 65520 bytes - in fcalloc, normalize pointer if size > 65520 bytes
- don't use special fcalloc for 32 bit Borland C++ - don't use special fcalloc for 32 bit Borland C++
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... - use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
- use Z_BINARY instead of BINARY - use Z_BINARY instead of BINARY
- document that gzclose after gzdopen will close the file - document that gzclose after gzdopen will close the file
- allow "a" as mode in gzopen. - allow "a" as mode in gzopen
- fix error checking in gzread - fix error checking in gzread
- allow skipping .gz extra-field on pipes - allow skipping .gz extra-field on pipes
- added reference to Perl interface in README - added reference to Perl interface in README
- put the crc table in FAR data (I dislike more and more the medium model :) - put the crc table in FAR data (I dislike more and more the medium model :)
- added get_crc_table - added get_crc_table
- added a dimension to all arrays (Borland C can't count). - added a dimension to all arrays (Borland C can't count)
- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast - workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
- guard against multiple inclusion of *.h (for precompiled header on Mac) - guard against multiple inclusion of *.h (for precompiled header on Mac)
- Watcom C pretends to be Microsoft C small model even in 32 bit mode. - Watcom C pretends to be Microsoft C small model even in 32 bit mode
- don't use unsized arrays to avoid silly warnings by Visual C++: - don't use unsized arrays to avoid silly warnings by Visual C++:
warning C4746: 'inflate_mask' : unsized array treated as '__far' warning C4746: 'inflate_mask' : unsized array treated as '__far'
(what's wrong with far data in far model?). (what's wrong with far data in far model?)
- define enum out of inflate_blocks_state to allow compilation with C++ - define enum out of inflate_blocks_state to allow compilation with C++
Changes in 0.95 (16 Aug 95) Changes in 0.95 (16 Aug 95)
- fix MSDOS small and medium model (now easier to adapt to any compiler) - fix MSDOS small and medium model (now easier to adapt to any compiler)
- inlined send_bits - inlined send_bits
- fix the final (:-) bug for deflate with flush (output was correct but - fix the final (:-) bug for deflate with flush (output was correct but
not completely flushed in rare occasions). not completely flushed in rare occasions)
- default window size is same for compression and decompression - default window size is same for compression and decompression
(it's now sufficient to set MAX_WBITS in zconf.h). (it's now sufficient to set MAX_WBITS in zconf.h)
- voidp -> voidpf and voidnp -> voidp (for consistency with other - voidp -> voidpf and voidnp -> voidp (for consistency with other
typedefs and because voidnp was not near in large model). typedefs and because voidnp was not near in large model)
Changes in 0.94 (13 Aug 95) Changes in 0.94 (13 Aug 95)
- support MSDOS medium model - support MSDOS medium model
@ -1405,12 +1511,12 @@ Changes in 0.94 (13 Aug 95)
- added support for VMS - added support for VMS
- allow a compression level in gzopen() - allow a compression level in gzopen()
- gzflush now calls fflush - gzflush now calls fflush
- For deflate with flush, flush even if no more input is provided. - For deflate with flush, flush even if no more input is provided
- rename libgz.a as libz.a - rename libgz.a as libz.a
- avoid complex expression in infcodes.c triggering Turbo C bug - avoid complex expression in infcodes.c triggering Turbo C bug
- work around a problem with gcc on Alpha (in INSERT_STRING) - work around a problem with gcc on Alpha (in INSERT_STRING)
- don't use inline functions (problem with some gcc versions) - don't use inline functions (problem with some gcc versions)
- allow renaming of Byte, uInt, etc... with #define. - allow renaming of Byte, uInt, etc... with #define
- avoid warning about (unused) pointer before start of array in deflate.c - avoid warning about (unused) pointer before start of array in deflate.c
- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c - avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
- avoid reserved word 'new' in trees.c - avoid reserved word 'new' in trees.c
@ -1429,7 +1535,7 @@ Changes in 0.92 (3 May 95)
- no memcpy on Pyramid - no memcpy on Pyramid
- suppressed inftest.c - suppressed inftest.c
- optimized fill_window, put longest_match inline for gcc - optimized fill_window, put longest_match inline for gcc
- optimized inflate on stored blocks. - optimized inflate on stored blocks
- untabify all sources to simplify patches - untabify all sources to simplify patches
Changes in 0.91 (2 May 95) Changes in 0.91 (2 May 95)
@ -1447,7 +1553,7 @@ Changes in 0.9 (1 May 95)
- let again gzread copy uncompressed data unchanged (was working in 0.71) - let again gzread copy uncompressed data unchanged (was working in 0.71)
- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented - deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
- added a test of inflateSync in example.c - added a test of inflateSync in example.c
- moved MAX_WBITS to zconf.h because users might want to change that. - moved MAX_WBITS to zconf.h because users might want to change that
- document explicitly that zalloc(64K) on MSDOS must return a normalized - document explicitly that zalloc(64K) on MSDOS must return a normalized
pointer (zero offset) pointer (zero offset)
- added Makefiles for Microsoft C, Turbo C, Borland C++ - added Makefiles for Microsoft C, Turbo C, Borland C++
@ -1456,7 +1562,7 @@ Changes in 0.9 (1 May 95)
Changes in 0.8 (29 April 95) Changes in 0.8 (29 April 95)
- added fast inflate (inffast.c) - added fast inflate (inffast.c)
- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
is incompatible with previous versions of zlib which returned Z_OK. is incompatible with previous versions of zlib which returned Z_OK
- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
(actually that was not a compiler bug, see 0.81 above) (actually that was not a compiler bug, see 0.81 above)
- gzread no longer reads one extra byte in certain cases - gzread no longer reads one extra byte in certain cases
@ -1466,50 +1572,50 @@ Changes in 0.8 (29 April 95)
Changes in 0.71 (14 April 95) Changes in 0.71 (14 April 95)
- Fixed more MSDOS compilation problems :( There is still a bug with - Fixed more MSDOS compilation problems :( There is still a bug with
TurboC large model. TurboC large model
Changes in 0.7 (14 April 95) Changes in 0.7 (14 April 95)
- Added full inflate support. - Added full inflate support
- Simplified the crc32() interface. The pre- and post-conditioning - Simplified the crc32() interface. The pre- and post-conditioning
(one's complement) is now done inside crc32(). WARNING: this is (one's complement) is now done inside crc32(). WARNING: this is
incompatible with previous versions; see zlib.h for the new usage. incompatible with previous versions; see zlib.h for the new usage
Changes in 0.61 (12 April 95) Changes in 0.61 (12 April 95)
- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - workaround for a bug in TurboC. example and minigzip now work on MSDOS
Changes in 0.6 (11 April 95) Changes in 0.6 (11 April 95)
- added minigzip.c - added minigzip.c
- added gzdopen to reopen a file descriptor as gzFile - added gzdopen to reopen a file descriptor as gzFile
- added transparent reading of non-gziped files in gzread. - added transparent reading of non-gziped files in gzread
- fixed bug in gzread (don't read crc as data) - fixed bug in gzread (don't read crc as data)
- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). - fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose)
- don't allocate big arrays in the stack (for MSDOS) - don't allocate big arrays in the stack (for MSDOS)
- fix some MSDOS compilation problems - fix some MSDOS compilation problems
Changes in 0.5: Changes in 0.5:
- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
not yet Z_FULL_FLUSH. not yet Z_FULL_FLUSH
- support decompression but only in a single step (forced Z_FINISH) - support decompression but only in a single step (forced Z_FINISH)
- added opaque object for zalloc and zfree. - added opaque object for zalloc and zfree
- added deflateReset and inflateReset - added deflateReset and inflateReset
- added a variable zlib_version for consistency checking. - added a variable zlib_version for consistency checking
- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - renamed the 'filter' parameter of deflateInit2 as 'strategy'
Added Z_FILTERED and Z_HUFFMAN_ONLY constants. Added Z_FILTERED and Z_HUFFMAN_ONLY constants
Changes in 0.4: Changes in 0.4:
- avoid "zip" everywhere, use zlib instead of ziplib. - avoid "zip" everywhere, use zlib instead of ziplib
- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
if compression method == 8. if compression method == 8
- added adler32 and crc32 - added adler32 and crc32
- renamed deflateOptions as deflateInit2, call one or the other but not both - renamed deflateOptions as deflateInit2, call one or the other but not both
- added the method parameter for deflateInit2. - added the method parameter for deflateInit2
- added inflateInit2 - added inflateInit2
- simplied considerably deflateInit and inflateInit by not supporting - simplified considerably deflateInit and inflateInit by not supporting
user-provided history buffer. This is supported only in deflateInit2 user-provided history buffer. This is supported only in deflateInit2
and inflateInit2. and inflateInit2
Changes in 0.3: Changes in 0.3:
- prefix all macro names with Z_ - prefix all macro names with Z_
- use Z_FINISH instead of deflateEnd to finish compression. - use Z_FINISH instead of deflateEnd to finish compression
- added Z_HUFFMAN_ONLY - added Z_HUFFMAN_ONLY
- added gzerror() - added gzerror()

7
deps/zlib/FAQ vendored
View File

@ -4,7 +4,7 @@
If your question is not there, please check the zlib home page If your question is not there, please check the zlib home page
http://zlib.net/ which may have more recent information. http://zlib.net/ which may have more recent information.
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html The latest zlib FAQ is at http://zlib.net/zlib_faq.html
1. Is zlib Y2K-compliant? 1. Is zlib Y2K-compliant?
@ -14,13 +14,12 @@ The lastest 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.

22
deps/zlib/LICENSE vendored Normal file
View File

@ -0,0 +1,22 @@
Copyright notice:
(C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu

9
deps/zlib/MODULE.bazel vendored Normal file
View File

@ -0,0 +1,9 @@
module(
name = "zlib",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.0.16")
bazel_dep(name = "rules_license", version = "1.0.0")

89
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:
@ -7,16 +7,14 @@
# Normally configure builds both a static and a shared library. # Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static # If you want to build just a static library, use: ./configure --static
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install # make install
# To install in $HOME instead of /usr/local, use: # To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME # make install prefix=$HOME
CC=cc CC=cc
GCOV=GCOV
LLVM_GCOV_FLAG=LLMV_GCOV_FLAG
CFLAGS=-O CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
@ -26,13 +24,13 @@ CFLAGS=-O
SFLAGS=-O SFLAGS=-O
LDFLAGS= LDFLAGS=
TEST_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.2.11 SHAREDLIBV=libz.so.1.3.1.1
SHAREDLIBM=libz.so.1 SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV) LIBS=$(STATICLIB) $(SHAREDLIBV)
@ -87,12 +85,12 @@ test: all teststatic testshared
teststatic: static teststatic: static
@TMPST=tmpst_$$; \ @TMPST=tmpst_$$; \
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
echo ' *** zlib test OK ***'; \ echo ' *** zlib test OK ***'; \
else \ else \
echo ' *** zlib test FAILED ***'; false; \ echo ' *** zlib test FAILED ***'; false; \
fi; \ fi
rm -f $$TMPST @rm -f tmpst_$$
testshared: shared testshared: shared
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
@ -100,32 +98,36 @@ testshared: shared
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \ TMPSH=tmpsh_$$; \
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
echo ' *** zlib shared test OK ***'; \ echo ' *** zlib shared test OK ***'; \
else \ else \
echo ' *** zlib shared test FAILED ***'; false; \ echo ' *** zlib shared test FAILED ***'; false; \
fi; \ fi
rm -f $$TMPSH @rm -f tmpsh_$$
test64: all64 test64: all64
@TMP64=tmp64_$$; \ @TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \ echo ' *** zlib 64-bit test OK ***'; \
else \ else \
echo ' *** zlib 64-bit test FAILED ***'; false; \ echo ' *** zlib 64-bit test FAILED ***'; false; \
fi; \ fi
rm -f $$TMP64 @rm -f tmp64_$$
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c $(CC) $(CFLAGS) $(ZINCOUT) -c -coverage -o $@ $(SRCDIR)test/infcover.c
infcover: infcover.o libz.a infcover: infcover.o libz.a
$(CC) $(CFLAGS) -o $@ infcover.o libz.a $(CC) $(CFLAGS) -coverage -o $@ infcover.o libz.a
cover: infcover cover: infcover
ifdef $(GCOV)
rm -f *.gcda rm -f *.gcda
./infcover ${QEMU_RUN} ./infcover
gcov inf*.c ${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda
else
@echo 'cover disabled as no suitable gcov was found'
endif
libz.a: $(OBJS) libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS)
@ -180,7 +182,7 @@ inftrees.o: $(SRCDIR)inftrees.c
trees.o: $(SRCDIR)trees.c trees.o: $(SRCDIR)trees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
zutil.o: $(SRCDIR)zutil.c zutil.o: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
compress.o: $(SRCDIR)compress.c compress.o: $(SRCDIR)compress.c
@ -242,7 +244,7 @@ trees.lo: $(SRCDIR)trees.c
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
-@mv objs/trees.o $@ -@mv objs/trees.o $@
zutil.lo: $(SRCDIR)zutil.c zutil.lo: $(SRCDIR)zutil.c $(SRCDIR)gzguts.h
-@mkdir objs 2>/dev/null || test -d objs -@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
-@mv objs/zutil.o $@ -@mv objs/zutil.o $@
@ -286,22 +288,22 @@ 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 -L. $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)
example64$(EXE): example64.o $(STATICLIB) 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
@ -353,18 +355,25 @@ docs: zlib.3.pdf
zlib.3.pdf: $(SRCDIR)zlib.3 zlib.3.pdf: $(SRCDIR)zlib.3
groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@ groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
zconf.h.cmakein: $(SRCDIR)zconf.h.in # zconf.h.cmakein: $(SRCDIR)zconf.h.in
-@ TEMPFILE=zconfh_$$; \ # -@ TEMPFILE=zconfh_$$; \
echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ # echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ # sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
touch -r $(SRCDIR)zconf.h.in $@ &&\ # touch -r $(SRCDIR)zconf.h.in $@ &&\
rm $$TEMPFILE # rm $$TEMPFILE
#
zconf: $(SRCDIR)zconf.h.in zconf: $(SRCDIR)zconf.h.in
cp -p $(SRCDIR)zconf.h.in zconf.h cp -p $(SRCDIR)zconf.h.in zconf.h
minizip-test: static
cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; }
minizip-clean:
cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; }
mostlyclean: clean mostlyclean: clean
clean: clean: minizip-clean
rm -f *.o *.lo *~ \ rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
example64$(EXE) minigzip64$(EXE) \ example64$(EXE) minigzip64$(EXE) \
@ -376,20 +385,19 @@ clean:
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
maintainer-clean: distclean maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs distclean: clean zconf # zconf.h.cmakein
rm -f Makefile zlib.pc configure.log rm -f Makefile zlib.pc configure.log
-@rm -f .DS_Store -@rm -f .DS_Store
@if [ -f Makefile.in ]; then \ @if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \ printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)Makefile.in Makefile ; fi touch -r $(SRCDIR)Makefile.in Makefile ; fi
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
tags: tags:
etags $(SRCDIR)*.[ch] etags $(SRCDIR)*.[ch]
adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h adler32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
@ -399,7 +407,8 @@ inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR
inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h adler32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h

26
deps/zlib/README vendored
View File

@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.11 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
@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997 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
http://marknelson.us/1997/01/01/zlib-engine/ . https://marknelson.us/posts/1997/01/01/zlib-engine.html .
The changes made in version 1.2.11 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/ .
zlib is available in Java using the java.util.zip package, documented at zlib is available in Java using the java.util.zip package. Follow the API
http://java.sun.com/developer/technicalArticles/Programming/compression/ . Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available A Perl interface to zlib and bzip2 written by Paul Marquess <pmqs@cpan.org>
at CPAN (Comprehensive Perl Archive Network) sites, including can be found at https://github.com/pmqs/IO-Compress .
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see available in Python 1.5 and later versions, see
@ -64,14 +63,12 @@ Notes for some targets:
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc. when compiled with cc.
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure. necessary to get gzprintf working correctly. This is done by configure.
- 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/
@ -84,7 +81,7 @@ Acknowledgments:
Copyright notice: Copyright notice:
(C) 1995-2017 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
@ -108,7 +105,10 @@ Copyright notice:
If you use the zlib library in a product, we would appreciate *not* receiving If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code. Gailly and Mark Adler; it does not include third-party code. We make all
contributions to and distributions of this project solely in our personal
capacity, and are not conveying any rights to any intellectual property of
any third parties.
If you redistribute modified sources, we would appreciate that you include in If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read the file ChangeLog history information documenting your changes. Please read

83
deps/zlib/README-cmake.md vendored Normal file
View File

@ -0,0 +1,83 @@
# For building with cmake at least version 3.12 (minizip 3.12) is needed
In most cases the usual
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
will create everything you need, however if you want something off default you can adjust several options fit your needs.
Every option is list below (excluding the cmake-standard options), they can be set via cmake-gui or on cmdline with
-D<option>=ON/OFF
## ZLIB-options with defaults ##
ZLIB_BUILD_TESTING=ON -- Enable Zlib Examples as tests
ZLIB_BUILD_SHARED=ON -- Enable building zlib shared library
ZLIB_BUILD_STATIC=ON -- Enable building zlib static library
ZLIB_BUILD_MINIZIP=ON -- Enable building libminizip contrib library
If this option is turned on, additional options are available from minizip (see below)
ZLIB_INSTALL=ON -- Enable installation of zlib
ZLIB_PREFIX=OFF -- prefix for all types and library functions, see zconf.h.in
ZLIB_INSTALL_COMPAT_DLL=ON -- Install a copy as zlib1.dll
This option is only on windows available and may/will be turned off and removed somewhen in the future.
If you rely cmake for finding and using zlib, this can be turned off, as `zlib1.dll` will never be used.
## minizip-options with defaults ##
MINIZIP_BUILD_SHARED=ON -- Enable building minizip shared library
MINIZIP_BUILD_STATIC=ON -- Enable building minizip static library
MINIZIP_BUILD_TESTING=ON -- Enable testing of minizip
MINIZIP_ENABLE_BZIP2=ON -- Build minizip withj bzip2 support
A usable installation of bzip2 is needed or config will fail. Turn this option of in this case.
MINIZIP_INSTALL=ON -- Enable installation of minizip
MINIZIP_INSTALL_COMPAT_DLL=ON -- Install a copy as libminizip-1.dll
This option is only available on mingw as they tend to name this lib different. Maybe this will also be
removed in the future as. If you rely cmake for finding and using zlib, this can be turned off, as
the other file will never be used.
## Using the libs ##
To pull in what you need it's enough to just write
find_package(ZLIB CONFIG)
or
find_package(minizip CONFIG)
in your CMakeLists.txt, however it is advised to specify what you really want via:
find_package(ZLIB CONFIG COMPONENTS shared static REQUIRED)
or
find_package(minizip CONFIG COMPONENTS shared static REQUIRED)
As it's possible to only build the shared or the static lib, you can make sure that everything you need
is found. If no COMPONENTS are requested, everything that is found will satisfy your request. If the
libraries are optional in you project, you can omit the REQUIRED and check yourself if the targets you
want to link against are created.
When you search for minizip, it will search zlib for you, so only one of both is needed.
## Imported targets ##
When found the following targets are created for you:
ZLIB::ZLIB and ZLIB::ZLIBSTATIC -- for zlib
MINIZIP::minizip and MINIZIP::minizipstatic -- for minizip

32
deps/zlib/adler32.c vendored
View File

@ -7,8 +7,6 @@
#include "zutil.h" #include "zutil.h"
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#define BASE 65521U /* largest prime smaller than 65536 */ #define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552 #define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif #endif
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32_z(adler, buf, len) uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
uLong adler;
const Bytef *buf;
z_size_t len;
{
unsigned long sum2; unsigned long sum2;
unsigned n; unsigned n;
@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len) uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
uLong adler;
const Bytef *buf;
uInt len;
{
return adler32_z(adler, buf, len); return adler32_z(adler, buf, len);
} }
/* ========================================================================= */ /* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2) local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
uLong adler1;
uLong adler2;
z_off64_t len2;
{
unsigned long sum1; unsigned long sum1;
unsigned long sum2; unsigned long sum2;
unsigned rem; unsigned rem;
@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2) uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
uLong adler1;
uLong adler2;
z_off_t len2;
{
return adler32_combine_(adler1, adler2, len2); return adler32_combine_(adler1, adler2, len2);
} }
uLong ZEXPORT adler32_combine64(adler1, adler2, len2) uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
uLong adler1;
uLong adler2;
z_off64_t len2;
{
return adler32_combine_(adler1, adler2, len2); return adler32_combine_(adler1, adler2, len2);
} }

21
deps/zlib/compress.c vendored
View File

@ -19,13 +19,8 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer, memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid. Z_STREAM_ERROR if the level parameter is invalid.
*/ */
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
Bytef *dest; uLong sourceLen, int level) {
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
{
z_stream stream; z_stream stream;
int err; int err;
const uInt max = (uInt)-1; const uInt max = (uInt)-1;
@ -65,12 +60,8 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
/* =========================================================================== /* ===========================================================================
*/ */
int ZEXPORT compress (dest, destLen, source, sourceLen) int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
Bytef *dest; uLong sourceLen) {
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
} }
@ -78,9 +69,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated. this function needs to be updated.
*/ */
uLong ZEXPORT compressBound (sourceLen) uLong ZEXPORT compressBound(uLong sourceLen) {
uLong sourceLen;
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13; (sourceLen >> 25) + 13;
} }

227
deps/zlib/configure vendored
View File

@ -25,15 +25,18 @@ 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
# set command prefix for cross-compilation # set command prefix for cross-compilation
if [ -n "${CHOST}" ]; then if [ -n "${CHOST}" ]; then
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" uname=${CHOST}
mname=${CHOST}
CROSS_PREFIX="${CHOST}-" CROSS_PREFIX="${CHOST}-"
else
mname=`(uname -a || echo unknown) 2>/dev/null`
fi fi
# destination name for static library # destination name for static library
@ -41,9 +44,8 @@ STATICLIB=libz.a
# extract zlib version numbers from zlib.h # extract zlib version numbers from zlib.h
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h` VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'`
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'`
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
# establish commands for library building # establish commands for library building
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
@ -85,8 +87,12 @@ zprefix=0
zconst=0 zconst=0
build64=0 build64=0
gcc=0 gcc=0
clang=0
warn=0 warn=0
debug=0 debug=0
address=0
memory=0
unknown=0
old_cc="$CC" old_cc="$CC"
old_cflags="$CFLAGS" old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)' OBJC='$(OBJZ) $(OBJG)'
@ -98,7 +104,7 @@ leave()
if test "$*" != "0"; then if test "$*" != "0"; then
echo "** $0 aborting." | tee -a configure.log echo "** $0 aborting." | tee -a configure.log
fi fi
rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version rm -rf $test.[co] $test $test$shared_ext $test.gcno $test.dSYM ./--version
echo -------------------- >> configure.log echo -------------------- >> configure.log
echo >> configure.log echo >> configure.log
echo >> configure.log echo >> configure.log
@ -137,12 +143,15 @@ case "$1" in
-c* | --const) zconst=1; shift ;; -c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;; -w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;; -d* | --debug) debug=1; shift ;;
*) --sanitize) address=1; shift ;;
echo "unknown option: $1" | tee -a configure.log --address) address=1; shift ;;
echo "$0 --help for help" | tee -a configure.log --memory) memory=1; shift ;;
leave 1;; *) unknown=1; echo "unknown option ignored: $1" | tee -a configure.log; shift;;
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$$
@ -165,25 +174,65 @@ extern int getchar();
int hello() {return getchar();} int hello() {return getchar();}
EOF EOF
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log if test -z "$CC"; then
cc=${CC-${CROSS_PREFIX}gcc} echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
cflags=${CFLAGS-"-O3"} if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure cc=${CROSS_PREFIX}gcc
else
cc=${CROSS_PREFIX}cc
fi
else
cc=${CC}
fi
case "$cc" in case "$cc" in
*gcc*) gcc=1 ;; *gcc*) gcc=1
*clang*) gcc=1 ;; GCOV="gcov" ;;
*clang*) gcc=1
clang=1 ;;
esac esac
case `$cc -v 2>&1` in case `$cc -v 2>&1` in
*gcc*) gcc=1 ;; *gcc*) gcc=1
*clang*) gcc=1 ;; GCOV="gcov" ;;
*clang*) gcc=1
clang=1 ;;
esac esac
if test "$clang" -eq 1; then
if test "$cc" = "clang"; then
if which -s llvm-cov; then
GCOV="llvm-cov"
LLVM_GCOV_FLAG="gcov"
GCOV="llvm-cov"
LLVM_GCOV_FLAG="gcov"
echo "Using ${GCOV} for coverage"
else
cover=0
GCOV=""
LLVM_GCOV_FLAG=""
echo "Deactivating cover as no suitable gcov can be found"
fi
else
clangV=`echo "$cc" | sed -e 's/^.*-//'`
if which -s llvm-cov-${clangV}; then
GCOV="llvm-cov-${clangV}"
LLVM_GCOV_FLAG="gcov"
echo "Using ${GCOV} for coverage"
else
cover=0
GCOV=""
LLVM_GCOV_FLAG=""
echo "Deactivating cover as no suitable gcov can be found"
fi
fi
fi
show $cc -c $test.c show $cc -c $test.c
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
echo ... using gcc >> configure.log echo ... using gcc >> configure.log
CC="$cc" CC="$cc"
CFLAGS="${CFLAGS--O3}" CFLAGS="${CFLAGS--O3} -fPIC"
SFLAGS="${CFLAGS--O3} -fPIC" SFLAGS="${CFLAGS--O3}"
if test "$ARCHS"; then if test "$ARCHS"; then
CFLAGS="${CFLAGS} ${ARCHS}" CFLAGS="${CFLAGS} ${ARCHS}"
LDFLAGS="${LDFLAGS} ${ARCHS}" LDFLAGS="${LDFLAGS} ${ARCHS}"
@ -194,11 +243,17 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
fi fi
if test "$warn" -eq 1; then if test "$warn" -eq 1; then
if test "$zconst" -eq 1; then if test "$zconst" -eq 1; then
CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -DZLIB_CONST"
else else
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" CFLAGS="${CFLAGS} -Wall -Wextra"
fi fi
fi fi
if test $address -eq 1; then
CFLAGS="${CFLAGS} -g -fsanitize=address -fno-omit-frame-pointer"
fi
if test $memory -eq 1; then
CFLAGS="${CFLAGS} -g -fsanitize=memory -fno-omit-frame-pointer"
fi
if test $debug -eq 1; then if test $debug -eq 1; then
CFLAGS="${CFLAGS} -DZLIB_DEBUG" CFLAGS="${CFLAGS} -DZLIB_DEBUG"
SFLAGS="${SFLAGS} -DZLIB_DEBUG" SFLAGS="${SFLAGS} -DZLIB_DEBUG"
@ -207,47 +262,55 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
uname=`(uname -s || echo unknown) 2>/dev/null` uname=`(uname -s || echo unknown) 2>/dev/null`
fi fi
case "$uname" in case "$uname" in
Linux* | linux* | GNU | GNU/* | solaris*) Linux* | linux* | *-linux* | GNU | GNU/* | solaris* | Haiku)
case "$mname" in
*sparc*)
LDFLAGS="${LDFLAGS} -Wl,--no-warn-rwx-segments" ;;
esac
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
*BSD | *bsd* | DragonFly) *BSD | *bsd* | DragonFly)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
LDCONFIG="ldconfig -m" ;; LDCONFIG="ldconfig -m" ;;
CYGWIN* | Cygwin* | cygwin* | OS/2*) CYGWIN* | Cygwin* | cygwin* | *-cygwin* | OS/2*)
EXE='.exe' ;; EXE='.exe' ;;
MINGW* | mingw*) MINGW* | mingw* | *-mingw*)
# temporary bypass
rm -f $test.[co] $test $test$shared_ext rm -f $test.[co] $test $test$shared_ext
echo "Please use win32/Makefile.gcc instead." | tee -a configure.log echo "If this doesn't work for you, try win32/Makefile.gcc." | tee -a configure.log
leave 1
LDSHARED=${LDSHARED-"$cc -shared"} LDSHARED=${LDSHARED-"$cc -shared"}
LDSHAREDLIBC="" LDSHAREDLIBC=""
EXE='.exe' ;; EXE='.exe' ;;
QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
# (alain.bonnefoy@icbt.com) # (alain.bonnefoy@icbt.com)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
HP-UX*) HP-UX*)
LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
case `(uname -m || echo unknown) 2>/dev/null` in case `(uname -m || echo unknown) 2>/dev/null` in
ia64) ia64)
shared_ext='.so' shared_ext='.so'
SHAREDLIB='libz.so' ;; SHAREDLIB='libz.so' ;;
*) *)
shared_ext='.sl' shared_ext='.sl'
SHAREDLIB='libz.sl' ;; SHAREDLIB='libz.sl' ;;
esac ;; esac ;;
Darwin* | darwin*) AIX*)
shared_ext='.dylib' LDSHARED=${LDSHARED-"$cc -shared"}
SHAREDLIB=libz$shared_ext LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
SHAREDLIBV=libz.$VER$shared_ext Darwin* | darwin* | *-darwin*)
SHAREDLIBM=libz.$VER1$shared_ext shared_ext='.dylib'
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} SHAREDLIB=libz$shared_ext
if libtool -V 2>&1 | grep Apple > /dev/null; then SHAREDLIBV=libz.$VER$shared_ext
AR="libtool" SHAREDLIBM=libz.$VER1$shared_ext
else LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
AR="/usr/bin/libtool" if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
fi AR="${CROSS_PREFIX}libtool"
ARFLAGS="-o" ;; elif libtool -V 2>&1 | grep Apple > /dev/null; then
*) LDSHARED=${LDSHARED-"$cc -shared"} ;; AR="libtool"
else
AR="/usr/bin/libtool"
fi
ARFLAGS="-o" ;;
*)
LDSHARED=${LDSHARED-"$cc -shared"} ;;
esac esac
else else
# find system name and corresponding cc options # find system name and corresponding cc options
@ -367,8 +430,11 @@ else
try() try()
{ {
show $* show $*
( $* ) >> configure.log 2>&1 got=`( $* ) 2>&1`
ret=$? ret=$?
if test "$got" != ""; then
printf "%s\n" "$got" >> configure.log
fi
if test $ret -ne 0; then if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log echo "(exit code "$ret")" >> configure.log
fi fi
@ -381,8 +447,11 @@ tryboth()
show $* show $*
got=`( $* ) 2>&1` got=`( $* ) 2>&1`
ret=$? ret=$?
printf %s "$got" >> configure.log if test "$got" != ""; then
printf "%s\n" "$got" >> configure.log
fi
if test $ret -ne 0; then if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
return $ret return $ret
fi fi
test "$got" = "" test "$got" = ""
@ -409,7 +478,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
@ -433,20 +502,6 @@ else
TEST="all teststatic testshared" TEST="all teststatic testshared"
fi fi
# check for underscores in external names for use by assembler code
CPP=${CPP-"$CC -E"}
case $CFLAGS in
*ASMV*)
echo >> configure.log
show "$NM $test.o | grep _hello"
if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
CPP="$CPP -DNO_UNDERLINE"
echo Checking for underline in external names... No. | tee -a configure.log
else
echo Checking for underline in external names... Yes. | tee -a configure.log
fi ;;
esac
echo >> configure.log echo >> configure.log
# check for size_t # check for size_t
@ -457,17 +512,11 @@ size_t dummy = 0;
EOF EOF
if try $CC -c $CFLAGS $test.c; then if try $CC -c $CFLAGS $test.c; then
echo "Checking for size_t... Yes." | tee -a configure.log echo "Checking for size_t... Yes." | tee -a configure.log
need_sizet=0
else else
echo "Checking for size_t... No." | tee -a configure.log echo "Checking for size_t... No." | tee -a configure.log
need_sizet=1 # find a size_t integer type
fi # check for long long
cat > $test.c << EOF
echo >> configure.log
# find the size_t integer type, if needed
if test $need_sizet -eq 1; then
cat > $test.c <<EOF
long long dummy = 0; long long dummy = 0;
EOF EOF
if try $CC -c $CFLAGS $test.c; then if try $CC -c $CFLAGS $test.c; then
@ -495,17 +544,13 @@ EOF
if try $CC $CFLAGS -o $test $test.c; then if try $CC $CFLAGS -o $test $test.c; then
sizet=`./$test` sizet=`./$test`
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
else else
echo "Failed to find a pointer-size integer type." | tee -a configure.log echo "Checking for a pointer-size integer type... not found." | tee -a configure.log
leave 1
fi fi
fi fi
if test $need_sizet -eq 1; then
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi
echo >> configure.log echo >> configure.log
# check for large file support, and if none, check for fseeko() # check for large file support, and if none, check for fseeko()
@ -566,7 +611,7 @@ cat > $test.c <<EOF
int main() { return 0; } int main() { return 0; }
EOF EOF
if try $CC -c $CFLAGS $test.c; then if try $CC -c $CFLAGS $test.c; then
sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h sed < zconf.h "/^#if HAVE_UNISTD_H-0.* may be/s/ HAVE_UNISTD_H-0\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h mv zconf.temp.h zconf.h
echo "Checking for unistd.h... Yes." | tee -a configure.log echo "Checking for unistd.h... Yes." | tee -a configure.log
else else
@ -581,7 +626,7 @@ cat > $test.c <<EOF
int main() { return 0; } int main() { return 0; }
EOF EOF
if try $CC -c $CFLAGS $test.c; then if try $CC -c $CFLAGS $test.c; then
sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h sed < zconf.h "/^#if HAVE_STDARG_H-0.* may be/s/ HAVE_STDARG_H-0\(.*\) may be/ 1\1 was/" > zconf.temp.h
mv zconf.temp.h zconf.h mv zconf.temp.h zconf.h
echo "Checking for stdarg.h... Yes." | tee -a configure.log echo "Checking for stdarg.h... Yes." | tee -a configure.log
else else
@ -609,7 +654,6 @@ fi
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X # if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
if test $cover -eq 1; then if test $cover -eq 1; then
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
if test -n "$GCC_CLASSIC"; then if test -n "$GCC_CLASSIC"; then
CC=$GCC_CLASSIC CC=$GCC_CLASSIC
fi fi
@ -849,7 +893,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
echo STATICLIB = $STATICLIB >> configure.log echo STATICLIB = $STATICLIB >> configure.log
echo TEST = $TEST >> configure.log echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log echo VER = $VER >> configure.log
echo Z_U4 = $Z_U4 >> configure.log
echo SRCDIR = $SRCDIR >> configure.log echo SRCDIR = $SRCDIR >> configure.log
echo exec_prefix = $exec_prefix >> configure.log echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log echo includedir = $includedir >> configure.log
@ -859,9 +902,11 @@ echo prefix = $prefix >> configure.log
echo sharedlibdir = $sharedlibdir >> configure.log echo sharedlibdir = $sharedlibdir >> configure.log
echo uname = $uname >> configure.log echo uname = $uname >> configure.log
# udpate Makefile with the configure results # update Makefile with the configure results
sed < ${SRCDIR}Makefile.in " sed < ${SRCDIR}Makefile.in "
/^CC *=/s#=.*#=$CC# /^CC *=/s#=.*#=$CC#
/^GCOV *=/s#=.*#=$GCOV#
/^LLVM_GCOV_FLAG *=/s#=.*#=$LLVM_GCOV_FLAG#
/^CFLAGS *=/s#=.*#=$CFLAGS# /^CFLAGS *=/s#=.*#=$CFLAGS#
/^SFLAGS *=/s#=.*#=$SFLAGS# /^SFLAGS *=/s#=.*#=$SFLAGS#
/^LDFLAGS *=/s#=.*#=$LDFLAGS# /^LDFLAGS *=/s#=.*#=$LDFLAGS#

View File

@ -1,4 +1,4 @@
All files under this contrib directory are UNSUPPORTED. There were All files under this contrib directory are UNSUPPORTED. They were
provided by users of zlib and were not tested by the authors of zlib. provided by users of zlib and were not tested by the authors of zlib.
Use at your own risk. Please contact the authors of the contributions Use at your own risk. Please contact the authors of the contributions
for help about these, not the zlib authors. Thanks. for help about these, not the zlib authors. Thanks.
@ -8,14 +8,6 @@ ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
Support for Ada Support for Ada
See http://zlib-ada.sourceforge.net/ See http://zlib-ada.sourceforge.net/
amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
asm code for AMD64
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
asm686/ by Brian Raiter <breadbox@muppetlabs.com>
asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
See http://www.muppetlabs.com/~breadbox/software/assembly.html
blast/ by Mark Adler <madler@alumni.caltech.edu> blast/ by Mark Adler <madler@alumni.caltech.edu>
Decompressor for output of PKWare Data Compression Library (DCL) Decompressor for output of PKWare Data Compression Library (DCL)
@ -32,9 +24,6 @@ gcc_gvmat64/by Gilles Vollant <info@winimage.com>
infback9/ by Mark Adler <madler@alumni.caltech.edu> infback9/ by Mark Adler <madler@alumni.caltech.edu>
Unsupported diffs to infback to decode the deflate64 format Unsupported diffs to infback to decode the deflate64 format
inflate86/ by Chris Anderson <christop@charm.net>
Tuned x86 gcc asm code to replace inflate_fast()
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu> iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions A C++ I/O streams interface to the zlib gz* functions
@ -45,16 +34,6 @@ iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
and Kevin Ruland <kevin@rodin.wustl.edu> and Kevin Ruland <kevin@rodin.wustl.edu>
Yet another C++ I/O streams interface Yet another C++ I/O streams interface
masmx64/ by Gilles Vollant <info@winimage.com>
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
replace longest_match() and inflate_fast(), also masm x86
64-bits translation of Chris Anderson inflate_fast()
masmx86/ by Gilles Vollant <info@winimage.com>
x86 asm code to replace longest_match() and inflate_fast(),
for Visual C++ and MASM (32 bits).
Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
minizip/ by Gilles Vollant <info@winimage.com> minizip/ by Gilles Vollant <info@winimage.com>
Mini zip and unzip based on zlib Mini zip and unzip based on zlib
Includes Zip64 support by Mathias Svensson <mathias@result42.com> Includes Zip64 support by Mathias Svensson <mathias@result42.com>

View File

@ -2,14 +2,14 @@
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.
Here are the main changes since ZLib.Ada 1.2: Here are the main changes since ZLib.Ada 1.2:
- Attension: ZLib.Read generic routine have a initialization requirement - Attention: ZLib.Read generic routine have a initialization requirement
for Read_Last parameter now. It is a bit incompartible with previous version, for Read_Last parameter now. It is a bit incompatible with previous version,
but extends functionality, we could use new parameters Allow_Read_Some and but extends functionality, we could use new parameters Allow_Read_Some and
Flush now. Flush now.

View File

@ -65,12 +65,12 @@ procedure Test is
Time_Stamp : Ada.Calendar.Time; Time_Stamp : Ada.Calendar.Time;
procedure Generate_File; procedure Generate_File;
-- Generate file of spetsified size with some random data. -- Generate file of specified size with some random data.
-- The random data is repeatable, for the good compression. -- The random data is repeatable, for the good compression.
procedure Compare_Streams procedure Compare_Streams
(Left, Right : in out Root_Stream_Type'Class); (Left, Right : in out Root_Stream_Type'Class);
-- The procedure compearing data in 2 streams. -- The procedure comparing data in 2 streams.
-- It is for compare data before and after compression/decompression. -- It is for compare data before and after compression/decompression.
procedure Compare_Files (Left, Right : String); procedure Compare_Files (Left, Right : String);

View File

@ -62,7 +62,7 @@ package ZLib.Streams is
:= Default_Buffer_Size; := Default_Buffer_Size;
Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset
:= Default_Buffer_Size); := Default_Buffer_Size);
-- Create the Comression/Decompression stream. -- Create the Compression/Decompression stream.
-- If mode is In_Stream then Write operation is disabled. -- If mode is In_Stream then Write operation is disabled.
-- If mode is Out_Stream then Read operation is disabled. -- If mode is Out_Stream then Read operation is disabled.

View File

@ -12,7 +12,8 @@ package body ZLib.Thin is
ZLIB_VERSION : constant Chars_Ptr := zlibVersion; ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit; Dummy : Z_Stream;
Z_Stream_Size : constant Int := Dummy'Size / System.Storage_Unit;
-------------- --------------
-- Avail_In -- -- Avail_In --

View File

@ -204,7 +204,7 @@ package body ZLib is
end if; end if;
-- We allow ZLib to make header only in case of default header type. -- We allow ZLib to make header only in case of default header type.
-- Otherwise we would either do header by ourselfs, or do not do -- Otherwise we would either do header by ourselves, or do not do
-- header at all. -- header at all.
if Header = None or else Header = GZip then if Header = None or else Header = GZip then

View File

@ -114,7 +114,7 @@ package ZLib is
-- Compression strategy constants -- -- Compression strategy constants --
------------------------------------ ------------------------------------
-- RLE stategy could be used only in version 1.2.0 and later. -- RLE strategy could be used only in version 1.2.0 and later.
Filtered : constant Strategy_Type; Filtered : constant Strategy_Type;
Huffman_Only : constant Strategy_Type; Huffman_Only : constant Strategy_Type;

View File

@ -1,452 +0,0 @@
/*
* match.S -- optimized version of longest_match()
* based on the similar work by Gilles Vollant, and Brian Raiter, written 1998
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the BSD License. Use by owners of Che Guevarra
* parafernalia is prohibited, where possible, and highly discouraged
* elsewhere.
*/
#ifndef NO_UNDERLINE
# define match_init _match_init
# define longest_match _longest_match
#endif
#define scanend ebx
#define scanendw bx
#define chainlenwmask edx /* high word: current chain len low word: s->wmask */
#define curmatch rsi
#define curmatchd esi
#define windowbestlen r8
#define scanalign r9
#define scanalignd r9d
#define window r10
#define bestlen r11
#define bestlend r11d
#define scanstart r12d
#define scanstartw r12w
#define scan r13
#define nicematch r14d
#define limit r15
#define limitd r15d
#define prev rcx
/*
* The 258 is a "magic number, not a parameter -- changing it
* breaks the hell loose
*/
#define MAX_MATCH (258)
#define MIN_MATCH (3)
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
/* stack frame offsets */
#define LocalVarsSize (112)
#define _chainlenwmask ( 8-LocalVarsSize)(%rsp)
#define _windowbestlen (16-LocalVarsSize)(%rsp)
#define save_r14 (24-LocalVarsSize)(%rsp)
#define save_rsi (32-LocalVarsSize)(%rsp)
#define save_rbx (40-LocalVarsSize)(%rsp)
#define save_r12 (56-LocalVarsSize)(%rsp)
#define save_r13 (64-LocalVarsSize)(%rsp)
#define save_r15 (80-LocalVarsSize)(%rsp)
.globl match_init, longest_match
/*
* On AMD64 the first argument of a function (in our case -- the pointer to
* deflate_state structure) is passed in %rdi, hence our offsets below are
* all off of that.
*/
/* you can check the structure offset by running
#include <stdlib.h>
#include <stdio.h>
#include "deflate.h"
void print_depl()
{
deflate_state ds;
deflate_state *s=&ds;
printf("size pointer=%u\n",(int)sizeof(void*));
printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s)));
printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s)));
printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s)));
printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s)));
printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s)));
printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s)));
printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s)));
printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s)));
printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s)));
printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s)));
printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s)));
printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s)));
printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s)));
}
*/
/*
to compile for XCode 3.2 on MacOSX x86_64
- run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S"
*/
#ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE
#define dsWSize ( 68)(%rdi)
#define dsWMask ( 76)(%rdi)
#define dsWindow ( 80)(%rdi)
#define dsPrev ( 96)(%rdi)
#define dsMatchLen (144)(%rdi)
#define dsPrevMatch (148)(%rdi)
#define dsStrStart (156)(%rdi)
#define dsMatchStart (160)(%rdi)
#define dsLookahead (164)(%rdi)
#define dsPrevLen (168)(%rdi)
#define dsMaxChainLen (172)(%rdi)
#define dsGoodMatch (188)(%rdi)
#define dsNiceMatch (192)(%rdi)
#else
#ifndef STRUCT_OFFSET
# define STRUCT_OFFSET (0)
#endif
#define dsWSize ( 56 + STRUCT_OFFSET)(%rdi)
#define dsWMask ( 64 + STRUCT_OFFSET)(%rdi)
#define dsWindow ( 72 + STRUCT_OFFSET)(%rdi)
#define dsPrev ( 88 + STRUCT_OFFSET)(%rdi)
#define dsMatchLen (136 + STRUCT_OFFSET)(%rdi)
#define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi)
#define dsStrStart (148 + STRUCT_OFFSET)(%rdi)
#define dsMatchStart (152 + STRUCT_OFFSET)(%rdi)
#define dsLookahead (156 + STRUCT_OFFSET)(%rdi)
#define dsPrevLen (160 + STRUCT_OFFSET)(%rdi)
#define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi)
#define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi)
#define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi)
#endif
.text
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
longest_match:
/*
* Retrieve the function arguments. %curmatch will hold cur_match
* throughout the entire function (passed via rsi on amd64).
* rdi will hold the pointer to the deflate_state (first arg on amd64)
*/
mov %rsi, save_rsi
mov %rbx, save_rbx
mov %r12, save_r12
mov %r13, save_r13
mov %r14, save_r14
mov %r15, save_r15
/* uInt wmask = s->w_mask; */
/* unsigned chain_length = s->max_chain_length; */
/* if (s->prev_length >= s->good_match) { */
/* chain_length >>= 2; */
/* } */
movl dsPrevLen, %eax
movl dsGoodMatch, %ebx
cmpl %ebx, %eax
movl dsWMask, %eax
movl dsMaxChainLen, %chainlenwmask
jl LastMatchGood
shrl $2, %chainlenwmask
LastMatchGood:
/* chainlen is decremented once beforehand so that the function can */
/* use the sign flag instead of the zero flag for the exit test. */
/* It is then shifted into the high word, to make room for the wmask */
/* value, which it will always accompany. */
decl %chainlenwmask
shll $16, %chainlenwmask
orl %eax, %chainlenwmask
/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
movl dsNiceMatch, %eax
movl dsLookahead, %ebx
cmpl %eax, %ebx
jl LookaheadLess
movl %eax, %ebx
LookaheadLess: movl %ebx, %nicematch
/* register Bytef *scan = s->window + s->strstart; */
mov dsWindow, %window
movl dsStrStart, %limitd
lea (%limit, %window), %scan
/* Determine how many bytes the scan ptr is off from being */
/* dword-aligned. */
mov %scan, %scanalign
negl %scanalignd
andl $3, %scanalignd
/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
movl dsWSize, %eax
subl $MIN_LOOKAHEAD, %eax
xorl %ecx, %ecx
subl %eax, %limitd
cmovng %ecx, %limitd
/* int best_len = s->prev_length; */
movl dsPrevLen, %bestlend
/* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */
lea (%window, %bestlen), %windowbestlen
mov %windowbestlen, _windowbestlen
/* register ush scan_start = *(ushf*)scan; */
/* register ush scan_end = *(ushf*)(scan+best_len-1); */
/* Posf *prev = s->prev; */
movzwl (%scan), %scanstart
movzwl -1(%scan, %bestlen), %scanend
mov dsPrev, %prev
/* Jump into the main loop. */
movl %chainlenwmask, _chainlenwmask
jmp LoopEntry
.balign 16
/* do {
* match = s->window + cur_match;
* if (*(ushf*)(match+best_len-1) != scan_end ||
* *(ushf*)match != scan_start) continue;
* [...]
* } while ((cur_match = prev[cur_match & wmask]) > limit
* && --chain_length != 0);
*
* Here is the inner loop of the function. The function will spend the
* majority of its time in this loop, and majority of that time will
* be spent in the first ten instructions.
*/
LookupLoop:
andl %chainlenwmask, %curmatchd
movzwl (%prev, %curmatch, 2), %curmatchd
cmpl %limitd, %curmatchd
jbe LeaveNow
subl $0x00010000, %chainlenwmask
js LeaveNow
LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw
jne LookupLoop
cmpw %scanstartw, (%window, %curmatch)
jne LookupLoop
/* Store the current value of chainlen. */
movl %chainlenwmask, _chainlenwmask
/* %scan is the string under scrutiny, and %prev to the string we */
/* are hoping to match it up with. In actuality, %esi and %edi are */
/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
/* initialized to -(MAX_MATCH_8 - scanalign). */
mov $(-MAX_MATCH_8), %rdx
lea (%curmatch, %window), %windowbestlen
lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen
lea MAX_MATCH_8(%scan, %scanalign), %prev
/* the prefetching below makes very little difference... */
prefetcht1 (%windowbestlen, %rdx)
prefetcht1 (%prev, %rdx)
/*
* Test the strings for equality, 8 bytes at a time. At the end,
* adjust %rdx so that it is offset to the exact byte that mismatched.
*
* It should be confessed that this loop usually does not represent
* much of the total running time. Replacing it with a more
* straightforward "rep cmpsb" would not drastically degrade
* performance -- unrolling it, for example, makes no difference.
*/
#undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */
LoopCmps:
#ifdef USE_SSE
/* Preload the SSE registers */
movdqu (%windowbestlen, %rdx), %xmm1
movdqu (%prev, %rdx), %xmm2
pcmpeqb %xmm2, %xmm1
movdqu 16(%windowbestlen, %rdx), %xmm3
movdqu 16(%prev, %rdx), %xmm4
pcmpeqb %xmm4, %xmm3
movdqu 32(%windowbestlen, %rdx), %xmm5
movdqu 32(%prev, %rdx), %xmm6
pcmpeqb %xmm6, %xmm5
movdqu 48(%windowbestlen, %rdx), %xmm7
movdqu 48(%prev, %rdx), %xmm8
pcmpeqb %xmm8, %xmm7
/* Check the comparisions' results */
pmovmskb %xmm1, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
/* this is the only iteration of the loop with a possibility of having
incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40
and (0x40*4)+8=0x108 */
add $8, %rdx
jz LenMaximum
add $8, %rdx
pmovmskb %xmm3, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
add $16, %rdx
pmovmskb %xmm5, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
add $16, %rdx
pmovmskb %xmm7, %rax
notw %ax
bsfw %ax, %ax
jnz LeaveLoopCmps
add $16, %rdx
jmp LoopCmps
LeaveLoopCmps: add %rax, %rdx
#else
mov (%windowbestlen, %rdx), %rax
xor (%prev, %rdx), %rax
jnz LeaveLoopCmps
mov 8(%windowbestlen, %rdx), %rax
xor 8(%prev, %rdx), %rax
jnz LeaveLoopCmps8
mov 16(%windowbestlen, %rdx), %rax
xor 16(%prev, %rdx), %rax
jnz LeaveLoopCmps16
add $24, %rdx
jnz LoopCmps
jmp LenMaximum
# if 0
/*
* This three-liner is tantalizingly simple, but bsf is a slow instruction,
* and the complicated alternative down below is quite a bit faster. Sad...
*/
LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */
shrl $3, %eax /* divide by 8 to get the byte */
add %rax, %rdx
# else
LeaveLoopCmps16:
add $8, %rdx
LeaveLoopCmps8:
add $8, %rdx
LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */
jnz Check16
add $4, %rdx
shr $32, %rax
Check16: testw $0xFFFF, %ax
jnz LenLower
add $2, %rdx
shrl $16, %eax
LenLower: subb $1, %al
adc $0, %rdx
# endif
#endif
/* Calculate the length of the match. If it is longer than MAX_MATCH, */
/* then automatically accept it as the best possible match and leave. */
lea (%prev, %rdx), %rax
sub %scan, %rax
cmpl $MAX_MATCH, %eax
jge LenMaximum
/* If the length of the match is not longer than the best match we */
/* have so far, then forget it and return to the lookup loop. */
cmpl %bestlend, %eax
jg LongerMatch
mov _windowbestlen, %windowbestlen
mov dsPrev, %prev
movl _chainlenwmask, %edx
jmp LookupLoop
/* s->match_start = cur_match; */
/* best_len = len; */
/* if (len >= nice_match) break; */
/* scan_end = *(ushf*)(scan+best_len-1); */
LongerMatch:
movl %eax, %bestlend
movl %curmatchd, dsMatchStart
cmpl %nicematch, %eax
jge LeaveNow
lea (%window, %bestlen), %windowbestlen
mov %windowbestlen, _windowbestlen
movzwl -1(%scan, %rax), %scanend
mov dsPrev, %prev
movl _chainlenwmask, %chainlenwmask
jmp LookupLoop
/* Accept the current string, with the maximum possible length. */
LenMaximum:
movl $MAX_MATCH, %bestlend
movl %curmatchd, dsMatchStart
/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
/* return s->lookahead; */
LeaveNow:
movl dsLookahead, %eax
cmpl %eax, %bestlend
cmovngl %bestlend, %eax
LookaheadRet:
/* Restore the registers and return from whence we came. */
mov save_rsi, %rsi
mov save_rbx, %rbx
mov save_r12, %r12
mov save_r13, %r13
mov save_r14, %r14
mov save_r15, %r15
ret
match_init: ret

View File

@ -1,51 +0,0 @@
This is a patched version of zlib, modified to use
Pentium-Pro-optimized assembly code in the deflation algorithm. The
files changed/added by this patch are:
README.686
match.S
The speedup that this patch provides varies, depending on whether the
compiler used to build the original version of zlib falls afoul of the
PPro's speed traps. My own tests show a speedup of around 10-20% at
the default compression level, and 20-30% using -9, against a version
compiled using gcc 2.7.2.3. Your mileage may vary.
Note that this code has been tailored for the PPro/PII in particular,
and will not perform particuarly well on a Pentium.
If you are using an assembler other than GNU as, you will have to
translate match.S to use your assembler's syntax. (Have fun.)
Brian Raiter
breadbox@muppetlabs.com
April, 1998
Added for zlib 1.1.3:
The patches come from
http://www.muppetlabs.com/~breadbox/software/assembly.html
To compile zlib with this asm file, copy match.S to the zlib directory
then do:
CFLAGS="-O3 -DASMV" ./configure
make OBJA=match.o
Update:
I've been ignoring these assembly routines for years, believing that
gcc's generated code had caught up with it sometime around gcc 2.95
and the major rearchitecting of the Pentium 4. However, I recently
learned that, despite what I believed, this code still has some life
in it. On the Pentium 4 and AMD64 chips, it continues to run about 8%
faster than the code produced by gcc 4.1.
In acknowledgement of its continuing usefulness, I've altered the
license to match that of the rest of zlib. Share and Enjoy!
Brian Raiter
breadbox@muppetlabs.com
April, 2007

View File

@ -1,357 +0,0 @@
/* match.S -- x86 assembly version of the zlib longest_match() function.
* Optimized for the Intel 686 chips (PPro and later).
*
* Copyright (C) 1998, 2007 Brian Raiter <breadbox@muppetlabs.com>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the author be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef NO_UNDERLINE
#define match_init _match_init
#define longest_match _longest_match
#endif
#define MAX_MATCH (258)
#define MIN_MATCH (3)
#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
/* stack frame offsets */
#define chainlenwmask 0 /* high word: current chain len */
/* low word: s->wmask */
#define window 4 /* local copy of s->window */
#define windowbestlen 8 /* s->window + bestlen */
#define scanstart 16 /* first two bytes of string */
#define scanend 12 /* last two bytes of string */
#define scanalign 20 /* dword-misalignment of string */
#define nicematch 24 /* a good enough match size */
#define bestlen 28 /* size of best match so far */
#define scan 32 /* ptr to string wanting match */
#define LocalVarsSize (36)
/* saved ebx 36 */
/* saved edi 40 */
/* saved esi 44 */
/* saved ebp 48 */
/* return address 52 */
#define deflatestate 56 /* the function arguments */
#define curmatch 60
/* All the +zlib1222add offsets are due to the addition of fields
* in zlib in the deflate_state structure since the asm code was first written
* (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
* (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
* if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
*/
#define zlib1222add (8)
#define dsWSize (36+zlib1222add)
#define dsWMask (44+zlib1222add)
#define dsWindow (48+zlib1222add)
#define dsPrev (56+zlib1222add)
#define dsMatchLen (88+zlib1222add)
#define dsPrevMatch (92+zlib1222add)
#define dsStrStart (100+zlib1222add)
#define dsMatchStart (104+zlib1222add)
#define dsLookahead (108+zlib1222add)
#define dsPrevLen (112+zlib1222add)
#define dsMaxChainLen (116+zlib1222add)
#define dsGoodMatch (132+zlib1222add)
#define dsNiceMatch (136+zlib1222add)
.file "match.S"
.globl match_init, longest_match
.text
/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
.cfi_sections .debug_frame
longest_match:
.cfi_startproc
/* Save registers that the compiler may be using, and adjust %esp to */
/* make room for our stack frame. */
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset ebp, -8
pushl %edi
.cfi_def_cfa_offset 12
pushl %esi
.cfi_def_cfa_offset 16
pushl %ebx
.cfi_def_cfa_offset 20
subl $LocalVarsSize, %esp
.cfi_def_cfa_offset LocalVarsSize+20
/* Retrieve the function arguments. %ecx will hold cur_match */
/* throughout the entire function. %edx will hold the pointer to the */
/* deflate_state structure during the function's setup (before */
/* entering the main loop). */
movl deflatestate(%esp), %edx
movl curmatch(%esp), %ecx
/* uInt wmask = s->w_mask; */
/* unsigned chain_length = s->max_chain_length; */
/* if (s->prev_length >= s->good_match) { */
/* chain_length >>= 2; */
/* } */
movl dsPrevLen(%edx), %eax
movl dsGoodMatch(%edx), %ebx
cmpl %ebx, %eax
movl dsWMask(%edx), %eax
movl dsMaxChainLen(%edx), %ebx
jl LastMatchGood
shrl $2, %ebx
LastMatchGood:
/* chainlen is decremented once beforehand so that the function can */
/* use the sign flag instead of the zero flag for the exit test. */
/* It is then shifted into the high word, to make room for the wmask */
/* value, which it will always accompany. */
decl %ebx
shll $16, %ebx
orl %eax, %ebx
movl %ebx, chainlenwmask(%esp)
/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
movl dsNiceMatch(%edx), %eax
movl dsLookahead(%edx), %ebx
cmpl %eax, %ebx
jl LookaheadLess
movl %eax, %ebx
LookaheadLess: movl %ebx, nicematch(%esp)
/* register Bytef *scan = s->window + s->strstart; */
movl dsWindow(%edx), %esi
movl %esi, window(%esp)
movl dsStrStart(%edx), %ebp
lea (%esi,%ebp), %edi
movl %edi, scan(%esp)
/* Determine how many bytes the scan ptr is off from being */
/* dword-aligned. */
movl %edi, %eax
negl %eax
andl $3, %eax
movl %eax, scanalign(%esp)
/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
movl dsWSize(%edx), %eax
subl $MIN_LOOKAHEAD, %eax
subl %eax, %ebp
jg LimitPositive
xorl %ebp, %ebp
LimitPositive:
/* int best_len = s->prev_length; */
movl dsPrevLen(%edx), %eax
movl %eax, bestlen(%esp)
/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
addl %eax, %esi
movl %esi, windowbestlen(%esp)
/* register ush scan_start = *(ushf*)scan; */
/* register ush scan_end = *(ushf*)(scan+best_len-1); */
/* Posf *prev = s->prev; */
movzwl (%edi), %ebx
movl %ebx, scanstart(%esp)
movzwl -1(%edi,%eax), %ebx
movl %ebx, scanend(%esp)
movl dsPrev(%edx), %edi
/* Jump into the main loop. */
movl chainlenwmask(%esp), %edx
jmp LoopEntry
.balign 16
/* do {
* match = s->window + cur_match;
* if (*(ushf*)(match+best_len-1) != scan_end ||
* *(ushf*)match != scan_start) continue;
* [...]
* } while ((cur_match = prev[cur_match & wmask]) > limit
* && --chain_length != 0);
*
* Here is the inner loop of the function. The function will spend the
* majority of its time in this loop, and majority of that time will
* be spent in the first ten instructions.
*
* Within this loop:
* %ebx = scanend
* %ecx = curmatch
* %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
* %esi = windowbestlen - i.e., (window + bestlen)
* %edi = prev
* %ebp = limit
*/
LookupLoop:
andl %edx, %ecx
movzwl (%edi,%ecx,2), %ecx
cmpl %ebp, %ecx
jbe LeaveNow
subl $0x00010000, %edx
js LeaveNow
LoopEntry: movzwl -1(%esi,%ecx), %eax
cmpl %ebx, %eax
jnz LookupLoop
movl window(%esp), %eax
movzwl (%eax,%ecx), %eax
cmpl scanstart(%esp), %eax
jnz LookupLoop
/* Store the current value of chainlen. */
movl %edx, chainlenwmask(%esp)
/* Point %edi to the string under scrutiny, and %esi to the string we */
/* are hoping to match it up with. In actuality, %esi and %edi are */
/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
/* initialized to -(MAX_MATCH_8 - scanalign). */
movl window(%esp), %esi
movl scan(%esp), %edi
addl %ecx, %esi
movl scanalign(%esp), %eax
movl $(-MAX_MATCH_8), %edx
lea MAX_MATCH_8(%edi,%eax), %edi
lea MAX_MATCH_8(%esi,%eax), %esi
/* Test the strings for equality, 8 bytes at a time. At the end,
* adjust %edx so that it is offset to the exact byte that mismatched.
*
* We already know at this point that the first three bytes of the
* strings match each other, and they can be safely passed over before
* starting the compare loop. So what this code does is skip over 0-3
* bytes, as much as necessary in order to dword-align the %edi
* pointer. (%esi will still be misaligned three times out of four.)
*
* It should be confessed that this loop usually does not represent
* much of the total running time. Replacing it with a more
* straightforward "rep cmpsb" would not drastically degrade
* performance.
*/
LoopCmps:
movl (%esi,%edx), %eax
xorl (%edi,%edx), %eax
jnz LeaveLoopCmps
movl 4(%esi,%edx), %eax
xorl 4(%edi,%edx), %eax
jnz LeaveLoopCmps4
addl $8, %edx
jnz LoopCmps
jmp LenMaximum
LeaveLoopCmps4: addl $4, %edx
LeaveLoopCmps: testl $0x0000FFFF, %eax
jnz LenLower
addl $2, %edx
shrl $16, %eax
LenLower: subb $1, %al
adcl $0, %edx
/* Calculate the length of the match. If it is longer than MAX_MATCH, */
/* then automatically accept it as the best possible match and leave. */
lea (%edi,%edx), %eax
movl scan(%esp), %edi
subl %edi, %eax
cmpl $MAX_MATCH, %eax
jge LenMaximum
/* If the length of the match is not longer than the best match we */
/* have so far, then forget it and return to the lookup loop. */
movl deflatestate(%esp), %edx
movl bestlen(%esp), %ebx
cmpl %ebx, %eax
jg LongerMatch
movl windowbestlen(%esp), %esi
movl dsPrev(%edx), %edi
movl scanend(%esp), %ebx
movl chainlenwmask(%esp), %edx
jmp LookupLoop
/* s->match_start = cur_match; */
/* best_len = len; */
/* if (len >= nice_match) break; */
/* scan_end = *(ushf*)(scan+best_len-1); */
LongerMatch: movl nicematch(%esp), %ebx
movl %eax, bestlen(%esp)
movl %ecx, dsMatchStart(%edx)
cmpl %ebx, %eax
jge LeaveNow
movl window(%esp), %esi
addl %eax, %esi
movl %esi, windowbestlen(%esp)
movzwl -1(%edi,%eax), %ebx
movl dsPrev(%edx), %edi
movl %ebx, scanend(%esp)
movl chainlenwmask(%esp), %edx
jmp LookupLoop
/* Accept the current string, with the maximum possible length. */
LenMaximum: movl deflatestate(%esp), %edx
movl $MAX_MATCH, bestlen(%esp)
movl %ecx, dsMatchStart(%edx)
/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
/* return s->lookahead; */
LeaveNow:
movl deflatestate(%esp), %edx
movl bestlen(%esp), %ebx
movl dsLookahead(%edx), %eax
cmpl %eax, %ebx
jg LookaheadRet
movl %ebx, %eax
LookaheadRet:
/* Restore the stack and return from whence we came. */
addl $LocalVarsSize, %esp
.cfi_def_cfa_offset 20
popl %ebx
.cfi_def_cfa_offset 16
popl %esi
.cfi_def_cfa_offset 12
popl %edi
.cfi_def_cfa_offset 8
popl %ebp
.cfi_def_cfa_offset 4
.cfi_endproc
match_init: ret

View File

@ -57,7 +57,7 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
* use by the application to pass an input descriptor to infun(), if desired. * use by the application to pass an input descriptor to infun(), if desired.
* *
* If left and in are not NULL and *left is not zero when blast() is called, * If left and in are not NULL and *left is not zero when blast() is called,
* then the *left bytes are *in are consumed for input before infun() is used. * then the *left bytes at *in are consumed for input before infun() is used.
* *
* The output function is invoked: err = outfun(how, buf, len), where the bytes * The output function is invoked: err = outfun(how, buf, len), where the bytes
* to be written are buf[0..len-1]. If err is not zero, then blast() returns * to be written are buf[0..len-1]. If err is not zero, then blast() returns

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.2.11'; 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)
@ -61,7 +61,7 @@ namespace DotZLib
/// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception> /// <exception cref="ArgumentException">The sum of offset and count is larger than the length of <c>data</c></exception>
/// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception> /// <exception cref="NullReferenceException"><c>data</c> is a null reference</exception>
/// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception> /// <exception cref="ArgumentOutOfRangeException">Offset or count is negative.</exception>
/// <remarks>All the other <c>Update</c> methods are implmeneted in terms of this one. /// <remarks>All the other <c>Update</c> methods are implemented in terms of this one.
/// This is therefore the only method a derived class has to implement</remarks> /// This is therefore the only method a derived class has to implement</remarks>
public abstract void Update(byte[] data, int offset, int count); public abstract void Update(byte[] data, int offset, int count);

View File

@ -139,7 +139,7 @@ namespace DotZLib
/// <remarks>This must be implemented by a derived class</remarks> /// <remarks>This must be implemented by a derived class</remarks>
protected abstract void CleanUp(); protected abstract void CleanUp();
// performs the release of the handles and calls the dereived CleanUp() // performs the release of the handles and calls the derived CleanUp()
private void CleanUp(bool isDisposing) private void CleanUp(bool isDisposing)
{ {
if (!_isDisposed) if (!_isDisposed)
@ -160,7 +160,7 @@ namespace DotZLib
#region Helper methods #region Helper methods
/// <summary> /// <summary>
/// Copies a number of bytes to the internal codec buffer - ready for proccesing /// Copies a number of bytes to the internal codec buffer - ready for processing
/// </summary> /// </summary>
/// <param name="data">The byte array that contains the data to copy</param> /// <param name="data">The byte array that contains the data to copy</param>
/// <param name="startIndex">The index of the first byte to copy</param> /// <param name="startIndex">The index of the first byte to copy</param>

View File

@ -246,7 +246,7 @@ namespace DotZLib
} }
/// <summary> /// <summary>
/// Not suppported. /// Not supported.
/// </summary> /// </summary>
/// <param name="offset"></param> /// <param name="offset"></param>
/// <param name="origin"></param> /// <param name="origin"></param>
@ -268,7 +268,7 @@ namespace DotZLib
} }
/// <summary> /// <summary>
/// Gets/sets the current position in the <c>GZipStream</c>. Not suppported. /// Gets/sets the current position in the <c>GZipStream</c>. Not supported.
/// </summary> /// </summary>
/// <remarks>In this implementation this property is not supported</remarks> /// <remarks>In this implementation this property is not supported</remarks>
/// <exception cref="NotSupportedException">Always thrown</exception> /// <exception cref="NotSupportedException">Always thrown</exception>
@ -285,7 +285,7 @@ namespace DotZLib
} }
/// <summary> /// <summary>
/// Gets the size of the stream. Not suppported. /// Gets the size of the stream. Not supported.
/// </summary> /// </summary>
/// <remarks>In this implementation this property is not supported</remarks> /// <remarks>In this implementation this property is not supported</remarks>
/// <exception cref="NotSupportedException">Always thrown</exception> /// <exception cref="NotSupportedException">Always thrown</exception>

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.2.11", 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

@ -36,7 +36,7 @@ Build instructions:
in the same directory as the DotZLib.build file. in the same directory as the DotZLib.build file.
You can define 2 properties on the nant command-line to control the build: You can define 2 properties on the nant command-line to control the build:
debug={true|false} to toggle between release/debug builds (default=true). debug={true|false} to toggle between release/debug builds (default=true).
nunit={true|false} to include or esclude unit tests (default=true). nunit={true|false} to include or exclude unit tests (default=true).
Also the target clean will remove binaries. Also the target clean will remove binaries.
Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release
or ./DotZLib/bin/debug, depending on whether you are building the release or ./DotZLib/bin/debug, depending on whether you are building the release

File diff suppressed because it is too large Load Diff

View File

@ -16,12 +16,8 @@
window is a user-supplied window and output buffer that is 64K bytes. window is a user-supplied window and output buffer that is 64K bytes.
*/ */
int ZEXPORT inflateBack9Init_(strm, window, version, stream_size) int ZEXPORT inflateBack9Init_(z_stream FAR *strm, unsigned char FAR *window,
z_stream FAR *strm; const char *version, int stream_size) {
unsigned char FAR *window;
const char *version;
int stream_size;
{
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
@ -51,8 +47,7 @@ int stream_size;
#ifdef MAKEFIXED #ifdef MAKEFIXED
#include <stdio.h> #include <stdio.h>
void makefixed9(void) void makefixed9(void) {
{
unsigned sym, bits, low, size; unsigned sym, bits, low, size;
code *next, *lenfix, *distfix; code *next, *lenfix, *distfix;
struct inflate_state state; struct inflate_state state;
@ -214,13 +209,8 @@ void makefixed9(void)
inflateBack() can also return Z_STREAM_ERROR if the input parameters inflateBack() can also return Z_STREAM_ERROR if the input parameters
are not correct, i.e. strm is Z_NULL or the state was not initialized. are not correct, i.e. strm is Z_NULL or the state was not initialized.
*/ */
int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc) int ZEXPORT inflateBack9(z_stream FAR *strm, in_func in, void FAR *in_desc,
z_stream FAR *strm; out_func out, void FAR *out_desc) {
in_func in;
void FAR *in_desc;
out_func out;
void FAR *out_desc;
{
struct inflate_state FAR *state; struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */ z_const unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */ unsigned char FAR *put; /* next output */
@ -303,7 +293,7 @@ void FAR *out_desc;
mode = TABLE; mode = TABLE;
break; break;
case 3: case 3:
strm->msg = (char *)"invalid block type"; strm->msg = (z_const char *)"invalid block type";
mode = BAD; mode = BAD;
} }
DROPBITS(2); DROPBITS(2);
@ -314,7 +304,7 @@ void FAR *out_desc;
BYTEBITS(); /* go to byte boundary */ BYTEBITS(); /* go to byte boundary */
NEEDBITS(32); NEEDBITS(32);
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
strm->msg = (char *)"invalid stored block lengths"; strm->msg = (z_const char *)"invalid stored block lengths";
mode = BAD; mode = BAD;
break; break;
} }
@ -351,7 +341,7 @@ void FAR *out_desc;
state->ncode = BITS(4) + 4; state->ncode = BITS(4) + 4;
DROPBITS(4); DROPBITS(4);
if (state->nlen > 286) { if (state->nlen > 286) {
strm->msg = (char *)"too many length symbols"; strm->msg = (z_const char *)"too many length symbols";
mode = BAD; mode = BAD;
break; break;
} }
@ -372,7 +362,7 @@ void FAR *out_desc;
ret = inflate_table9(CODES, state->lens, 19, &(state->next), ret = inflate_table9(CODES, state->lens, 19, &(state->next),
&(lenbits), state->work); &(lenbits), state->work);
if (ret) { if (ret) {
strm->msg = (char *)"invalid code lengths set"; strm->msg = (z_const char *)"invalid code lengths set";
mode = BAD; mode = BAD;
break; break;
} }
@ -396,7 +386,7 @@ void FAR *out_desc;
NEEDBITS(here.bits + 2); NEEDBITS(here.bits + 2);
DROPBITS(here.bits); DROPBITS(here.bits);
if (state->have == 0) { if (state->have == 0) {
strm->msg = (char *)"invalid bit length repeat"; strm->msg = (z_const char *)"invalid bit length repeat";
mode = BAD; mode = BAD;
break; break;
} }
@ -419,7 +409,7 @@ void FAR *out_desc;
DROPBITS(7); DROPBITS(7);
} }
if (state->have + copy > state->nlen + state->ndist) { if (state->have + copy > state->nlen + state->ndist) {
strm->msg = (char *)"invalid bit length repeat"; strm->msg = (z_const char *)"invalid bit length repeat";
mode = BAD; mode = BAD;
break; break;
} }
@ -433,7 +423,7 @@ void FAR *out_desc;
/* check for end-of-block code (better have one) */ /* check for end-of-block code (better have one) */
if (state->lens[256] == 0) { if (state->lens[256] == 0) {
strm->msg = (char *)"invalid code -- missing end-of-block"; strm->msg = (z_const char *)"invalid code -- missing end-of-block";
mode = BAD; mode = BAD;
break; break;
} }
@ -447,7 +437,7 @@ void FAR *out_desc;
ret = inflate_table9(LENS, state->lens, state->nlen, ret = inflate_table9(LENS, state->lens, state->nlen,
&(state->next), &(lenbits), state->work); &(state->next), &(lenbits), state->work);
if (ret) { if (ret) {
strm->msg = (char *)"invalid literal/lengths set"; strm->msg = (z_const char *)"invalid literal/lengths set";
mode = BAD; mode = BAD;
break; break;
} }
@ -457,7 +447,7 @@ void FAR *out_desc;
state->ndist, &(state->next), &(distbits), state->ndist, &(state->next), &(distbits),
state->work); state->work);
if (ret) { if (ret) {
strm->msg = (char *)"invalid distances set"; strm->msg = (z_const char *)"invalid distances set";
mode = BAD; mode = BAD;
break; break;
} }
@ -505,7 +495,7 @@ void FAR *out_desc;
/* invalid code */ /* invalid code */
if (here.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid literal/length code"; strm->msg = (z_const char *)"invalid literal/length code";
mode = BAD; mode = BAD;
break; break;
} }
@ -537,7 +527,7 @@ void FAR *out_desc;
} }
DROPBITS(here.bits); DROPBITS(here.bits);
if (here.op & 64) { if (here.op & 64) {
strm->msg = (char *)"invalid distance code"; strm->msg = (z_const char *)"invalid distance code";
mode = BAD; mode = BAD;
break; break;
} }
@ -551,7 +541,7 @@ void FAR *out_desc;
DROPBITS(extra); DROPBITS(extra);
} }
if (offset > WSIZE - (wrap ? 0: left)) { if (offset > WSIZE - (wrap ? 0: left)) {
strm->msg = (char *)"invalid distance too far back"; strm->msg = (z_const char *)"invalid distance too far back";
mode = BAD; mode = BAD;
break; break;
} }
@ -603,9 +593,7 @@ void FAR *out_desc;
return ret; return ret;
} }
int ZEXPORT inflateBack9End(strm) int ZEXPORT inflateBack9End(z_stream FAR *strm) {
z_stream FAR *strm;
{
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
ZFREE(strm, strm->state); ZFREE(strm, strm->state);

View File

@ -20,14 +20,14 @@
extern "C" { extern "C" {
#endif #endif
ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm, ZEXTERN int ZEXPORT inflateBack9(z_stream FAR *strm,
in_func in, void FAR *in_desc, in_func in, void FAR *in_desc,
out_func out, void FAR *out_desc)); out_func out, void FAR *out_desc);
ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm)); ZEXTERN int ZEXPORT inflateBack9End(z_stream FAR *strm);
ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm, ZEXTERN int ZEXPORT inflateBack9Init_(z_stream FAR *strm,
unsigned char FAR *window, unsigned char FAR *window,
const char *version, const char *version,
int stream_size)); int stream_size);
#define inflateBack9Init(strm, window) \ #define inflateBack9Init(strm, window) \
inflateBack9Init_((strm), (window), \ inflateBack9Init_((strm), (window), \
ZLIB_VERSION, sizeof(z_stream)) ZLIB_VERSION, sizeof(z_stream))

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-2017 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.2.11 Copyright 1995-2017 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
@ -29,14 +29,9 @@ const char inflate9_copyright[] =
table index bits. It will differ if the request is greater than the table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code. longest code or if it is less than the shortest code.
*/ */
int inflate_table9(type, lens, codes, table, bits, work) int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes,
codetype type; code FAR * FAR *table, unsigned FAR *bits,
unsigned short FAR *lens; unsigned short FAR *work) {
unsigned codes;
code FAR * FAR *table;
unsigned FAR *bits;
unsigned short FAR *work;
{
unsigned len; /* a code's length in bits */ unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */ unsigned sym; /* index of code symbols */
unsigned min, max; /* minimum and maximum code lengths */ unsigned min, max; /* minimum and maximum code lengths */
@ -64,7 +59,7 @@ unsigned short FAR *work;
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, 77, 202}; 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

@ -38,11 +38,11 @@ typedef struct {
/* Maximum size of the dynamic table. The maximum number of code structures is /* Maximum size of the dynamic table. The maximum number of code structures is
1446, which is the sum of 852 for literal/length codes and 594 for distance 1446, which is the sum of 852 for literal/length codes and 594 for distance
codes. These values were found by exhaustive searches using the program codes. These values were found by exhaustive searches using the program
examples/enough.c found in the zlib distribtution. The arguments to that examples/enough.c found in the zlib distribution. The arguments to that
program are the number of symbols, the initial root table size, and the program are the number of symbols, the initial root table size, and the
maximum bit length of a code. "enough 286 9 15" for literal/length codes maximum bit length of a code. "enough 286 9 15" for literal/length codes
returns returns 852, and "enough 32 6 15" for distance codes returns 594. returns 852, and "enough 32 6 15" for distance codes returns 594. The
The initial root table size (9 or 6) is found in the fifth argument of the initial root table size (9 or 6) is found in the fifth argument of the
inflate_table() calls in infback9.c. If the root table size is changed, inflate_table() calls in infback9.c. If the root table size is changed,
then these maximum sizes would be need to be recalculated and updated. */ then these maximum sizes would be need to be recalculated and updated. */
#define ENOUGH_LENS 852 #define ENOUGH_LENS 852
@ -56,6 +56,6 @@ typedef enum {
DISTS DISTS
} codetype; } codetype;
extern int inflate_table9 OF((codetype type, unsigned short FAR *lens, extern int inflate_table9(codetype type, unsigned short FAR *lens,
unsigned codes, code FAR * FAR *table, unsigned codes, code FAR * FAR *table,
unsigned FAR *bits, unsigned short FAR *work)); unsigned FAR *bits, unsigned short FAR *work);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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,2 +0,0 @@
ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
ml64.exe /Flgvmat64 /c /Zi gvmat64.asm

View File

@ -1,553 +0,0 @@
;uInt longest_match_x64(
; deflate_state *s,
; IPos cur_match); /* current match */
; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86_64
; (AMD64 on Athlon 64, Opteron, Phenom
; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7)
; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
;
; File written by Gilles Vollant, by converting to assembly the longest_match
; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
;
; and by taking inspiration on asm686 with masm, optimised assembly code
; from Brian Raiter, written 1998
;
; This software is provided 'as-is', without any express or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not be
; misrepresented as being the original software
; 3. This notice may not be removed or altered from any source distribution.
;
;
;
; http://www.zlib.net
; http://www.winimage.com/zLibDll
; http://www.muppetlabs.com/~breadbox/software/assembly.html
;
; to compile this file for infozip Zip, I use option:
; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm
;
; to compile this file for zLib, I use option:
; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
; Be carrefull to adapt zlib1222add below to your version of zLib
; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change
; value of zlib1222add later)
;
; This file compile with Microsoft Macro Assembler (x64) for AMD64
;
; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK
;
; (you can get Windows WDK with ml64 for AMD64 from
; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price)
;
;uInt longest_match(s, cur_match)
; deflate_state *s;
; IPos cur_match; /* current match */
.code
longest_match PROC
;LocalVarsSize equ 88
LocalVarsSize equ 72
; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12
; free register : r14,r15
; register can be saved : rsp
chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len
; low word: s->wmask
;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10
;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11
;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w
;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx
;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13
;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d
;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9
IFDEF INFOZIP
ELSE
nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size
ENDIF
save_rdi equ rsp + 24 - LocalVarsSize
save_rsi equ rsp + 32 - LocalVarsSize
save_rbx equ rsp + 40 - LocalVarsSize
save_rbp equ rsp + 48 - LocalVarsSize
save_r12 equ rsp + 56 - LocalVarsSize
save_r13 equ rsp + 64 - LocalVarsSize
;save_r14 equ rsp + 72 - LocalVarsSize
;save_r15 equ rsp + 80 - LocalVarsSize
; summary of register usage
; scanend ebx
; scanendw bx
; chainlenwmask edx
; curmatch rsi
; curmatchd esi
; windowbestlen r8
; scanalign r9
; scanalignd r9d
; window r10
; bestlen r11
; bestlend r11d
; scanstart r12d
; scanstartw r12w
; scan r13
; nicematch r14d
; limit r15
; limitd r15d
; prev rcx
; all the +4 offsets are due to the addition of pending_buf_size (in zlib
; in the deflate_state structure since the asm code was first written
; (if you compile with zlib 1.0.4 or older, remove the +4).
; Note : these value are good with a 8 bytes boundary pack structure
MAX_MATCH equ 258
MIN_MATCH equ 3
MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
;;; Offsets for fields in the deflate_state structure. These numbers
;;; are calculated from the definition of deflate_state, with the
;;; assumption that the compiler will dword-align the fields. (Thus,
;;; changing the definition of deflate_state could easily cause this
;;; program to crash horribly, without so much as a warning at
;;; compile time. Sigh.)
; all the +zlib1222add offsets are due to the addition of fields
; in zlib in the deflate_state structure since the asm code was first written
; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
IFDEF INFOZIP
_DATA SEGMENT
COMM window_size:DWORD
; WMask ; 7fff
COMM window:BYTE:010040H
COMM prev:WORD:08000H
; MatchLen : unused
; PrevMatch : unused
COMM strstart:DWORD
COMM match_start:DWORD
; Lookahead : ignore
COMM prev_length:DWORD ; PrevLen
COMM max_chain_length:DWORD
COMM good_match:DWORD
COMM nice_match:DWORD
prev_ad equ OFFSET prev
window_ad equ OFFSET window
nicematch equ nice_match
_DATA ENDS
WMask equ 07fffh
ELSE
IFNDEF zlib1222add
zlib1222add equ 8
ENDIF
dsWSize equ 56+zlib1222add+(zlib1222add/2)
dsWMask equ 64+zlib1222add+(zlib1222add/2)
dsWindow equ 72+zlib1222add
dsPrev equ 88+zlib1222add
dsMatchLen equ 128+zlib1222add
dsPrevMatch equ 132+zlib1222add
dsStrStart equ 140+zlib1222add
dsMatchStart equ 144+zlib1222add
dsLookahead equ 148+zlib1222add
dsPrevLen equ 152+zlib1222add
dsMaxChainLen equ 156+zlib1222add
dsGoodMatch equ 172+zlib1222add
dsNiceMatch equ 176+zlib1222add
window_size equ [ rcx + dsWSize]
WMask equ [ rcx + dsWMask]
window_ad equ [ rcx + dsWindow]
prev_ad equ [ rcx + dsPrev]
strstart equ [ rcx + dsStrStart]
match_start equ [ rcx + dsMatchStart]
Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip
prev_length equ [ rcx + dsPrevLen]
max_chain_length equ [ rcx + dsMaxChainLen]
good_match equ [ rcx + dsGoodMatch]
nice_match equ [ rcx + dsNiceMatch]
ENDIF
; parameter 1 in r8(deflate state s), param 2 in rdx (cur match)
; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
;
; All registers must be preserved across the call, except for
; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
;;; Save registers that the compiler may be using, and adjust esp to
;;; make room for our stack frame.
;;; Retrieve the function arguments. r8d will hold cur_match
;;; throughout the entire function. edx will hold the pointer to the
;;; deflate_state structure during the function's setup (before
;;; entering the main loop.
; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match)
; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
mov [save_rdi],rdi
mov [save_rsi],rsi
mov [save_rbx],rbx
mov [save_rbp],rbp
IFDEF INFOZIP
mov r8d,ecx
ELSE
mov r8d,edx
ENDIF
mov [save_r12],r12
mov [save_r13],r13
; mov [save_r14],r14
; mov [save_r15],r15
;;; uInt wmask = s->w_mask;
;;; unsigned chain_length = s->max_chain_length;
;;; if (s->prev_length >= s->good_match) {
;;; chain_length >>= 2;
;;; }
mov edi, prev_length
mov esi, good_match
mov eax, WMask
mov ebx, max_chain_length
cmp edi, esi
jl LastMatchGood
shr ebx, 2
LastMatchGood:
;;; chainlen is decremented once beforehand so that the function can
;;; use the sign flag instead of the zero flag for the exit test.
;;; It is then shifted into the high word, to make room for the wmask
;;; value, which it will always accompany.
dec ebx
shl ebx, 16
or ebx, eax
;;; on zlib only
;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
IFDEF INFOZIP
mov [chainlenwmask], ebx
; on infozip nice_match = [nice_match]
ELSE
mov eax, nice_match
mov [chainlenwmask], ebx
mov r10d, Lookahead
cmp r10d, eax
cmovnl r10d, eax
mov [nicematch],r10d
ENDIF
;;; register Bytef *scan = s->window + s->strstart;
mov r10, window_ad
mov ebp, strstart
lea r13, [r10 + rbp]
;;; Determine how many bytes the scan ptr is off from being
;;; dword-aligned.
mov r9,r13
neg r13
and r13,3
;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
IFDEF INFOZIP
mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1))
ELSE
mov eax, window_size
sub eax, MIN_LOOKAHEAD
ENDIF
xor edi,edi
sub ebp, eax
mov r11d, prev_length
cmovng ebp,edi
;;; int best_len = s->prev_length;
;;; Store the sum of s->window + best_len in esi locally, and in esi.
lea rsi,[r10+r11]
;;; register ush scan_start = *(ushf*)scan;
;;; register ush scan_end = *(ushf*)(scan+best_len-1);
;;; Posf *prev = s->prev;
movzx r12d,word ptr [r9]
movzx ebx, word ptr [r9 + r11 - 1]
mov rdi, prev_ad
;;; Jump into the main loop.
mov edx, [chainlenwmask]
cmp bx,word ptr [rsi + r8 - 1]
jz LookupLoopIsZero
LookupLoop1:
and r8d, edx
movzx r8d, word ptr [rdi + r8*2]
cmp r8d, ebp
jbe LeaveNow
sub edx, 00010000h
js LeaveNow
LoopEntry1:
cmp bx,word ptr [rsi + r8 - 1]
jz LookupLoopIsZero
LookupLoop2:
and r8d, edx
movzx r8d, word ptr [rdi + r8*2]
cmp r8d, ebp
jbe LeaveNow
sub edx, 00010000h
js LeaveNow
LoopEntry2:
cmp bx,word ptr [rsi + r8 - 1]
jz LookupLoopIsZero
LookupLoop4:
and r8d, edx
movzx r8d, word ptr [rdi + r8*2]
cmp r8d, ebp
jbe LeaveNow
sub edx, 00010000h
js LeaveNow
LoopEntry4:
cmp bx,word ptr [rsi + r8 - 1]
jnz LookupLoop1
jmp LookupLoopIsZero
;;; do {
;;; match = s->window + cur_match;
;;; if (*(ushf*)(match+best_len-1) != scan_end ||
;;; *(ushf*)match != scan_start) continue;
;;; [...]
;;; } while ((cur_match = prev[cur_match & wmask]) > limit
;;; && --chain_length != 0);
;;;
;;; Here is the inner loop of the function. The function will spend the
;;; majority of its time in this loop, and majority of that time will
;;; be spent in the first ten instructions.
;;;
;;; Within this loop:
;;; ebx = scanend
;;; r8d = curmatch
;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
;;; esi = windowbestlen - i.e., (window + bestlen)
;;; edi = prev
;;; ebp = limit
LookupLoop:
and r8d, edx
movzx r8d, word ptr [rdi + r8*2]
cmp r8d, ebp
jbe LeaveNow
sub edx, 00010000h
js LeaveNow
LoopEntry:
cmp bx,word ptr [rsi + r8 - 1]
jnz LookupLoop1
LookupLoopIsZero:
cmp r12w, word ptr [r10 + r8]
jnz LookupLoop1
;;; Store the current value of chainlen.
mov [chainlenwmask], edx
;;; Point edi to the string under scrutiny, and esi to the string we
;;; are hoping to match it up with. In actuality, esi and edi are
;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
;;; initialized to -(MAX_MATCH_8 - scanalign).
lea rsi,[r8+r10]
mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8)
lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8]
lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8]
prefetcht1 [rsi+rdx]
prefetcht1 [rdi+rdx]
;;; Test the strings for equality, 8 bytes at a time. At the end,
;;; adjust rdx so that it is offset to the exact byte that mismatched.
;;;
;;; We already know at this point that the first three bytes of the
;;; strings match each other, and they can be safely passed over before
;;; starting the compare loop. So what this code does is skip over 0-3
;;; bytes, as much as necessary in order to dword-align the edi
;;; pointer. (rsi will still be misaligned three times out of four.)
;;;
;;; It should be confessed that this loop usually does not represent
;;; much of the total running time. Replacing it with a more
;;; straightforward "rep cmpsb" would not drastically degrade
;;; performance.
LoopCmps:
mov rax, [rsi + rdx]
xor rax, [rdi + rdx]
jnz LeaveLoopCmps
mov rax, [rsi + rdx + 8]
xor rax, [rdi + rdx + 8]
jnz LeaveLoopCmps8
mov rax, [rsi + rdx + 8+8]
xor rax, [rdi + rdx + 8+8]
jnz LeaveLoopCmps16
add rdx,8+8+8
jnz short LoopCmps
jmp short LenMaximum
LeaveLoopCmps16: add rdx,8
LeaveLoopCmps8: add rdx,8
LeaveLoopCmps:
test eax, 0000FFFFh
jnz LenLower
test eax,0ffffffffh
jnz LenLower32
add rdx,4
shr rax,32
or ax,ax
jnz LenLower
LenLower32:
shr eax,16
add rdx,2
LenLower: sub al, 1
adc rdx, 0
;;; Calculate the length of the match. If it is longer than MAX_MATCH,
;;; then automatically accept it as the best possible match and leave.
lea rax, [rdi + rdx]
sub rax, r9
cmp eax, MAX_MATCH
jge LenMaximum
;;; If the length of the match is not longer than the best match we
;;; have so far, then forget it and return to the lookup loop.
;///////////////////////////////////
cmp eax, r11d
jg LongerMatch
lea rsi,[r10+r11]
mov rdi, prev_ad
mov edx, [chainlenwmask]
jmp LookupLoop
;;; s->match_start = cur_match;
;;; best_len = len;
;;; if (len >= nice_match) break;
;;; scan_end = *(ushf*)(scan+best_len-1);
LongerMatch:
mov r11d, eax
mov match_start, r8d
cmp eax, [nicematch]
jge LeaveNow
lea rsi,[r10+rax]
movzx ebx, word ptr [r9 + rax - 1]
mov rdi, prev_ad
mov edx, [chainlenwmask]
jmp LookupLoop
;;; Accept the current string, with the maximum possible length.
LenMaximum:
mov r11d,MAX_MATCH
mov match_start, r8d
;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
;;; return s->lookahead;
LeaveNow:
IFDEF INFOZIP
mov eax,r11d
ELSE
mov eax, Lookahead
cmp r11d, eax
cmovng eax, r11d
ENDIF
;;; Restore the stack and return from whence we came.
mov rsi,[save_rsi]
mov rdi,[save_rdi]
mov rbx,[save_rbx]
mov rbp,[save_rbp]
mov r12,[save_r12]
mov r13,[save_r13]
; mov r14,[save_r14]
; mov r15,[save_r15]
ret 0
; please don't remove this string !
; Your can freely use gvmat64 in any free or commercial app
; but it is far better don't remove the string in the binary!
db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0
longest_match ENDP
match_init PROC
ret 0
match_init ENDP
END

View File

@ -1,186 +0,0 @@
/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding
* version for AMD64 on Windows using Microsoft C compiler
*
* Copyright (C) 1995-2003 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Copyright (C) 2003 Chris Anderson <christop@charm.net>
* Please use the copyright conditions above.
*
* 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant
*
* inffas8664.c call function inffas8664fnc in inffasx64.asm
* inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
*
* Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
* slightly quicker on x86 systems because, instead of using rep movsb to copy
* data, it uses rep movsw, which moves data in 2-byte chunks instead of single
* bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
* from http://fedora.linux.duke.edu/fc1_x86_64
* which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
* 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
* when decompressing mozilla-source-1.3.tar.gz.
*
* Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
* the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
* the moment. I have successfully compiled and tested this code with gcc2.96,
* gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
* compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
* enabled. I will attempt to merge the MMX code into this version. Newer
* versions of this and inffast.S can be found at
* http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
*
*/
#include <stdio.h>
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
/* Mark Adler's comments from inffast.c: */
/*
Decode literal, length, and distance codes and write out the resulting
literal and match bytes until either not enough input or output is
available, an end-of-block is encountered, or a data error is encountered.
When large enough input and output buffers are supplied to inflate(), for
example, a 16K input buffer and a 64K output buffer, more than 95% of the
inflate execution time is spent in this routine.
Entry assumptions:
state->mode == LEN
strm->avail_in >= 6
strm->avail_out >= 258
start >= strm->avail_out
state->bits < 8
On return, state->mode is one of:
LEN -- ran out of enough output space or enough available input
TYPE -- reached end of block code, inflate() to interpret next block
BAD -- error in block data
Notes:
- The maximum input bits used by a length/distance pair is 15 bits for the
length code, 5 bits for the length extra, 15 bits for the distance code,
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
Therefore if strm->avail_in >= 6, then there is enough input to avoid
checking for available input while decoding.
- The maximum bytes that a single length/distance pair can output is 258
bytes, which is the maximum length that can be coded. inflate_fast()
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
typedef struct inffast_ar {
/* 64 32 x86 x86_64 */
/* ar offset register */
/* 0 0 */ void *esp; /* esp save */
/* 8 4 */ void *ebp; /* ebp save */
/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */
/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
/* 92 48 */ unsigned wsize; /* window size */
/* 96 52 */ unsigned write; /* window write index */
/*100 56 */ unsigned lmask; /* r12 mask for lcode */
/*104 60 */ unsigned dmask; /* r13 mask for dcode */
/*108 64 */ unsigned len; /* r14 match length */
/*112 68 */ unsigned dist; /* r15 match distance */
/*116 72 */ unsigned status; /* set when state chng*/
} type_ar;
#ifdef ASMINF
void inflate_fast(strm, start)
z_streamp strm;
unsigned start; /* inflate()'s starting value for strm->avail_out */
{
struct inflate_state FAR *state;
type_ar ar;
void inffas8664fnc(struct inffast_ar * par);
#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64))
#define PAD_AVAIL_IN 6
#define PAD_AVAIL_OUT 258
#else
#define PAD_AVAIL_IN 5
#define PAD_AVAIL_OUT 257
#endif
/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
ar.in = strm->next_in;
ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
ar.out = strm->next_out;
ar.beg = ar.out - (start - strm->avail_out);
ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
ar.wsize = state->wsize;
ar.write = state->wnext;
ar.window = state->window;
ar.hold = state->hold;
ar.bits = state->bits;
ar.lcode = state->lencode;
ar.dcode = state->distcode;
ar.lmask = (1U << state->lenbits) - 1;
ar.dmask = (1U << state->distbits) - 1;
/* decode literals and length/distances until end-of-block or not enough
input data or output space */
/* align in on 1/2 hold size boundary */
while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
ar.hold += (unsigned long)*ar.in++ << ar.bits;
ar.bits += 8;
}
inffas8664fnc(&ar);
if (ar.status > 1) {
if (ar.status == 2)
strm->msg = "invalid literal/length code";
else if (ar.status == 3)
strm->msg = "invalid distance code";
else
strm->msg = "invalid distance too far back";
state->mode = BAD;
}
else if ( ar.status == 1 ) {
state->mode = TYPE;
}
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
ar.len = ar.bits >> 3;
ar.in -= ar.len;
ar.bits -= ar.len << 3;
ar.hold &= (1U << ar.bits) - 1;
/* update state and return */
strm->next_in = ar.in;
strm->next_out = ar.out;
strm->avail_in = (unsigned)(ar.in < ar.last ?
PAD_AVAIL_IN + (ar.last - ar.in) :
PAD_AVAIL_IN - (ar.in - ar.last));
strm->avail_out = (unsigned)(ar.out < ar.end ?
PAD_AVAIL_OUT + (ar.end - ar.out) :
PAD_AVAIL_OUT - (ar.out - ar.end));
state->hold = (unsigned long)ar.hold;
state->bits = ar.bits;
return;
}
#endif

View File

@ -1,396 +0,0 @@
; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding
; version for AMD64 on Windows using Microsoft C compiler
;
; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
; inffasx64.asm is called by inffas8664.c, which contain more info.
; to compile this file, I use option
; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
; with Microsoft Macro Assembler (x64) for AMD64
;
; This file compile with Microsoft Macro Assembler (x64) for AMD64
;
; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK
;
; (you can get Windows WDK with ml64 for AMD64 from
; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price)
;
.code
inffas8664fnc PROC
; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
;
; All registers must be preserved across the call, except for
; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch.
mov [rsp-8],rsi
mov [rsp-16],rdi
mov [rsp-24],r12
mov [rsp-32],r13
mov [rsp-40],r14
mov [rsp-48],r15
mov [rsp-56],rbx
mov rax,rcx
mov [rax+8], rbp ; /* save regs rbp and rsp */
mov [rax], rsp
mov rsp, rax ; /* make rsp point to &ar */
mov rsi, [rsp+16] ; /* rsi = in */
mov rdi, [rsp+32] ; /* rdi = out */
mov r9, [rsp+24] ; /* r9 = last */
mov r10, [rsp+48] ; /* r10 = end */
mov rbp, [rsp+64] ; /* rbp = lcode */
mov r11, [rsp+72] ; /* r11 = dcode */
mov rdx, [rsp+80] ; /* rdx = hold */
mov ebx, [rsp+88] ; /* ebx = bits */
mov r12d, [rsp+100] ; /* r12d = lmask */
mov r13d, [rsp+104] ; /* r13d = dmask */
; /* r14d = len */
; /* r15d = dist */
cld
cmp r10, rdi
je L_one_time ; /* if only one decode left */
cmp r9, rsi
jne L_do_loop
L_one_time:
mov r8, r12 ; /* r8 = lmask */
cmp bl, 32
ja L_get_length_code_one_time
lodsd ; /* eax = *(uint *)in++ */
mov cl, bl ; /* cl = bits, needs it for shifting */
add bl, 32 ; /* bits += 32 */
shl rax, cl
or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
jmp L_get_length_code_one_time
ALIGN 4
L_while_test:
cmp r10, rdi
jbe L_break_loop
cmp r9, rsi
jbe L_break_loop
L_do_loop:
mov r8, r12 ; /* r8 = lmask */
cmp bl, 32
ja L_get_length_code ; /* if (32 < bits) */
lodsd ; /* eax = *(uint *)in++ */
mov cl, bl ; /* cl = bits, needs it for shifting */
add bl, 32 ; /* bits += 32 */
shl rax, cl
or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
L_get_length_code:
and r8, rdx ; /* r8 &= hold */
mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
mov cl, ah ; /* cl = this.bits */
sub bl, ah ; /* bits -= this.bits */
shr rdx, cl ; /* hold >>= this.bits */
test al, al
jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
mov r8, r12 ; /* r8 = lmask */
shr eax, 16 ; /* output this.val char */
stosb
L_get_length_code_one_time:
and r8, rdx ; /* r8 &= hold */
mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
L_dolen:
mov cl, ah ; /* cl = this.bits */
sub bl, ah ; /* bits -= this.bits */
shr rdx, cl ; /* hold >>= this.bits */
test al, al
jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
shr eax, 16 ; /* output this.val char */
stosb
jmp L_while_test
ALIGN 4
L_test_for_length_base:
mov r14d, eax ; /* len = this */
shr r14d, 16 ; /* len = this.val */
mov cl, al
test al, 16
jz L_test_for_second_level_length ; /* if ((op & 16) == 0) 8% */
and cl, 15 ; /* op &= 15 */
jz L_decode_distance ; /* if (!op) */
L_add_bits_to_len:
sub bl, cl
xor eax, eax
inc eax
shl eax, cl
dec eax
and eax, edx ; /* eax &= hold */
shr rdx, cl
add r14d, eax ; /* len += hold & mask[op] */
L_decode_distance:
mov r8, r13 ; /* r8 = dmask */
cmp bl, 32
ja L_get_distance_code ; /* if (32 < bits) */
lodsd ; /* eax = *(uint *)in++ */
mov cl, bl ; /* cl = bits, needs it for shifting */
add bl, 32 ; /* bits += 32 */
shl rax, cl
or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
L_get_distance_code:
and r8, rdx ; /* r8 &= hold */
mov eax, [r11+r8*4] ; /* eax = dcode[hold & dmask] */
L_dodist:
mov r15d, eax ; /* dist = this */
shr r15d, 16 ; /* dist = this.val */
mov cl, ah
sub bl, ah ; /* bits -= this.bits */
shr rdx, cl ; /* hold >>= this.bits */
mov cl, al ; /* cl = this.op */
test al, 16 ; /* if ((op & 16) == 0) */
jz L_test_for_second_level_dist
and cl, 15 ; /* op &= 15 */
jz L_check_dist_one
L_add_bits_to_dist:
sub bl, cl
xor eax, eax
inc eax
shl eax, cl
dec eax ; /* (1 << op) - 1 */
and eax, edx ; /* eax &= hold */
shr rdx, cl
add r15d, eax ; /* dist += hold & ((1 << op) - 1) */
L_check_window:
mov r8, rsi ; /* save in so from can use it's reg */
mov rax, rdi
sub rax, [rsp+40] ; /* nbytes = out - beg */
cmp eax, r15d
jb L_clip_window ; /* if (dist > nbytes) 4.2% */
mov ecx, r14d ; /* ecx = len */
mov rsi, rdi
sub rsi, r15 ; /* from = out - dist */
sar ecx, 1
jnc L_copy_two ; /* if len % 2 == 0 */
rep movsw
mov al, [rsi]
mov [rdi], al
inc rdi
mov rsi, r8 ; /* move in back to %rsi, toss from */
jmp L_while_test
L_copy_two:
rep movsw
mov rsi, r8 ; /* move in back to %rsi, toss from */
jmp L_while_test
ALIGN 4
L_check_dist_one:
cmp r15d, 1 ; /* if dist 1, is a memset */
jne L_check_window
cmp [rsp+40], rdi ; /* if out == beg, outside window */
je L_check_window
mov ecx, r14d ; /* ecx = len */
mov al, [rdi-1]
mov ah, al
sar ecx, 1
jnc L_set_two
mov [rdi], al
inc rdi
L_set_two:
rep stosw
jmp L_while_test
ALIGN 4
L_test_for_second_level_length:
test al, 64
jnz L_test_for_end_of_block ; /* if ((op & 64) != 0) */
xor eax, eax
inc eax
shl eax, cl
dec eax
and eax, edx ; /* eax &= hold */
add eax, r14d ; /* eax += len */
mov eax, [rbp+rax*4] ; /* eax = lcode[val+(hold&mask[op])]*/
jmp L_dolen
ALIGN 4
L_test_for_second_level_dist:
test al, 64
jnz L_invalid_distance_code ; /* if ((op & 64) != 0) */
xor eax, eax
inc eax
shl eax, cl
dec eax
and eax, edx ; /* eax &= hold */
add eax, r15d ; /* eax += dist */
mov eax, [r11+rax*4] ; /* eax = dcode[val+(hold&mask[op])]*/
jmp L_dodist
ALIGN 4
L_clip_window:
mov ecx, eax ; /* ecx = nbytes */
mov eax, [rsp+92] ; /* eax = wsize, prepare for dist cmp */
neg ecx ; /* nbytes = -nbytes */
cmp eax, r15d
jb L_invalid_distance_too_far ; /* if (dist > wsize) */
add ecx, r15d ; /* nbytes = dist - nbytes */
cmp dword ptr [rsp+96], 0
jne L_wrap_around_window ; /* if (write != 0) */
mov rsi, [rsp+56] ; /* from = window */
sub eax, ecx ; /* eax -= nbytes */
add rsi, rax ; /* from += wsize - nbytes */
mov eax, r14d ; /* eax = len */
cmp r14d, ecx
jbe L_do_copy ; /* if (nbytes >= len) */
sub eax, ecx ; /* eax -= nbytes */
rep movsb
mov rsi, rdi
sub rsi, r15 ; /* from = &out[ -dist ] */
jmp L_do_copy
ALIGN 4
L_wrap_around_window:
mov eax, [rsp+96] ; /* eax = write */
cmp ecx, eax
jbe L_contiguous_in_window ; /* if (write >= nbytes) */
mov esi, [rsp+92] ; /* from = wsize */
add rsi, [rsp+56] ; /* from += window */
add rsi, rax ; /* from += write */
sub rsi, rcx ; /* from -= nbytes */
sub ecx, eax ; /* nbytes -= write */
mov eax, r14d ; /* eax = len */
cmp eax, ecx
jbe L_do_copy ; /* if (nbytes >= len) */
sub eax, ecx ; /* len -= nbytes */
rep movsb
mov rsi, [rsp+56] ; /* from = window */
mov ecx, [rsp+96] ; /* nbytes = write */
cmp eax, ecx
jbe L_do_copy ; /* if (nbytes >= len) */
sub eax, ecx ; /* len -= nbytes */
rep movsb
mov rsi, rdi
sub rsi, r15 ; /* from = out - dist */
jmp L_do_copy
ALIGN 4
L_contiguous_in_window:
mov rsi, [rsp+56] ; /* rsi = window */
add rsi, rax
sub rsi, rcx ; /* from += write - nbytes */
mov eax, r14d ; /* eax = len */
cmp eax, ecx
jbe L_do_copy ; /* if (nbytes >= len) */
sub eax, ecx ; /* len -= nbytes */
rep movsb
mov rsi, rdi
sub rsi, r15 ; /* from = out - dist */
jmp L_do_copy ; /* if (nbytes >= len) */
ALIGN 4
L_do_copy:
mov ecx, eax ; /* ecx = len */
rep movsb
mov rsi, r8 ; /* move in back to %esi, toss from */
jmp L_while_test
L_test_for_end_of_block:
test al, 32
jz L_invalid_literal_length_code
mov dword ptr [rsp+116], 1
jmp L_break_loop_with_status
L_invalid_literal_length_code:
mov dword ptr [rsp+116], 2
jmp L_break_loop_with_status
L_invalid_distance_code:
mov dword ptr [rsp+116], 3
jmp L_break_loop_with_status
L_invalid_distance_too_far:
mov dword ptr [rsp+116], 4
jmp L_break_loop_with_status
L_break_loop:
mov dword ptr [rsp+116], 0
L_break_loop_with_status:
; /* put in, out, bits, and hold back into ar and pop esp */
mov [rsp+16], rsi ; /* in */
mov [rsp+32], rdi ; /* out */
mov [rsp+88], ebx ; /* bits */
mov [rsp+80], rdx ; /* hold */
mov rax, [rsp] ; /* restore rbp and rsp */
mov rbp, [rsp+8]
mov rsp, rax
mov rsi,[rsp-8]
mov rdi,[rsp-16]
mov r12,[rsp-24]
mov r13,[rsp-32]
mov r14,[rsp-40]
mov r15,[rsp-48]
mov rbx,[rsp-56]
ret 0
; :
; : "m" (ar)
; : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi",
; "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
; );
inffas8664fnc ENDP
;_TEXT ENDS
END

View File

@ -1,31 +0,0 @@
Summary
-------
This directory contains ASM implementations of the functions
longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t),
for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits.
gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits
assembly optimized version from Jean-loup Gailly original longest_match function
inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing
original function from Mark Adler
Use instructions
----------------
Assemble the .asm files using MASM and put the object files into the zlib source
directory. You can also get object files here:
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
define ASMV and ASMINF in your project. Include inffas8664.c in your source tree,
and inffasx64.obj and gvmat64.obj as object to link.
Build instructions
------------------
run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe)
ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK
You can get Windows 2003 server DDK with ml64 and cl for AMD64 from
http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)

View File

@ -1,2 +0,0 @@
ml /coff /Zi /c /Flmatch686.lst match686.asm
ml /coff /Zi /c /Flinffas32.lst inffas32.asm

File diff suppressed because it is too large Load Diff

View File

@ -1,479 +0,0 @@
; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86
; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
; File written by Gilles Vollant, by converting match686.S from Brian Raiter
; for MASM. This is as assembly version of longest_match
; from Jean-loup Gailly in deflate.c
;
; http://www.zlib.net
; http://www.winimage.com/zLibDll
; http://www.muppetlabs.com/~breadbox/software/assembly.html
;
; For Visual C++ 4.x and higher and ML 6.x and higher
; ml.exe is distributed in
; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
;
; this file contain two implementation of longest_match
;
; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro
; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom)
;
; for using an assembly version of longest_match, you need define ASMV in project
;
; compile the asm file running
; ml /coff /Zi /c /Flmatch686.lst match686.asm
; and do not include match686.obj in your project
;
; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for
; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor
; with autoselect (with cpu detection code)
; if you want support the old pentium optimization, you can still use these version
;
; this file is not optimized for old pentium, but it compatible with all x86 32 bits
; processor (starting 80386)
;
;
; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2
;uInt longest_match(s, cur_match)
; deflate_state *s;
; IPos cur_match; /* current match */
NbStack equ 76
cur_match equ dword ptr[esp+NbStack-0]
str_s equ dword ptr[esp+NbStack-4]
; 5 dword on top (ret,ebp,esi,edi,ebx)
adrret equ dword ptr[esp+NbStack-8]
pushebp equ dword ptr[esp+NbStack-12]
pushedi equ dword ptr[esp+NbStack-16]
pushesi equ dword ptr[esp+NbStack-20]
pushebx equ dword ptr[esp+NbStack-24]
chain_length equ dword ptr [esp+NbStack-28]
limit equ dword ptr [esp+NbStack-32]
best_len equ dword ptr [esp+NbStack-36]
window equ dword ptr [esp+NbStack-40]
prev equ dword ptr [esp+NbStack-44]
scan_start equ word ptr [esp+NbStack-48]
wmask equ dword ptr [esp+NbStack-52]
match_start_ptr equ dword ptr [esp+NbStack-56]
nice_match equ dword ptr [esp+NbStack-60]
scan equ dword ptr [esp+NbStack-64]
windowlen equ dword ptr [esp+NbStack-68]
match_start equ dword ptr [esp+NbStack-72]
strend equ dword ptr [esp+NbStack-76]
NbStackAdd equ (NbStack-24)
.386p
name gvmatch
.MODEL FLAT
; all the +zlib1222add offsets are due to the addition of fields
; in zlib in the deflate_state structure since the asm code was first written
; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
zlib1222add equ 8
; Note : these value are good with a 8 bytes boundary pack structure
dep_chain_length equ 74h+zlib1222add
dep_window equ 30h+zlib1222add
dep_strstart equ 64h+zlib1222add
dep_prev_length equ 70h+zlib1222add
dep_nice_match equ 88h+zlib1222add
dep_w_size equ 24h+zlib1222add
dep_prev equ 38h+zlib1222add
dep_w_mask equ 2ch+zlib1222add
dep_good_match equ 84h+zlib1222add
dep_match_start equ 68h+zlib1222add
dep_lookahead equ 6ch+zlib1222add
_TEXT segment
IFDEF NOUNDERLINE
public longest_match
public match_init
ELSE
public _longest_match
public _match_init
ENDIF
MAX_MATCH equ 258
MIN_MATCH equ 3
MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
MAX_MATCH equ 258
MIN_MATCH equ 3
MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1)
MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h)
;;; stack frame offsets
chainlenwmask equ esp + 0 ; high word: current chain len
; low word: s->wmask
window equ esp + 4 ; local copy of s->window
windowbestlen equ esp + 8 ; s->window + bestlen
scanstart equ esp + 16 ; first two bytes of string
scanend equ esp + 12 ; last two bytes of string
scanalign equ esp + 20 ; dword-misalignment of string
nicematch equ esp + 24 ; a good enough match size
bestlen equ esp + 28 ; size of best match so far
scan equ esp + 32 ; ptr to string wanting match
LocalVarsSize equ 36
; saved ebx byte esp + 36
; saved edi byte esp + 40
; saved esi byte esp + 44
; saved ebp byte esp + 48
; return address byte esp + 52
deflatestate equ esp + 56 ; the function arguments
curmatch equ esp + 60
;;; Offsets for fields in the deflate_state structure. These numbers
;;; are calculated from the definition of deflate_state, with the
;;; assumption that the compiler will dword-align the fields. (Thus,
;;; changing the definition of deflate_state could easily cause this
;;; program to crash horribly, without so much as a warning at
;;; compile time. Sigh.)
dsWSize equ 36+zlib1222add
dsWMask equ 44+zlib1222add
dsWindow equ 48+zlib1222add
dsPrev equ 56+zlib1222add
dsMatchLen equ 88+zlib1222add
dsPrevMatch equ 92+zlib1222add
dsStrStart equ 100+zlib1222add
dsMatchStart equ 104+zlib1222add
dsLookahead equ 108+zlib1222add
dsPrevLen equ 112+zlib1222add
dsMaxChainLen equ 116+zlib1222add
dsGoodMatch equ 132+zlib1222add
dsNiceMatch equ 136+zlib1222add
;;; match686.asm -- Pentium-Pro-optimized version of longest_match()
;;; Written for zlib 1.1.2
;;; Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html
;;;
;;
;; This software is provided 'as-is', without any express or implied
;; warranty. In no event will the authors be held liable for any damages
;; arising from the use of this software.
;;
;; Permission is granted to anyone to use this software for any purpose,
;; including commercial applications, and to alter it and redistribute it
;; freely, subject to the following restrictions:
;;
;; 1. The origin of this software must not be misrepresented; you must not
;; claim that you wrote the original software. If you use this software
;; in a product, an acknowledgment in the product documentation would be
;; appreciated but is not required.
;; 2. Altered source versions must be plainly marked as such, and must not be
;; misrepresented as being the original software
;; 3. This notice may not be removed or altered from any source distribution.
;;
;GLOBAL _longest_match, _match_init
;SECTION .text
;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch)
;_longest_match:
IFDEF NOUNDERLINE
longest_match proc near
ELSE
_longest_match proc near
ENDIF
.FPO (9, 4, 0, 0, 1, 0)
;;; Save registers that the compiler may be using, and adjust esp to
;;; make room for our stack frame.
push ebp
push edi
push esi
push ebx
sub esp, LocalVarsSize
;;; Retrieve the function arguments. ecx will hold cur_match
;;; throughout the entire function. edx will hold the pointer to the
;;; deflate_state structure during the function's setup (before
;;; entering the main loop.
mov edx, [deflatestate]
mov ecx, [curmatch]
;;; uInt wmask = s->w_mask;
;;; unsigned chain_length = s->max_chain_length;
;;; if (s->prev_length >= s->good_match) {
;;; chain_length >>= 2;
;;; }
mov eax, [edx + dsPrevLen]
mov ebx, [edx + dsGoodMatch]
cmp eax, ebx
mov eax, [edx + dsWMask]
mov ebx, [edx + dsMaxChainLen]
jl LastMatchGood
shr ebx, 2
LastMatchGood:
;;; chainlen is decremented once beforehand so that the function can
;;; use the sign flag instead of the zero flag for the exit test.
;;; It is then shifted into the high word, to make room for the wmask
;;; value, which it will always accompany.
dec ebx
shl ebx, 16
or ebx, eax
mov [chainlenwmask], ebx
;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
mov eax, [edx + dsNiceMatch]
mov ebx, [edx + dsLookahead]
cmp ebx, eax
jl LookaheadLess
mov ebx, eax
LookaheadLess: mov [nicematch], ebx
;;; register Bytef *scan = s->window + s->strstart;
mov esi, [edx + dsWindow]
mov [window], esi
mov ebp, [edx + dsStrStart]
lea edi, [esi + ebp]
mov [scan], edi
;;; Determine how many bytes the scan ptr is off from being
;;; dword-aligned.
mov eax, edi
neg eax
and eax, 3
mov [scanalign], eax
;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
mov eax, [edx + dsWSize]
sub eax, MIN_LOOKAHEAD
sub ebp, eax
jg LimitPositive
xor ebp, ebp
LimitPositive:
;;; int best_len = s->prev_length;
mov eax, [edx + dsPrevLen]
mov [bestlen], eax
;;; Store the sum of s->window + best_len in esi locally, and in esi.
add esi, eax
mov [windowbestlen], esi
;;; register ush scan_start = *(ushf*)scan;
;;; register ush scan_end = *(ushf*)(scan+best_len-1);
;;; Posf *prev = s->prev;
movzx ebx, word ptr [edi]
mov [scanstart], ebx
movzx ebx, word ptr [edi + eax - 1]
mov [scanend], ebx
mov edi, [edx + dsPrev]
;;; Jump into the main loop.
mov edx, [chainlenwmask]
jmp short LoopEntry
align 4
;;; do {
;;; match = s->window + cur_match;
;;; if (*(ushf*)(match+best_len-1) != scan_end ||
;;; *(ushf*)match != scan_start) continue;
;;; [...]
;;; } while ((cur_match = prev[cur_match & wmask]) > limit
;;; && --chain_length != 0);
;;;
;;; Here is the inner loop of the function. The function will spend the
;;; majority of its time in this loop, and majority of that time will
;;; be spent in the first ten instructions.
;;;
;;; Within this loop:
;;; ebx = scanend
;;; ecx = curmatch
;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
;;; esi = windowbestlen - i.e., (window + bestlen)
;;; edi = prev
;;; ebp = limit
LookupLoop:
and ecx, edx
movzx ecx, word ptr [edi + ecx*2]
cmp ecx, ebp
jbe LeaveNow
sub edx, 00010000h
js LeaveNow
LoopEntry: movzx eax, word ptr [esi + ecx - 1]
cmp eax, ebx
jnz LookupLoop
mov eax, [window]
movzx eax, word ptr [eax + ecx]
cmp eax, [scanstart]
jnz LookupLoop
;;; Store the current value of chainlen.
mov [chainlenwmask], edx
;;; Point edi to the string under scrutiny, and esi to the string we
;;; are hoping to match it up with. In actuality, esi and edi are
;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
;;; initialized to -(MAX_MATCH_8 - scanalign).
mov esi, [window]
mov edi, [scan]
add esi, ecx
mov eax, [scanalign]
mov edx, 0fffffef8h; -(MAX_MATCH_8)
lea edi, [edi + eax + 0108h] ;MAX_MATCH_8]
lea esi, [esi + eax + 0108h] ;MAX_MATCH_8]
;;; Test the strings for equality, 8 bytes at a time. At the end,
;;; adjust edx so that it is offset to the exact byte that mismatched.
;;;
;;; We already know at this point that the first three bytes of the
;;; strings match each other, and they can be safely passed over before
;;; starting the compare loop. So what this code does is skip over 0-3
;;; bytes, as much as necessary in order to dword-align the edi
;;; pointer. (esi will still be misaligned three times out of four.)
;;;
;;; It should be confessed that this loop usually does not represent
;;; much of the total running time. Replacing it with a more
;;; straightforward "rep cmpsb" would not drastically degrade
;;; performance.
LoopCmps:
mov eax, [esi + edx]
xor eax, [edi + edx]
jnz LeaveLoopCmps
mov eax, [esi + edx + 4]
xor eax, [edi + edx + 4]
jnz LeaveLoopCmps4
add edx, 8
jnz LoopCmps
jmp short LenMaximum
LeaveLoopCmps4: add edx, 4
LeaveLoopCmps: test eax, 0000FFFFh
jnz LenLower
add edx, 2
shr eax, 16
LenLower: sub al, 1
adc edx, 0
;;; Calculate the length of the match. If it is longer than MAX_MATCH,
;;; then automatically accept it as the best possible match and leave.
lea eax, [edi + edx]
mov edi, [scan]
sub eax, edi
cmp eax, MAX_MATCH
jge LenMaximum
;;; If the length of the match is not longer than the best match we
;;; have so far, then forget it and return to the lookup loop.
mov edx, [deflatestate]
mov ebx, [bestlen]
cmp eax, ebx
jg LongerMatch
mov esi, [windowbestlen]
mov edi, [edx + dsPrev]
mov ebx, [scanend]
mov edx, [chainlenwmask]
jmp LookupLoop
;;; s->match_start = cur_match;
;;; best_len = len;
;;; if (len >= nice_match) break;
;;; scan_end = *(ushf*)(scan+best_len-1);
LongerMatch: mov ebx, [nicematch]
mov [bestlen], eax
mov [edx + dsMatchStart], ecx
cmp eax, ebx
jge LeaveNow
mov esi, [window]
add esi, eax
mov [windowbestlen], esi
movzx ebx, word ptr [edi + eax - 1]
mov edi, [edx + dsPrev]
mov [scanend], ebx
mov edx, [chainlenwmask]
jmp LookupLoop
;;; Accept the current string, with the maximum possible length.
LenMaximum: mov edx, [deflatestate]
mov dword ptr [bestlen], MAX_MATCH
mov [edx + dsMatchStart], ecx
;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
;;; return s->lookahead;
LeaveNow:
mov edx, [deflatestate]
mov ebx, [bestlen]
mov eax, [edx + dsLookahead]
cmp ebx, eax
jg LookaheadRet
mov eax, ebx
LookaheadRet:
;;; Restore the stack and return from whence we came.
add esp, LocalVarsSize
pop ebx
pop esi
pop edi
pop ebp
ret
; please don't remove this string !
; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary!
db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah
IFDEF NOUNDERLINE
longest_match endp
ELSE
_longest_match endp
ENDIF
IFDEF NOUNDERLINE
match_init proc near
ret
match_init endp
ELSE
_match_init proc near
ret
_match_init endp
ENDIF
_TEXT ends
end

View File

@ -1,27 +0,0 @@
Summary
-------
This directory contains ASM implementations of the functions
longest_match() and inflate_fast().
Use instructions
----------------
Assemble using MASM, and copy the object files into the zlib source
directory, then run the appropriate makefile, as suggested below. You can
donwload MASM from here:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64
You can also get objects files here:
http://www.winimage.com/zLibDll/zlib124_masm_obj.zip
Build instructions
------------------
* With Microsoft C and MASM:
nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj"
* With Borland C and TASM:
make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj"

380
deps/zlib/contrib/minizip/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,380 @@
cmake_minimum_required(VERSION 3.12...3.31)
project(
minizip
VERSION 1.0.0
LANGUAGES C
DESCRIPTION "A library for creating zipfiles based in zlib"
HOMEPAGE_URL "https://www.winimage.com/zLibDll/minizip.html")
if(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
message(WARNING "libminizip needs 64bit - stopping here")
return()
endif(CMAKE_SIZEOF_VOID_P LESS 8 AND NOT MINGW)
# ============================================================================
# CPack
# ============================================================================
set(CPACK_PACKAGE_VENDOR "zlib-Project")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
set(CPACK_RESOURCE_FILE_LICENSE ${minizip_SOURCE_DIR}/../../LICENSE)
set(CPACK_RESOURCE_FILE_README ${minizip_SOURCE_DIR}/MiniZip64_info.txt)
# ============================================================================
# configuration
# ============================================================================
option(MINIZIP_BUILD_SHARED "Enable building minizip shared library" ON)
option(MINIZIP_BUILD_STATIC "Enable building minizip static library" ON)
option(MINIZIP_BUILD_TESTING "Enable testing of minizip" ON)
option(MINIZIP_ENABLE_BZIP2 "Build minizip withj bzip2 support" ON)
option(MINIZIP_INSTALL "Enable installation of minizip" ON)
if(MINGW)
option(MINIZIP_INSTALL_COMPAT_DLL "Install a copy as libminizip-1.dll" ON)
endif(MINGW)
include(CheckCSourceCompiles)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CMakePackageConfigHelpers)
include(CheckTypeSize)
include(GNUInstallDirs)
if(NOT CPACK_INCLUDED)
include(CPack)
endif(NOT CPACK_INCLUDED)
if(MINIZIP_ENABLE_BZIP2)
find_package(BZip2 REQUIRED)
endif(MINIZIP_ENABLE_BZIP2)
#
# Check for fopen64
#
check_function_exists(fopen64 HAVE_FOPEN64)
#
# Check for fseeko
#
check_function_exists(fseeko HAVE_FSEEKO)
#
# Check for unistd.h
#
check_include_file(unistd.h HAVE_UNISTD_H)
#
# Check to see if we have large file support
#
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
check_type_size(off64_t OFF64_T)
unset(CMAKE_REQUIRED_DEFINITIONS) # clear variable
#
# Check visibility attribute is supported
#
if(MSVC)
set(CMAKE_REQUIRED_FLAGS "-WX")
else(MSVC)
set(CMAKE_REQUIRED_FLAGS "-WError")
endif(MSVC)
check_c_source_compiles(
"
#include <stdlib.h>
static void f(void) __attribute__ ((visibility(\"hidden\")));
int main(void) {return 0;}
"
HAVE___ATTR__VIS_HIDDEN)
unset(CMAKE_REQUIRED_FLAGS)
if(NOT TARGET ZLIB::ZLIB)
find_package(ZLIB REQUIRED CONFIG)
endif(NOT TARGET ZLIB::ZLIB)
set(LIBMINIZIP_SRCS ioapi.c mztools.c unzip.c zip.c)
set(LIBMINIZIP_HDRS crypt.h ints.h ioapi.h mztools.h unzip.h zip.h)
set(MINIZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> minizip.c zip.c)
set(MINIZIP_HDRS crypt.h ints.h ioapi.h $<$<BOOL:${WIN32}>:iowin32.h> skipset.h
zip.h)
set(MINIUNZIP_SRCS ioapi.c $<$<BOOL:${WIN32}>:iowin32.c> miniunz.c unzip.c
zip.c)
set(MINIUNZIP_HDRS
crypt.h
ints.h
ioapi.h
$<$<BOOL:${WIN32}>:iowin32.h>
skipset.h
unzip.h
zip.h)
if(WIN32 OR CYGWIN)
set(minizip_static_suffix "s")
set(CMAKE_DEBUG_POSTFIX "d")
endif(WIN32 OR CYGWIN)
if(MINIZIP_BUILD_SHARED)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
add_library(libminizip SHARED ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
add_library(MINIZIP::minizip ALIAS libminizip)
target_include_directories(
libminizip PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_definitions(
libminizip
PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
if(NOT CYGWIN)
set_target_properties(libminizip PROPERTIES SOVERSION
${minizip_VERSION_MAJOR})
endif(NOT CYGWIN)
set_target_properties(
libminizip
PROPERTIES EXPORT_NAME minizip
OUTPUT_NAME minizip
VERSION ${minizip_VERSION}
SOVERSION ${minizip_VERSION_MAJOR})
target_link_libraries(libminizip
PUBLIC ZLIB::ZLIB
$<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
add_executable(minizip ${MINIZIP_SRCS} ${MINIZIP_HDRS})
set_target_properties(minizip PROPERTIES EXPORT_NAME minizip_executable)
target_compile_definitions(
minizip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
target_link_libraries(minizip PRIVATE MINIZIP::minizip)
add_executable(miniunzip ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
set_target_properties(miniunzip PROPERTIES EXPORT_NAME miniunzip_executable)
target_compile_definitions(
miniunzip PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
target_link_libraries(miniunzip PRIVATE MINIZIP::minizip)
endif(MINIZIP_BUILD_SHARED)
if(MINIZIP_BUILD_STATIC)
add_library(libminizipstatic STATIC ${LIBMINIZIP_SRCS} ${LIBMINIZIP_HDRS})
add_library(MINIZIP::minizipstatic ALIAS libminizipstatic)
target_include_directories(
libminizipstatic
PUBLIC $<BUILD_INTERFACE:${minizip_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_definitions(
libminizipstatic
PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>
$<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>
$<$<BOOL:${HAVE_UNISTD_H}>:HAVE_UNISTD_H=1>
PUBLIC $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>
$<$<BOOL:${BZIP2_FOUND}>:HAVE_BZIP2=1>
$<$<BOOL:NOT:${HAVE_FOPEN64}>:USE_FILE32API=1>)
set_target_properties(
libminizipstatic PROPERTIES EXPORT_NAME minizipstatic
OUTPUT_NAME minizip${minizip_static_suffix})
if(CYGWIN)
set_target_properties(libminizipstatic PROPERTIES SUFFIX ".dll.a")
endif(CYGWIN)
target_link_libraries(libminizipstatic PUBLIC ZLIB::ZLIBSTATIC
$<$<BOOL:${BZIP2_FOUND}>:BZip2::BZip2>)
add_executable(minizipstatic ${MINIZIP_SRCS} ${MINIZIP_HDRS})
set_target_properties(minizipstatic PROPERTIES EXPORT_NAME
minizip_static_executable)
target_compile_definitions(
minizipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
target_link_libraries(minizipstatic PRIVATE MINIZIP::minizipstatic)
add_executable(miniunzipstatic ${MINIUNZIP_SRCS} ${MINIUNZIP_HDRS})
set_target_properties(miniunzipstatic
PROPERTIES EXPORT_NAME miniunzip_static_executable)
target_compile_definitions(
miniunzipstatic PRIVATE $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_WARNINGS>)
target_link_libraries(miniunzipstatic PRIVATE MINIZIP::minizipstatic)
endif(MINIZIP_BUILD_STATIC)
if(MINIZIP_INSTALL)
if(MINIZIP_BUILD_SHARED)
install(
TARGETS libminizip minizip miniunzip
COMPONENT Runtime
EXPORT minizipSharedExport
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(
EXPORT minizipSharedExport
FILE minizip-shared.cmake
NAMESPACE MINIZIP::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
if(MINIZIP_INSTALL_COMPAT_DLL)
install(
FILES $<TARGET_FILE:libminizip>
COMPONENT Runtime
RENAME libminizip-${minizip_VERSION_MAJOR}.dll
DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif(MINIZIP_INSTALL_COMPAT_DLL)
if(MSVC)
install(
FILES $<TARGET_PDB_FILE:libminizip>
COMPONENT Runtime
DESTINATION ${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS Debug OR RelWithDebInfo
OPTIONAL)
endif(MSVC)
endif(MINIZIP_BUILD_SHARED)
if(MINIZIP_BUILD_STATIC)
install(
TARGETS libminizipstatic
COMPONENT Development
TARGETS minizipstatic miniunzipstatic
COMPONENT Runtime
EXPORT minizipStaticExport
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(
EXPORT minizipStaticExport
FILE minizip-static.cmake
NAMESPACE MINIZIP::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
endif(MINIZIP_BUILD_STATIC)
configure_package_config_file(
${minizip_SOURCE_DIR}/minizipConfig.cmake.in
${minizip_BINARY_DIR}/minizipConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
write_basic_package_version_file(
"${minizip_BINARY_DIR}/minizipConfigVersion.cmake"
VERSION "${minizip_VERSION}"
COMPATIBILITY AnyNewerVersion)
install(FILES ${minizip_BINARY_DIR}/minizipConfig.cmake
${minizip_BINARY_DIR}/minizipConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/minizip)
install(
FILES ${LIBMINIZIP_HDRS}
COMPONENT Development
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endif(MINIZIP_INSTALL)
if(MINIZIP_BUILD_TESTING)
enable_testing()
if(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
".dll")
add_test(
NAME minizip_prepare_shared_zip
COMMAND ${CMAKE_COMMAND} -DCREATE_SHARED=ON -P
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_zipping_test_file_shared
COMMAND minizip test_file_shared.zip test_file_shared.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_prepare_shared_unzip
COMMAND ${CMAKE_COMMAND} -DMOVE_SHARED=ON -P
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_miniunzipping_test_file_shared.zip
COMMAND miniunzip test_file_shared.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_compare_shared
COMMAND ${CMAKE_COMMAND} -E compare_files test_file_shared.txt
test_file_shared.orig
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_clean_shared_zip
COMMAND ${CMAKE_COMMAND} -DDELETE_SHARED=ON -P
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
set_tests_properties(minizip_prepare_shared_zip
PROPERTIES FIXTURES_SETUP prepare_shared)
set_tests_properties(
minizip_zipping_test_file_shared
PROPERTIES FIXTURES_REQUIRED prepare_shared FIXTURES_SETUP
zip_shared)
set_tests_properties(
minizip_prepare_shared_unzip
PROPERTIES FIXTURES_REQUIRED zip_shared FIXTURES_SETUP
prepare_unzip_shared)
set_tests_properties(
minizip_miniunzipping_test_file_shared.zip
PROPERTIES FIXTURES_REQUIRED prepare_unzip_shared FIXTURES_SETUP
prepare_compare_shared)
set_tests_properties(
minizip_compare_shared
PROPERTIES FIXTURES_REQUIRED prepare_compare_shared FIXTURES_SETUP
compared_shared)
set_tests_properties(minizip_clean_shared_zip
PROPERTIES FIXTURES_CLEANUP compared_shared)
endif(MINIZIP_BUILD_SHARED AND NOT ${CMAKE_SHARED_LIBRARY_SUFFIX} STREQUAL
".dll")
if(MINIZIP_BUILD_STATIC)
add_test(
NAME minizip_prepare_static_zip
COMMAND ${CMAKE_COMMAND} -DCREATE_STATIC=ON -P
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_zipping_test_file_static
COMMAND minizipstatic test_file_static.zip test_file_static.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_prepare_static_unzip
COMMAND ${CMAKE_COMMAND} -DMOVE_STATIC=ON -P
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_miniunzipping_test_file_static.zip
COMMAND miniunzipstatic test_file_static.zip
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_compare_static
COMMAND ${CMAKE_COMMAND} -E compare_files test_file_static.txt
test_file_static.orig
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
add_test(
NAME minizip_clean_static_zip
COMMAND ${CMAKE_COMMAND} -DDELETE_STATIC=ON -P
${CMAKE_CURRENT_SOURCE_DIR}/test/test_helper.cm
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test)
set_tests_properties(minizip_prepare_static_zip
PROPERTIES FIXTURES_SETUP prepare_static)
set_tests_properties(
minizip_zipping_test_file_static
PROPERTIES FIXTURES_REQUIRED prepare_static FIXTURES_SETUP
zip_static)
set_tests_properties(
minizip_prepare_static_unzip
PROPERTIES FIXTURES_REQUIRED zip_static FIXTURES_SETUP
prepare_unzip_static)
set_tests_properties(
minizip_miniunzipping_test_file_static.zip
PROPERTIES FIXTURES_REQUIRED prepare_unzip_static FIXTURES_SETUP
prepare_compare_static)
set_tests_properties(
minizip_compare_static
PROPERTIES FIXTURES_REQUIRED prepare_compare_static FIXTURES_SETUP
compared_static)
set_tests_properties(minizip_clean_static_zip
PROPERTIES FIXTURES_CLEANUP compared_static)
endif(MINIZIP_BUILD_STATIC)
add_subdirectory(test)
endif(MINIZIP_BUILD_TESTING)

View File

@ -1,5 +1,5 @@
CC=cc CC?=cc
CFLAGS=-O -I../.. CFLAGS := -O $(CFLAGS) -I../..
UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
@ -9,17 +9,29 @@ ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
all: miniunz minizip all: miniunz minizip
miniunz: $(UNZ_OBJS) miniunz.o: miniunz.c unzip.h iowin32.h
minizip.o: minizip.c zip.h iowin32.h ints.h
unzip.o: unzip.c unzip.h crypt.h
zip.o: zip.c zip.h crypt.h skipset.h ints.h
ioapi.o: ioapi.c ioapi.h ints.h
iowin32.o: iowin32.c iowin32.h ioapi.h
mztools.o: mztools.c unzip.h
miniunz: $(UNZ_OBJS)
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
minizip: $(ZIP_OBJS) minizip: $(ZIP_OBJS)
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
test: miniunz minizip test: miniunz minizip
./minizip test readme.txt @rm -f test.*
@echo hello hello hello > test.txt
./minizip test test.txt
./miniunz -l test.zip ./miniunz -l test.zip
mv readme.txt readme.old @mv test.txt test.old
./miniunz test.zip ./miniunz test.zip
@cmp test.txt test.old
@rm -f test.*
clean: clean:
/bin/rm -f *.o *~ minizip miniunz /bin/rm -f *.o *~ minizip miniunz test.*

View File

@ -1,5 +1,5 @@
MiniZip 1.1 was derrived from MiniZip at version 1.01f MiniZip 1.1 was derived from MiniZip at version 1.01f
Change in 1.0 (Okt 2009) Change in 1.0 (Okt 2009)
- **TODO - Add history** - **TODO - Add history**

View File

@ -1,13 +1,13 @@
# -*- 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.2.11], [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
AC_MSG_CHECKING([whether to build example programs]) AC_MSG_CHECKING([whether to build example programs])
AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs])) AC_ARG_ENABLE([demos], AS_HELP_STRING([--enable-demos], [build example programs]))
AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes]) AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes])
if test "$enable_demos" = yes if test "$enable_demos" = yes
then then

View File

@ -32,12 +32,12 @@
/*********************************************************************** /***********************************************************************
* Return the next byte in the pseudo-random sequence * Return the next byte in the pseudo-random sequence
*/ */
static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem * unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */ * with any known compiler so far, though */
(void)pcrc_32_tab;
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
} }
@ -45,8 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
/*********************************************************************** /***********************************************************************
* Update the encryption keys with the next byte of plain text * Update the encryption keys with the next byte of plain text
*/ */
static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) {
{
(*(pkeys+0)) = CRC32((*(pkeys+0)), c); (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff; (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
@ -62,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c)
* Initialize the encryption keys and the random header according to * Initialize the encryption keys and the random header according to
* the given password. * the given password.
*/ */
static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) {
{
*(pkeys+0) = 305419896L; *(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L; *(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L; *(pkeys+2) = 878082192L;
@ -77,24 +75,23 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
#define zencode(pkeys,pcrc_32_tab,c,t) \ #define zencode(pkeys,pcrc_32_tab,c,t) \
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED #ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
#define RAND_HEAD_LEN 12 #define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */ /* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2 # ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ # define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif # endif
static int crypthead(const char* passwd, /* password string */ static unsigned crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */ unsigned char* buf, /* where to write header */
int bufSize, int bufSize,
unsigned long* pkeys, unsigned long* pkeys,
const z_crc_t* pcrc_32_tab, const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting) unsigned long crcForCrypting) {
{ unsigned n; /* index in random header */
int n; /* index in random header */
int t; /* temporary */ int t; /* temporary */
int c; /* random byte */ int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */ unsigned char header[RAND_HEAD_LEN-2]; /* random header */

57
deps/zlib/contrib/minizip/ints.h vendored Normal file
View File

@ -0,0 +1,57 @@
/* ints.h -- create integer types for 8, 16, 32, and 64 bits
* Copyright (C) 2024 Mark Adler
* For conditions of distribution and use, see the copyright notice in zlib.h
*
* There exist compilers with limits.h, but not stdint.h or inttypes.h.
*/
#ifndef INTS_H
#define INTS_H
#include <limits.h>
#if defined(UCHAR_MAX) && UCHAR_MAX == 0xff
typedef signed char i8_t;
typedef unsigned char ui8_t;
#else
# error "no 8-bit integer"
#endif
#if defined(USHRT_MAX) && USHRT_MAX == 0xffff
typedef short i16_t;
typedef unsigned short ui16_t;
#elif defined(UINT_MAX) && UINT_MAX == 0xffff
typedef int i16_t;
typedef unsigned ui16_t;
#else
# error "no 16-bit integer"
#endif
#if defined(UINT_MAX) && UINT_MAX == 0xffffffff
typedef int i32_t;
typedef unsigned ui32_t;
# define PI32 "d"
# define PUI32 "u"
#elif defined(ULONG_MAX) && ULONG_MAX == 0xffffffff
typedef long i32_t;
typedef unsigned long ui32_t;
# define PI32 "ld"
# define PUI32 "lu"
#else
# error "no 32-bit integer"
#endif
#if defined(ULONG_MAX) && ULONG_MAX == 0xffffffffffffffff
typedef long i64_t;
typedef unsigned long ui64_t;
# define PI64 "ld"
# define PUI64 "lu"
#elif defined(ULLONG_MAX) && ULLONG_MAX == 0xffffffffffffffff
typedef long long i64_t;
typedef unsigned long long ui64_t;
# define PI64 "lld"
# define PUI64 "llu"
#elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xffffffffffffffff
typedef long long i64_t;
typedef unsigned long long ui64_t;
# define PI64 "lld"
# define PUI64 "llu"
#else
# error "no 64-bit integer"
#endif
#endif

View File

@ -14,8 +14,8 @@
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#if defined(__APPLE__) || defined(IOAPI_NO_64) #if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions /* In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions */
#define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream) #define FTELLO_FUNC(stream) ftello(stream)
#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin)
@ -28,8 +28,7 @@
#include "ioapi.h" #include "ioapi.h"
voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc, const void*filename, int mode) {
{
if (pfilefunc->zfile_func64.zopen64_file != NULL) if (pfilefunc->zfile_func64.zopen64_file != NULL)
return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode);
else else
@ -38,8 +37,7 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
} }
} }
long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) {
{
if (pfilefunc->zfile_func64.zseek64_file != NULL) if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin);
else else
@ -52,13 +50,12 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
} }
} }
ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) {
{
if (pfilefunc->zfile_func64.zseek64_file != NULL) if (pfilefunc->zfile_func64.zseek64_file != NULL)
return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream);
else else
{ {
uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); uLong tell_uLong = (uLong)(*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
if ((tell_uLong) == MAXU32) if ((tell_uLong) == MAXU32)
return (ZPOS64_T)-1; return (ZPOS64_T)-1;
else else
@ -66,11 +63,9 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
} }
} }
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32) void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) {
{
p_filefunc64_32->zfile_func64.zopen64_file = NULL; p_filefunc64_32->zfile_func64.zopen64_file = NULL;
p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file;
p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file;
p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file;
p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file;
p_filefunc64_32->zfile_func64.ztell64_file = NULL; p_filefunc64_32->zfile_func64.ztell64_file = NULL;
@ -84,18 +79,10 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
{
FILE* file = NULL; FILE* file = NULL;
const char* mode_fopen = NULL; const char* mode_fopen = NULL;
(void)opaque;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb"; mode_fopen = "rb";
else else
@ -110,10 +97,10 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
return file; return file;
} }
static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
{
FILE* file = NULL; FILE* file = NULL;
const char* mode_fopen = NULL; const char* mode_fopen = NULL;
(void)opaque;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
mode_fopen = "rb"; mode_fopen = "rb";
else else
@ -129,39 +116,39 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
} }
static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
{
uLong ret; uLong ret;
(void)opaque;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret; return ret;
} }
static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
{
uLong ret; uLong ret;
(void)opaque;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret; return ret;
} }
static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
{
long ret; long ret;
(void)opaque;
ret = ftell((FILE *)stream); ret = ftell((FILE *)stream);
return ret; return ret;
} }
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
{
ZPOS64_T ret; ZPOS64_T ret;
ret = FTELLO_FUNC((FILE *)stream); (void)opaque;
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
return ret; return ret;
} }
static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
{
int fseek_origin=0; int fseek_origin=0;
long ret; long ret;
(void)opaque;
switch (origin) switch (origin)
{ {
case ZLIB_FILEFUNC_SEEK_CUR : case ZLIB_FILEFUNC_SEEK_CUR :
@ -176,15 +163,15 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
default: return -1; default: return -1;
} }
ret = 0; ret = 0;
if (fseek((FILE *)stream, offset, fseek_origin) != 0) if (fseek((FILE *)stream, (long)offset, fseek_origin) != 0)
ret = -1; ret = -1;
return ret; return ret;
} }
static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
{
int fseek_origin=0; int fseek_origin=0;
long ret; long ret;
(void)opaque;
switch (origin) switch (origin)
{ {
case ZLIB_FILEFUNC_SEEK_CUR : case ZLIB_FILEFUNC_SEEK_CUR :
@ -200,30 +187,28 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
} }
ret = 0; ret = 0;
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) if(FSEEKO_FUNC((FILE *)stream, (z_off64_t)offset, fseek_origin) != 0)
ret = -1; ret = -1;
return ret; return ret;
} }
static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
{
int ret; int ret;
(void)opaque;
ret = fclose((FILE *)stream); ret = fclose((FILE *)stream);
return ret; return ret;
} }
static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
{
int ret; int ret;
(void)opaque;
ret = ferror((FILE *)stream); ret = ferror((FILE *)stream);
return ret; return ret;
} }
void fill_fopen_filefunc (pzlib_filefunc_def) void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
zlib_filefunc_def* pzlib_filefunc_def;
{
pzlib_filefunc_def->zopen_file = fopen_file_func; pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func; pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func; pzlib_filefunc_def->zwrite_file = fwrite_file_func;
@ -234,8 +219,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
pzlib_filefunc_def->opaque = NULL; pzlib_filefunc_def->opaque = NULL;
} }
void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
{
pzlib_filefunc_def->zopen64_file = fopen64_file_func; pzlib_filefunc_def->zopen64_file = fopen64_file_func;
pzlib_filefunc_def->zread_file = fread_file_func; pzlib_filefunc_def->zread_file = fread_file_func;
pzlib_filefunc_def->zwrite_file = fwrite_file_func; pzlib_filefunc_def->zwrite_file = fwrite_file_func;

View File

@ -18,13 +18,13 @@
*/ */
#ifndef _ZLIBIOAPI64_H #ifndef ZLIBIOAPI64_H
#define _ZLIBIOAPI64_H #define ZLIBIOAPI64_H
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
// Linux needs this to support file operation on files larger then 4+GB /* Linux needs this to support file operation on files larger then 4+GB */
// But might need better if/def to select just the platforms that needs them. /* But might need better if/def to select just the platforms that needs them.*/
#ifndef __USE_FILE_OFFSET64 #ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64 #define __USE_FILE_OFFSET64
@ -50,7 +50,7 @@
#define ftello64 ftell #define ftello64 ftell
#define fseeko64 fseek #define fseeko64 fseek
#else #else
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
#define fopen64 fopen #define fopen64 fopen
#define ftello64 ftello #define ftello64 ftello
#define fseeko64 fseeko #define fseeko64 fseeko
@ -67,42 +67,17 @@
#endif #endif
#endif #endif
/*
#ifndef ZPOS64_T
#ifdef _WIN32
#define ZPOS64_T fpos_t
#else
#include <stdint.h>
#define ZPOS64_T uint64_t
#endif
#endif
*/
#ifdef HAVE_MINIZIP64_CONF_H #ifdef HAVE_MINIZIP64_CONF_H
#include "mz64conf.h" #include "mz64conf.h"
#endif #endif
/* a type choosen by DEFINE */ #include "ints.h"
#ifdef HAVE_64BIT_INT_CUSTOM typedef ui64_t ZPOS64_T;
typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T;
#else
#ifdef HAS_STDINT_H
#include "stdint.h"
typedef uint64_t ZPOS64_T;
#else
/* Maximum unsigned 32-bit value used as placeholder for zip64 */ /* Maximum unsigned 32-bit value used as placeholder for zip64 */
#define MAXU32 0xffffffff #ifndef MAXU32
#define MAXU32 (0xffffffff)
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ZPOS64_T;
#else
typedef unsigned long long int ZPOS64_T;
#endif #endif
#endif
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -132,17 +107,17 @@ extern "C" {
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin);
/* here is the "old" 32 bits structure structure */ /* here is the "old" 32 bits structure */
typedef struct zlib_filefunc_def_s typedef struct zlib_filefunc_def_s
{ {
open_file_func zopen_file; open_file_func zopen_file;
@ -155,9 +130,9 @@ typedef struct zlib_filefunc_def_s
voidpf opaque; voidpf opaque;
} zlib_filefunc_def; } zlib_filefunc_def;
typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream);
typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin);
typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode);
typedef struct zlib_filefunc64_def_s typedef struct zlib_filefunc64_def_s
{ {
@ -171,8 +146,8 @@ typedef struct zlib_filefunc64_def_s
voidpf opaque; voidpf opaque;
} zlib_filefunc64_def; } zlib_filefunc64_def;
void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def);
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
/* now internal definition, only for zip.c and unzip.h */ /* now internal definition, only for zip.c and unzip.h */
typedef struct zlib_filefunc64_32_def_s typedef struct zlib_filefunc64_32_def_s
@ -186,16 +161,16 @@ typedef struct zlib_filefunc64_32_def_s
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) /*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) */
//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) /*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) */
#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream))
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode);
long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin);
ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream);
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32);
#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode)))
#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream)))

View File

@ -26,21 +26,18 @@
#endif #endif
// see Include/shared/winapifamily.h in the Windows Kit /* see Include/shared/winapifamily.h in the Windows Kit */
#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) #if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API)))
#if !defined(WINAPI_FAMILY_ONE_PARTITION)
#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition)
#endif
#if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP)
#define IOWIN32_USING_WINRT_API 1 #define IOWIN32_USING_WINRT_API 1
#endif #endif
#endif #endif
voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode));
uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream));
long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream));
int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream));
typedef struct typedef struct
{ {
HANDLE hf; HANDLE hf;
@ -52,8 +49,7 @@ static void win32_translate_open_mode(int mode,
DWORD* lpdwDesiredAccess, DWORD* lpdwDesiredAccess,
DWORD* lpdwCreationDisposition, DWORD* lpdwCreationDisposition,
DWORD* lpdwShareMode, DWORD* lpdwShareMode,
DWORD* lpdwFlagsAndAttributes) DWORD* lpdwFlagsAndAttributes) {
{
*lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
@ -74,8 +70,7 @@ static void win32_translate_open_mode(int mode,
} }
} }
static voidpf win32_build_iowin(HANDLE hFile) static voidpf win32_build_iowin(HANDLE hFile) {
{
voidpf ret=NULL; voidpf ret=NULL;
if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
@ -93,9 +88,8 @@ static voidpf win32_build_iowin(HANDLE hFile)
return ret; return ret;
} }
voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode) voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) {
{ (void)opaque;
const char* mode_fopen = NULL;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL; HANDLE hFile = NULL;
@ -122,9 +116,8 @@ voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int
} }
voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode) voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) {
{ (void)opaque;
const char* mode_fopen = NULL;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL; HANDLE hFile = NULL;
@ -146,9 +139,8 @@ voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int
} }
voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode) voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) {
{ (void)opaque;
const char* mode_fopen = NULL;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL; HANDLE hFile = NULL;
@ -166,9 +158,8 @@ voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int
} }
voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode) voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) {
{ (void)opaque;
const char* mode_fopen = NULL;
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
HANDLE hFile = NULL; HANDLE hFile = NULL;
@ -195,8 +186,8 @@ voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mo
} }
uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size) uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) {
{ (void)opaque;
uLong ret=0; uLong ret=0;
HANDLE hFile = NULL; HANDLE hFile = NULL;
if (stream!=NULL) if (stream!=NULL)
@ -217,8 +208,8 @@ uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uL
} }
uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size) uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
{ (void)opaque;
uLong ret=0; uLong ret=0;
HANDLE hFile = NULL; HANDLE hFile = NULL;
if (stream!=NULL) if (stream!=NULL)
@ -238,8 +229,7 @@ uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* b
return ret; return ret;
} }
static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) {
{
#ifdef IOWIN32_USING_WINRT_API #ifdef IOWIN32_USING_WINRT_API
return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
#else #else
@ -258,8 +248,8 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n
#endif #endif
} }
long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) {
{ (void)opaque;
long ret=-1; long ret=-1;
HANDLE hFile = NULL; HANDLE hFile = NULL;
if (stream!=NULL) if (stream!=NULL)
@ -281,8 +271,8 @@ long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
return ret; return ret;
} }
ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) {
{ (void)opaque;
ZPOS64_T ret= (ZPOS64_T)-1; ZPOS64_T ret= (ZPOS64_T)-1;
HANDLE hFile = NULL; HANDLE hFile = NULL;
if (stream!=NULL) if (stream!=NULL)
@ -306,8 +296,8 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
} }
long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin) long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
{ (void)opaque;
DWORD dwMoveMethod=0xFFFFFFFF; DWORD dwMoveMethod=0xFFFFFFFF;
HANDLE hFile = NULL; HANDLE hFile = NULL;
@ -344,8 +334,8 @@ long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,in
return ret; return ret;
} }
long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin) long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
{ (void)opaque;
DWORD dwMoveMethod=0xFFFFFFFF; DWORD dwMoveMethod=0xFFFFFFFF;
HANDLE hFile = NULL; HANDLE hFile = NULL;
long ret=-1; long ret=-1;
@ -383,8 +373,8 @@ long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T off
return ret; return ret;
} }
int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) {
{ (void)opaque;
int ret=-1; int ret=-1;
if (stream!=NULL) if (stream!=NULL)
@ -401,8 +391,8 @@ int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream)
return ret; return ret;
} }
int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream) int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) {
{ (void)opaque;
int ret=-1; int ret=-1;
if (stream!=NULL) if (stream!=NULL)
{ {
@ -411,8 +401,7 @@ int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
return ret; return ret;
} }
void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
{
pzlib_filefunc_def->zopen_file = win32_open_file_func; pzlib_filefunc_def->zopen_file = win32_open_file_func;
pzlib_filefunc_def->zread_file = win32_read_file_func; pzlib_filefunc_def->zread_file = win32_read_file_func;
pzlib_filefunc_def->zwrite_file = win32_write_file_func; pzlib_filefunc_def->zwrite_file = win32_write_file_func;
@ -423,8 +412,7 @@ void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
pzlib_filefunc_def->opaque = NULL; pzlib_filefunc_def->opaque = NULL;
} }
void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) {
{
pzlib_filefunc_def->zopen64_file = win32_open64_file_func; pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
pzlib_filefunc_def->zread_file = win32_read_file_func; pzlib_filefunc_def->zread_file = win32_read_file_func;
pzlib_filefunc_def->zwrite_file = win32_write_file_func; pzlib_filefunc_def->zwrite_file = win32_write_file_func;
@ -436,8 +424,7 @@ void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
} }
void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) {
{
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
pzlib_filefunc_def->zread_file = win32_read_file_func; pzlib_filefunc_def->zread_file = win32_read_file_func;
pzlib_filefunc_def->zwrite_file = win32_write_file_func; pzlib_filefunc_def->zwrite_file = win32_write_file_func;
@ -449,8 +436,7 @@ void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
} }
void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) {
{
pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
pzlib_filefunc_def->zread_file = win32_read_file_func; pzlib_filefunc_def->zread_file = win32_read_file_func;
pzlib_filefunc_def->zwrite_file = win32_write_file_func; pzlib_filefunc_def->zwrite_file = win32_write_file_func;

View File

@ -18,10 +18,10 @@
extern "C" { extern "C" {
#endif #endif
void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def);
void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def);
void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def);
void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -2,7 +2,7 @@ $ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig
$ open/write zdef vmsdefs.h $ open/write zdef vmsdefs.h
$ copy sys$input: zdef $ copy sys$input: zdef
$ deck $ deck
#define unix #define __unix__
#define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from #define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from
#define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator #define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator
#define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord #define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord

View File

@ -27,7 +27,7 @@
#endif #endif
#endif #endif
#ifdef __APPLE__ #if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream) #define FTELLO_FUNC(stream) ftello(stream)
@ -39,12 +39,16 @@
#endif #endif
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h>
#ifdef _WIN32 #ifdef _WIN32
# include <direct.h> # include <direct.h>
@ -78,14 +82,11 @@
/* 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 */
void change_file_date(filename,dosdate,tmu_date) static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) {
const char *filename;
uLong dosdate;
tm_unz tmu_date;
{
#ifdef _WIN32 #ifdef _WIN32
(void)tmu_date;
HANDLE hFile; HANDLE hFile;
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
@ -96,8 +97,8 @@ void change_file_date(filename,dosdate,tmu_date)
LocalFileTimeToFileTime(&ftLocal,&ftm); LocalFileTimeToFileTime(&ftLocal,&ftm);
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile); CloseHandle(hFile);
#else #elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
#ifdef unix || __APPLE__ (void)dosdate;
struct utimbuf ut; struct utimbuf ut;
struct tm newdate; struct tm newdate;
newdate.tm_sec = tmu_date.tm_sec; newdate.tm_sec = tmu_date.tm_sec;
@ -113,7 +114,10 @@ void change_file_date(filename,dosdate,tmu_date)
ut.actime=ut.modtime=mktime(&newdate); ut.actime=ut.modtime=mktime(&newdate);
utime(filename,&ut); utime(filename,&ut);
#endif #else
(void)filename;
(void)dosdate;
(void)tmu_date;
#endif #endif
} }
@ -121,28 +125,24 @@ void change_file_date(filename,dosdate,tmu_date)
/* mymkdir and change_file_date are not 100 % portable /* mymkdir and change_file_date are not 100 % portable
As I don't know well Unix, I wait feedback for the unix portion */ As I don't know well Unix, I wait feedback for the unix portion */
int mymkdir(dirname) static int mymkdir(const char* dirname) {
const char* dirname;
{
int ret=0; int ret=0;
#ifdef _WIN32 #ifdef _WIN32
ret = _mkdir(dirname); ret = _mkdir(dirname);
#elif unix #elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
ret = mkdir (dirname,0775);
#elif __APPLE__
ret = mkdir (dirname,0775); ret = mkdir (dirname,0775);
#else
(void)dirname;
#endif #endif
return ret; return ret;
} }
int makedir (newdir) static int makedir(const char *newdir) {
char *newdir;
{
char *buffer ; char *buffer ;
char *p; char *p;
int len = (int)strlen(newdir); size_t len = strlen(newdir);
if (len <= 0) if (len == 0)
return 0; return 0;
buffer = (char*)malloc(len+1); buffer = (char*)malloc(len+1);
@ -185,14 +185,12 @@ int makedir (newdir)
return 1; return 1;
} }
void do_banner() static void do_banner(void) {
{ printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n");
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
} }
void do_help() static void do_help(void) {
{
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
" -e Extract without pathname (junk paths)\n" \ " -e Extract without pathname (junk paths)\n" \
" -x Extract with pathname\n" \ " -x Extract with pathname\n" \
@ -200,11 +198,10 @@ void do_help()
" -l list files\n" \ " -l list files\n" \
" -d directory to extract into\n" \ " -d directory to extract into\n" \
" -o overwrite files without prompting\n" \ " -o overwrite files without prompting\n" \
" -p extract crypted file using password\n\n"); " -p extract encrypted file using password\n\n");
} }
void Display64BitsSize(ZPOS64_T n, int size_char) static void Display64BitsSize(ZPOS64_T n, int size_char) {
{
/* to avoid compatibility problem , we do here the conversion */ /* to avoid compatibility problem , we do here the conversion */
char number[21]; char number[21];
int offset=19; int offset=19;
@ -231,9 +228,7 @@ void Display64BitsSize(ZPOS64_T n, int size_char)
printf("%s",&number[pos_string]); printf("%s",&number[pos_string]);
} }
int do_list(uf) static int do_list(unzFile uf) {
unzFile uf;
{
uLong i; uLong i;
unz_global_info64 gi; unz_global_info64 gi;
int err; int err;
@ -245,10 +240,10 @@ int do_list(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 = "";
char charCrypt=' '; char charCrypt=' ';
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
if (err!=UNZ_OK) if (err!=UNZ_OK)
@ -259,7 +254,7 @@ int do_list(uf)
if (file_info.uncompressed_size>0) if (file_info.uncompressed_size>0)
ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size); ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size);
/* display a '*' if the file is crypted */ /* display a '*' if the file is encrypted */
if ((file_info.flag & 1) != 0) if ((file_info.flag & 1) != 0)
charCrypt='*'; charCrypt='*';
@ -309,13 +304,8 @@ int do_list(uf)
} }
int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) {
unzFile uf; char filename_inzip[65536+1];
const int* popt_extract_without_path;
int* popt_overwrite;
const char* password;
{
char filename_inzip[256];
char* filename_withoutpath; char* filename_withoutpath;
char* p; char* p;
int err=UNZ_OK; int err=UNZ_OK;
@ -324,7 +314,6 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
uInt size_buf; uInt size_buf;
unz_file_info64 file_info; unz_file_info64 file_info;
uLong ratio=0;
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
if (err!=UNZ_OK) if (err!=UNZ_OK)
@ -367,6 +356,20 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
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)
{ {
@ -439,7 +442,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
break; break;
} }
if (err>0) if (err>0)
if (fwrite(buf,err,1,fout)!=1) if (fwrite(buf,(unsigned)err,1,fout)!=1)
{ {
printf("error in writing extracted file\n"); printf("error in writing extracted file\n");
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -472,16 +475,10 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
} }
int do_extract(uf,opt_extract_without_path,opt_overwrite,password) static int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password) {
unzFile uf;
int opt_extract_without_path;
int opt_overwrite;
const char* password;
{
uLong i; uLong i;
unz_global_info64 gi; unz_global_info64 gi;
int err; int err;
FILE* fout=NULL;
err = unzGetGlobalInfo64(uf,&gi); err = unzGetGlobalInfo64(uf,&gi);
if (err!=UNZ_OK) if (err!=UNZ_OK)
@ -508,14 +505,7 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
return 0; return 0;
} }
int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) static int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) {
unzFile uf;
const char* filename;
int opt_extract_without_path;
int opt_overwrite;
const char* password;
{
int err = UNZ_OK;
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
{ {
printf("file %s not found in the zipfile\n",filename); printf("file %s not found in the zipfile\n",filename);
@ -531,10 +521,7 @@ int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,passwo
} }
int main(argc,argv) int main(int argc, char *argv[]) {
int argc;
char *argv[];
{
const char *zipfilename=NULL; const char *zipfilename=NULL;
const char *filename_to_extract=NULL; const char *filename_to_extract=NULL;
const char *password=NULL; const char *password=NULL;
@ -565,7 +552,7 @@ int main(argc,argv)
while ((*p)!='\0') while ((*p)!='\0')
{ {
char c=*(p++);; char c=*(p++);
if ((c=='l') || (c=='L')) if ((c=='l') || (c=='L'))
opt_do_list = 1; opt_do_list = 1;
if ((c=='v') || (c=='V')) if ((c=='v') || (c=='V'))
@ -607,7 +594,7 @@ int main(argc,argv)
# endif # endif
strncpy(filename_try, zipfilename,MAXFILENAME-1); strncpy(filename_try, zipfilename,MAXFILENAME-1);
/* strncpy doesnt append the trailing NULL, of the string is too long. */ /* strncpy doesn't append the trailing NULL, of the string is too long. */
filename_try[ MAXFILENAME ] = '\0'; filename_try[ MAXFILENAME ] = '\0';
# ifdef USEWIN32IOAPI # ifdef USEWIN32IOAPI

View File

@ -28,7 +28,7 @@
#endif #endif
#endif #endif
#ifdef __APPLE__ #if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream) #define FTELLO_FUNC(stream) ftello(stream)
@ -41,6 +41,9 @@
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -59,6 +62,7 @@
#endif #endif
#include "zip.h" #include "zip.h"
#include "ints.h"
#ifdef _WIN32 #ifdef _WIN32
#define USEWIN32IOAPI #define USEWIN32IOAPI
@ -71,11 +75,10 @@
#define MAXFILENAME (256) #define MAXFILENAME (256)
#ifdef _WIN32 #ifdef _WIN32
uLong filetime(f, tmzip, dt) /* f: name of file to get info on, tmzip: return value: access,
char *f; /* name of file to get info on */ modification and creation times, dt: dostime */
tm_zip *tmzip; /* return value: access, modific. and creation times */ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
uLong *dt; /* dostime */ (void)tmzip;
{
int ret = 0; int ret = 0;
{ {
FILETIME ftLocal; FILETIME ftLocal;
@ -93,13 +96,11 @@ uLong filetime(f, tmzip, dt)
} }
return ret; return ret;
} }
#else #elif defined(__unix__) || defined(__unix) || defined(__APPLE__)
#ifdef unix || __APPLE__ /* f: name of file to get info on, tmzip: return value: access,
uLong filetime(f, tmzip, dt) modification and creation times, dt: dostime */
char *f; /* name of file to get info on */ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
tm_zip *tmzip; /* return value: access, modific. and creation times */ (void)dt;
uLong *dt; /* dostime */
{
int ret=0; int ret=0;
struct stat s; /* results of stat() */ struct stat s; /* results of stat() */
struct tm* filedate; struct tm* filedate;
@ -108,12 +109,12 @@ uLong filetime(f, tmzip, dt)
if (strcmp(f,"-")!=0) if (strcmp(f,"-")!=0)
{ {
char name[MAXFILENAME+1]; char name[MAXFILENAME+1];
int len = strlen(f); size_t len = strlen(f);
if (len > MAXFILENAME) if (len > MAXFILENAME)
len = MAXFILENAME; len = MAXFILENAME;
strncpy(name, f,MAXFILENAME-1); strncpy(name, f,MAXFILENAME-1);
/* strncpy doesnt append the trailing NULL, of the string is too long. */ /* strncpy doesn't append the trailing NULL, of the string is too long. */
name[ MAXFILENAME ] = '\0'; name[ MAXFILENAME ] = '\0';
if (name[len - 1] == '/') if (name[len - 1] == '/')
@ -137,22 +138,20 @@ uLong filetime(f, tmzip, dt)
return ret; return ret;
} }
#else #else
uLong filetime(f, tmzip, dt) /* f: name of file to get info on, tmzip: return value: access,
char *f; /* name of file to get info on */ modification and creation times, dt: dostime */
tm_zip *tmzip; /* return value: access, modific. and creation times */ static int filetime(const char *f, tm_zip *tmzip, uLong *dt) {
uLong *dt; /* dostime */ (void)f;
{ (void)tmzip;
(void)dt;
return 0; return 0;
} }
#endif #endif
#endif
int check_exist_file(filename) static int check_exist_file(const char* filename) {
const char* filename;
{
FILE* ftestexist; FILE* ftestexist;
int ret = 1; int ret = 1;
ftestexist = FOPEN_FUNC(filename,"rb"); ftestexist = FOPEN_FUNC(filename,"rb");
@ -163,14 +162,12 @@ int check_exist_file(filename)
return ret; return ret;
} }
void do_banner() static void do_banner(void) {
{
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
} }
void do_help() static void do_help(void) {
{
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
" -o Overwrite existing file.zip\n" \ " -o Overwrite existing file.zip\n" \
" -a Append to existing file.zip\n" \ " -a Append to existing file.zip\n" \
@ -182,14 +179,13 @@ void do_help()
/* calculate the CRC32 of a file, /* calculate the CRC32 of a file,
because to encrypt a file, we need known the CRC32 of the file before */ because to encrypt a file, we need known the CRC32 of the file before */
int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_buf, unsigned long* result_crc) {
{
unsigned long calculate_crc=0; unsigned long calculate_crc=0;
int err=ZIP_OK; int err=ZIP_OK;
FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); FILE * fin = FOPEN_FUNC(filenameinzip,"rb");
unsigned long size_read = 0; unsigned long size_read = 0;
unsigned long total_read = 0; /* unsigned long total_read = 0; */
if (fin==NULL) if (fin==NULL)
{ {
err = ZIP_ERRNO; err = ZIP_ERRNO;
@ -199,7 +195,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
do do
{ {
err = ZIP_OK; err = ZIP_OK;
size_read = (int)fread(buf,1,size_buf,fin); size_read = (unsigned long)fread(buf,1,size_buf,fin);
if (size_read < size_buf) if (size_read < size_buf)
if (feof(fin)==0) if (feof(fin)==0)
{ {
@ -208,8 +204,8 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
} }
if (size_read>0) if (size_read>0)
calculate_crc = crc32(calculate_crc,buf,size_read); calculate_crc = crc32_z(calculate_crc,buf,size_read);
total_read += size_read; /* total_read += size_read; */
} while ((err == ZIP_OK) && (size_read>0)); } while ((err == ZIP_OK) && (size_read>0));
@ -221,18 +217,17 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
return err; return err;
} }
int isLargeFile(const char* filename) static int isLargeFile(const char* filename) {
{
int largeFile = 0; int largeFile = 0;
ZPOS64_T pos = 0; ZPOS64_T pos = 0;
FILE* pFile = FOPEN_FUNC(filename, "rb"); FILE* pFile = FOPEN_FUNC(filename, "rb");
if(pFile != NULL) if(pFile != NULL)
{ {
int n = FSEEKO_FUNC(pFile, 0, SEEK_END); FSEEKO_FUNC(pFile, 0, SEEK_END);
pos = FTELLO_FUNC(pFile); pos = (ZPOS64_T)FTELLO_FUNC(pFile);
printf("File : %s is %lld bytes\n", filename, pos); printf("File : %s is %"PUI64" bytes\n", filename, pos);
if(pos >= 0xffffffff) if(pos >= 0xffffffff)
largeFile = 1; largeFile = 1;
@ -243,10 +238,7 @@ int isLargeFile(const char* filename)
return largeFile; return largeFile;
} }
int main(argc,argv) int main(int argc, char *argv[]) {
int argc;
char *argv[];
{
int i; int i;
int opt_overwrite=0; int opt_overwrite=0;
int opt_compress_level=Z_DEFAULT_COMPRESSION; int opt_compress_level=Z_DEFAULT_COMPRESSION;
@ -255,7 +247,7 @@ int main(argc,argv)
char filename_try[MAXFILENAME+16]; char filename_try[MAXFILENAME+16];
int zipok; int zipok;
int err=0; int err=0;
int size_buf=0; unsigned long size_buf=0;
void* buf=NULL; void* buf=NULL;
const char* password=NULL; const char* password=NULL;
@ -276,7 +268,7 @@ int main(argc,argv)
while ((*p)!='\0') while ((*p)!='\0')
{ {
char c=*(p++);; char c=*(p++);
if ((c=='o') || (c=='O')) if ((c=='o') || (c=='O'))
opt_overwrite = 1; opt_overwrite = 1;
if ((c=='a') || (c=='A')) if ((c=='a') || (c=='A'))
@ -317,12 +309,12 @@ int main(argc,argv)
} }
else else
{ {
int i,len; int len;
int dot_found=0; int dot_found=0;
zipok = 1 ; zipok = 1 ;
strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1); strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
/* strncpy doesnt append the trailing NULL, of the string is too long. */ /* strncpy doesn't append the trailing NULL, of the string is too long. */
filename_try[ MAXFILENAME ] = '\0'; filename_try[ MAXFILENAME ] = '\0';
len=(int)strlen(filename_try); len=(int)strlen(filename_try);
@ -392,11 +384,11 @@ int main(argc,argv)
((argv[i][1]=='o') || (argv[i][1]=='O') || ((argv[i][1]=='o') || (argv[i][1]=='O') ||
(argv[i][1]=='a') || (argv[i][1]=='A') || (argv[i][1]=='a') || (argv[i][1]=='A') ||
(argv[i][1]=='p') || (argv[i][1]=='P') || (argv[i][1]=='p') || (argv[i][1]=='P') ||
((argv[i][1]>='0') || (argv[i][1]<='9'))) && ((argv[i][1]>='0') && (argv[i][1]<='9'))) &&
(strlen(argv[i]) == 2))) (strlen(argv[i]) == 2)))
{ {
FILE * fin; FILE * fin = NULL;
int size_read; size_t size_read;
const char* filenameinzip = argv[i]; const char* filenameinzip = argv[i];
const char *savefilenameinzip; const char *savefilenameinzip;
zip_fileinfo zi; zip_fileinfo zi;
@ -443,7 +435,7 @@ int main(argc,argv)
} }
if( lastslash != NULL ) if( lastslash != NULL )
{ {
savefilenameinzip = lastslash+1; // base filename follows last slash. savefilenameinzip = lastslash+1; /* base filename follows last slash. */
} }
} }
@ -472,7 +464,7 @@ int main(argc,argv)
do do
{ {
err = ZIP_OK; err = ZIP_OK;
size_read = (int)fread(buf,1,size_buf,fin); size_read = fread(buf,1,size_buf,fin);
if (size_read < size_buf) if (size_read < size_buf)
if (feof(fin)==0) if (feof(fin)==0)
{ {
@ -482,7 +474,7 @@ int main(argc,argv)
if (size_read>0) if (size_read>0)
{ {
err = zipWriteInFileInZip (zf,buf,size_read); err = zipWriteInFileInZip (zf,buf,(unsigned)size_read);
if (err<0) if (err<0)
{ {
printf("error in writing %s in the zipfile\n", printf("error in writing %s in the zipfile\n",

View File

@ -1,7 +1,7 @@
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@/minizip includedir=@includedir@
Name: minizip Name: minizip
Description: Minizip zip file manipulation library Description: Minizip zip file manipulation library

View File

@ -0,0 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
sharedlibdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${exec_prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: minizip
Description: minizip compression library
Version: @minizip_VERSION@
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz -lminizip
Cflags: -I${includedir}

View File

@ -0,0 +1,35 @@
@PACKAGE_INIT@
set(_minizip_supported_components "")
include(CMakeFindDependencyMacro)
if(@MINIZIP_BUILD_SHARED@)
list(APPEND _minizip_supported_components shared)
endif(@MINIZIP_BUILD_SHARED@)
if(@MINIZIP_BUILD_STATIC@)
list(APPEND _minizip_supported_components static)
endif(@MINIZIP_BUILD_STATIC@)
if(@MINIZIP_ENABLE_BZIP2@)
find_dependency(BZip2)
endif(@MINIZIP_ENABLE_BZIP2@)
if(minizip_FIND_COMPONENTS)
find_dependency(ZLIB CONFIG COMPONENTS ${minizip_FIND_COMPONENTS})
foreach(_comp ${minizip_FIND_COMPONENTS})
if(NOT _comp IN_LIST _MINIZIP_supported_components)
set(minizip_FOUND False)
set(minizip_NOT_FOUND_MESSAGE "Unsupported component: ${_comp}")
endif(NOT _comp IN_LIST _MINIZIP_supported_components)
include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_comp}.cmake")
endforeach(_comp ${ZLIB_FIND_COMPONENTS})
else(minizip_FIND_COMPONENTS)
find_dependency(ZLIB CONFIG)
foreach(_component_config IN LISTS _minizip_supported_components)
include("${CMAKE_CURRENT_LIST_DIR}/minizip-${_component_config}.cmake")
endforeach(_component_config IN LISTS _minizip_supported_components)
endif(minizip_FIND_COMPONENTS)

View File

@ -5,6 +5,9 @@
*/ */
/* Code */ /* Code */
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -27,18 +30,12 @@
WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
} while(0) } while(0)
extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) {
const char* file;
const char* fileOut;
const char* fileOutTmp;
uLong* nRecovered;
uLong* bytesRecovered;
{
int err = Z_OK; int err = Z_OK;
FILE* fpZip = fopen(file, "rb"); FILE* fpZip = fopen(file, "rb");
FILE* fpOut = fopen(fileOut, "wb"); FILE* fpOut = fopen(fileOut, "wb");
FILE* fpOutCD = fopen(fileOutTmp, "wb"); FILE* fpOutCD = fopen(fileOutTmp, "wb");
if (fpZip != NULL && fpOut != NULL && fpOutCD !=NULL) { if (fpZip != NULL && fpOut != NULL) {
int entries = 0; int entries = 0;
uLong totalBytes = 0; uLong totalBytes = 0;
char header[30]; char header[30];
@ -146,28 +143,28 @@ uLong* bytesRecovered;
/* Central directory entry */ /* Central directory entry */
{ {
char header[46]; char central[46];
char* comment = ""; char* comment = "";
int comsize = (int) strlen(comment); int comsize = (int) strlen(comment);
WRITE_32(header, 0x02014b50); WRITE_32(central, 0x02014b50);
WRITE_16(header + 4, version); WRITE_16(central + 4, version);
WRITE_16(header + 6, version); WRITE_16(central + 6, version);
WRITE_16(header + 8, gpflag); WRITE_16(central + 8, gpflag);
WRITE_16(header + 10, method); WRITE_16(central + 10, method);
WRITE_16(header + 12, filetime); WRITE_16(central + 12, filetime);
WRITE_16(header + 14, filedate); WRITE_16(central + 14, filedate);
WRITE_32(header + 16, crc); WRITE_32(central + 16, crc);
WRITE_32(header + 20, cpsize); WRITE_32(central + 20, cpsize);
WRITE_32(header + 24, uncpsize); WRITE_32(central + 24, uncpsize);
WRITE_16(header + 28, fnsize); WRITE_16(central + 28, fnsize);
WRITE_16(header + 30, extsize); WRITE_16(central + 30, extsize);
WRITE_16(header + 32, comsize); WRITE_16(central + 32, comsize);
WRITE_16(header + 34, 0); /* disk # */ WRITE_16(central + 34, 0); /* disk # */
WRITE_16(header + 36, 0); /* int attrb */ WRITE_16(central + 36, 0); /* int attrb */
WRITE_32(header + 38, 0); /* ext attrb */ WRITE_32(central + 38, 0); /* ext attrb */
WRITE_32(header + 42, currentOffset); WRITE_32(central + 42, currentOffset);
/* Header */ /* Header */
if (fwrite(header, 1, 46, fpOutCD) == 46) { if (fwrite(central, 1, 46, fpOutCD) == 46) {
offsetCD += 46; offsetCD += 46;
/* Filename */ /* Filename */
@ -221,23 +218,23 @@ uLong* bytesRecovered;
/* Final central directory */ /* Final central directory */
{ {
int entriesZip = entries; int entriesZip = entries;
char header[22]; char end[22];
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; char* comment = ""; /* "ZIP File recovered by zlib/minizip/mztools"; */
int comsize = (int) strlen(comment); int comsize = (int) strlen(comment);
if (entriesZip > 0xffff) { if (entriesZip > 0xffff) {
entriesZip = 0xffff; entriesZip = 0xffff;
} }
WRITE_32(header, 0x06054b50); WRITE_32(end, 0x06054b50);
WRITE_16(header + 4, 0); /* disk # */ WRITE_16(end + 4, 0); /* disk # */
WRITE_16(header + 6, 0); /* disk # */ WRITE_16(end + 6, 0); /* disk # */
WRITE_16(header + 8, entriesZip); /* hack */ WRITE_16(end + 8, entriesZip); /* hack */
WRITE_16(header + 10, entriesZip); /* hack */ WRITE_16(end + 10, entriesZip); /* hack */
WRITE_32(header + 12, offsetCD); /* size of CD */ WRITE_32(end + 12, offsetCD); /* size of CD */
WRITE_32(header + 16, offset); /* offset to CD */ WRITE_32(end + 16, offset); /* offset to CD */
WRITE_16(header + 20, comsize); /* comment */ WRITE_16(end + 20, comsize); /* comment */
/* Header */ /* Header */
if (fwrite(header, 1, 22, fpOutCD) == 22) { if (fwrite(end, 1, 22, fpOutCD) == 22) {
/* Comment field */ /* Comment field */
if (comsize > 0) { if (comsize > 0) {

361
deps/zlib/contrib/minizip/skipset.h vendored Normal file
View File

@ -0,0 +1,361 @@
/* skipset.h -- set operations using a skiplist
// Copyright (C) 2024 Mark Adler
// See MiniZip_info.txt for the license.
// This implements a skiplist set, i.e. just keys, no data, with ~O(log n) time
// insert and search operations. The application defines the type of a key, and
// provides a function to compare two keys.
// This header is not definitions of functions found in another source file --
// it creates the set functions, with the application's key type, right where
// the #include is. Before this header is #included, these must be defined:
//
// 1. A macro or typedef for set_key_t, the type of a key.
// 2. A macro or function set_cmp(a, b) to compare two keys. The return values
// are < 0 for a < b, 0 for a == b, and > 0 for a > b.
// 3. A macro or function set_drop(s, k) to release the key k's resources, if
// any, when doing a set_end() or set_clear(). s is a pointer to the set
// that key is in, for use with set_free() if desired.
//
// Example usage:
//
// typedef int set_key_t;
// #define set_cmp(a, b) ((a) < (b) ? -1 : (a) == (b) ? 0 : 1)
// #define set_drop(s, k)
// #include "skipset.h"
//
// int test(void) { // return 0: good, 1: bad, -1: out of memory
// set_t set;
// if (setjmp(set.env))
// return -1;
// set_start(&set);
// set_insert(&set, 2);
// set_insert(&set, 1);
// set_insert(&set, 7);
// int bad = !set_found(&set, 2);
// bad = bad || set_found(&set, 5);
// set_end(&set);
// return bad;
// }
//
// Interface summary (see more details below):
// - set_t is the type of the set being operated on (a set_t pointer is passed)
// - set_start() initializes a new, empty set (initialize set.env first)
// - set_insert() inserts a new key into the set, or not if it's already there
// - set_found() determines whether or not a key is in the set
// - set_end() ends the use of the set, freeing all memory
// - set_clear() empties the set, equivalent to set_end() and then set_start()
// - set_ok() checks if set appears to be usable, i.e. started and not ended
//
// Auxiliary functions available to the application:
// - set_alloc() allocates memory with optional tracking (#define SET_TRACK)
// - set_free() deallocates memory allocated by set_alloc()
// - set_rand() returns 32 random bits (seeded by set_start()) */
#ifndef SKIPSET_H
#define SKIPSET_H
#include <stdlib.h> /* realloc(), free(), NULL, size_t */
#include <stddef.h> /* ptrdiff_t */
#include <setjmp.h> /* jmp_buf, longjmp() */
#include <errno.h> /* ENOMEM */
#include <time.h> /* time(), clock() */
#include <assert.h> /* assert.h */
#include "ints.h" /* i16_t, ui32_t, ui64_t */
/* Structures and functions below noted as "--private--" should not be used by
// the application. set_t is partially private and partially public -- see the
// comments there.
// There is no POSIX random() in MSVC, and rand() is awful. For portability, we
// cannot rely on a library function for random numbers. Instead we use the
// fast and effective algorithm below, invented by Melissa O'Neill.
// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / www.pcg-random.org
// Licensed under Apache License 2.0 (NO WARRANTY, etc. see website)
// --private-- Random number generator state. */
typedef struct {
ui64_t state; /* 64-bit generator state */
ui64_t inc; /* 63-bit sequence id */
} set_rand_t;
/* --private-- Initialize the state *gen using seed and seq. seed seeds the
// advancing 64-bit state. seq is a sequence selection constant. */
void set_seed(set_rand_t *gen, ui64_t seed, ui64_t seq) {
gen->inc = (seq << 1) | 1;
gen->state = (seed + gen->inc) * 6364136223846793005ULL + gen->inc;
}
/* Return 32 random bits, advancing the state *gen. */
ui32_t set_rand(set_rand_t *gen) {
ui64_t state = gen->state;
gen->state = state * 6364136223846793005ULL + gen->inc;
ui32_t mix = (ui32_t)(((state >> 18) ^ state) >> 27);
int rot = state >> 59;
return (mix >> rot) | (mix << ((-rot) & 31));
}
/* End of PCG32 code. */
/* --private-- Linked-list node. */
typedef struct set_node_s set_node_t;
struct set_node_s {
set_key_t key; /* the key (not used for head or path) */
i16_t size; /* number of allocated pointers in right[] */
i16_t fill; /* number of pointers in right[] filled in */
set_node_t **right; /* pointer for each level, each to the right */
};
/* A set. The application sets env, may use gen with set_rand(), and may read
// allocs and memory. The remaining variables are --private-- . */
typedef struct set_s {
set_node_t *head; /* skiplist head -- no key, just links */
set_node_t *path; /* right[] is path to key from set_found() */
set_node_t *node; /* node under construction, in case of longjmp() */
i16_t depth; /* maximum depth of the skiplist */
ui64_t ran; /* a precious trove of random bits */
set_rand_t gen; /* random number generator state */
jmp_buf env; /* setjmp() environment for allocation errors */
#ifdef SET_TRACK
size_t allocs; /* number of allocations */
size_t memory; /* total amount of allocated memory (>= requests) */
#endif
} set_t;
/* Memory allocation and deallocation. set_alloc(set, ptr, size) returns a
// pointer to an allocation of size bytes if ptr is NULL, or the previous
// allocation ptr resized to size bytes. set_alloc() will never return NULL.
// set_free(set, ptr) frees an allocation created by set_alloc(). These may be
// used by the application. e.g. if allocation tracking is desired. */
#ifdef SET_TRACK
/* Track the number of allocations and the total backing memory size. */
# if defined(_WIN32)
# include <malloc.h>
# define SET_ALLOC_SIZE(ptr) _msize(ptr)
# elif defined(__MACH__)
# include <malloc/malloc.h>
# define SET_ALLOC_SIZE(ptr) malloc_size(ptr)
# elif defined(__linux__)
# include <malloc.h>
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
# elif defined(__FreeBSD__)
# include <malloc_np.h>
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
# elif defined(__NetBSD__)
# include <jemalloc/jemalloc.h>
# define SET_ALLOC_SIZE(ptr) malloc_usable_size(ptr)
# else // e.g. OpenBSD
# define SET_ALLOC_SIZE(ptr) 0
# endif
// With tracking.
void *set_alloc(set_t *set, void *ptr, size_t size) {
size_t had = ptr == NULL ? 0 : SET_ALLOC_SIZE(ptr);
void *mem = realloc(ptr, size);
if (mem == NULL)
longjmp(set->env, ENOMEM);
set->allocs += ptr == NULL;
set->memory += SET_ALLOC_SIZE(mem) - had;
return mem;
}
void set_free(set_t *set, void *ptr) {
if (ptr != NULL) {
set->allocs--;
set->memory -= SET_ALLOC_SIZE(ptr);
free(ptr);
}
}
#else
/* Without tracking. */
void *set_alloc(set_t *set, void *ptr, size_t size) {
void *mem = realloc(ptr, size);
if (mem == NULL)
longjmp(set->env, ENOMEM);
return mem;
}
void set_free(set_t *set, void *ptr) {
(void)set;
free(ptr);
}
#endif
/* --private-- Grow node's array right[] as needed to be able to hold at least
// want links. If fill is true, assure that the first want links are filled in,
// setting them to set->head if not previously filled in. Otherwise it is
// assumed that the first want links are about to be filled in. */
void set_grow(set_t *set, set_node_t *node, int want, int fill) {
if (node->size < want) {
int more = node->size ? node->size : 1;
while (more < want)
more <<= 1;
node->right = set_alloc(set, node->right, more * sizeof(set_node_t *));
node->size = (i16_t)more;
}
int i;
if (fill)
for (i = node->fill; i < want; i++)
node->right[i] = set->head;
node->fill = (i16_t)want;
}
/* --private-- Return a new node. key is left uninitialized. */
set_node_t *set_node(set_t *set) {
set_node_t *node = set_alloc(set, NULL, sizeof(set_node_t));
node->size = 0;
node->fill = 0;
node->right = NULL;
return node;
}
/* --private-- Free the list linked from head, along with the keys. */
void set_sweep(set_t *set) {
set_node_t *step = set->head->right[0];
while (step != set->head) {
set_node_t *next = step->right[0]; /* save link to next node */
set_drop(set, step->key);
set_free(set, step->right);
set_free(set, step);
step = next;
}
}
/* Initialize a new set. set->env must be initialized using setjmp() before
// set_start() is called. A longjmp(set->env, ENOMEM) will be used to handle a
// memory allocation failure during any of the operations. (See setjmp.h and
// errno.h.) The set can still be used if this happens, assuming that it didn't
// happen during set_start(). Whether set_start() completed or not, set_end()
// can be used to free the set's memory after a longjmp(). */
void set_start(set_t *set) {
#ifdef SET_TRACK
set->allocs = 0;
set->memory = 0;
#endif
set->head = set->path = set->node = NULL; /* in case set_node() fails */
set->path = set_node(set);
set->head = set_node(set);
set_grow(set, set->head, 1, 1); /* one link back to head for an empty set */
*(unsigned char *)&set->head->key = 137; /* set id */
set->depth = 0;
set_seed(&set->gen, ((ui64_t)(ptrdiff_t)set << 32) ^
((ui64_t)time(NULL) << 12) ^ clock(), 0);
set->ran = 1;
}
/* Return true if *set appears to be in a usable state. If *set has been zeroed
// out, then set_ok(set) will be false and set_end(set) will be safe. */
int set_ok(set_t *set) {
return set->head != NULL &&
set->head->right != NULL &&
*(unsigned char *)&set->head->key == 137;
}
/* Empty the set. This frees the memory used for the previous set contents.
// After set_clear(), *set is ready for use, as if after a set_start(). */
void set_clear(set_t *set) {
assert(set_ok(set) && "improper use");
/* Free all the keys and their nodes. */
set_sweep(set);
/* Leave the head and path allocations as is. Clear their contents, with
// head pointing to itself and setting depth to zero, for an empty set. */
set->head->right[0] = set->head;
set->head->fill = 1;
set->path->fill = 0;
set->depth = 0;
}
/* Done using the set -- free all allocations. The only operation on *set
// permitted after this is set_start(). Though another set_end() would do no
// harm. This can be done at any time after a set_start(), or after a longjmp()
// on any allocation failure, including during a set_start(). */
void set_end(set_t *set) {
if (set->head != NULL) {
/* Empty the set and free the head node. */
if (set->head->right != NULL) {
set_sweep(set);
set_free(set, set->head->right);
}
set_free(set, set->head);
set->head = NULL;
}
if (set->path != NULL) {
/* Free the path work area. */
set_free(set, set->path->right);
set_free(set, set->path);
set->path = NULL;
}
if (set->node != NULL) {
/* Free the node that was under construction when longjmp() hit. */
set_drop(set, set->node->key);
set_free(set, set->node->right);
set_free(set, set->node);
set->node = NULL;
}
}
/* Look for key. Return 1 if found or 0 if not. This also puts the path to get
// there in set->path, for use by set_insert(). */
int set_found(set_t *set, set_key_t key) {
assert(set_ok(set) && "improper use");
/* Start at depth and work down and right as determined by key comparisons. */
set_node_t *head = set->head, *here = head;
int i = set->depth;
set_grow(set, set->path, i + 1, 0);
do {
while (here->right[i] != head &&
set_cmp(here->right[i]->key, key) < 0)
here = here->right[i];
set->path->right[i] = here;
} while (i--);
/* See if the key matches. */
here = here->right[0];
return here != head && set_cmp(here->key, key) == 0;
}
/* Insert the key key. Return 0 on success, or 1 if key is already in the set. */
int set_insert(set_t *set, set_key_t key) {
assert(set_ok(set) && "improper use");
if (set_found(set, key))
/* That key is already in the set. */
return 1;
/* Randomly generate a new level-- level 0 with probability 1/2, 1 with
// probability 1/4, 2 with probability 1/8, etc. */
int level = 0;
for (;;) {
if (set->ran == 1)
/* Ran out. Get another 32 random bits. */
set->ran = set_rand(&set->gen) | (1ULL << 32);
int bit = set->ran & 1;
set->ran >>= 1;
if (bit)
break;
assert(level < 32767 &&
"Overhead, without any fuss, the stars were going out.");
level++;
}
if (level > set->depth) {
/* The maximum depth is now deeper. Update the structures. */
set_grow(set, set->path, level + 1, 1);
set_grow(set, set->head, level + 1, 1);
set->depth = (i16_t)level;
}
/* Make a new node for the provided key, and insert it in the lists up to
// and including level. */
set->node = set_node(set);
set->node->key = key;
set_grow(set, set->node, level + 1, 0);
int i;
for (i = 0; i <= level; i++) {
set->node->right[i] = set->path->right[i]->right[i];
set->path->right[i]->right[i] = set->node;
}
set->node = NULL;
return 0;
}
#else
#error ** another skiplist set already created here
/* Would need to implement a prefix in order to support multiple sets. */
#endif

View File

@ -0,0 +1,121 @@
# if we are built from with zlib, use this path's)
if(DEFINED ZLIB_BUILD_SHARED)
set(WORK_DIR ${zlib_BINARY_DIR})
set(inst_setup minizip_minizip_install)
else(DEFINED ZLIB_BUILD_SHARED)
set(WORK_DIR ${minizip_BINARY_DIR})
set(inst_setup minizip_minizip_install)
set(ZLIB_ARG "-DZLIB_DIR=${ZLIB_DIR}")
add_test(
NAME minizip_install
COMMAND ${CMAKE_COMMAND} --install ${minizip_BINARY_DIR} --prefix
${CMAKE_CURRENT_BINARY_DIR}/test_install --config $<CONFIG>
WORKING_DIRECTORY ${minizip_BINARY_DIR})
set_tests_properties(minizip_install PROPERTIES FIXTURES_SETUP
minizip_install)
endif(DEFINED ZLIB_BUILD_SHARED)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/find_package_test.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/findpackage_test/CMakeLists.txt @ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_test.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test/CMakeLists.txt @ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/add_subdirectory_exclude_test.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test/CMakeLists.txt
@ONLY)
# CMAKE_GENERATOR_PLATFORM doesn't work in the if
set(GENERATOR ${CMAKE_GENERATOR_PLATFORM})
if(GENERATOR)
set(PLATFORM "-A ${GENERATOR}")
endif(GENERATOR)
#
# findpackage_test
#
add_test(
NAME minizip_find_package_configure
COMMAND
${CMAKE_COMMAND} ${PLATFORM}
-B${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
--fresh -G "${CMAKE_GENERATOR}"
-S${CMAKE_CURRENT_BINARY_DIR}/findpackage_test)
add_test(
NAME minizip_find_package_build
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/findpackage_test_build)
set_tests_properties(
minizip_find_package_configure PROPERTIES FIXTURES_REQUIRED ${inst_setup}
FIXTURES_SETUP mzfp_config)
set_tests_properties(minizip_find_package_build PROPERTIES FIXTURES_REQUIRED
mzfp_config)
#
# add_subdirectory_test
#
add_test(
NAME minizip_add_subdirectory_configure
COMMAND
${CMAKE_COMMAND} ${PLATFORM}
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
--fresh -G "${CMAKE_GENERATOR}"
-S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test)
add_test(
NAME minizip_add_subdirectory_build
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_test_build)
set_tests_properties(
minizip_add_subdirectory_configure
PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzas_config)
set_tests_properties(minizip_add_subdirectory_build PROPERTIES FIXTURES_REQUIRED
mzas_config)
#
# add_subdirectory_exclude_test
#
add_test(
NAME minizip_add_subdirectory_exclude_configure
COMMAND
${CMAKE_COMMAND} ${PLATFORM}
-B${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build
-DCMAKE_BUILD_TYPE=$<CONFIG> -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_INSTALL_PREFIX=${WORK_DIR}/test/test_install ${ZLIB_ARG}
--fresh -G "${CMAKE_GENERATOR}"
-S${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test)
add_test(
NAME minizip_add_subdirectory_exclude_build
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG>
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/add_subdirectory_exclude_test_build)
set_tests_properties(
minizip_add_subdirectory_exclude_configure
PROPERTIES FIXTURES_REQUIRED ${inst_setup} FIXTURES_SETUP mzasx_config)
set_tests_properties(minizip_add_subdirectory_exclude_build
PROPERTIES FIXTURES_REQUIRED mzasx_config)

View File

@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.12...3.31)
project(
minizip_add_subdirectory_exclude_from_all
LANGUAGES C
VERSION @minizip_VERSION@)
option(MINIZIP_BUILD_TESTING "" OFF)
option(MINIZIP_BUILD_SHARED "" @MINIZIP_BUILD_SHARED@)
option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@)
option(MINIZIP_ENABLE_BZIP2 "" @MINIZIP_ENABLE_BZIP2@)
add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip
EXCLUDE_FROM_ALL)
set(MINIZIP_SRCS
@minizip_SOURCE_DIR@/ioapi.c
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
if(MINIZIP_BUILD_SHARED)
add_executable(test_example ${MINIZIP_SRCS})
target_link_libraries(test_example MINIZIP::minizip)
endif(MINIZIP_BUILD_SHARED)
if(MINIZIP_BUILD_STATIC)
add_executable(test_example_static ${MINIZIP_SRCS})
target_link_libraries(test_example_static MINIZIP::minizipstatic)
endif(MINIZIP_BUILD_STATIC)

View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.12...3.31)
project(
minizip_add_subdirectory_exclude_from_all
LANGUAGES C
VERSION @minizip_VERSION@)
option(MINIZIP_BUILD_TESTING "" OFF)
option(MINIZIP_BUILD_SHARED "" @MINIZIP_BUILD_SHARED@)
option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@)
option(MINIZIP_ENABLE_BZIP2 "" @MINIZIP_ENABLE_BZIP2@)
add_subdirectory(@minizip_SOURCE_DIR@ ${CMAKE_CURRENT_BINARY_DIR}/minizip)
set(MINIZIP_SRCS
@minizip_SOURCE_DIR@/ioapi.c
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
if(MINIZIP_BUILD_SHARED)
add_executable(test_example ${MINIZIP_SRCS})
target_link_libraries(test_example MINIZIP::minizip)
endif(MINIZIP_BUILD_SHARED)
if(MINIZIP_BUILD_STATIC)
add_executable(test_example_static ${MINIZIP_SRCS})
target_link_libraries(test_example_static MINIZIP::minizipstatic)
endif(MINIZIP_BUILD_STATIC)

View File

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.12...3.31)
project(
minizip_find_package
LANGUAGES C
VERSION @minizip_VERSION@)
option(MINIZIP_BUILD_SHARED "" @MINIZIP_BUILD_SHARED@)
option(MINIZIP_BUILD_STATIC "" @MINIZIP_BUILD_STATIC@)
find_package(minizip ${minizip_VERSION} CONFIG REQUIRED)
set(MINIZIP_SRCS
@minizip_SOURCE_DIR@/ioapi.c
$<$<BOOL:${WIN32}>:@minizip_SOURCE_DIR@/iowin32.c>
@minizip_SOURCE_DIR@/minizip.c @minizip_SOURCE_DIR@/zip.c)
if(MINIZIP_BUILD_SHARED)
add_executable(test_example ${MINIZIP_SRCS})
target_link_libraries(test_example MINIZIP::minizip)
endif(MINIZIP_BUILD_SHARED)
if(MINIZIP_BUILD_STATIC)
add_executable(test_example_static ${MINIZIP_SRCS})
target_link_libraries(test_example_static MINIZIP::minizipstatic)
endif(MINIZIP_BUILD_STATIC)

View File

@ -0,0 +1,32 @@
if(CREATE_SHARED)
file(REMOVE ./test_file_shared.orig ./test_file_shared.zip)
file(WRITE ./test_file_shared.txt "Hello Hello Hello")
endif(CREATE_SHARED)
if(MOVE_SHARED)
file(RENAME ./test_file_shared.txt ./test_file_shared.orig)
endif(MOVE_SHARED)
if(DELETE_SHARED)
file(REMOVE
./test_file_shared.txt
./test_file_shared.orig
./test_file_shared.zip)
endif(DELETE_SHARED)
if(CREATE_STATIC)
file(REMOVE ./test_file_static.orig ./test_file_static.zip)
file(WRITE ./test_file_static.txt "Hello Hello Hello")
endif(CREATE_STATIC)
if(MOVE_STATIC)
file(RENAME ./test_file_static.txt ./test_file_static.orig)
endif(MOVE_STATIC)
if(DELETE_STATIC)
file(REMOVE
./test_file_static.txt
./test_file_static.orig
./test_file_static.zip)
endif(DELETE_STATIC)

File diff suppressed because it is too large Load Diff

View File

@ -83,12 +83,12 @@ typedef voidp unzFile;
/* tm_unz contain date/time info */ /* tm_unz contain date/time info */
typedef struct tm_unz_s typedef struct tm_unz_s
{ {
uInt tm_sec; /* seconds after the minute - [0,59] */ int tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */ int tm_min; /* minutes after the hour - [0,59] */
uInt tm_hour; /* hours since midnight - [0,23] */ int tm_hour; /* hours since midnight - [0,23] */
uInt tm_mday; /* day of the month - [1,31] */ int tm_mday; /* day of the month - [1,31] */
uInt tm_mon; /* months since January - [0,11] */ int tm_mon; /* months since January - [0,11] */
uInt tm_year; /* years - [1980..2044] */ int tm_year; /* years - [1980..2044] */
} tm_unz; } tm_unz;
/* unz_global_info structure contain global data about the ZIPfile /* unz_global_info structure contain global data about the ZIPfile
@ -150,21 +150,21 @@ typedef struct unz_file_info_s
tm_unz tmu_date; tm_unz tmu_date;
} unz_file_info; } unz_file_info;
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, extern int ZEXPORT unzStringFileNameCompare(const char* fileName1,
const char* fileName2, const char* fileName2,
int iCaseSensitivity)); int iCaseSensitivity);
/* /*
Compare two filename (fileName1,fileName2). Compare two filenames (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSensitivity = 1, comparison is case sensitive (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi
or strcasecmp) or strcasecmp)
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system If iCaseSensitivity = 0, case sensitivity is default of your operating system
(like 1 on Unix, 2 on Windows) (like 1 on Unix, 2 on Windows)
*/ */
extern unzFile ZEXPORT unzOpen OF((const char *path)); extern unzFile ZEXPORT unzOpen(const char *path);
extern unzFile ZEXPORT unzOpen64 OF((const void *path)); extern unzFile ZEXPORT unzOpen64(const void *path);
/* /*
Open a Zip file. path contain the full pathname (by example, Open a Zip file. path contain the full pathname (by example,
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
@ -181,41 +181,41 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path));
*/ */
extern unzFile ZEXPORT unzOpen2 OF((const char *path, extern unzFile ZEXPORT unzOpen2(const char *path,
zlib_filefunc_def* pzlib_filefunc_def)); zlib_filefunc_def* pzlib_filefunc_def);
/* /*
Open a Zip file, like unzOpen, but provide a set of file low level API Open a Zip file, like unzOpen, but provide a set of file low level API
for read/write the zip file (see ioapi.h) for read/write the zip file (see ioapi.h)
*/ */
extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, extern unzFile ZEXPORT unzOpen2_64(const void *path,
zlib_filefunc64_def* pzlib_filefunc_def)); zlib_filefunc64_def* pzlib_filefunc_def);
/* /*
Open a Zip file, like unz64Open, but provide a set of file low level API Open a Zip file, like unz64Open, but provide a set of file low level API
for read/write the zip file (see ioapi.h) for read/write the zip file (see ioapi.h)
*/ */
extern int ZEXPORT unzClose OF((unzFile file)); extern int ZEXPORT unzClose(unzFile file);
/* /*
Close a ZipFile opened with unzOpen. Close a ZipFile opened with unzOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later), If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzCloseCurrentFile before call unzClose. these files MUST be closed with unzCloseCurrentFile before call unzClose.
return UNZ_OK if there is no problem. */ return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, extern int ZEXPORT unzGetGlobalInfo(unzFile file,
unz_global_info *pglobal_info)); unz_global_info *pglobal_info);
extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, extern int ZEXPORT unzGetGlobalInfo64(unzFile file,
unz_global_info64 *pglobal_info)); unz_global_info64 *pglobal_info);
/* /*
Write info about the ZipFile in the *pglobal_info structure. Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed No preparation of the structure is needed
return UNZ_OK if there is no problem. */ return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalComment OF((unzFile file, extern int ZEXPORT unzGetGlobalComment(unzFile file,
char *szComment, char *szComment,
uLong uSizeBuf)); uLong uSizeBuf);
/* /*
Get the global comment string of the ZipFile, in the szComment buffer. Get the global comment string of the ZipFile, in the szComment buffer.
uSizeBuf is the size of the szComment buffer. uSizeBuf is the size of the szComment buffer.
@ -226,22 +226,22 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
/***************************************************************************/ /***************************************************************************/
/* Unzip package allow you browse the directory of the zipfile */ /* Unzip package allow you browse the directory of the zipfile */
extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); extern int ZEXPORT unzGoToFirstFile(unzFile file);
/* /*
Set the current file of the zipfile to the first file. Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem return UNZ_OK if there is no problem
*/ */
extern int ZEXPORT unzGoToNextFile OF((unzFile file)); extern int ZEXPORT unzGoToNextFile(unzFile file);
/* /*
Set the current file of the zipfile to the next file. Set the current file of the zipfile to the next file.
return UNZ_OK if there is no problem return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/ */
extern int ZEXPORT unzLocateFile OF((unzFile file, extern int ZEXPORT unzLocateFile(unzFile file,
const char *szFileName, const char *szFileName,
int iCaseSensitivity)); int iCaseSensitivity);
/* /*
Try locate the file szFileName in the zipfile. Try locate the file szFileName in the zipfile.
For the iCaseSensitivity signification, see unzStringFileNameCompare For the iCaseSensitivity signification, see unzStringFileNameCompare
@ -285,40 +285,44 @@ extern int ZEXPORT unzGoToFilePos64(
/* ****************************************** */ /* ****************************************** */
extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
unz_file_info64 *pfile_info, unz_file_info64 *pfile_info,
char *szFileName, char *szFileName,
uLong fileNameBufferSize, uLong fileNameBufferSize,
void *extraField, void *extraField,
uLong extraFieldBufferSize, uLong extraFieldBufferSize,
char *szComment, char *szComment,
uLong commentBufferSize)); uLong commentBufferSize);
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
unz_file_info *pfile_info, unz_file_info *pfile_info,
char *szFileName, char *szFileName,
uLong fileNameBufferSize, uLong fileNameBufferSize,
void *extraField, void *extraField,
uLong extraFieldBufferSize, uLong extraFieldBufferSize,
char *szComment, char *szComment,
uLong commentBufferSize)); uLong commentBufferSize);
/* /*
Get Info about the current file Get Info about the current file
if pfile_info!=NULL, the *pfile_info structure will contain somes 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.
*/ */
/** Addition for GDAL : START */ /** Addition for GDAL : START */
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file);
/** Addition for GDAL : END */ /** Addition for GDAL : END */
@ -328,24 +332,24 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file));
from it, and close it (you can close it before reading all the file) from it, and close it (you can close it before reading all the file)
*/ */
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); extern int ZEXPORT unzOpenCurrentFile(unzFile file);
/* /*
Open for reading data the current file in the zipfile. Open for reading data the current file in the zipfile.
If there is no error, the return value is UNZ_OK. If there is no error, the return value is UNZ_OK.
*/ */
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file,
const char* password)); const char* password);
/* /*
Open for reading data the current file in the zipfile. Open for reading data the current file in the zipfile.
password is a crypting password password is a crypting password
If there is no error, the return value is UNZ_OK. If there is no error, the return value is UNZ_OK.
*/ */
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, extern int ZEXPORT unzOpenCurrentFile2(unzFile file,
int* method, int* method,
int* level, int* level,
int raw)); int raw);
/* /*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1 if raw==1
@ -355,11 +359,11 @@ extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
but you CANNOT set method parameter as NULL but you CANNOT set method parameter as NULL
*/ */
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, extern int ZEXPORT unzOpenCurrentFile3(unzFile file,
int* method, int* method,
int* level, int* level,
int raw, int raw,
const char* password)); const char* password);
/* /*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1 if raw==1
@ -370,41 +374,41 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
*/ */
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); extern int ZEXPORT unzCloseCurrentFile(unzFile file);
/* /*
Close the file in zip opened with unzOpenCurrentFile Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/ */
extern int ZEXPORT unzReadCurrentFile OF((unzFile file, extern int ZEXPORT unzReadCurrentFile(unzFile file,
voidp buf, voidp buf,
unsigned len)); unsigned len);
/* /*
Read bytes from the current file (opened by unzOpenCurrentFile) Read bytes from the current file (opened by unzOpenCurrentFile)
buf contain buffer where data must be copied buf contain buffer where data must be copied
len the size of buf. len the size of buf.
return the number of byte copied if somes bytes are copied return the number of byte copied if some bytes are copied
return 0 if the end of file was reached return 0 if the end of file was reached
return <0 with error code if there is an error return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error) (UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/ */
extern z_off_t ZEXPORT unztell OF((unzFile file)); extern z_off_t ZEXPORT unztell(unzFile file);
extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); extern ZPOS64_T ZEXPORT unztell64(unzFile file);
/* /*
Give the current position in uncompressed data Give the current position in uncompressed data
*/ */
extern int ZEXPORT unzeof OF((unzFile file)); extern int ZEXPORT unzeof(unzFile file);
/* /*
return 1 if the end of file was reached, 0 elsewhere return 1 if the end of file was reached, 0 elsewhere
*/ */
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, extern int ZEXPORT unzGetLocalExtrafield(unzFile file,
voidp buf, voidp buf,
unsigned len)); unsigned len);
/* /*
Read extra field from the current file (opened by unzOpenCurrentFile) Read extra field from the current file (opened by unzOpenCurrentFile)
This is the local-header version of the extra field (sometimes, there is This is the local-header version of the extra field (sometimes, there is

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@
See header of zip.h See header of zip.h
*/ */
#ifndef _zip12_H #ifndef _zip12_H
#define _zip12_H #define _zip12_H
@ -44,7 +44,7 @@
extern "C" { extern "C" {
#endif #endif
//#define HAVE_BZIP2 /* #define HAVE_BZIP2 */
#ifndef _ZLIB_H #ifndef _ZLIB_H
#include "zlib.h" #include "zlib.h"
@ -88,12 +88,12 @@ typedef voidp zipFile;
/* tm_zip contain date/time info */ /* tm_zip contain date/time info */
typedef struct tm_zip_s typedef struct tm_zip_s
{ {
uInt tm_sec; /* seconds after the minute - [0,59] */ int tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */ int tm_min; /* minutes after the hour - [0,59] */
uInt tm_hour; /* hours since midnight - [0,23] */ int tm_hour; /* hours since midnight - [0,23] */
uInt tm_mday; /* day of the month - [1,31] */ int tm_mday; /* day of the month - [1,31] */
uInt tm_mon; /* months since January - [0,11] */ int tm_mon; /* months since January - [0,11] */
uInt tm_year; /* years - [1980..2044] */ int tm_year; /* years - [1980..2044] */
} tm_zip; } tm_zip;
typedef struct typedef struct
@ -113,8 +113,8 @@ typedef const char* zipcharpc;
#define APPEND_STATUS_CREATEAFTER (1) #define APPEND_STATUS_CREATEAFTER (1)
#define APPEND_STATUS_ADDINZIP (2) #define APPEND_STATUS_ADDINZIP (2)
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); extern zipFile ZEXPORT zipOpen(const char *pathname, int append);
extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); extern zipFile ZEXPORT zipOpen64(const void *pathname, int append);
/* /*
Create a zipfile. Create a zipfile.
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
@ -127,127 +127,131 @@ extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
If the zipfile cannot be opened, the return value is NULL. If the zipfile cannot be opened, the return value is NULL.
Else, the return value is a zipFile Handle, usable with other function Else, the return value is a zipFile Handle, usable with other function
of this zip package. of this zip package.
*/ */
/* Note : there is no delete function into a zipfile. /* Note : there is no delete function into a zipfile.
If you want delete file into a zipfile, you must open a zipfile, and create another If you want delete file into a zipfile, you must open a zipfile, and create another
Of couse, you can use RAW reading and writing to copy the file you did not want delte Of course, you can use RAW reading and writing to copy the file you did not want delete
*/ */
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, extern zipFile ZEXPORT zipOpen2(const char *pathname,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def);
extern zipFile ZEXPORT zipOpen2_64(const void *pathname,
int append, int append,
zipcharpc* globalcomment, zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def)); zlib_filefunc64_def* pzlib_filefunc_def);
extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, extern zipFile ZEXPORT zipOpen3(const void *pathname,
int append, int append,
zipcharpc* globalcomment, zipcharpc* globalcomment,
zlib_filefunc64_def* pzlib_filefunc_def)); zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level)); int level);
extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip64(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int zip64)); int zip64);
/* /*
Open a file in the ZIP for writing. Open a file in the ZIP for writing.
filename : the filename in zip (if NULL, '-' without quote will be used filename : the filename in zip (if NULL, '-' without quote will be used
*zipfi contain supplemental information *zipfi contain supplemental information
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
contains the extrafield data the the local header contains the extrafield data for the local header
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
contains the extrafield data the the local header contains the extrafield data for the global header
if comment != NULL, comment contain the comment string if comment != NULL, comment contain the comment string
method contain the compression method (0 for store, Z_DEFLATED for deflate) method contain the compression method (0 for store, Z_DEFLATED for deflate)
level contain the level of compression (can be Z_DEFAULT_COMPRESSION) level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
zip64 is set to 1 if a zip64 extended information block should be added to the local file header. zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
this MUST be '1' if the uncompressed size is >= 0xffffffff. this MUST be '1' if the uncompressed size is >= 0xffffffff.
*/ */
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip2(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int raw)); int raw);
extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int raw, int raw,
int zip64)); int zip64);
/* /*
Same than zipOpenNewFileInZip, except if raw=1, we write raw file Same than zipOpenNewFileInZip, except if raw=1, we write raw file
*/ */
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip3(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int raw, int raw,
int windowBits, int windowBits,
int memLevel, int memLevel,
int strategy, int strategy,
const char* password, const char* password,
uLong crcForCrypting)); uLong crcForCrypting);
extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int raw, int raw,
int windowBits, int windowBits,
int memLevel, int memLevel,
int strategy, int strategy,
const char* password, const char* password,
uLong crcForCrypting, uLong crcForCrypting,
int zip64 int zip64);
));
/* /*
Same than zipOpenNewFileInZip2, except Same than zipOpenNewFileInZip2, except
@ -256,47 +260,45 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
crcForCrypting : crc of file to compress (needed for crypting) crcForCrypting : crc of file to compress (needed for crypting)
*/ */
extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip4(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int raw, int raw,
int windowBits, int windowBits,
int memLevel, int memLevel,
int strategy, int strategy,
const char* password, const char* password,
uLong crcForCrypting, uLong crcForCrypting,
uLong versionMadeBy, uLong versionMadeBy,
uLong flagBase uLong flagBase);
));
extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file,
const char* filename, const char* filename,
const zip_fileinfo* zipfi, const zip_fileinfo* zipfi,
const void* extrafield_local, const void* extrafield_local,
uInt size_extrafield_local, uInt size_extrafield_local,
const void* extrafield_global, const void* extrafield_global,
uInt size_extrafield_global, uInt size_extrafield_global,
const char* comment, const char* comment,
int method, int method,
int level, int level,
int raw, int raw,
int windowBits, int windowBits,
int memLevel, int memLevel,
int strategy, int strategy,
const char* password, const char* password,
uLong crcForCrypting, uLong crcForCrypting,
uLong versionMadeBy, uLong versionMadeBy,
uLong flagBase, uLong flagBase,
int zip64 int zip64);
));
/* /*
Same than zipOpenNewFileInZip4, except Same than zipOpenNewFileInZip4, except
versionMadeBy : value for Version made by field versionMadeBy : value for Version made by field
@ -304,40 +306,46 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
*/ */
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, extern int ZEXPORT zipWriteInFileInZip(zipFile file,
const void* buf, const void* buf,
unsigned len)); unsigned len);
/* /*
Write data in the zipfile Write data in the zipfile
*/ */
extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); extern int ZEXPORT zipCloseFileInZip(zipFile file);
/* /*
Close the current file in the zipfile Close the current file in the zipfile
*/ */
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, extern int ZEXPORT zipCloseFileInZipRaw(zipFile file,
uLong uncompressed_size, uLong uncompressed_size,
uLong crc32)); uLong crc32);
extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file,
ZPOS64_T uncompressed_size, ZPOS64_T uncompressed_size,
uLong crc32)); uLong crc32);
extern int ZEXPORT zipAlreadyThere(zipFile file,
char const* name);
/*
See if name is already in file's central directory.
*/
/* /*
Close the current file in the zipfile, for file opened with Close the current file in the zipfile, for file opened with
parameter raw=1 in zipOpenNewFileInZip2 parameter raw=1 in zipOpenNewFileInZip2
uncompressed_size and crc32 are value for the uncompressed size uncompressed_size and crc32 are value for the uncompressed size
*/ */
extern int ZEXPORT zipClose OF((zipFile file, extern int ZEXPORT zipClose(zipFile file,
const char* global_comment)); const char* global_comment);
/* /*
Close the zipfile Close the zipfile
*/ */
extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader);
/* /*
zipRemoveExtraInfoBlock - Added by Mathias Svensson zipRemoveExtraInfoBlock - Added by Mathias Svensson
@ -353,7 +361,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short
Remove ZIP64 Extra information from a Local File Header extra field data Remove ZIP64 Extra information from a Local File Header extra field data
zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
*/ */
#ifdef __cplusplus #ifdef __cplusplus
} }

43
deps/zlib/contrib/nuget/nuget.csproj vendored Normal file
View File

@ -0,0 +1,43 @@
<Project Sdk="Microsoft.Build.NoTargets/3.5.6">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<PackageId>madler.zlib.redist</PackageId>
<PackageId Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(PackageId).win</PackageId>
<PackageId Condition="$([MSBuild]::IsOSPlatform('Linux'))">$(PackageId).linux</PackageId>
<PackageId Condition="$([MSBuild]::IsOSPlatform('OSX'))">$(PackageId).osx</PackageId>
<Copyright>(C) 1995-2024 Jean-loup Gailly and Mark Adler</Copyright>
<version>1.3.1.1</version>
<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.
Native only packages that is to be consumed in .NET should not require these.
-->
<NoWarn>NU5128</NoWarn>
<PackageOutputPath>$(MSBuildProjectDirectory)</PackageOutputPath>
<Authors>Jean-loup Gailly and Mark Adler</Authors>
</PropertyGroup>
<ItemGroup>
<None Include="../../LICENSE" Pack="true" PackagePath="" />
<!-- Package up Windows builds. -->
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/x86/ZlibDll$(Configuration)/zlibwapi.dll" Pack="true" PackagePath="runtimes/win-x86/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/x64/ZlibDll$(Configuration)/zlibwapi.dll" Pack="true" PackagePath="runtimes/win-x64/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/arm/ZlibDll$(Configuration)/zlibwapi.dll" Pack="true" PackagePath="runtimes/win-arm/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/arm64/ZlibDll$(Configuration)/zlibwapi.dll" Pack="true" PackagePath="runtimes/win-arm64/native" />
<!-- Include debug symbols as well as we never know if they might actually be needed in the future. -->
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/x86/ZlibDll$(Configuration)/zlibwapi.pdb" Pack="true" PackagePath="runtimes/win-x86/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/x64/ZlibDll$(Configuration)/zlibwapi.pdb" Pack="true" PackagePath="runtimes/win-x64/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/arm/ZlibDll$(Configuration)/zlibwapi.pdb" Pack="true" PackagePath="runtimes/win-arm/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="../vstudio/vc17/arm64/ZlibDll$(Configuration)/zlibwapi.pdb" Pack="true" PackagePath="runtimes/win-arm64/native" />
<!-- Package up Linux builds. -->
<None Condition="$([MSBuild]::IsOSPlatform('Linux'))" Include="./linux-x86/libz.so" Pack="true" PackagePath="runtimes/linux-x86/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Linux'))" Include="./linux-x64/libz.so" Pack="true" PackagePath="runtimes/linux-x64/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Linux'))" Include="./linux-arm/libz.so" Pack="true" PackagePath="runtimes/linux-arm/native" />
<None Condition="$([MSBuild]::IsOSPlatform('Linux'))" Include="./linux-arm64/libz.so" Pack="true" PackagePath="runtimes/linux-arm64/native" />
<!-- Package up MacOS builds. -->
<None Condition="$([MSBuild]::IsOSPlatform('OSX'))" Include="./osx-x64/libz.dylib" Pack="true" PackagePath="runtimes/osx-x64/native" />
<None Condition="$([MSBuild]::IsOSPlatform('OSX'))" Include="./osx-arm64/libz.dylib" Pack="true" PackagePath="runtimes/osx-arm64/native" />
</ItemGroup>
</Project>

22
deps/zlib/contrib/nuget/nuget.sln vendored Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nuget", "nuget.csproj", "{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

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

View File

@ -38,7 +38,7 @@ Then you can call puff() to decompress a deflate stream that is in memory in
its entirety at source, to a sufficiently sized block of memory for the its entirety at source, to a sufficiently sized block of memory for the
decompressed data at dest. puff() is the only external symbol in puff.c The decompressed data at dest. puff() is the only external symbol in puff.c The
only C library functions that puff.c needs are setjmp() and longjmp(), which only C library functions that puff.c needs are setjmp() and longjmp(), which
are used to simplify error checking in the code to improve readabilty. puff.c are used to simplify error checking in the code to improve readability. puff.c
does no memory allocation, and uses less than 2K bytes off of the stack. does no memory allocation, and uses less than 2K bytes off of the stack.
If destlen is not enough space for the uncompressed data, then inflate will If destlen is not enough space for the uncompressed data, then inflate will

View File

@ -43,7 +43,7 @@
* - Use pointers instead of long to specify source and * - Use pointers instead of long to specify source and
* destination sizes to avoid arbitrary 4 GB limits * destination sizes to avoid arbitrary 4 GB limits
* 1.2 17 Mar 2002 - Add faster version of decode(), doubles speed (!), * 1.2 17 Mar 2002 - Add faster version of decode(), doubles speed (!),
* but leave simple version for readabilty * but leave simple version for readability
* - Make sure invalid distances detected if pointers * - Make sure invalid distances detected if pointers
* are 16 bits * are 16 bits
* - Fix fixed codes table error * - Fix fixed codes table error
@ -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.
@ -624,7 +624,7 @@ local int fixed(struct state *s)
* are themselves compressed using Huffman codes and run-length encoding. In * are themselves compressed using Huffman codes and run-length encoding. In
* the list of code lengths, a 0 symbol means no code, a 1..15 symbol means * the list of code lengths, a 0 symbol means no code, a 1..15 symbol means
* that length, and the symbols 16, 17, and 18 are run-length instructions. * that length, and the symbols 16, 17, and 18 are run-length instructions.
* Each of 16, 17, and 18 are follwed by extra bits to define the length of * Each of 16, 17, and 18 are followed by extra bits to define the length of
* the run. 16 copies the last length 3 to 6 times. 17 represents 3 to 10 * the run. 16 copies the last length 3 to 6 times. 17 represents 3 to 10
* zero lengths, and 18 represents 11 to 138 zero lengths. Unused symbols * zero lengths, and 18 represents 11 to 138 zero lengths. Unused symbols
* are common, hence the special coding for zero lengths. * are common, hence the special coding for zero lengths.

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"
@ -143,7 +147,7 @@ int main(int argc, char **argv)
len - sourcelen); len - sourcelen);
} }
/* if requested, inflate again and write decompressd data to stdout */ /* if requested, inflate again and write decompressed data to stdout */
if (put && ret == 0) { if (put && ret == 0) {
if (fail) if (fail)
destlen >>= 1; destlen >>= 1;

View File

@ -169,7 +169,7 @@ int main(int argc, char *argv[])
printf("error reading %s\n",argv[1]); printf("error reading %s\n",argv[1]);
return 1; return 1;
} }
else printf("file %s read, %u bytes\n",argv[1],lFileSize); else printf("file %s read, %ld bytes\n",argv[1],lFileSize);
if (argc>=3) if (argc>=3)
BlockSizeCompress=atol(argv[2]); BlockSizeCompress=atol(argv[2]);

View File

@ -4,6 +4,22 @@
* written by Pedro A. Aranda Gutierrez <paag@tid.es> * written by Pedro A. Aranda Gutierrez <paag@tid.es>
* adaptation to Unix by Jean-loup Gailly <jloup@gzip.org> * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
* various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro> * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/ */
#include <stdio.h> #include <stdio.h>
@ -14,15 +30,10 @@
#include "zlib.h" #include "zlib.h"
#ifdef unix #ifdef _WIN32
# include <unistd.h>
#else
# include <direct.h> # include <direct.h>
# include <io.h> # include <io.h>
#endif # include <windows.h>
#ifdef WIN32
#include <windows.h>
# ifndef F_OK # ifndef F_OK
# define F_OK 0 # define F_OK 0
# endif # endif
@ -33,6 +44,8 @@
# define strdup(str) _strdup(str) # define strdup(str) _strdup(str)
# endif # endif
#else #else
# include <sys/stat.h>
# include <unistd.h>
# include <utime.h> # include <utime.h>
#endif #endif
@ -102,28 +115,14 @@ struct attr_item
enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID }; enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID };
char *TGZfname OF((const char *));
void TGZnotfound OF((const char *));
int getoct OF((char *, int));
char *strtime OF((time_t *));
int setfiletime OF((char *, time_t));
void push_attr OF((struct attr_item **, char *, int, time_t));
void restore_attr OF((struct attr_item **));
int ExprMatch OF((char *, char *));
int makedir OF((char *));
int matchname OF((int, int, char **, char *));
void error OF((const char *));
int tar OF((gzFile, int, int, int, char **));
void help OF((int));
int main OF((int, char **));
char *prog; char *prog;
void error(const char *msg)
{
fprintf(stderr, "%s: %s\n", prog, msg);
exit(1);
}
const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL }; const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL };
/* return the file name of the TGZ archive */ /* return the file name of the TGZ archive */
@ -205,7 +204,7 @@ char *strtime (time_t *t)
int setfiletime (char *fname,time_t ftime) int setfiletime (char *fname,time_t ftime)
{ {
#ifdef WIN32 #ifdef _WIN32
static int isWinNT = -1; static int isWinNT = -1;
SYSTEMTIME st; SYSTEMTIME st;
FILETIME locft, modft; FILETIME locft, modft;
@ -590,12 +589,6 @@ void help(int exitval)
exit(exitval); exit(exitval);
} }
void error(const char *msg)
{
fprintf(stderr, "%s: %s\n", prog, msg);
exit(1);
}
/* ============================================================ */ /* ============================================================ */
@ -608,7 +601,7 @@ int main(int argc,char **argv)
int action = TGZ_EXTRACT; int action = TGZ_EXTRACT;
int arg = 1; int arg = 1;
char *TGZfile; char *TGZfile;
gzFile *f; gzFile f;
prog = strrchr(argv[0],'\\'); prog = strrchr(argv[0],'\\');
if (prog == NULL) if (prog == NULL)

View File

@ -1,78 +1,81 @@
Building instructions for the DLL versions of Zlib 1.2.11 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
Microsoft Visual C++ 9.0/10.0. Microsoft Visual C++ 9.0/10.0.
You don't need to build these projects yourself. You can download the You don't need to build these projects yourself. You can download the
binaries from: binaries from:
http://www.winimage.com/zLibDll http://www.winimage.com/zLibDll
More information can be found at this site. More information can be found at this site.
Build instructions for Visual Studio 2008 (32 bits or 64 bits) Build instructions for Visual Studio 2008 (32 bits or 64 bits)
-------------------------------------------------------------- --------------------------------------------------------------
- Decompress current zlib, including all contrib/* files - Decompress current zlib, including all contrib/* files
- Compile assembly code (with Visual Studio Command Prompt) by running: - Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008
bld_ml64.bat (in contrib\masmx64) - Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32"
bld_ml32.bat (in contrib\masmx86)
- Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008 Build instructions for Visual Studio 2010 (32 bits or 64 bits)
- Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32" --------------------------------------------------------------
- Decompress current zlib, including all contrib/* files
Build instructions for Visual Studio 2010 (32 bits or 64 bits) - Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010
--------------------------------------------------------------
- Decompress current zlib, including all contrib/* files Build instructions for Visual Studio 2012 (32 bits or 64 bits)
- Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 --------------------------------------------------------------
- Decompress current zlib, including all contrib/* files
Build instructions for Visual Studio 2012 (32 bits or 64 bits) - Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012
--------------------------------------------------------------
- Decompress current zlib, including all contrib/* files Build instructions for Visual Studio 2013 (32 bits or 64 bits)
- Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 --------------------------------------------------------------
- Decompress current zlib, including all contrib/* files
Build instructions for Visual Studio 2013 (32 bits or 64 bits) - Open contrib\vstudio\vc12\zlibvc.sln with Microsoft Visual C++ 2013
--------------------------------------------------------------
- Decompress current zlib, including all contrib/* files Build instructions for Visual Studio 2015 (32 bits or 64 bits)
- Open contrib\vstudio\vc12\zlibvc.sln with Microsoft Visual C++ 2013 --------------------------------------------------------------
- Decompress current zlib, including all contrib/* files
Build instructions for Visual Studio 2015 (32 bits or 64 bits) - Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015
--------------------------------------------------------------
- Decompress current zlib, including all contrib/* files Build instructions for Visual Studio 2022 (64 bits)
- Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015 --------------------------------------------------------------
- Decompress current zlib, including all contrib/* files
- Open contrib\vstudio\vc143\zlibvc.sln with Microsoft Visual C++ 2022
Important
---------
- To use zlibwapi.dll in your application, you must define the
macro ZLIB_WINAPI when compiling your application's source files. Important
---------
- To use zlibwapi.dll in your application, you must define the
Additional notes macro ZLIB_WINAPI when compiling your application's source files.
----------------
- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built
by Gilles Vollant from the zlib 1.1.x sources, and distributed at Additional notes
http://www.winimage.com/zLibDll ----------------
It uses the WINAPI calling convention for the exported functions, and - This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built
includes the minizip functionality. If your application needs that by Gilles Vollant from the zlib 1.1.x sources, and distributed at
particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll. http://www.winimage.com/zLibDll
It uses the WINAPI calling convention for the exported functions, and
- The new DLL was renamed because there exist several incompatible includes the minizip functionality. If your application needs that
versions of zlib.dll on the Internet. particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll.
- There is also an official DLL build of zlib, named zlib1.dll. This one - The new DLL was renamed because there exist several incompatible
is exporting the functions using the CDECL convention. See the file versions of zlib.dll on the Internet.
win32\DLL_FAQ.txt found in this zlib distribution.
- There is also an official DLL build of zlib, named zlib1.dll. This one
- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol is exporting the functions using the CDECL convention. See the file
has a slightly different effect. To avoid compatibility problems, do win32\DLL_FAQ.txt found in this zlib distribution.
not define it here.
- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol
has a slightly different effect. To avoid compatibility problems, do
Gilles Vollant not define it here.
info@winimage.com
Visual Studio 2013 and 2015 Projects from Sean Hunt Gilles Vollant
seandhunt_7@yahoo.com info@winimage.com
Visual Studio 2013, 2015, and 2022 Projects from Sean Hunt
seandhunt_7@yahoo.com

View File

@ -3,7 +3,7 @@
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{048af943-022b-4db6-beeb-a54c34774ee2}</UniqueIdentifier> <UniqueIdentifier>{048af943-022b-4db6-beeb-a54c34774ee2}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{c1d600d2-888f-4aea-b73e-8b0dd9befa0c}</UniqueIdentifier> <UniqueIdentifier>{c1d600d2-888f-4aea-b73e-8b0dd9befa0c}</UniqueIdentifier>

View File

@ -3,7 +3,7 @@
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{c0419b40-bf50-40da-b153-ff74215b79de}</UniqueIdentifier> <UniqueIdentifier>{c0419b40-bf50-40da-b153-ff74215b79de}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{bb87b070-735b-478e-92ce-7383abb2f36c}</UniqueIdentifier> <UniqueIdentifier>{bb87b070-735b-478e-92ce-7383abb2f36c}</UniqueIdentifier>

View File

@ -181,7 +181,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -194,7 +194,7 @@
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)testzlib.exe</OutputFile> <OutputFile>$(OutDir)testzlib.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)testzlib.pdb</ProgramDatabaseFile> <ProgramDatabaseFile>$(OutDir)testzlib.pdb</ProgramDatabaseFile>
@ -241,7 +241,7 @@
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers> <OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@ -254,7 +254,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)testzlib.exe</OutputFile> <OutputFile>$(OutDir)testzlib.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
@ -269,14 +269,14 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
@ -352,14 +352,14 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks> <BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
@ -398,14 +398,6 @@
<ClCompile Include="..\..\..\crc32.c" /> <ClCompile Include="..\..\..\crc32.c" />
<ClCompile Include="..\..\..\deflate.c" /> <ClCompile Include="..\..\..\deflate.c" />
<ClCompile Include="..\..\..\infback.c" /> <ClCompile Include="..\..\..\infback.c" />
<ClCompile Include="..\..\masmx64\inffas8664.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\inffast.c" /> <ClCompile Include="..\..\..\inffast.c" />
<ClCompile Include="..\..\..\inflate.c" /> <ClCompile Include="..\..\..\inflate.c" />
<ClCompile Include="..\..\..\inftrees.c" /> <ClCompile Include="..\..\..\inftrees.c" />

View File

@ -3,7 +3,7 @@
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{c1f6a2e3-5da5-4955-8653-310d3efe05a9}</UniqueIdentifier> <UniqueIdentifier>{c1f6a2e3-5da5-4955-8653-310d3efe05a9}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{c2aaffdc-2c95-4d6f-8466-4bec5890af2c}</UniqueIdentifier> <UniqueIdentifier>{c2aaffdc-2c95-4d6f-8466-4bec5890af2c}</UniqueIdentifier>
@ -30,9 +30,6 @@
<ClCompile Include="..\..\..\infback.c"> <ClCompile Include="..\..\..\infback.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\masmx64\inffas8664.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\inffast.c"> <ClCompile Include="..\..\..\inffast.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -3,7 +3,7 @@
<ItemGroup> <ItemGroup>
<Filter Include="Source Files"> <Filter Include="Source Files">
<UniqueIdentifier>{fa61a89f-93fc-4c89-b29e-36224b7592f4}</UniqueIdentifier> <UniqueIdentifier>{fa61a89f-93fc-4c89-b29e-36224b7592f4}</UniqueIdentifier>
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm</Extensions> <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat</Extensions>
</Filter> </Filter>
<Filter Include="Header Files"> <Filter Include="Header Files">
<UniqueIdentifier>{d4b85da0-2ba2-4934-b57f-e2584e3848ee}</UniqueIdentifier> <UniqueIdentifier>{d4b85da0-2ba2-4934-b57f-e2584e3848ee}</UniqueIdentifier>

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, 2, 11, 0 FILEVERSION 1, 3, 1, 1
PRODUCTVERSION 1, 2, 11, 0 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.2.11\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-2017 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

@ -160,7 +160,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -182,16 +182,12 @@
<OutputFile>$(OutDir)zlibstat.lib</OutputFile> <OutputFile>$(OutDir)zlibstat.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
</Lib> </Lib>
<PreBuildEvent>
<Command>cd ..\..\masmx86
bld_ml32.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -210,19 +206,15 @@ bld_ml32.bat</Command>
</ResourceCompile> </ResourceCompile>
<Lib> <Lib>
<AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)zlibstat.lib</OutputFile> <OutputFile>$(OutDir)zlibstat.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
</Lib> </Lib>
<PreBuildEvent>
<Command>cd ..\..\masmx86
bld_ml32.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -252,7 +244,7 @@ bld_ml32.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -274,10 +266,6 @@ bld_ml32.bat</Command>
<OutputFile>$(OutDir)zlibstat.lib</OutputFile> <OutputFile>$(OutDir)zlibstat.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
</Lib> </Lib>
<PreBuildEvent>
<Command>cd ..\..\masmx64
bld_ml64.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
<Midl> <Midl>
@ -285,7 +273,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -314,8 +302,8 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -334,14 +322,10 @@ bld_ml64.bat</Command>
</ResourceCompile> </ResourceCompile>
<Lib> <Lib>
<AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)zlibstat.lib</OutputFile> <OutputFile>$(OutDir)zlibstat.lib</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
</Lib> </Lib>
<PreBuildEvent>
<Command>cd ..\..\masmx64
bld_ml64.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
<Midl> <Midl>
@ -349,7 +333,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -379,7 +363,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -409,7 +393,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -443,14 +427,6 @@ bld_ml64.bat</Command>
<ClCompile Include="..\..\..\gzread.c" /> <ClCompile Include="..\..\..\gzread.c" />
<ClCompile Include="..\..\..\gzwrite.c" /> <ClCompile Include="..\..\..\gzwrite.c" />
<ClCompile Include="..\..\..\infback.c" /> <ClCompile Include="..\..\..\infback.c" />
<ClCompile Include="..\..\masmx64\inffas8664.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\inffast.c" /> <ClCompile Include="..\..\..\inffast.c" />
<ClCompile Include="..\..\..\inflate.c" /> <ClCompile Include="..\..\..\inflate.c" />
<ClCompile Include="..\..\..\inftrees.c" /> <ClCompile Include="..\..\..\inftrees.c" />

View File

@ -33,9 +33,6 @@
<ClCompile Include="..\..\..\infback.c"> <ClCompile Include="..\..\..\infback.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\masmx64\inffas8664.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\inffast.c"> <ClCompile Include="..\..\..\inffast.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View File

@ -1,7 +1,7 @@
LIBRARY LIBRARY
; zlib data compression and ZIP file I/O library ; zlib data compression and ZIP file I/O library
VERSION 1.2 VERSION 1.3
EXPORTS EXPORTS
adler32 @1 adler32 @1
@ -151,3 +151,11 @@ EXPORTS
deflateGetDictionary @173 deflateGetDictionary @173
adler32_z @174 adler32_z @174
crc32_z @175 crc32_z @175
; zlib1 v1.2.12 added:
crc32_combine_gen @176
crc32_combine_gen64 @177
crc32_combine_op @178
; zlib1 v1.3.2 added:
deflateUsed @179

View File

@ -197,8 +197,8 @@
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -219,7 +219,7 @@
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile> <ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -229,10 +229,6 @@
<DataExecutionPrevention> <DataExecutionPrevention>
</DataExecutionPrevention> </DataExecutionPrevention>
</Link> </Link>
<PreBuildEvent>
<Command>cd ..\..\masmx86
bld_ml32.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">
<Midl> <Midl>
@ -244,7 +240,7 @@ bld_ml32.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -288,8 +284,8 @@ bld_ml32.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -312,7 +308,7 @@ bld_ml32.bat</Command>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile> <ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile>
@ -322,10 +318,6 @@ bld_ml32.bat</Command>
<DataExecutionPrevention> <DataExecutionPrevention>
</DataExecutionPrevention> </DataExecutionPrevention>
</Link> </Link>
<PreBuildEvent>
<Command>cd ..\..\masmx86
bld_ml32.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl> <Midl>
@ -337,8 +329,8 @@ bld_ml32.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -358,7 +350,7 @@ bld_ml32.bat</Command>
<Culture>0x040c</Culture> <Culture>0x040c</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile> <ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -366,10 +358,6 @@ bld_ml32.bat</Command>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
</Link> </Link>
<PreBuildEvent>
<Command>cd ..\..\masmx64
bld_ml64.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
<Midl> <Midl>
@ -381,7 +369,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -424,7 +412,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -465,7 +453,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -510,8 +498,8 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
</ExceptionHandling> </ExceptionHandling>
@ -533,7 +521,7 @@ bld_ml64.bat</Command>
<Culture>0x040c</Culture> <Culture>0x040c</Culture>
</ResourceCompile> </ResourceCompile>
<Link> <Link>
<AdditionalDependencies>..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries> <IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile> <ModuleDefinitionFile>.\zlibvc.def</ModuleDefinitionFile>
@ -541,10 +529,6 @@ bld_ml64.bat</Command>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine> <TargetMachine>MachineX64</TargetMachine>
</Link> </Link>
<PreBuildEvent>
<Command>cd ..\..\masmx64
bld_ml64.bat</Command>
</PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
<Midl> <Midl>
@ -556,7 +540,7 @@ bld_ml64.bat</Command>
</Midl> </Midl>
<ClCompile> <ClCompile>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling> <StringPooling>true</StringPooling>
<ExceptionHandling> <ExceptionHandling>
@ -601,14 +585,6 @@ bld_ml64.bat</Command>
<ClCompile Include="..\..\..\gzread.c" /> <ClCompile Include="..\..\..\gzread.c" />
<ClCompile Include="..\..\..\gzwrite.c" /> <ClCompile Include="..\..\..\gzwrite.c" />
<ClCompile Include="..\..\..\infback.c" /> <ClCompile Include="..\..\..\infback.c" />
<ClCompile Include="..\..\masmx64\inffas8664.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseWithoutAsm|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\inffast.c" /> <ClCompile Include="..\..\..\inffast.c" />
<ClCompile Include="..\..\..\inflate.c" /> <ClCompile Include="..\..\..\inflate.c" />
<ClCompile Include="..\..\..\inftrees.c" /> <ClCompile Include="..\..\..\inftrees.c" />

View File

@ -42,9 +42,6 @@
<ClCompile Include="..\..\..\infback.c"> <ClCompile Include="..\..\..\infback.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\masmx64\inffas8664.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\inffast.c"> <ClCompile Include="..\..\..\inffast.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

Some files were not shown because too many files have changed in this diff Show More