Commit Graph

440 Commits

Author SHA1 Message Date
Mark Adler
288f108031 Remove old assembler code in which bugs have manifested.
In addition, there is not sufficient gain from the inflate
assembler code to warrant its inclusion.
2017-10-12 20:27:14 -07:00
Mark Adler
a577351394 Make the names in functions declarations identical to definitions. 2017-10-12 20:03:51 -07:00
Mark Adler
723e928b84 Avoid an undefined behavior of memcpy() in _tr_stored_block().
Allegedly the behavior of memcpy() is undefined if the source
pointer is NULL, even if the number of bytes to copy is zero.
2017-10-12 19:44:01 -07:00
Mark Adler
b25d5fcdcf Avoid undefined behaviors of memcpy() in gz*printf(). 2017-10-12 19:35:59 -07:00
Mark Adler
ae49d1472e Avoid an undefined behavior of memcpy() in gzappend(). 2017-10-12 19:27:59 -07:00
Mark Adler
3c46f5ddb5 Avoid the use of ptrdiff_t.
This isn't the right type anyway to assure that it contains a
pointer. That type would be intptr_t or uintptr_t. However the C99
standard says that those types are optional, so their use would not
be portable. This commit simply uses size_t or whatever configure
decided to use for size_t. That would be the same length as
ptrdiff_t, and so will work just as well. The code checks to see if
the length of the type used is the same as the length of a void
pointer, so there is already protection against the use of the
wrong type. The use of size_t (or ptrdiff_t) will almost always
work, as all modern architectures have an array size that is the
same as the pointer size. Only old segmented architectures would
have to fall back to the slower CRC-32 calculation, where the
amount of memory that can be accessed is larger than the maximum
array size.
2017-06-03 09:53:33 -07:00
Mark Adler
44e8ac810d Handle case where inflateSync used when header never processed.
If zlib and/or gzip header processing was requested, but a header
was never provided and inflateSync was used successfully, then the
inflate state would be inconsistent, trying to compute a check
value but with no flags set. This commit sets the inflate mode to
raw in this case, since there is no other assumption that can be
made if a header was requested but never seen.
2017-04-16 08:35:33 -07:00
Mark Adler
89245c0a84 Don't compute check value for raw inflate if asked to validate. 2017-03-30 14:48:43 -07:00
Mark Adler
be5e3647c4 Add address checking in clang to -w option of configure. 2017-02-18 23:07:01 -08:00
Mark Adler
90287635ef Return an error if the gzputs string length can't fit in an int. 2017-02-15 22:39:26 -08:00
Mark Adler
60a5ecc62b Small speedup to inflate [psumbera].
Seeing a few percent speedup by using a pointer instead of an
assigned structure. This seems to help the compiler to optimize
better.
2017-02-15 22:39:26 -08:00
Mark Adler
e1f1a3a146 Update use of errno for newer Windows CE versions. 2017-02-15 22:39:26 -08:00
Mark Adler
793ad7f559 Avoid some conversion warnings in gzread.c and gzwrite.c. 2017-02-15 22:39:26 -08:00
Mark Adler
e00a2bd392 Have Makefile return non-zero error code on test failure. 2017-02-15 22:39:26 -08:00
Mark Adler
a362293745 Avoid a conversion error in gzseek when off_t type too small.
This is a problem in the odd case that the second argument of
LSEEK is a larger type than off_t. Apparently MinGW defines off_t
to be 32 bits, but _lseeki64 has a 64-bit second argument.

