Commit Graph

73 Commits

Author SHA1 Message Date
Mark Adler
4fe59efbe0 zlib 1.3.1
madler/zlib#51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
2024-02-07 19:15:56 +01:00
Nathan Moinvaziri
efae7678b0 Add back gz_intmax for zlib compatibility when linking statically 2024-02-07 19:15:56 +01:00
Milan Bulat
0d2984d0d3 Make the existence of gz_intmax() unconditional.
gz_intmax() is noted in zlib.map. This assures it's always there.

madler/zlib#01253ecd7e0a01d311670f2d03c61b82fc12d338
2024-02-07 19:15:56 +01:00
Mark Adler
fe44e1f1df Fix bug when using gzflush() with a very small buffer. 2023-08-24 11:22:33 +02:00
Nathan Moinvaziri
d43822b9a7 zlib 1.2.12 2022-06-13 15:58:03 +02:00
Hans Kristian Rosbach
b1ebcc0ee9 Remove gz_intmax implementation, since INT_MAX is always available in modern C implementations. 2021-12-19 15:40:52 +01:00
Nathan Moinvaziri
601a997644 Move gzclose() to gzlib.c. Modern linkers should be smart enough to link it in only if it is used. 2020-09-16 09:10:28 +02:00
Hans Kristian Rosbach
a14ec1a53a Allocate gzlib/gzread/gzwrite structs and in/out buffers using zng_alloc
instead of malloc, this also enforces data alignment.
2020-09-14 12:04:30 +02:00
Nathan Moinvaziri
1f10aa4e29 Rename ZEXPORT and ZEXTERN for consistency. 2020-08-31 12:33:16 +02:00
Nathan Moinvaziri
7cffba4dd6 Rename ZLIB_INTERNAL to Z_INTERNAL for consistency. 2020-08-31 12:33:16 +02:00
Pavel P
59e860cb44 Fixed casting warnings 2020-06-20 09:11:11 +02:00
Don
d0ac4929f0 Remove Borland C++ compiler references
There are a few guards checking for Borland C++ 5.0 or greater which was released
in 1996. While there is still a descendent of this compiler in Embarcadero C++ Builder
its value for __BORLANDC__ is greater than 0x500 so it is safe to remove these guards.
2020-06-16 15:58:04 +02:00
Nathan Moinvaziri
6dcc7bf815 For gzseek, gzoffset, gzopen, adler32_combine, crc32_combine and crc32_combine_gen, export 32-bit and 64-bit versions for zlib-compatible api and only 64-bit version (without 64 suffix) for zlib-ng native api. 2020-06-08 21:14:07 +02:00
Pavel P
6dfff29c01 Clean up windows defines, use _WIN32
+ replaced WIN32 with _WIN32
 + removed unused WINDOWS/_WINDOWS defines
 + no need to test for __MINGW__, as _WIN32 is also defined
2020-06-08 15:09:17 +02:00
Mark Adler
72c9ed1415 Avoid adding empty gzip member after gzflush with Z_FINISH. 2019-10-22 09:55:41 +02:00
Mark Adler
195ff00f40 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.
2019-01-15 10:59:22 +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
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
Mika Lindqvist
8a3815bf99 Type cleanup...
* gz_statep -> gz_state *
2017-02-25 12:52:11 +01:00
Mark Adler
21bffda72c zlib 1.2.11 2017-02-13 10:16:17 +01:00
Mark Adler
61a36de691 Avoid warnings on snprintf() return value. 2017-02-09 11:49:52 +01:00
Mark Adler
2a51c84f6c zlib 1.2.9 2017-02-09 11:39:40 +01:00
Mark Adler
867e981565 Clean up gz* function return values.
In some cases the return values did not match the documentation,
or the documentation did not document all of the return values.
gzprintf() now consistently returns negative values on error,
which matches the behavior of the stdio fprintf() function.
2017-02-06 13:06:25 +01:00
Mika Lindqvist
631817cce8 local -> static
* local -> static
* Normalize and cleanup line-endings
* Fix warnings under Visual Studio.
* Whitespace cleanup

