summaryrefslogtreecommitdiff
path: root/gzread.c
AgeCommit message (Collapse)Author
2020-11-02Fixed ubsan warning in gzfread due to size_t overflow. #783Nathan Moinvaziri
gzread.c:398:18: runtime error: unsigned integer overflow: 2 * 18446744073709551615 cannot be represented in type 'unsigned long' #0 0x10009d31e in zng_gzfread gzread.c:398 #1 0x100005b1a in test_gzio example.c:213 #2 0x10001093b in main example.c:1034 #3 0x7fff71f57cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)
2020-09-14Allocate gzlib/gzread/gzwrite structs and in/out buffers using zng_allocHans Kristian Rosbach
instead of malloc, this also enforces data alignment.
2020-08-31Rename ZEXPORT and ZEXTERN for consistency.Nathan Moinvaziri
2020-02-07Fixed formatting, 4 spaces for code intent, 2 spaces for preprocessor ↵Nathan Moinvaziri
indent, initial function brace on the same line as definition, removed extraneous spaces and new lines.
2019-01-15Avoid some conversion warnings in gzread.c and gzwrite.c.Mark Adler
2018-09-17Fix ZLIB_COMPAT=OFF and WITH_GZFILEOP=ON compilation failure.Hans Kristian Rosbach
Also add this combination to travis testing. Remove --native testing from travis, since they somehow make this fail very often, probably due to caching or running the executables on a different platform than the compiler thinks it is running on.
2018-03-22Move private defines from zconf.h and zconf-ng.h to zbuild.hMika Lindqvist
* move definition of z_size_t to zbuild.h
2018-01-31Adapt code to support PREFIX macros and update build scriptsMika Lindqvist
2018-01-31Add function prefix (zng_) to all exported functions to allow zlib-ngHans Kristian Rosbach
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.
2017-03-24Prevent potential division-by-zero in gzfwrite and gzfread.Hans Kristian Rosbach
2017-02-25Type cleanup...Mika Lindqvist
* gz_statep -> gz_state *
2017-02-13Fix build with nmake.Mika Lindqvist
2017-02-09zlib 1.2.9Mark Adler
2017-02-06No need to check for NULL argument to free().Mark Adler
2017-02-06Add gzfread(), duplicating the interface of fread().Hans Kristian Rosbach
Based on upstream commit 44dfd831d24f9b627ab666cf0973b0dce98fabba
2017-01-31Clean up type conversions.Mark Adler
Based on upstream 7096424f23df1b1813237fb5f8bc8f34cfcedd0c, but modified heavily to match zlib-ng.
2017-01-31Replace Z_NULL with NULL. Fix incorrect uses of NULL/Z_NULL.Mika Lindqvist
2017-01-30local -> staticMika Lindqvist
* 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"
2015-05-25Style cleanup for gzfile codeHans Kristian Rosbach
2015-05-13Remove Z_PREFIX leftoversHans Kristian Rosbach
2015-05-12Convert remaining K&R function declarations to ANSI-C declarations.Hans Kristian Rosbach
2015-04-26Cleanup: Replace 'z_streamp' with 'z_stream *'Hans Kristian Rosbach
2015-04-26Cleanup: Replace 'voidp' with 'void *'Hans Kristian Rosbach
2014-10-18Rewrite K&R-style function prototypes to ANSI-C-style.hansr
Only internal functions, no exported functions in this commit.
2014-10-12Remove workarounds for non-ANSI-C compatible compilers (Part 2)hansr
-Removing usage of OF() definition
2013-03-24zlib 1.2.7.1Mark Adler
2013-03-24Add casts and consts to ease user conversion to C++.Mark Adler
You would still need to run zlib2ansi on all of the *.c files.
2012-08-13Clean up the usage of z_const and respect const usage within zlib.Mark Adler
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-05-17Fix gzgetc undefine when Z_PREFIX set [Turk].Mark Adler
2012-02-18Restore gzgetc_ for backward compatibility with 1.2.6.Mark Adler
2012-02-18Replace use of memmove() with a simple copy for portability.Mark Adler
SunOS 4.1 doesn't have memmove(), and there may be others. memcpy() should not be used for overlapping copies, so here a simple copy is implemented that works for the particular direction of the overlap, which is where the destination precedes the source.
2012-02-12zlib 1.2.6.1Mark Adler
2012-02-10Remove unnecessary gzgetc_ function.Mark Adler
2011-12-18Restore gzgetc function for binary compatibility.Mark Adler
Newly compiled applications will use the gzgetc macro.
2011-12-14Document gzread() capability to read concurrently written files.Mark Adler
Also since gzread() will no longer return an error for an incomplete gzip file, have gzclose() return an error if the last gzread() ended in the middle of a gzip stream.
2011-12-13Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF.Mark Adler
Z_BUF_ERROR was also being used for an unsuccessful gzungetc and for buffer lengths that didn't fit in an int. Those uses were changed to Z_DATA_ERROR in order to assure that Z_BUF_ERROR occurs only when a premature end of input occurs, indicating that gzclearerr() can be used.
2011-12-11Fix bug in gzread.c when end-of-file is reached.Mark Adler
2011-12-11Fix gzeof() to behave just like feof() when read is not past end of file.Mark Adler
Before, gzeof() would return true (accurately) when the last read request went just up to the end of the uncompressed data. In the analogous case, feof() would return false, only returning true when a read request goes past the end of the file. This patch corrects gzeof() to behave in the same way as feof(), as noted in the zlib.h documentation.
2011-10-02Add a transparent write mode to gzopen() when 'T' is in the mode.Mark Adler
2011-09-30Update copyright dates on gz* source files.Mark Adler
2011-09-26Change gzgetc() to a macro for speed (~40% speedup in testing).Mark Adler
2011-09-26Simplify gzseek() now that raw after gzip is ignored.Mark Adler
2011-09-26Allow gzread() and related to continue after gzclearerr().Mark Adler
Before this fix, gzread() would lose data if a premature end of file was encountered. This prevented gzread() from being used on a file that was being written concurrently. Now gzread() returns all of the data it has available before indicating a premature end of file. This also changes the error returned on a premature end of file from Z_DATA_ERROR to Z_BUF_ERROR. This allows the user to determine if the error is recoverable, which it is if Z_BUF_ERROR is returned. If a Z_DATA_ERROR is returned, then the error is not recoverable. This patch replaces the functionality of a previous patch that fixed reading through an empty gzip stream in a concatenation of gzip streams. To implement this fix, a noticeable rewrite of gzread.c was needed. The patch has the added advantage of using inflate's gzip processing instead of replicating the functionality in gzread.c. This makes the gz code a little simpler.
2011-09-24Change gzread() and related to ignore junk after gzip streams.Mark Adler
Previously the new gz* functions (introduced in 1.2.4) would read and return raw data after the last gzip stream. This is inconsistent with the behavior of gzip and the previous versions of zlib. Now when one or more gzip streams have been decoded from the file, which is then followed by data that is not a gzip stream (as detemined by not finding the magic header), then that subsequent trailing garbage is ignored, and no error is returned.
2011-09-24Correct error in comment for gz_make().Mark Adler
2011-09-24Fix bug in gzgets() for a concatenated empty gzip stream.Mark Adler
2011-09-24Correct spelling error in gzread.cMark Adler
2011-09-09zlib 1.2.4.1Mark Adler
2011-09-09zlib 1.2.4-pre1Mark Adler
2011-09-09zlib 1.2.3.9Mark Adler