Also undo a previous commit to permit MinGW to use _lseeki64.
2017-02-15 22:39:26 -08:00
Mark Adler
38e8ce32af Fix CLEAR_HASH macro to be usable as a single statement.
As it is used in deflateParams().
2017-02-15 22:39:26 -08:00
Mark Adler
8ba393e70d Fix bug when window full in deflate_stored(). 2017-02-15 22:39:25 -08:00
Mark Adler
2d80d3f6b5 Limit hash table inserts after switch from stored deflate.
This limits hash table inserts to the available data in the window
and to the sliding window size in deflate_stored(). The hash table
inserts are deferred until deflateParams() switches to a non-zero
compression level.
2017-02-15 22:39:25 -08:00
Mark Adler
f9694097dd Permit a deflateParams() parameter change as soon as possible.
This commit allows a parameter change even if the input data has
not all been compressed and copied to the application output
buffer, so long as all of the input data has been compressed to
the internal pending output buffer. This also allows an immediate
deflateParams change so long as there have been no deflate calls
since initialization or reset.
2017-02-15 22:38:55 -08:00
Mark Adler
5ff989033e Cygwin does not have _wopen(), so do not create gzopen_w() there. 2017-01-16 09:38:36 -08:00
Mark Adler
7d60b86782 Change version number to 1.2.11.1. 2017-01-15 22:46:03 -08:00
Mark Adler
cacf7f1d4e zlib 1.2.11 2017-01-15 09:29:40 -08:00
Mark Adler
cbbd20302c Permit immediate deflateParams changes before any deflate input.
This permits deflateParams to change the strategy and level right
after deflateInit, without having to wait until a header has been
written. The parameters can be changed immediately up until the
first deflate call that consumes any input data.
2017-01-15 09:29:40 -08:00
Mark Adler
7d9c9d410a Update high water mark in deflate_stored.
This avoids unnecessary filling of bytes in the sliding window
buffer when switching from level zero to a non-zero level. This
also provides a consistent indication of deflate having taken
input for a later commit ...
2017-01-15 09:29:27 -08:00
Mark Adler
37ed2112a1 Update vestigial comment from very old Info-ZIP deflate. 2017-01-15 09:07:14 -08:00
Mark Adler
4c7c907683 Fix deflate stored bug when pulling last block from window.
And some cosmetic cleanups.
2017-01-15 09:07:14 -08:00
Mark Adler
74d2696d87 Update location of Visual Studio project files. 2017-01-15 09:07:14 -08:00
Mark Adler
c38a2603ce Delete user-specific Visual Studio project files. 2017-01-15 09:07:14 -08:00
Mark Adler
11ceaed751 Change version number to 1.2.10.1. 2017-01-15 09:07:08 -08:00
Mark Adler
4a090adef8 zlib 1.2.10 2017-01-02 18:21:29 -08:00
Mark Adler
e13def040e Fix compilation with --solo and --debug combined.
However this ends up not really being solo, since it has to
include external libraries.
2017-01-02 18:21:29 -08:00
Mark Adler
1e3bccd496 Add warnings when compiling with assembler code.
There have been many reports of bugs in the assembler codes
intended to speed up deflate and inflate. They are third-party
contributions in contrib, and so are not supported by the zlib
maintainers.
2017-01-02 17:28:27 -08:00
Mark Adler
c7d77756d0 Remove files to be installed before copying them in Makefile.in. 2017-01-02 17:04:38 -08:00
Mark Adler
0b5c158cc7 Fix bug in gzwrite.c that produced corrupt gzip files. 2017-01-02 16:17:43 -08:00
Mark Adler
bc5503b224 Fix bug in deflate_stored() for zero-length input. 2017-01-02 15:17:59 -08:00
Mark Adler
52aa5501ec Minor edits and clarifications of comments. 2017-01-01 22:24:37 -08:00
Mark Adler
7358ef23c2 Avoid warnings on snprintf() return value. 2017-01-01 22:24:37 -08:00
Mark Adler
20e472546e Change version number to zlib 1.2.9.1. 2017-01-01 22:24:17 -08:00
Mark Adler
6bdca5060d Fix some stray 1.2.8.1 version numbers. 2017-01-01 22:23:41 -08:00
Mark Adler
2fa463bacf zlib 1.2.9 2016-12-31 23:37:10 -08:00
Mark Adler
14e3194e1e Update Visual Studio project files (AraHaan). 2016-12-31 18:57:48 -08:00
Mark Adler
b9ae6f0079 Add crc32_z() and adler32_z() functions with size_t lengths. 2016-12-31 17:50:52 -08:00
Mark Adler
61b91f27f8 Make z_size_t unsigned long for non-standard C.
Also declare z_size_t when compiling solo.
2016-12-31 17:50:39 -08:00
Mark Adler
cca27e95cf Avoid the need for ssize_t.
Limit read() and write() requests to sizes that fit in an int.
This allows storing the return value in an int, and avoiding the
need to use or construct an ssize_t type. This is required for
Microsoft C, whose _read and _write functions take an unsigned
request and return an int.
2016-12-31 10:06:40 -08:00
Mark Adler
b7fbee2156 Use a uniform approach for the largest value of an unsigned type. 2016-12-31 08:49:17 -08:00
Mark Adler
f3fcb92cf6 Use intptr_t for z_ssize_t on MSVC. 2016-12-30 23:42:22 -08:00
Mark Adler
8f147c3d12 Avoid some random compiler warnings on various platforms. 2016-12-30 23:42:10 -08:00
Mark Adler
fb26fc427f Allow minigzip to compile when testing with ./configure --solo. 2016-12-30 22:04:22 -08:00
Mark Adler
d46546544a Replace as400 with os400 for OS/400 support (Monnerat). 2016-12-30 20:00:57 -08:00
Mark Adler
f12d3dc367 Detect clang in cc version. 2016-12-30 20:00:57 -08:00