diff options
| author | Mark Adler <git@madler.net> | 2025-05-25 21:46:47 -0700 |
|---|---|---|
| committer | Mark Adler <git@madler.net> | 2025-12-06 19:56:13 -0800 |
| commit | 370ef1b41fd35fbfcf2af317ef3d8065a132f27a (patch) | |
| tree | 3a7707b876f2934b04d1ecfff33708d6350a7ad4 /zlib.h | |
| parent | 562b823635fdcd26e44961f6bd213ae0c10be098 (diff) | |
| download | zlib-370ef1b41fd35fbfcf2af317ef3d8065a132f27a.tar.gz zlib-370ef1b41fd35fbfcf2af317ef3d8065a132f27a.tar.bz2 zlib-370ef1b41fd35fbfcf2af317ef3d8065a132f27a.zip | |
Return all available uncompressed data on error in gzread.c.
The error is recorded, and will be detected by the application
after all of the uncompressed data has been consumed and then one
more call is made to read data. The error is available immediately
from gzerror() if the application would like to know earlier.
Diffstat (limited to 'zlib.h')
| -rw-r--r-- | zlib.h | 21 |
1 files changed, 13 insertions, 8 deletions
| @@ -1454,7 +1454,8 @@ ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len); | |||
| 1454 | gzread returns the number of uncompressed bytes actually read, less than | 1454 | gzread returns the number of uncompressed bytes actually read, less than |
| 1455 | len for end of file, or -1 for error. If len is too large to fit in an int, | 1455 | len for end of file, or -1 for error. If len is too large to fit in an int, |
| 1456 | then nothing is read, -1 is returned, and the error state is set to | 1456 | then nothing is read, -1 is returned, and the error state is set to |
| 1457 | Z_STREAM_ERROR. | 1457 | Z_STREAM_ERROR. If some data was read before an error, then that data is |
| 1458 | returned until exhausted, after which the next call will signal the error. | ||
| 1458 | */ | 1459 | */ |
| 1459 | 1460 | ||
| 1460 | ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, | 1461 | ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, |
| @@ -1536,8 +1537,9 @@ ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len); | |||
| 1536 | left untouched. | 1537 | left untouched. |
| 1537 | 1538 | ||
| 1538 | gzgets returns buf which is a null-terminated string, or it returns NULL | 1539 | gzgets returns buf which is a null-terminated string, or it returns NULL |
| 1539 | for end-of-file or in case of error. If there was an error, the contents at | 1540 | for end-of-file or in case of error. If some data was read before an error, |
| 1540 | buf are indeterminate. | 1541 | then that data is returned until exhausted, after which the next call will |
| 1542 | return NULL to signal the error. | ||
| 1541 | */ | 1543 | */ |
| 1542 | 1544 | ||
| 1543 | ZEXTERN int ZEXPORT gzputc(gzFile file, int c); | 1545 | ZEXTERN int ZEXPORT gzputc(gzFile file, int c); |
| @@ -1548,11 +1550,14 @@ ZEXTERN int ZEXPORT gzputc(gzFile file, int c); | |||
| 1548 | 1550 | ||
| 1549 | ZEXTERN int ZEXPORT gzgetc(gzFile file); | 1551 | ZEXTERN int ZEXPORT gzgetc(gzFile file); |
| 1550 | /* | 1552 | /* |
| 1551 | Read and decompress one byte from file. gzgetc returns this byte or -1 | 1553 | Read and decompress one byte from file. gzgetc returns this byte or -1 in |
| 1552 | in case of end of file or error. This is implemented as a macro for speed. | 1554 | case of end of file or error. If some data was read before an error, then |
| 1553 | As such, it does not do all of the checking the other functions do. I.e. | 1555 | that data is returned until exhausted, after which the next call will return |
| 1554 | it does not check to see if file is NULL, nor whether the structure file | 1556 | -1 to signal the error. |
| 1555 | points to has been clobbered or not. | 1557 | |
| 1558 | This is implemented as a macro for speed. As such, it does not do all of | ||
| 1559 | the checking the other functions do. I.e. it does not check to see if file | ||
| 1560 | is NULL, nor whether the structure file points to has been clobbered or not. | ||
| 1556 | */ | 1561 | */ |
| 1557 | 1562 | ||
| 1558 | ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); | 1563 | ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); |
