Commit Graph

51 Commits

Author SHA1 Message Date
Mika T. Lindqvist
c970422caa Fix definition of z_size_t to match documentation of legacy zlib API. 2023-02-23 12:17:34 +01:00
Mika Lindqvist
4fadf3c49e Add one extra byte to return value of compressBound and deflateBound for small lengths due to shift returning 0.
* Treat 0 byte input as 1 byte input when calculating compressBound and deflateBound
2022-04-22 13:50:22 +02:00
Nathan Moinvaziri
92aa5d1caf Use zutil.h which already includes zlib headers. 2022-03-18 15:57:25 +01:00
Hans Kristian Rosbach
70f608c79c Fix deflateBound and compressBound returning very small size estimates.
Remove workaround in switchlevels.c, so we do actual testing of this.
Use named defines instead of magic numbers where we can.
2021-12-20 14:49:27 +01:00
Ilya Leoshkevich
63e0002cba IBM Z: Adjust compressBound() for DFLTCC
When DFLTCC was introduced, deflateBound() was adjusted, but
compressBound() was not, leading to compression failures when using
compressBound() + compress() with poorly compressible data.
2021-10-13 15:39:57 +02:00
Nathan Moinvaziri
1f10aa4e29 Rename ZEXPORT and ZEXTERN for consistency. 2020-08-31 12:33:16 +02:00
Mika Lindqvist
28e5e73f34
Reintroduce support for ZLIB_CONST in compat mode. (#704)
* Reintroduce support for ZLIB_CONST in compat mode.
2020-08-23 09:58:57 +02:00
Nathan Moinvaziri
b6b8ad6c0f Make deflate_quick algorithm available to all architectures. #205 2020-06-08 15:01:50 +02:00
Pavel P
762068fdc6 Remove cvs keywords 2020-03-17 15:26:47 +01:00
Nathan Moinvaziri
7cf5afc5d5 Fixed compressBound calculation for quick deflate strategy. Worse case is 9 bits per literal plus the size of headers and footers for block and gzip format. Works out to the size of the input plus additional 13.67%. 2020-03-13 13:06:14 +01:00
Nathan Moinvaziri
e0a711cdde Fixed formatting, 4 spaces for code intent, 2 spaces for preprocessor indent, initial function brace on the same line as definition, removed extraneous spaces and new lines. 2020-02-07 10:44:20 +01:00
Mika Lindqvist
df1fd1567f Move private defines from zconf.h and zconf-ng.h to zbuild.h
* move definition of z_size_t to zbuild.h
2018-03-22 10:18:27 +01:00
Mika Lindqvist
ec6adfbfb0 [MSVC] Fix size_t/ssize_t when using ZLIB_COMPAT. (#161)
* zconf.h.in wasn't including Windows.h, that is correct header to include definitions from BaseTsd.h, and such missing required type definition for ssize_t when compiling using MS Visual C++
* Various places need implicit casting to z_size_t to get around compatibility issues, this will truncate the result when ZLIB_COMPAT is defined, calling code should check for truncation.
* Add ZLIB_COMPAT flag to nmake Makefile and use it to determine correct
  filenames instead of WITH_GZFILEOP
2018-03-22 10:01:18 +01:00
Mika Lindqvist
cd3f3d6e68 [compat] Use unsigned long for size parameters of compress/compressBound/uncompress 2018-02-16 15:48:06 +01:00
Mika Lindqvist
aff0fc6e3c Adapt code to support PREFIX macros and update build scripts 2018-01-31 10:45:29 +01:00
Hans Kristian Rosbach
f5e888a6a6 Add function prefix (zng_) to all exported functions to allow zlib-ng
to co-exist in an application that has been linked to something that
depends on stock zlib. Previously, that would cause random problems
since there is no way to guarantee what zlib version is being used
for each dynamically linked function.

Add the corresponding zlib-ng.h.

Tests, example and minigzip will not compile before they have been
adapted to use the correct functions as well.
Either duplicate them, so we have minigzip-ng.c for example, or add
compile-time detection in the source code.
2018-01-31 10:45:29 +01:00
Mark Adler
2a51c84f6c zlib 1.2.9 2017-02-09 11:39:40 +01:00
Mark Adler
cd0071573c Use a uniform approach for the largest value of an unsigned type. 2017-02-07 10:38:47 +01:00
Mika Lindqvist
602531cf3d Replace Z_NULL with NULL. Fix incorrect uses of NULL/Z_NULL. 2017-01-31 10:53:22 +01:00
Mika Lindqvist
63523d388d Use size_t for total_in and total_out. 2015-12-14 11:00:31 +02:00
Mika Lindqvist
9c3a280877 Type cleanup. 2015-12-14 11:00:22 +02:00
Hans Kristian Rosbach
a8c8743112 Fix merge errors. 2015-11-03 19:35:54 +01:00
Mark Adler
b673ee00f3 Do not initialize unsigned with -1 in compress.c uncompr.c.
Sun compiler complained.  Use (unsigned)0 - 1 instead.
2015-11-03 18:52:30 +01:00
Mark Adler
6aa9399790 Fix compress() to work on lengths more than a maximum unsigned.
Conflicts:
	compress.c
2015-11-03 18:50:35 +01:00
Hans Kristian Rosbach
ae0043b988 Style cleanup for compress/uncompress and longest_match code 2015-05-25 23:04:39 +02:00
Mika Lindqvist
d6523bc5d5 Replace (void *)0 with NULL. 2015-05-22 23:17:30 +03:00
Daniel Axtens
24cfc4d7bb Kill Byte and Bytef
Signed-off-by: Daniel Axtens <dja@axtens.net>

Conflicts:
	adler32.c
	compress.c
	deflate.c
	inflate.c
	match.c
	test/example.c
	uncompr.c
	zlib.h
2015-05-17 18:11:59 +02:00
Daniel Axtens
48f9b2a0e9 z_const -> const
Signed-off-by: Daniel Axtens <dja@axtens.net>

Conflicts:
	arch/x86/crc_folding.c
	crc32.c
2015-05-13 14:18:18 +02:00
Hans Kristian Rosbach
abae9eefc4 Convert remaining K&R function declarations to ANSI-C declarations. 2015-05-12 18:54:20 +02:00
Hans Kristian Rosbach
e5ee314ad4 Cleanup: Replace 'voidp' with 'void *' 2015-04-26 21:08:25 +02:00
hansr
8999d0a963 Remove FAR variants of voidpf
And a few Bytef leftovers from test/example.c
2014-10-18 12:11:48 +02:00
hansr
c4963b5ebf Remove FAR variants of variables ushf, schf, Posf, Bytef, charf,
intf, uIntf and uLongf
2014-10-16 15:32:17 +02:00
hansr
279e637d95 Remove legacy 16-bit workarounds 2014-10-09 14:35:50 +02:00
Mark Adler
62d6112a79 Clean up the usage of z_const and respect const usage within zlib.
This patch allows zlib to compile cleanly with the -Wcast-qual gcc
warning enabled, but only if ZLIB_CONST is defined, which adds
const to next_in and msg in z_stream and in the in_func prototype.
A --const option is added to ./configure which adds -DZLIB_CONST
to the compile flags, and adds -Wcast-qual to the compile flags
when ZLIBGCCWARN is set in the environment.
2012-08-13 00:02:40 -07:00
Mark Adler
b1c19ca6d8 zlib 1.2.3.1 2011-09-09 23:25:27 -07:00
Mark Adler
9811b53dd9 zlib 1.2.2.1 2011-09-09 23:24:24 -07:00
Mark Adler
4b5a43a219 zlib 1.2.0.5 2011-09-09 23:22:37 -07:00
Mark Adler
8e34b3a802 zlib 1.2.0.2 2011-09-09 23:22:10 -07:00
Mark Adler
7c2a874e50 zlib 1.2.0 2011-09-09 23:21:47 -07:00
Mark Adler
a383133c4e zlib 1.1.4 2011-09-09 23:20:42 -07:00
Mark Adler
b8c9ecb076 zlib 1.0.9 2011-09-09 23:19:21 -07:00
Mark Adler
6759211ad8 zlib 1.0.8 2011-09-09 23:18:57 -07:00
Mark Adler
7850e4e406 zlib 1.0.7 2011-09-09 23:17:33 -07:00
Mark Adler
e26a448e96 zlib 1.0.2 2011-09-09 23:15:17 -07:00
Mark Adler
423eb40306 zlib 1.0.1 2011-09-09 23:14:39 -07:00
Mark Adler
8a2acbffc8 zlib 1.0-pre 2011-09-09 23:13:27 -07:00
Mark Adler
56bcb184fa zlib 0.99 2011-09-09 23:11:37 -07:00
Mark Adler
23c69f1069 zlib 0.94 2011-09-09 23:09:18 -07:00
Mark Adler
bdde4e09d2 zlib 0.92 2011-09-09 23:08:07 -07:00
Mark Adler
4ca984fb44 zlib 0.8 2011-09-09 23:03:14 -07:00