This commit is contained in:
Ariel Abreu 2020-06-29 22:41:44 -04:00
parent 4c57660f7d
commit 1b002dae77
No known key found for this signature in database
GPG Key ID: F4D43CC7053EA2B3
285 changed files with 11490 additions and 1505 deletions

View File

@ -1,5 +1,53 @@
all:
-@echo "Please use ./configure first. Thank you."
# Common options
CONFIG ?= Release
RELEASE ?= macOSJazz
SANITIZE ?= 0
distclean:
make -f Makefile.in distclean
# OSX build options
OSX_SDK ?= macosx.internal
OSX_ARCHS ?= i386 x86_64 x86_64h
# IOS build options
IOS_SDK ?= iphoneos.internal
IOS_ARCHS ?= arm64 arm64e
# WatchOS build options
WOS_SDK ?= watchos.internal
WOS_ARCHS ?= armv7k arm64_32
# Buildit record name
BUILDIT_RECORD_NAME ?= zlib
ifeq ($(SANITIZE),0)
SANITIZER_OPT :=
else
SANITIZER_OPT := -enableAddressSanitizer YES
endif
DOC_DSTROOT ?= /tmp/bnns_doc.dst
LOG_EXT := > ./build/log.txt 2>&1 || ( cat ./build/log.txt && exit 1 )
ARCH_DATE := $(shell date +"%Y%m%d")
ARCH_FILE := $(HOME)/BNNS-$(ARCH_DATE).tgz
define PRINT_OPT
@echo "\033[1;34m$(1)\033[0m = $(2)"
endef
all: osx
osx:
@[ -d ./build ] || mkdir -p ./build
xcodebuild -sdk $(OSX_SDK) -configuration $(CONFIG) -target all ARCHS="$(OSX_ARCHS)" $(SANITIZER_OPT) $(LOG_EXT)
ios:
@[ -d ./build ] || mkdir -p ./build
xcodebuild -sdk $(IOS_SDK) -configuration $(CONFIG) -target all ARCHS="$(IOS_ARCHS)" $(SANITIZER_OPT) $(LOG_EXT)
wos:
@[ -d ./build ] || mkdir -p ./build
xcodebuild -sdk $(WOS_SDK) -configuration $(CONFIG) -target all ARCHS="$(WOS_ARCHS)" $(SANITIZER_OPT) $(LOG_EXT)
buildit-archive: clean
xbs buildit . -noverify -project zlib -update Prevailing$(RELEASE) -buildAllAliases -buildRecordName zlib -archive
@cd /tmp/$(BUILDIT_RECORD_NAME).roots/BuildRecords && find . -type f -ls | egrep '\/(SDKContent)?Root\/'
clean:
/bin/rm -rf ./build

35
NMakefile Normal file
View File

@ -0,0 +1,35 @@
# Makefile for Windows build of zlib
!if "$(PLATFORM)" == "x86_amd64"
bits=64
!else
bits=32
!endif
name=zlib
project=$(name)-1.2.11
bin_dir=bin$(bits)
lib_dir=lib$(bits)
sym_dir=public$(bits)\sym
install:
xcopy $(name) "$(SRCROOT)\$(project)" /s/v/i/h/y
cd "$(SRCROOT)\$(project)"
nmake -f win32\Makefile.msc clean
nmake -f win32\Makefile.msc PLATFORM=$(PLATFORM)
xcopy "$(SRCROOT)\$(project)\*.dll" "$(DSTROOT)\AppleInternal\$(bin_dir)" /s/v/i/h/y
-mkdir "$(DSTROOT)\AppleInternal\$(sym_dir)"
copy "$(SRCROOT)\$(project)\zlib1.pdb" "$(DSTROOT)\AppleInternal\$(sym_dir)\" /v/y
xcopy "$(SRCROOT)\$(project)\*.h" "$(DSTROOT)\AppleInternal\include\zlib" /s/v/i/h/y
xcopy "$(SRCROOT)\$(project)\*.lib" "$(DSTROOT)\AppleInternal\$(lib_dir)" /s/v/i/h/y
install_DEBUG:
xcopy $(name) "$(SRCROOT)\$(project)" /s/v/i/h/y
cd "$(SRCROOT)\$(project)"
nmake -f win32\Makefile.msc clean
nmake -f win32\Makefile.msc DEBUG=1 PLATFORM=$(PLATFORM)
xcopy "$(SRCROOT)\$(project)\*.dll" "$(DSTROOT)\AppleInternal\$(bin_dir)" /s/v/i/h/y
xcopy "$(SRCROOT)\$(project)\*.lib" "$(DSTROOT)\AppleInternal\$(lib_dir)" /s/v/i/h/y
-mkdir "$(DSTROOT)\AppleInternal\$(sym_dir)"
copy "$(SRCROOT)\$(project)\zlib1_debug.pdb" "$(DSTROOT)\AppleInternal\$(sym_dir)\" /v/y

195
Testers/t_zlib.c Normal file
View File