***
This patch has been edited to merge cleanly and to exclude type changes.
Based on 8d7a7c3b82c6e38734bd504dac800b148ab410d0 "Type Cleanup"
2017-01-30 10:35:05 +01:00
Mark Adler
9363966f9f
Fix gzseek() problem on MinGW due to buggy _lseeki64 there. 2016-04-26 22:49:18 +03:00
Mika Lindqvist
9c3a280877 Type cleanup. 2015-12-14 11:00:22 +02:00
Mika Lindqvist
962354736f Fix creating shared library under MSYS64. 2015-11-25 16:12:13 +01:00
Mark Adler
fa1c29c7f4 Compile the gzopen_w() function when __CYGWIN__ defined.
Conflicts:
	gzlib.c
	zlib.h
2015-11-03 19:10:23 +01:00
Mark Adler
51bf318c94 Assure that gzoffset() is correct when appending.
An open() with O_APPEND followed by an lseek() to determine the
position will return zero for a non-empty file, even though the
next write will start at the end of the file.  This commit works
around that by doing an lseek() to the end when appending.
2015-11-03 18:53:46 +01:00
Mark Adler
48e985b618 Improve speed of gzprintf() in transparent mode.
A few minor modifications done to help with conflicts.
2015-11-03 18:43:48 +01:00
Hans Kristian Rosbach
7e13ce3e3d Style cleanup for gzfile code 2015-05-25 23:01:55 +02:00
Hans Kristian Rosbach
abae9eefc4 Convert remaining K&R function declarations to ANSI-C declarations. 2015-05-12 18:54:20 +02:00
Mika Lindqvist
3b8b9053e1 Enable gzopen_w for Cygwin 2015-05-12 12:37:07 +03:00
Daniel Axtens
239692bf13 Remove UNDER_CE: Windows CE is old.
Signed-off-by: Daniel Axtens <dja@axtens.net>
2015-05-11 20:40:22 +02:00
Mika Lindqvist
f197292e36 Fix building under Cygwin. 2015-05-07 23:17:16 +02:00
hansr
84002037ee Rewrite K&R-style function prototypes to ANSI-C-style.
Only internal functions, no exported functions in this commit.
2014-10-18 22:49:16 +02:00
hansr
3f8e26e0b7 Remove workarounds for non-ANSI-C compatible compilers (Part 2)
-Removing usage of OF() definition
2014-10-12 22:57:27 +02:00
hansr
f7e1e0130f Remove workarounds for non-ANSI-C compatible compilers (Part 1) 2014-10-12 12:38:06 +02:00
Mark Adler
0b16609409 zlib 1.2.7.1 2013-03-24 22:47:59 -07:00
Mark Adler
e9f0b78443 Add casts and consts to ease user conversion to C++.
You would still need to run zlib2ansi on all of the *.c files.
2013-03-24 16:09:08 -07: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
eb90f6a568 Fix bug in 'F' mode for gzopen(). 2012-05-22 22:31:19 -07:00
Mark Adler
c58f7ab28d Replace use of unsafe string functions with snprintf if available.
This avoids warnings in OpenBSD that apparently can't be turned
off whenever you link strcpy, strcat, or sprintf.  When snprintf
isn't available, the use of the "unsafe" string functions has
always in fact been safe, since the lengths are all checked before
those functions are called.

We do not use strlcpy or strlcat, since they are not (yet) found on
all systems.  snprintf on the other hand is part of the C standard
library and is very common.
2012-05-02 23:18:38 -07:00
Mark Adler
a5d803b7ef Attempt to convert the wchar_t path in gzopen_w() for errors.
The conversion to multi-byte will be locale-specific, but it's
better than nothing and is only to provide more information in the
error message returned by gz_error().  The conversion has no
effect on what's opened.
2012-03-18 14:52:31 -07:00
Mark Adler
04afd39fcc Fix syntax error in gzlib.c. 2012-03-18 14:25:00 -07:00
Mark Adler
8e16df2c3f More fixes for gzopen_w().
Also need to #include <stddef.h> for zlib.h, and need to workaround
the inability to use wide characters in constructed error messages
with zlib's interface.
2012-03-18 09:29:44 -07:00
Mark Adler
a1af6e96e3 Fix gzopen_w() type and add #include for the type. 2012-03-17 21:45:01 -07:00
Mark Adler
dbe0bed739 Add gzopen_w() in Windows for wide character path names. 2012-03-16 20:53:09 -07:00
Mark Adler
5d5befa4c3 Update copyright years in gzlib.c. 2012-03-10 22:24:08 -08:00