Skip to content

Commit

Permalink
Upgrade zlib to 1.2.12
Browse files Browse the repository at this point in the history
Partial commit for third_party/*, see bazelbuild#15497.

Signed-off-by: Sunil Gowroji <[email protected]>
  • Loading branch information
meteorcloudy authored and sgowroji committed May 17, 2022
1 parent 43cb21a commit 668805a
Show file tree
Hide file tree
Showing 72 changed files with 12,197 additions and 1,713 deletions.
2 changes: 1 addition & 1 deletion third_party/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(zlib C)

set(VERSION "1.2.11")
set(VERSION "1.2.12")

option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
Expand Down
161 changes: 112 additions & 49 deletions third_party/zlib/ChangeLog

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions third_party/zlib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CPP=$(CC) -E

STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.11
SHAREDLIBV=libz.so.1.2.12
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)

Expand Down Expand Up @@ -91,8 +91,8 @@ teststatic: static
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
fi; \
rm -f $$TMPST
fi
@rm -f tmpst_$$

testshared: shared
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
Expand All @@ -104,17 +104,17 @@ testshared: shared
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
fi; \
rm -f $$TMPSH
fi
@rm -f tmpsh_$$

test64: all64
@TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
fi; \
rm -f $$TMP64
fi
@rm -f tmp64_$$

infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
Expand Down Expand Up @@ -376,15 +376,13 @@ clean:
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov

maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
distclean: clean zconf zconf.h.cmakein
rm -f Makefile zlib.pc configure.log
-@rm -f .DS_Store
@if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)Makefile.in Makefile ; fi
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi

tags:
etags $(SRCDIR)*.[ch]
Expand Down
11 changes: 7 additions & 4 deletions third_party/zlib/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY

zlib 1.2.11 is a general purpose data compression library. All the code is
zlib 1.2.12 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
Expand Down Expand Up @@ -31,7 +31,7 @@ Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .

The changes made in version 1.2.11 are documented in the file ChangeLog.
The changes made in version 1.2.12 are documented in the file ChangeLog.

Unsupported third party contributions are provided in directory contrib/ .

Expand Down Expand Up @@ -84,7 +84,7 @@ Acknowledgments:

Copyright notice:

(C) 1995-2017 Jean-loup Gailly and Mark Adler
(C) 1995-2022 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand All @@ -108,7 +108,10 @@ Copyright notice:
If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code.
Gailly and Mark Adler; it does not include third-party code. We make all
contributions to and distributions of this project solely in our personal
capacity, and are not conveying any rights to any intellectual property of
any third parties.

If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
Expand Down
48 changes: 27 additions & 21 deletions third_party/zlib/configure
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ build64=0
gcc=0
warn=0
debug=0
sanitize=0
old_cc="$CC"
old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)'
Expand Down Expand Up @@ -137,6 +138,7 @@ case "$1" in
-c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
--sanitize) sanitize=1; shift ;;
*)
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
Expand Down Expand Up @@ -165,8 +167,14 @@ extern int getchar();
int hello() {return getchar();}
EOF

test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
cc=${CC-${CROSS_PREFIX}gcc}
if test -z "$CC"; then
echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
cc=${CROSS_PREFIX}gcc
else
cc=${CROSS_PREFIX}cc
fi
fi
cflags=${CFLAGS-"-O3"}
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
case "$cc" in
Expand Down Expand Up @@ -199,6 +207,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
fi
fi
if test $sanitize -eq 1; then
CFLAGS="${CFLAGS} -fsanitize=address"
fi
if test $debug -eq 1; then
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
Expand Down Expand Up @@ -367,8 +378,11 @@ else
try()
{
show $*
( $* ) >> configure.log 2>&1
got=`( $* ) 2>&1`
ret=$?
if test "$got" != ""; then
printf "%s\n" "$got" >> configure.log
fi
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
fi
Expand All @@ -381,8 +395,11 @@ tryboth()
show $*
got=`( $* ) 2>&1`
ret=$?
printf %s "$got" >> configure.log
if test "$got" != ""; then
printf "%s\n" "$got" >> configure.log
fi
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
return $ret
fi
test "$got" = ""
Expand Down Expand Up @@ -457,17 +474,11 @@ size_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for size_t... Yes." | tee -a configure.log
need_sizet=0
else
echo "Checking for size_t... No." | tee -a configure.log
need_sizet=1
fi

echo >> configure.log

# find the size_t integer type, if needed
if test $need_sizet -eq 1; then
cat > $test.c <<EOF
# find a size_t integer type
# check for long long
cat > $test.c << EOF
long long dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
Expand Down Expand Up @@ -495,17 +506,13 @@ EOF
if try $CC $CFLAGS -o $test $test.c; then
sizet=`./$test`
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
else
echo "Failed to find a pointer-size integer type." | tee -a configure.log
leave 1
echo "Checking for a pointer-size integer type... not found." | tee -a configure.log
fi
fi

if test $need_sizet -eq 1; then
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi

echo >> configure.log

# check for large file support, and if none, check for fseeko()
Expand Down Expand Up @@ -849,7 +856,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
echo STATICLIB = $STATICLIB >> configure.log
echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log
echo Z_U4 = $Z_U4 >> configure.log
echo SRCDIR = $SRCDIR >> configure.log
echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log
Expand Down
21 changes: 0 additions & 21 deletions third_party/zlib/contrib/README.contrib
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ ada/ by Dmitriy Anisimkov <[email protected]>
Support for Ada
See http://zlib-ada.sourceforge.net/

amd64/ by Mikhail Teterin <[email protected]>
asm code for AMD64
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393

asm686/ by Brian Raiter <[email protected]>
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 <[email protected]>
Decompressor for output of PKWare Data Compression Library (DCL)

Expand All @@ -32,9 +24,6 @@ gcc_gvmat64/by Gilles Vollant <[email protected]>
infback9/ by Mark Adler <[email protected]>
Unsupported diffs to infback to decode the deflate64 format

inflate86/ by Chris Anderson <[email protected]>
Tuned x86 gcc asm code to replace inflate_fast()

iostream/ by Kevin Ruland <[email protected]>
A C++ I/O streams interface to the zlib gz* functions

Expand All @@ -45,16 +34,6 @@ iostream3/ by Ludwig Schwardt <[email protected]>
and Kevin Ruland <[email protected]>
Yet another C++ I/O streams interface

masmx64/ by Gilles Vollant <[email protected]>
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 <[email protected]>
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 <[email protected]>
Mini zip and unzip based on zlib
Includes Zip64 support by Mathias Svensson <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion third_party/zlib/contrib/blast/blast.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow,
* use by the application to pass an input descriptor to infun(), if desired.
*
* If left and in are not NULL and *left is not zero when blast() is called,
* then the *left bytes are *in are consumed for input before infun() is used.
* then the *left bytes at *in are consumed for input before infun() is used.
*
* The output function is invoked: err = outfun(how, buf, len), where the bytes
* to be written are buf[0..len-1]. If err is not zero, then blast() returns
Expand Down
2 changes: 1 addition & 1 deletion third_party/zlib/contrib/delphi/ZLib.pas
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
const OutBuf: Pointer; BufSize: Integer);

const
zlib_version = '1.2.11';
zlib_version = '1.2.12';

type
EZlibError = class(Exception);
Expand Down
2 changes: 1 addition & 1 deletion third_party/zlib/contrib/dotzlib/DotZLib/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public class InfoTests
public void Info_Version()
{
Info info = new Info();
Assert.AreEqual("1.2.11", Info.Version);
Assert.AreEqual("1.2.12", Info.Version);
Assert.AreEqual(32, info.SizeOfUInt);
Assert.AreEqual(32, info.SizeOfULong);
Assert.AreEqual(32, info.SizeOfPointer);
Expand Down
6 changes: 3 additions & 3 deletions third_party/zlib/contrib/infback9/inftree9.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* inftree9.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-2017 Mark Adler
* Copyright (C) 1995-2022 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

Expand All @@ -9,7 +9,7 @@
#define MAXBITS 15

const char inflate9_copyright[] =
" inflate9 1.2.11 Copyright 1995-2017 Mark Adler ";
" inflate9 1.2.12 Copyright 1995-2022 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
Expand Down Expand Up @@ -64,7 +64,7 @@ unsigned short FAR *work;
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
133, 133, 133, 133, 144, 77, 202};
133, 133, 133, 133, 144, 199, 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,
Expand Down
12 changes: 8 additions & 4 deletions third_party/zlib/contrib/minizip/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=cc
CFLAGS=-O -I../..
CFLAGS := $(CFLAGS) -O -I../..

UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a
Expand All @@ -16,10 +16,14 @@ minizip: $(ZIP_OBJS)
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)

test: miniunz minizip
./minizip test readme.txt
@rm -f test.*
@echo hello hello hello > test.txt
./minizip test test.txt
./miniunz -l test.zip
mv readme.txt readme.old
@mv test.txt test.old
./miniunz test.zip
@cmp test.txt test.old
@rm -f test.*

clean:
/bin/rm -f *.o *~ minizip miniunz
/bin/rm -f *.o *~ minizip miniunz test.*
2 changes: 1 addition & 1 deletion third_party/zlib/contrib/minizip/configure.ac
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([minizip], [1.2.11], [bugzilla.redhat.com])
AC_INIT([minizip], [1.2.12], [bugzilla.redhat.com])
AC_CONFIG_SRCDIR([minizip.c])
AM_INIT_AUTOMAKE([foreign])
LT_INIT
Expand Down
19 changes: 10 additions & 9 deletions third_party/zlib/contrib/minizip/crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */

(void)pcrc_32_tab;
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
Expand Down Expand Up @@ -77,24 +78,24 @@ static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcr
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))

#define zencode(pkeys,pcrc_32_tab,c,t) \
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), (Byte)t^(c))

#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED

#define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# define ZCR_SEED2 3141592654L /* use PI as default pattern */
# endif

static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting)
static unsigned crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const z_crc_t* pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
unsigned n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
Expand Down
Loading

0 comments on commit 668805a

Please sign in to comment.