@ -0,0 +1,195 @@
//
// t_zlib.c
// t_zlib
//
// Created by Tal Uliel on 2/7/18.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zlib.h>
#define ZLIB_PADDING_SIZE (4 * 65536 + 8192) // Empirically determined alloc size for our deflateInit2 call + z_stream
typedef struct {
uint8_t * buf; // pre-allocated buffer
size_t size; // available bytes in BUF
} zlib_alloc_state;
// Alloc item*size bytes. Return 0 on failure.
// OPAQUE shall point to a zlib_alloc_state, and will be updated.
static void * zlib_malloc(void * opaque,uInt items,uInt itemSize)
{
zlib_alloc_state * s = (zlib_alloc_state *)opaque;
size_t size = (size_t)items*(size_t)itemSize;
if ((size > 0) && (itemSize > 0) &&
((size < items) || (size < itemSize)) )
return 0; //overflow
// Fail if not enough space remaining in s->buf
if (size > s->size) return 0;
// Return BUF, and consume SIZE bytes
void * ptr = s->buf;
s->buf += size;
s->size -= size;
return ptr;
}
// Free PTR.
// OPAQUE shall point to a zlib_alloc_state, and will be updated.
static void zlib_free(void * opaque,void * ptr)
{
// We don't free anything
}
static int read_parameters(int argc, const char * argv[], FILE ** f)
{
if (argc == 1)
{
fprintf(stderr, "t_zlib: error, input file wasn't specified\n");
return -1; // fail
}
for (int i = 1; i < argc;)
{
if ((strcmp(argv[i],"-h")==0) || (strcmp(argv[i],"-help")==0))
{
return 1; // need to print help
} else
{
*f = fopen(argv[i], "rb");
if (*f == 0)
{
fprintf(stderr,"t_zlib: failed to open %s\n", argv[i]);
return -1; // fail
}
if ((i+1) != argc)
{
fprintf(stderr, "t_zlib: ignoring rest of the paramters after file path %s\n", argv[i]);
return 0; // success
}
i++;
}
}
return 0;
}
static void print_help()
{
fprintf(stderr, "t_zlib help\n");
fprintf(stderr, "t_zlib <path_to_file>\n");
fprintf(stderr, "t_zlib will load content from a file and verify encode/decode\n");
fprintf(stderr, "-h/-help - print help message");
}
/*!
@abstract simple tester for zlib
@discussion simple tester to load content from a file and verify encode/decode
*/
int main(int argc, const char * argv[])
{
FILE * f;
int res = read_parameters(argc, argv, &f);
if (res)
{
print_help();
// return 0 if user requested to print help menu (-h/-help)
return (res < 0);
}
fseek(f, 0, SEEK_END);
size_t number_of_bytes = ftell(f);
Bytef * input_buf = malloc(number_of_bytes); // buffer that will hold the input byts from the file
if (input_buf == 0) { fprintf(stderr, "t_zlib: alloc failed\n"); return -1;}
// read input from file
fseek(f, 0, SEEK_SET);
fread(input_buf, 1, number_of_bytes, f);
// close the file
fclose(f);
// assuming 2x the input size + ZLIB_PADDING_SIZE would be enough
Bytef * encoded_buf = malloc(2*number_of_bytes + ZLIB_PADDING_SIZE); // buffer to hold the encode result
if (encoded_buf == 0) { fprintf(stderr, "t_zlib: alloc failed\n"); return -1;}
// set stream structre for encode
z_stream desc;
bzero(&desc, sizeof(desc));
uint8_t scratch[ZLIB_PADDING_SIZE];
zlib_alloc_state opaque;
opaque.buf = (uint8_t*)scratch;
opaque.size = ZLIB_PADDING_SIZE;
desc.next_in = input_buf;
desc.avail_in = (uint32_t)number_of_bytes;
desc.next_out = encoded_buf;
desc.avail_out = (uint32_t)(2*number_of_bytes + ZLIB_PADDING_SIZE);
desc.zalloc = zlib_malloc;
desc.zfree = zlib_free;
desc.opaque = &opaque;
// encode file
res = deflateInit2(&desc, 5, Z_DEFLATED,(-15),8,Z_DEFAULT_STRATEGY);
res = deflate(&desc, Z_FINISH);
if (res != Z_STREAM_END) { fprintf(stderr, "zlib: encode failed\n"); return -1; }
size_t encoded_size = desc.total_out;
deflateEnd(&desc);
// realloc encoede buf to limit buffer size
encoded_buf = realloc(encoded_buf, encoded_size);
Bytef * decoded_buf = malloc(number_of_bytes); // bufert hat will hold the decode result
if (decoded_buf == 0) { fprintf(stderr, "t_zlib: alloc failed\n"); return -1;}
// set stream structre for encode
bzero(&desc, sizeof(desc));
opaque.buf = (uint8_t*)scratch;
opaque.size = ZLIB_PADDING_SIZE;
desc.next_in = encoded_buf;
desc.avail_in = (uint32_t)encoded_size;
desc.next_out = decoded_buf;
desc.avail_out = (uint32_t)number_of_bytes;
desc.zalloc = zlib_malloc;
desc.zfree = zlib_free;
desc.opaque = &opaque;
desc.adler = (uint32_t)adler32(0, input_buf, (uint32_t)number_of_bytes);
// decode buffer
inflateInit2(&desc, (-15));
res = inflate(&desc, Z_FINISH);
if (res != Z_STREAM_END) { fprintf(stderr, "zlib: decode failed\n"); return -1; }
inflateEnd(&desc);
free(encoded_buf);
// compare buffers
for (size_t i = 0; i < number_of_bytes; i++)
{
if (input_buf[i] != decoded_buf[i])
{
fprintf(stderr, "t_zlib: valdiation fail, buffers differ in byte %zu\n", i);
return -1;
}
}
free(input_buf);
free(decoded_buf);
fprintf(stderr, "PASSED\n");
return 0;
}

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
../crc32.h

View File

@ -1 +0,0 @@
../deflate.h

View File

@ -1 +0,0 @@
../gzguts.h

View File

@ -1 +0,0 @@
../inffast.h

View File

@ -1 +0,0 @@
../inffixed.h

View File

@ -1 +0,0 @@
../inflate.h

View File

@ -1 +0,0 @@
../inftrees.h

View File

@ -1 +0,0 @@
../trees.h

View File

@ -1 +0,0 @@
../zconf.h

View File

@ -1 +0,0 @@
../zlib.h

View File

@ -1 +0,0 @@
../zutil.h

79
libz.exp Normal file
View File

@ -0,0 +1,79 @@
_zlibVersion
_deflate
_deflateEnd
_inflate
_inflateEnd
_deflateSetDictionary
_deflateCopy
_deflateReset
_deflateParams
_deflateTune
_deflateBound
_deflatePrime
_deflateSetHeader
_inflateSetDictionary
_inflateSync
_inflateCopy
_inflateReset
_inflateReset2
_inflatePrime
_inflateGetHeader
_inflateBack
_inflateBackEnd
_inflateMark
_inflateUndermine
_zlibCompileFlags
_compress
_compress2
_compressBound
_uncompress
_gzopen
_gzdopen
_gzsetparams
_gzread
_gzwrite
_gzprintf
_gzputs
_gzgets
_gzputc
_gzgetc
_gzungetc
_gzflush
_gzseek
_gzrewind
_gztell
_gzeof
_gzdirect
_gzclose
_gzclose_r
_gzclose_w
_gzerror
_gzclearerr
_gzbuffer
_gzoffset
_adler32
_adler32_combine
_crc32
_crc32_combine
_deflateInit_
_inflateInit_
_deflateInit2_
_inflateInit2_
_inflateBackInit_
_zError
_inflateSyncPoint
_get_crc_table
_deflatePending
_deflateResetKeep
_gzgetc_
_inflateResetKeep
_inflateGetDictionary
_deflateGetDictionary
_gzvprintf
_adler32_z
_crc32_z
_gzfread
_gzfwrite
_uncompress2
_inflateValidate
_inflateCodesUsed

30
scripts/t_bats_zlib.pl Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/perl -w
# BATS entry point for zlib tests
use File::Basename;
# Get our location
my $scripts_dir = dirname(__FILE__);
# Figure out which code to run
my $uname = `uname -m -p`;
my $bindir = 'osx';
$bindir = 'ios' if ( $uname =~ /arm/ );
$bindir = 'wos' if ( $uname =~ /Watch/ );
$bindir = $scripts_dir.'/../bin/'.$bindir;
my $datadir = $scripts_dir.'/../data';
if ( not -d $bindir ) {
print STDERR "ERROR: binary directory not found: $bindir\n";
exit(1);
}
if ( not -d $datadir ) {
print STDERR "ERROR: binary directory not found: $datadir\n";
exit(1);
}
my $cmd = "$scripts_dir/t_zlib_all.pl -d \"$datadir\" -b $bindir/t_zlib";
system($cmd);
exit(1) if ( $? != 0 ); # failed
exit(0); #OK

46
scripts/t_zlib_all.pl Normal file
View File

