aboutsummaryrefslogtreecommitdiff
path: root/zlib.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-12-14 04:21:00 -0800
committerMark Adler <madler@alumni.caltech.edu>2011-12-14 04:21:00 -0800
commit2556706d67b471b45e0882ea4f32aa8b2efc14ec (patch)
treeed16d084027fa6726873eddfaa5187a64e05857e /zlib.h
parent850a198ff1879e506c961c91da30009539ed14b3 (diff)
downloadzlib-2556706d67b471b45e0882ea4f32aa8b2efc14ec.tar.gz
zlib-2556706d67b471b45e0882ea4f32aa8b2efc14ec.tar.bz2
zlib-2556706d67b471b45e0882ea4f32aa8b2efc14ec.zip
Document gzread() capability to read concurrently written files.
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.
Diffstat (limited to 'zlib.h')
-rw-r--r--zlib.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/zlib.h b/zlib.h
index 1ee04e9..7068d50 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1297,6 +1297,18 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
1297 If something other than a gzip stream is encountered after a gzip stream, 1297 If something other than a gzip stream is encountered after a gzip stream,
1298 that remaining trailing garbage is ignored (and no error is returned). 1298 that remaining trailing garbage is ignored (and no error is returned).
1299 1299
1300 gzread can be used to read a gzip file that is being concurrently written.
1301 Upon reaching the end of the input, gzread will return with the available
1302 data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
1303 gzclearerr can be used to clear the end of file indicator in order to permit
1304 gzread to be tried again. Z_OK indicates that a gzip stream was completed
1305 on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
1306 middle of a gzip stream. Note that gzread does not return -1 in the event
1307 of an incomplete gzip stream. This error is deferred until gzclose(), which
1308 will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
1309 stream. Alternatively, gzerror can be used before gzclose to detect this
1310 case.
1311
1300 gzread returns the number of uncompressed bytes actually read, less than 1312 gzread returns the number of uncompressed bytes actually read, less than
1301 len for end of file, or -1 for error. 1313 len for end of file, or -1 for error.
1302*/ 1314*/
@@ -1480,7 +1492,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file));
1480 must not be called more than once on the same allocation. 1492 must not be called more than once on the same allocation.
1481 1493
1482 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a 1494 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
1483 file operation error, Z_MEM_ERROR if out of memory, or Z_OK on success. 1495 file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
1496 last read ended in the middle of a gzip stream, or Z_OK on success.
1484*/ 1497*/
1485 1498
1486ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); 1499ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));