diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-24 10:26:07 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-24 10:26:07 -0700 |
commit | a9ae24b6538a8c75b13826ef8a2547344fd2e08c (patch) | |
tree | 9f726be0a8f64c2a896d41683551d89b0e9a6611 /zlib.h | |
parent | 8824da8f01c63b0e77f96fe57faf762070bd0576 (diff) | |
download | zlib-a9ae24b6538a8c75b13826ef8a2547344fd2e08c.tar.gz zlib-a9ae24b6538a8c75b13826ef8a2547344fd2e08c.tar.bz2 zlib-a9ae24b6538a8c75b13826ef8a2547344fd2e08c.zip |
Change gzread() and related to ignore junk after gzip streams.
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.
Diffstat (limited to 'zlib.h')
-rw-r--r-- | zlib.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1259,14 +1259,14 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); | |||
1259 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); | 1259 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); |
1260 | /* | 1260 | /* |
1261 | Reads the given number of uncompressed bytes from the compressed file. If | 1261 | Reads the given number of uncompressed bytes from the compressed file. If |
1262 | the input file was not in gzip format, gzread copies the given number of | 1262 | the input file is not in gzip format, gzread copies the given number of |
1263 | bytes into the buffer. | 1263 | bytes into the buffer directly from the file. |
1264 | 1264 | ||
1265 | After reaching the end of a gzip stream in the input, gzread will continue | 1265 | After reaching the end of a gzip stream in the input, gzread will continue |
1266 | to read, looking for another gzip stream, or failing that, reading the rest | 1266 | to read, looking for another gzip stream. Any number of gzip streams may be |
1267 | of the input file directly without decompression. The entire input file | 1267 | concatenated in the input file, and will all be decompressed by gzread(). |
1268 | will be read if gzread is called until it returns less than the requested | 1268 | If something other than a gzip stream is encountered after a gzip stream, |
1269 | len. | 1269 | that remaining trailing garbage is ignored (and no error is returned). |
1270 | 1270 | ||
1271 | gzread returns the number of uncompressed bytes actually read, less than | 1271 | gzread returns the number of uncompressed bytes actually read, less than |
1272 | len for end of file, or -1 for error. | 1272 | len for end of file, or -1 for error. |