@ -0,0 +1,46 @@
#!/usr/bin/perl -w
# Run t_zlib on all regular files in the specified directory
use Getopt::Std;
use File::Temp;
our $opt_d = '.';
our $opt_h = 0;
our $opt_s = 0;
our $opt_b = '.';
getopts('hvsd:a:r:b:');
if ($opt_h) {
print STDERR "Usage: t_compression_all.pl [-h] [-v] [-s] [-d dataDir] [-a algorithm] [-r dstroot]\n";
print STDERR "-h print usage and quit\n";
print STDERR "-s run *_static variants of the test tools\n";
print STDERR "-d directory providing test files\n";
print STDERR "-b path to tester\n";
exit(1);
}
my $dataDir = $opt_d;
my $status = 0;
my $binFile = $opt_b;
open(FILE,"find \"$dataDir\" -type f|") or die "find";
LINE: while (my $f = <FILE>) {
chop($f);
next LINE if ( $f =~ /\.svn\// ); # skip subversion stuff
next LINE if ( $f =~ /\.git\// ); # skip git stuff
next LINE if ( $f =~ /\.DS_Store$/ ); # skip .DS_Store
next LINE unless ( -f $f );
my $sz = (-s $f);
next LINE if ( $sz < 1 or $sz > (2 << 30)); # alloc will fail if too large
my $cmd = $binFile.' "'.$f.'"';
print STDERR "$cmd ";
$status = system($cmd);
exit(1) if ( $status != 0 ); # return 1 if failed
}
close(FILE);
exit(0); #OK

42
scripts/zlib_tests.py Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/python -u
# -*- coding: utf-8 -*-
import os
from bats.test.parambulator import Parambulator
class Test(Parambulator):
def set_up(self):
super(Test, self).set_up()
# copy and decompress test files on the device
filename = 'zlib_test_files.zip'
tar_command = 'cd {}; tar -xzf zlib_test_files.zip'
self.copy_to_device(filename, self.device_tmp_dir,
on_error="Failed to copy test files to device.")
self.run_setup_on_device(tar_command.format(
self.device_tmp_dir))
if not self.is_watchos():
filename = 'zlib_large_test_files.zip'
tar_command = 'cd {}; tar -xzf zlib_large_test_files.zip'
self.copy_to_device(filename, self.device_tmp_dir,
on_error="Failed to copy test files to device.")
self.run_setup_on_device(tar_command.format(
self.device_tmp_dir))
def run_parambulator_iteration(self):
results = {}
# Run tests and gather results
so, se, rc = self.run_test_on_device(
'perl {}'.format(os.path.join(self.device_tmp_dir,
'scripts/t_bats_zlib.pl')),
as_root=True,
# test will return non-zero if anything fails
on_error="Test had non-zero exit status.")
return results
Test.execute_tests()

View File

@ -1,59 +0,0 @@
/* uncompr.c -- decompress a memory buffer
* Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
/* ===========================================================================
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total
size of the destination buffer, which must be large enough to hold the
entire uncompressed data. (The size of the uncompressed data must have
been saved previously by the compressor and transmitted to the decompressor
by some mechanism outside the scope of this compression library.)
Upon exit, destLen is the actual size of the compressed buffer.
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
int ZEXPORT uncompress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{
z_stream stream;
int err;
stream.next_in = (z_const Bytef *)source;
stream.avail_in = (uInt)sourceLen;
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
err = inflateInit(&stream);
if (err != Z_OK) return err;
err = inflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
inflateEnd(&stream);
if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
return Z_DATA_ERROR;
return err;
}
*destLen = stream.total_out;
err = inflateEnd(&stream);
return err;
}

View File

@ -1,3 +0,0 @@
To build zlib using the Microsoft Visual C++ environment,
use the appropriate project from the projects/ directory.

Binary file not shown.

24
zlib.plist Normal file
View File

@ -0,0 +1,24 @@
<plist version="1.0">
<dict>
<key>OpenSourceProject</key>
<string>zlib</string>
<key>OpenSourceVersion</key>
<string>1.2.11</string>
<key>OpenSourceWebsiteURL</key>
<string>http://www.zlib.net/</string>
<key>OpenSourceURL</key>
<string>http://zlib.net/zlib-1.2.11.tar.gz</string>
<key>OpenSourceMD5</key>
<string>1c9f62f0778697a09d36121ead88e08e</string>
<key>OpenSourceImportDate</key>
<string>2017-06-07</string>
<key>OpenSourceModifications</key>
<array>
<string>Minor changes to configure script.</string>
</array>
<key>OpenSourceLicense</key>
<string>other</string>
<key>OpenSourceLicenseFile</key>
<string>zlib.txt</string>
</dict>
</plist>

69
zlib.proj Normal file
View File

@ -0,0 +1,69 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="install" ToolsVersion="3.5">
<!--
Ex:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe Project.proj -> both platforms
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe Project.proj /p:Platform="x86" -> x86 only
MSBuild.exe zlib.proj /p:SRCROOT="c:\sources\zlib" /p:DSTROOT="c:\roots\zlib"
-->
<!--
Unless 'vcvars=none' is included in the buildArguments, the build system will call vcvars before invoking MSBuild.
If vcvars has been called, VCINSTALLDIR will be defined to the appropriate VC path. Otherwise, the path will be
retrieved from the registry.
For manual builds, either call vcvars before invoking MSBuild or change the version in the registry key below to match the system.
-->
<PropertyGroup>
<VCPath Condition="'$(VCINSTALLDIR)' == ''">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\Setup\VC@ProductDir)</VCPath>
<VCPath Condition="'$(VCINSTALLDIR)' != ''">$(VCINSTALLDIR)</VCPath>
</PropertyGroup>
<ItemGroup>
<!-- command line platforms (/p:Platform="xxx;yyy") -->
<PlatformList Condition="'@(PlatformList)' == '' and $(Platform) != ''" Include="$(Platform.Split(';'))" />
<!-- default platforms: x86 and x64 cross -->
<PlatformList Condition="'@(PlatformList)' == ''" Include="x86;x86_amd64" />
</ItemGroup>
<Target Name="install">
<!-- SRCROOT, DSTROOT, and OBJROOT must be defined -->
<Error Text="SRCROOT property or environment variable must be defined." Condition="'$(SRCROOT)' == ''"/>
<Error Text="DSTROOT property or environment variable must be defined." Condition="'$(DSTROOT)' == ''"/>
<ItemGroup>
<NMakeArgs Include="SRCROOT=&quot;$(SRCROOT)&quot;"/>
<NMakeArgs Include="DSTROOT=&quot;$(DSTROOT)&quot;"/>
</ItemGroup>
<!-- ensure the registry queries succeeded -->
<Error Text="Cannot determine Visual Studio 'vcvars' location." Condition="'$(VCPath)' == ''"/>
<!-- The following will be executed once for each item in $(PlatformList) -->
<Exec Command="call &quot;$(VCPath)vcvarsall.bat&quot; %(PlatformList.Identity) &amp;
nmake.exe /f $(MSBuildProjectDirectory)\NMakefile PLATFORM=%(PlatformList.Identity) @(NMakeArgs, ' ') install" />
</Target>
<Target Name="install_DEBUG">
<!-- SRCROOT, DSTROOT, and OBJROOT must be defined -->
<Error Text="SRCROOT property or environment variable must be defined." Condition="'$(SRCROOT)' == ''"/>
<Error Text="DSTROOT property or environment variable must be defined." Condition="'$(DSTROOT)' == ''"/>
<ItemGroup>
<NMakeArgs Include="SRCROOT=&quot;$(SRCROOT)&quot;"/>
<NMakeArgs Include="DSTROOT=&quot;$(DSTROOT)&quot;"/>
</ItemGroup>
<!-- ensure the registry queries succeeded -->
<Error Text="Cannot determine Visual Studio 'vcvars' location." Condition="'$(VCPath)' == ''"/>
<!-- The following will be executed once for each item in $(PlatformList) -->
<Exec Command="call &quot;$(VCPath)vcvarsall.bat&quot; %(PlatformList.Identity) &amp;
nmake.exe /f $(MSBuildProjectDirectory)\NMakefile PLATFORM=%(PlatformList.Identity) @(NMakeArgs, ' ') install_DEBUG" />
</Target>
</Project>

27
zlib.xcconfig Normal file
View File

@ -0,0 +1,27 @@
#include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
ARCHS = $(ARCHS_STANDARD_32_64_BIT)
ONLY_ACTIVE_ARCH = NO
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
CODE_SIGN_IDENTITY = -
INSTALL_PATH = /usr/lib
DYLIB_COMPATIBILITY_VERSION = 1
DYLIB_CURRENT_VERSION = 1.2.11
DEAD_CODE_STRIPPING = YES
EXPORTED_SYMBOLS_FILE = libz.exp
EXECUTABLE_PREFIX = lib
PRODUCT_NAME = z.$(DYLIB_COMPATIBILITY_VERSION)
STRIP_STYLE = non-global
PUBLIC_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/include
ALWAYS_SEARCH_USER_PATHS = NO
CURRENT_PROJECT_VERSION = $(RC_ProjectSourceVersion)
VERSION_INFO_PREFIX = __
VERSIONING_SYSTEM = apple-generic
GCC_C_LANGUAGE_STANDARD = gnu99
GCC_ENABLE_PASCAL_STRINGS = NO
GCC_PREPROCESSOR_DEFINITIONS = USE_MMAP VEC_OPTIMIZE
GCC_WARN_ABOUT_RETURN_TYPE = YES
GCC_WARN_UNUSED_VARIABLE = YES
PREBINDING = NO
USE_HEADERMAP = NO
ZERO_LINK = NO

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Latest</string>
</dict>
</plist>

View File

@ -3,7 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
project(zlib C)
set(VERSION "1.2.8")
set(VERSION "1.2.11")
option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")

View File

@ -1,10 +1,53 @@
ChangeLog file for zlib
Changes in 1.2.11 (15 Jan 2017)
- Fix deflate stored bug when pulling last block from window
- Permit immediate deflateParams changes before any deflate input
Changes in 1.2.10 (2 Jan 2017)
- Avoid warnings on snprintf() return value
- Fix bug in deflate_stored() for zero-length input
- Fix bug in gzwrite.c that produced corrupt gzip files
- Remove files to be installed before copying them in Makefile.in
- Add warnings when compiling with assembler code
Changes in 1.2.9 (31 Dec 2016)
- Fix contrib/minizip to permit unzipping with desktop API [Zouzou]
- Improve contrib/blast to return unused bytes
- Assure that gzoffset() is correct when appending
- Improve compress() and uncompress() to support large lengths
- Fix bug in test/example.c where error code not saved
- Remedy Coverity warning [Randers-Pehrson]
- Improve speed of gzprintf() in transparent mode
- Fix inflateInit2() bug when windowBits is 16 or 32
- Change DEBUG macro to ZLIB_DEBUG
- Avoid uninitialized access by gzclose_w()
- Allow building zlib outside of the source directory
- Fix bug that accepted invalid zlib header when windowBits is zero
- Fix gzseek() problem on MinGW due to buggy _lseeki64 there
- Loop on write() calls in gzwrite.c in case of non-blocking I/O
- Add --warn (-w) option to ./configure for more compiler warnings
- Reject a window size of 256 bytes if not using the zlib wrapper
- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
- Add --debug (-d) option to ./configure to define ZLIB_DEBUG
- Fix bugs in creating a very large gzip header
- Add uncompress2() function, which returns the input size used
- Assure that deflateParams() will not switch functions mid-block
- Dramatically speed up deflation for level 0 (storing)
- Add gzfread(), duplicating the interface of fread()
- Add gzfwrite(), duplicating the interface of fwrite()
- Add deflateGetDictionary() function
- Use snprintf() for later versions of Microsoft C
- Fix *Init macros to use z_ prefix when requested
- Replace as400 with os400 for OS/400 support [Monnerat]
- Add crc32_z() and adler32_z() functions with size_t lengths
- Update Visual Studio project files [AraHaan]
Changes in 1.2.8 (28 Apr 2013)
- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
- Do not force Z_CONST for C++
- Clean up contrib/vstudio [Ro§]
- Clean up contrib/vstudio [Roß]
- Correct spelling error in zlib.h
- Fix mixed line endings in contrib/vstudio
@ -34,7 +77,7 @@ Changes in 1.2.7.1 (24 Mar 2013)
- Clean up the usage of z_const and respect const usage within zlib
- Clean up examples/gzlog.[ch] comparisons of different types
- Avoid shift equal to bits in type (caused endless loop)
- Fix unintialized value bug in gzputc() introduced by const patches
- Fix uninitialized value bug in gzputc() introduced by const patches
- Fix memory allocation error in examples/zran.c [Nor]
- Fix bug where gzopen(), gzclose() would write an empty file
- Fix bug in gzclose() when gzwrite() runs out of memory
@ -194,7 +237,7 @@ Changes in 1.2.5.2 (17 Dec 2011)
- Add a transparent write mode to gzopen() when 'T' is in the mode
- Update python link in zlib man page
- Get inffixed.h and MAKEFIXED result to match
- Add a ./config --solo option to make zlib subset with no libary use
- Add a ./config --solo option to make zlib subset with no library use
- Add undocumented inflateResetKeep() function for CAB file decoding
- Add --cover option to ./configure for gcc coverage testing
- Add #define ZLIB_CONST option to use const in the z_stream interface
@ -564,7 +607,7 @@ Changes in 1.2.3.1 (16 August 2006)
- Update make_vms.com [Zinser]
- Use -fPIC for shared build in configure [Teredesai, Nicholson]
- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck]
- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck]
- Add some FAQ entries about the contrib directory
- Update the MVS question in the FAQ
- Avoid extraneous reads after EOF in gzio.c [Brown]
@ -1178,7 +1221,7 @@ Changes in 1.0.6 (19 Jan 1998)
386 asm code replacing longest_match().
contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
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>
Another C++ I/O streams interface
contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
A very simple tar.gz file extractor using zlib
@ -1267,7 +1310,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
- fix array overlay in deflate.c which sometimes caused bad compressed data
- fix inflate bug with empty stored block
- fix MSDOS medium model which was broken in 0.99
- fix deflateParams() which could generated bad compressed data.
- fix deflateParams() which could generate bad compressed data.
- Bytef is define'd instead of typedef'ed (work around Borland bug)
- added an INDEX file
- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),

View File

View File

View File

@ -16,28 +16,28 @@
# To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME
CC=cc
CC=gcc
CFLAGS=-O
CFLAGS=-O3 -arch i386 -arch x86_64 -DHAVE_HIDDEN
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=
SFLAGS=-O3 -arch i386 -arch x86_64 -fPIC -DHAVE_HIDDEN
LDFLAGS= -arch i386 -arch x86_64
TEST_LDFLAGS=-L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
LDSHARED=gcc -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.8
CPP=gcc -E
STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.8
SHAREDLIBM=libz.so.1
SHAREDLIB=libz.dylib
SHAREDLIBV=libz.1.2.8.dylib
SHAREDLIBM=libz.1.dylib
LIBS=$(STATICLIB) $(SHAREDLIBV)
AR=ar
ARFLAGS=rc
AR=libtool
ARFLAGS=-o
RANLIB=ranlib
LDCONFIG=ldconfig
LDSHAREDLIBC=-lc
@ -45,12 +45,12 @@ TAR=tar
SHELL=/bin/sh
EXE=
prefix = /usr/local
exec_prefix = ${prefix}
libdir = ${exec_prefix}/lib
sharedlibdir = ${libdir}
includedir = ${prefix}/include
mandir = ${prefix}/share/man
prefix =/usr
exec_prefix =${prefix}
libdir =${exec_prefix}/lib
sharedlibdir =${libdir}
includedir =${prefix}/include
mandir =${prefix}/share/man
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
@ -159,8 +159,13 @@ minigzip64.o: test/minigzip.c zlib.h zconf.h
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
-@mv objs/$*.o $@
SECTORDER_FILE=/usr/local/lib/OrderFiles/libz.1.order
ifeq "$(shell test -f $(SECTORDER_FILE) && echo YES)" "YES"
SECTORDER_FLAGS=-sectorder __TEXT __text $(SECTORDER_FILE)
endif
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
$(LDSHARED) -exported_symbols_list $(SRCROOT)/libz.exp $(SECTORDER_FLAGS) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)

415
zlib/Makefile.in Normal file
View File

@ -0,0 +1,415 @@
# Makefile for zlib
# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
# For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type:
# ./configure; make test
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME
CC=cc
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DZLIB_DEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E
STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.11
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)
AR=ar
ARFLAGS=rc
RANLIB=ranlib
LDCONFIG=ldconfig
LDSHAREDLIBC=-lc
TAR=tar
SHELL=/bin/sh
EXE=
prefix = /usr/local
exec_prefix = ${prefix}
libdir = ${exec_prefix}/lib
sharedlibdir = ${libdir}
includedir = ${prefix}/include
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
SRCDIR=
ZINC=
ZINCOUT=-I.
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
OBJC = $(OBJZ) $(OBJG)
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
PIC_OBJA =
OBJS = $(OBJC) $(OBJA)
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
all: static shared
static: example$(EXE) minigzip$(EXE)
shared: examplesh$(EXE) minigzipsh$(EXE)
all64: example64$(EXE) minigzip64$(EXE)
check: test
test: all teststatic testshared
teststatic: static
@TMPST=tmpst_$$; \
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
fi; \
rm -f $$TMPST
testshared: shared
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
fi; \
rm -f $$TMPSH
test64: all64
@TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
fi; \
rm -f $$TMP64
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
infcover: infcover.o libz.a
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
cover: infcover
rm -f *.gcda
./infcover
gcov inf*.c
libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
match.o: match.S
$(CPP) match.S > _match.s
$(CC) -c _match.s
mv _match.o match.o
rm -f _match.s
match.lo: match.S
$(CPP) match.S > _match.s
$(CC) -c -fPIC _match.s
mv _match.o match.lo
rm -f _match.s
example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
adler32.o: $(SRCDIR)adler32.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
crc32.o: $(SRCDIR)crc32.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
deflate.o: $(SRCDIR)deflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
infback.o: $(SRCDIR)infback.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
inffast.o: $(SRCDIR)inffast.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
inflate.o: $(SRCDIR)inflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
inftrees.o: $(SRCDIR)inftrees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
trees.o: $(SRCDIR)trees.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
zutil.o: $(SRCDIR)zutil.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
compress.o: $(SRCDIR)compress.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
uncompr.o: $(SRCDIR)uncompr.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
gzclose.o: $(SRCDIR)gzclose.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
gzlib.o: $(SRCDIR)gzlib.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
gzread.o: $(SRCDIR)gzread.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
gzwrite.o: $(SRCDIR)gzwrite.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
adler32.lo: $(SRCDIR)adler32.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
-@mv objs/adler32.o $@
crc32.lo: $(SRCDIR)crc32.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
-@mv objs/crc32.o $@
deflate.lo: $(SRCDIR)deflate.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
-@mv objs/deflate.o $@
infback.lo: $(SRCDIR)infback.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
-@mv objs/infback.o $@
inffast.lo: $(SRCDIR)inffast.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
-@mv objs/inffast.o $@
inflate.lo: $(SRCDIR)inflate.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
-@mv objs/inflate.o $@
inftrees.lo: $(SRCDIR)inftrees.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
-@mv objs/inftrees.o $@
trees.lo: $(SRCDIR)trees.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
-@mv objs/trees.o $@
zutil.lo: $(SRCDIR)zutil.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
-@mv objs/zutil.o $@
compress.lo: $(SRCDIR)compress.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
-@mv objs/compress.o $@
uncompr.lo: $(SRCDIR)uncompr.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
-@mv objs/uncompr.o $@
gzclose.lo: $(SRCDIR)gzclose.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
-@mv objs/gzclose.o $@
gzlib.lo: $(SRCDIR)gzlib.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
-@mv objs/gzlib.o $@
gzread.lo: $(SRCDIR)gzread.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
-@mv objs/gzread.o $@
gzwrite.lo: $(SRCDIR)gzwrite.c
-@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
-@mv objs/gzwrite.o $@
SECTORDER_FILE=/usr/local/lib/OrderFiles/libz.1.order
ifeq "$(shell test -f $(SECTORDER_FILE) && echo YES)" "YES"
SECTORDER_FLAGS=-sectorder __TEXT __text $(SECTORDER_FILE)
endif
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
$(LDSHARED) -exported_symbols_list $(SRCROOT)/libz.exp $(SECTORDER_FLAGS) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)
-@rmdir objs
example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
minigzip64$(EXE): minigzip64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
install-libs: $(LIBS)
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
cp $(STATICLIB) $(DESTDIR)$(libdir)
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
-@if test -n "$(SHAREDLIBV)"; then \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
($(LDCONFIG) || true) >/dev/null 2>&1; \
fi
rm -f $(DESTDIR)$(man3dir)/zlib.3
cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
# The ranlib in install is needed on NeXTSTEP which checks file times
# ldconfig is for Linux
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
uninstall:
cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
cd $(DESTDIR)$(libdir) && rm -f libz.a; \
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
fi
cd $(DESTDIR)$(man3dir) && rm -f zlib.3
cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
docs: zlib.3.pdf
zlib.3.pdf: $(SRCDIR)zlib.3
groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
zconf.h.cmakein: $(SRCDIR)zconf.h.in
-@ TEMPFILE=zconfh_$$; \
echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
touch -r $(SRCDIR)zconf.h.in $@ &&\
rm $$TEMPFILE
zconf: $(SRCDIR)zconf.h.in
cp -p $(SRCDIR)zconf.h.in zconf.h
mostlyclean: clean
clean:
rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
example64$(EXE) minigzip64$(EXE) \
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
rm -f Makefile zlib.pc configure.log
-@rm -f .DS_Store
@if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)Makefile.in Makefile ; fi
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
tags:
etags $(SRCDIR)*.[ch]
adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.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
crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.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
adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.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
crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h

View File

@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY
zlib 1.2.8 is a general purpose data compression library. All the code is
zlib 1.2.11 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .
The changes made in version 1.2.8 are documented in the file ChangeLog.
The changes made in version 1.2.11 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
@ -84,7 +84,7 @@ Acknowledgments:
Copyright notice:
(C) 1995-2013 Jean-loup Gailly and Mark Adler
(C) 1995-2017 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

View File

@ -1,17 +1,20 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-2011 Mark Adler
* Copyright (C) 1995-2011, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#if defined __arm__
#include <arm/arch.h>
#endif
#include "zutil.h"
#define local static
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#define BASE 65521 /* largest prime smaller than 65536 */
#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@ -62,13 +65,12 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong ZEXPORT adler32_z(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
z_size_t len;
{
unsigned long sum2;
unsigned n;
/* split Adler-32 into component sums */
sum2 = (adler >> 16) & 0xffff;
@ -101,8 +103,10 @@ uLong ZEXPORT adler32(adler, buf, len)
return adler | (sum2 << 16);
}
/* do length NMAX blocks -- requires just one modulo operation */
while (len >= NMAX) {
unsigned n;
len -= NMAX;
n = NMAX / 16; /* NMAX is divisible by 16 */
do {
@ -132,6 +136,15 @@ uLong ZEXPORT adler32(adler, buf, len)
return adler | (sum2 << 16);
}
/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
{
return adler32_z(adler, buf, len);
}
/* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2)
uLong adler1;
@ -156,7 +169,7 @@ local uLong adler32_combine_(adler1, adler2, len2)
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
if (sum1 >= BASE) sum1 -= BASE;
if (sum1 >= BASE) sum1 -= BASE;
if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
if (sum2 >= BASE) sum2 -= BASE;
return sum1 | (sum2 << 16);
}

View File

@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005 Jean-loup Gailly.
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -28,16 +28,17 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
{
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
stream.next_in = (z_const Bytef *)source;
left = *destLen;
*destLen = 0;
#if defined(__LP64__)
/* Check for source > 4G under LP64 */
stream.avail_in = (uInt)sourceLen;
#ifdef MAXSEG_64K
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
#endif
stream.next_out = dest;
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
@ -46,15 +47,26 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
err = deflateInit(&stream, level);
if (err != Z_OK) return err;
err = deflate(&stream, Z_FINISH);
if (err != Z_STREAM_END) {
deflateEnd(&stream);
return err == Z_OK ? Z_BUF_ERROR : err;
}
*destLen = stream.total_out;
stream.next_out = dest;
stream.avail_out = 0;
stream.next_in = (z_const Bytef *)source;
stream.avail_in = 0;
err = deflateEnd(&stream);
return err;
do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);
*destLen = stream.total_out;
deflateEnd(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}
/* ===========================================================================

134
configure → zlib/configure vendored Executable file → Normal file
View File

@ -18,6 +18,18 @@ echo -------------------- >> configure.log
echo $0 $* >> configure.log
date >> configure.log
# get source directory
SRCDIR=`dirname $0`
if test $SRCDIR = "."; then
ZINC=""
ZINCOUT="-I."
SRCDIR=""
else
ZINC='-include zconf.h'
ZINCOUT='-I. -I$(SRCDIR)'
SRCDIR="$SRCDIR/"
fi
# set command prefix for cross-compilation
if [ -n "${CHOST}" ]; then
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
@ -28,10 +40,10 @@ fi
STATICLIB=libz.a
# extract zlib version numbers from zlib.h
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < 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`
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
# establish commands for library building
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
@ -73,6 +85,8 @@ zprefix=0
zconst=0
build64=0
gcc=0
warn=0
debug=0
old_cc="$CC"
old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)'
@ -121,6 +135,8 @@ case "$1" in
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
--localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
-c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
*)
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
@ -159,34 +175,42 @@ case "$cc" in
esac
case `$cc -v 2>&1` in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
esac
show $cc -c $test.c
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
echo ... using gcc >> configure.log
CC="$cc"
CFLAGS="${CFLAGS--O3} ${ARCHS}"
CFLAGS="${CFLAGS--O3}"
SFLAGS="${CFLAGS--O3} -fPIC"
LDFLAGS="${LDFLAGS} ${ARCHS}"
if test "$ARCHS"; then
CFLAGS="${CFLAGS} ${ARCHS}"
LDFLAGS="${LDFLAGS} ${ARCHS}"
fi
if test $build64 -eq 1; then
CFLAGS="${CFLAGS} -m64"
SFLAGS="${SFLAGS} -m64"
fi
if test "${ZLIBGCCWARN}" = "YES"; then
if test "$warn" -eq 1; then
if test "$zconst" -eq 1; then
CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
else
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
fi
fi
if test $debug -eq 1; then
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
fi
if test -z "$uname"; then
uname=`(uname -s || echo unknown) 2>/dev/null`
fi
case "$uname" in
Linux* | linux* | GNU | GNU/* | solaris*)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
*BSD | *bsd* | DragonFly)
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
LDCONFIG="ldconfig -m" ;;
CYGWIN* | Cygwin* | cygwin* | OS/2*)
EXE='.exe' ;;
@ -287,6 +311,9 @@ else
esac
fi
fi
if test -n "$ZINC"; then
ZINC='-I- -I. -I$(SRCDIR)'
fi
;;
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
CFLAGS=${CFLAGS-"-O2"}
@ -337,16 +364,16 @@ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
}
echo - using any output from compiler to indicate an error >> configure.log
else
try()
{
show $*
( $* ) >> configure.log 2>&1
ret=$?
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
fi
return $ret
}
try()
{
show $*
( $* ) >> configure.log 2>&1
ret=$?
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
fi
return $ret
}
fi
tryboth()
@ -422,6 +449,65 @@ esac
echo >> configure.log
# check for size_t
cat > $test.c <<EOF
#include <stdio.h>
#include <stdlib.h>
size_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for size_t... Yes." | tee -a configure.log
need_sizet=0
else
echo "Checking for size_t... No." | tee -a configure.log
need_sizet=1
fi
echo >> configure.log
# find the size_t integer type, if needed
if test $need_sizet -eq 1; then
cat > $test.c <<EOF
long long dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for long long... Yes." | tee -a configure.log
cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
if (sizeof(void *) <= sizeof(int)) puts("int");
else if (sizeof(void *) <= sizeof(long)) puts("long");
else puts("z_longlong");
return 0;
}
EOF
else
echo "Checking for long long... No." | tee -a configure.log
cat > $test.c <<EOF
#include <stdio.h>
int main(void) {
if (sizeof(void *) <= sizeof(int)) puts("int");
else puts("long");
return 0;
}
EOF
fi
if try $CC $CFLAGS -o $test $test.c; then
sizet=`./$test`
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
else
echo "Failed to find a pointer-size integer type." | tee -a configure.log
leave 1
fi
fi
if test $need_sizet -eq 1; then
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi
echo >> configure.log
# check for large file support, and if none, check for fseeko()
cat > $test.c <<EOF
#include <sys/types.h>
@ -470,7 +556,7 @@ else
fi
# copy clean zconf.h for subsequent edits
cp -p zconf.h.in zconf.h
cp -p ${SRCDIR}zconf.h.in zconf.h
echo >> configure.log
@ -764,6 +850,7 @@ echo STATICLIB = $STATICLIB >> configure.log
echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log
echo Z_U4 = $Z_U4 >> configure.log
echo SRCDIR = $SRCDIR >> configure.log
echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log
echo libdir = $libdir >> configure.log
@ -773,7 +860,7 @@ echo sharedlibdir = $sharedlibdir >> configure.log
echo uname = $uname >> configure.log
# udpate Makefile with the configure results
sed < Makefile.in "
sed < ${SRCDIR}Makefile.in "
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^SFLAGS *=/s#=.*#=$SFLAGS#
@ -790,6 +877,9 @@ sed < Makefile.in "
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
/^EXE *=/s#=.*#=$EXE#
/^SRCDIR *=/s#=.*#=$SRCDIR#
/^ZINC *=/s#=.*#=$ZINC#
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
/^prefix *=/s#=.*#=$prefix#
/^exec_prefix *=/s#=.*#=$exec_prefix#
/^libdir *=/s#=.*#=$libdir#
@ -803,7 +893,7 @@ sed < Makefile.in "
" > Makefile
# create zlib.pc with the configure results
sed < zlib.pc.in "
sed < ${SRCDIR}zlib.pc.in "
/^CC *=/s#=.*#=$CC#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^CPP *=/s#=.*#=$CPP#

187
zlib/configure.log Normal file
View File

@ -0,0 +1,187 @@
--------------------
./configure --help
Fri Sep 20 11:07:22 PDT 2013
usage:
configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]
[--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]
[--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]
--------------------
./configure --prefix=/usr --archs=-arch i386 -arch x86_64
Fri Sep 20 11:09:06 PDT 2013
Checking for gcc...
=== ztest49714.c ===
extern int getchar();
int hello() {return getchar();}
===
gcc -c ztest49714.c
... using gcc
Checking for obsessive-compulsive compiler options...
=== ztest49714.c ===
int foo() { return 0; }
===
gcc -c -O3 -arch i386 -arch x86_64 ztest49714.c
Checking for shared library support...
=== ztest49714.c ===
extern int getchar();
int hello() {return getchar();}
===
gcc -w -c -O3 -arch i386 -arch x86_64 -fPIC ztest49714.c
gcc -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.8 -O3 -arch i386 -arch x86_64 -fPIC -o ztest49714.dylib ztest49714.o
Building shared library libz.1.2.8.dylib with gcc.
=== ztest49714.c ===
#include <sys/types.h>
off64_t dummy = 0;
===
gcc -c -O3 -arch i386 -arch x86_64 -D_LARGEFILE64_SOURCE=1 ztest49714.c
ztest49714.c:2:1: error: unknown type name 'off64_t'; did you mean 'off_t'?
off64_t dummy = 0;
^~~~~~~
off_t
/usr/include/sys/_types/_off_t.h:30:25: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
1 error generated.
(exit code 1)
Checking for off64_t... No.
=== ztest49714.c ===
#include <stdio.h>
int main(void) {
fseeko(NULL, 0, 0);
return 0;
}
===
gcc -O3 -arch i386 -arch x86_64 -o ztest49714 ztest49714.c
Checking for fseeko... Yes.
=== ztest49714.c ===
#include <string.h>
#include <errno.h>
int main() { return strlen(strerror(errno)); }
===
gcc -O3 -arch i386 -arch x86_64 -o ztest49714 ztest49714.c
Checking for strerror... Yes.
=== ztest49714.c ===
#include <unistd.h>
int main() { return 0; }
===
gcc -c -O3 -arch i386 -arch x86_64 ztest49714.c
Checking for unistd.h... Yes.
=== ztest49714.c ===
#include <stdarg.h>
int main() { return 0; }
===
gcc -c -O3 -arch i386 -arch x86_64 ztest49714.c
Checking for stdarg.h... Yes.
=== ztest49714.c ===
#include <stdio.h>
#include <stdarg.h>
#include "zconf.h"
int main()
{
#ifndef STDC
choke me
#endif
return 0;
}
===
gcc -c -O3 -arch i386 -arch x86_64 ztest49714.c
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
=== ztest49714.c ===
#include <stdio.h>
#include <stdarg.h>
int mytest(const char *fmt, ...)
{
char buf[20];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
return 0;
}
int main()
{
return (mytest("Hello%d\n", 1));
}
===
gcc -O3 -arch i386 -arch x86_64 -o ztest49714 ztest49714.c
Checking for vsnprintf() in stdio.h... Yes.
=== ztest49714.c ===
#include <stdio.h>
#include <stdarg.h>
int mytest(const char *fmt, ...)
{
int n;
char buf[20];
va_list ap;
va_start(ap, fmt);
n = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
return n;
}
int main()
{
return (mytest("Hello%d\n", 1));
}
===
gcc -c -O3 -arch i386 -arch x86_64 ztest49714.c
Checking for return value of vsnprintf()... Yes.
=== ztest49714.c ===
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
int ZLIB_INTERNAL foo;
int main()
{
return 0;
}
===
gcc -c -O3 -arch i386 -arch x86_64 ztest49714.c
Checking for attribute(visibility) support... Yes.
ALL = static shared
AR = libtool
ARFLAGS = -o
CC = gcc
CFLAGS = -O3 -arch i386 -arch x86_64 -DHAVE_HIDDEN
CPP = gcc -E
EXE =
LDCONFIG = ldconfig
LDFLAGS = -arch i386 -arch x86_64
LDSHARED = gcc -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.8
LDSHAREDLIBC = -lc
OBJC = $(OBJZ) $(OBJG)
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
RANLIB = ranlib
SFLAGS = -O3 -arch i386 -arch x86_64 -fPIC -DHAVE_HIDDEN
SHAREDLIB = libz.dylib
SHAREDLIBM = libz.1.dylib
SHAREDLIBV = libz.1.2.8.dylib
STATICLIB = libz.a
TEST = all teststatic testshared
VER = 1.2.8
Z_U4 =
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
mandir = ${prefix}/share/man
prefix = /usr
sharedlibdir = ${libdir}
uname = Darwin
--------------------
--------------------
./configure -h
Thu Sep 26 12:55:23 PDT 2013
usage:
configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]
[--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]
[--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]

View File

@ -38,7 +38,7 @@ inflate86/ by Chris Anderson <christop@charm.net>
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions
iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
Another C++ I/O streams interface
iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
@ -58,7 +58,7 @@ masmx86/ by Gilles Vollant <info@winimage.com>
minizip/ by Gilles Vollant <info@winimage.com>
Mini zip and unzip based on zlib
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
See http://www.winimage.com/zLibDll/unzip.html
See http://www.winimage.com/zLibDll/minizip.html
pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
Support for Pascal

View File

@ -31,7 +31,7 @@ package ZLib.Streams is
Mode : in Flush_Mode := Sync_Flush);
-- Flush the written data to the back stream,
-- all data placed to the compressor is flushing to the Back stream.
-- Should not be used untill necessary, becouse it is decreasing
-- Should not be used until necessary, because it is decreasing
-- compression.
function Read_Total_In (Stream : in Stream_Type) return Count;
@ -97,13 +97,13 @@ private
Rest_Last : Stream_Element_Offset;
-- Buffer for Read operation.
-- We need to have this buffer in the record
-- becouse not all read data from back stream
-- because not all read data from back stream
-- could be processed during the read operation.
Buffer_Size : Stream_Element_Offset;
-- Buffer size for write operation.
-- We do not need to have this buffer
-- in the record becouse all data could be
-- in the record because all data could be
-- processed in the write operation.
Back : Stream_Access;

View File

@ -436,7 +436,7 @@ private
pragma Import (C, inflateBackInit, "inflateBackInit_");
-- I stopped binding the inflateBack routines, becouse realize that
-- I stopped binding the inflateBack routines, because realize that
-- it does not support zlib and gzip headers for now, and have no
-- symmetric deflateBack routines.
-- ZLib-Ada is symmetric regarding deflate/inflate data transformation

View File

@ -1,7 +1,7 @@
/* blast.c
* Copyright (C) 2003, 2012 Mark Adler
* Copyright (C) 2003, 2012, 2013 Mark Adler
* For conditions of distribution and use, see copyright notice in blast.h
* version 1.2, 24 Oct 2012
* version 1.3, 24 Aug 2013
*
* blast.c decompresses data compressed by the PKWare Compression Library.
* This function provides functionality similar to the explode() function of
@ -24,8 +24,12 @@
* 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data
* 1.2 24 Oct 2012 - Add note about using binary mode in stdio
* - Fix comparisons of differently signed integers
* 1.3 24 Aug 2013 - Return unused input from blast()
* - Fix test code to correctly report unused input
* - Enable the provision of initial input to blast()
*/
#include <stddef.h> /* for NULL */
#include <setjmp.h> /* for setjmp(), longjmp(), and jmp_buf */
#include "blast.h" /* prototype for blast() */
@ -256,7 +260,7 @@ local int construct(struct huffman *h, const unsigned char *rep, int n)
* next, 0 for literals, 1 for length/distance.
*
* - If literals are uncoded, then the next eight bits are the literal, in the
* normal bit order in th stream, i.e. no bit-reversal is needed. Similarly,
* normal bit order in the stream, i.e. no bit-reversal is needed. Similarly,
* no bit reversal is needed for either the length extra bits or the distance
* extra bits.
*
@ -376,7 +380,8 @@ local int decomp(struct state *s)
}
/* See comments in blast.h */
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
unsigned *left, unsigned char **in)
{
struct state s; /* input/output state */
int err; /* return value */
@ -384,7 +389,12 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
/* initialize input state */
s.infun = infun;
s.inhow = inhow;
s.left = 0;
if (left != NULL && *left) {
s.left = *left;
s.in = *in;
}
else
s.left = 0;
s.bitbuf = 0;
s.bitcnt = 0;
@ -400,6 +410,12 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow)
else
err = decomp(&s); /* decompress */
/* return unused input */
if (left != NULL)
*left = s.left;
if (in != NULL)
*in = s.left ? s.in : NULL;
/* write any leftover output and update the error code if needed */
if (err != 1 && s.next && s.outfun(s.outhow, s.out, s.next) && err == 0)
err = 1;
@ -429,16 +445,20 @@ local int outf(void *how, unsigned char *buf, unsigned len)
/* Decompress a PKWare Compression Library stream from stdin to stdout */
int main(void)
{
int ret, n;
int ret;
unsigned left;
/* decompress to stdout */
ret = blast(inf, stdin, outf, stdout);
if (ret != 0) fprintf(stderr, "blast error: %d\n", ret);
left = 0;
ret = blast(inf, stdin, outf, stdout, &left, NULL);
if (ret != 0)
fprintf(stderr, "blast error: %d\n", ret);
/* see if there are any leftover bytes */
n = 0;
while (getchar() != EOF) n++;
if (n) fprintf(stderr, "blast warning: %d unused bytes of input\n", n);
/* count any leftover bytes */
while (getchar() != EOF)
left++;
if (left)
fprintf(stderr, "blast warning: %u unused bytes of input\n", left);
/* return blast() error code */
return ret;

View File

@ -1,6 +1,6 @@
/* blast.h -- interface for blast.c
Copyright (C) 2003, 2012 Mark Adler
version 1.2, 24 Oct 2012
Copyright (C) 2003, 2012, 2013 Mark Adler
version 1.3, 24 Aug 2013
This software is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
@ -42,7 +42,8 @@ typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len);
*/
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
unsigned *left, unsigned char **in);
/* Decompress input to output using the provided infun() and outfun() calls.
* On success, the return value of blast() is zero. If there is an error in
* the source data, i.e. it is not in the proper format, then a negative value
@ -55,12 +56,19 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow);
* an input error. (blast() only asks for input if it needs it.) inhow is for
* use by the application to pass an input descriptor to infun(), if desired.
*
* If left and in are not NULL and *left is not zero when blast() is called,
* then the *left bytes are *in are consumed for input before infun() is used.
*
* 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
* with an output error. outfun() is always called with len <= 4096. outhow
* is for use by the application to pass an output descriptor to outfun(), if
* desired.
*
* If there is any unused input, *left is set to the number of bytes that were
* read and *in points to them. Otherwise *left is set to zero and *in is set
* to NULL. If left or in are NULL, then they are not set.
*
* The return codes are:
*
* 2: ran out of input before completing decompression

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/* inftree9.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2013 Mark Adler
* Copyright (C) 1995-2017 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate9_copyright[] =
" inflate9 1.2.8 Copyright 1995-2013 Mark Adler ";
" inflate9 1.2.11 Copyright 1995-2017 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@ -64,7 +64,7 @@ unsigned short FAR *work;
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
133, 133, 133, 133, 144, 72, 78};
133, 133, 133, 133, 144, 77, 202};
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,

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