diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-10-02 13:24:43 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-10-02 13:34:29 -0700 |
commit | 26a99cd8957db86bdc75d9d1ebf00146cb20c87c (patch) | |
tree | 2f65d57da589c9e5475902fdf08a4aa8c4294bda /zlib.h | |
parent | 3c9d261809bfafc4350147ade7b74022dd144d32 (diff) | |
download | zlib-26a99cd8957db86bdc75d9d1ebf00146cb20c87c.tar.gz zlib-26a99cd8957db86bdc75d9d1ebf00146cb20c87c.tar.bz2 zlib-26a99cd8957db86bdc75d9d1ebf00146cb20c87c.zip |
Add a transparent write mode to gzopen() when 'T' is in the mode.
Diffstat (limited to 'zlib.h')
-rw-r--r-- | zlib.h | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -696,7 +696,7 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | |||
696 | be larger than the value returned by deflateBound() if flush options other | 696 | be larger than the value returned by deflateBound() if flush options other |
697 | than Z_FINISH or Z_NO_FLUSH are used. | 697 | than Z_FINISH or Z_NO_FLUSH are used. |
698 | */ | 698 | */ |
699 | 699 | ||
700 | ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, | 700 | ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, |
701 | unsigned *pending, | 701 | unsigned *pending, |
702 | int *bits)); | 702 | int *bits)); |
@@ -706,7 +706,7 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, | |||
706 | provided would be due to the available output space having being consumed. | 706 | provided would be due to the available output space having being consumed. |
707 | The number of bits of output not provided are between 0 and 7, where they | 707 | The number of bits of output not provided are between 0 and 7, where they |
708 | await more bits to join them in order to fill out a full byte. | 708 | await more bits to join them in order to fill out a full byte. |
709 | 709 | ||
710 | deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source | 710 | deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source |
711 | stream state was inconsistent. | 711 | stream state was inconsistent. |
712 | */ | 712 | */ |
@@ -1196,10 +1196,13 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | |||
1196 | a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only | 1196 | a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only |
1197 | compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' | 1197 | compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' |
1198 | for fixed code compression as in "wb9F". (See the description of | 1198 | for fixed code compression as in "wb9F". (See the description of |
1199 | deflateInit2 for more information about the strategy parameter.) Also "a" | 1199 | deflateInit2 for more information about the strategy parameter.) 'T' will |
1200 | can be used instead of "w" to request that the gzip stream that will be | 1200 | request transparent writing or appending with no compression and not using |
1201 | written be appended to the file. "+" will result in an error, since reading | 1201 | the gzip format. |
1202 | and writing to the same gzip file is not supported. | 1202 | |
1203 | "a" can be used instead of "w" to request that the gzip stream that will | ||
1204 | be written be appended to the file. "+" will result in an error, since | ||
1205 | reading and writing to the same gzip file is not supported. | ||
1203 | 1206 | ||
1204 | These functions, as well as gzip, will read and decode a sequence of gzip | 1207 | These functions, as well as gzip, will read and decode a sequence of gzip |
1205 | streams in a file. The append function of gzopen() can be used to create | 1208 | streams in a file. The append function of gzopen() can be used to create |
@@ -1209,7 +1212,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | |||
1209 | will simply append a gzip stream to the existing file. | 1212 | will simply append a gzip stream to the existing file. |
1210 | 1213 | ||
1211 | gzopen can be used to read a file which is not in gzip format; in this | 1214 | gzopen can be used to read a file which is not in gzip format; in this |
1212 | case gzread will directly read from the file without decompression. | 1215 | case gzread will directly read from the file without decompression. When |
1216 | reading, this will be detected automatically by looking for the magic two- | ||
1217 | byte gzip header. | ||
1213 | 1218 | ||
1214 | gzopen returns NULL if the file could not be opened, if there was | 1219 | gzopen returns NULL if the file could not be opened, if there was |
1215 | insufficient memory to allocate the gzFile state, or if an invalid mode was | 1220 | insufficient memory to allocate the gzFile state, or if an invalid mode was |
@@ -1440,6 +1445,13 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); | |||
1440 | cause buffers to be allocated to allow reading the file to determine if it | 1445 | cause buffers to be allocated to allow reading the file to determine if it |
1441 | is a gzip file. Therefore if gzbuffer() is used, it should be called before | 1446 | is a gzip file. Therefore if gzbuffer() is used, it should be called before |
1442 | gzdirect(). | 1447 | gzdirect(). |
1448 | |||
1449 | When writing, gzdirect() returns true (1) if transparent writing was | ||
1450 | requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: | ||
1451 | gzdirect() is not needed when writing. Transparent writing must be | ||
1452 | explicitly requested, so the application already knows the answer. When | ||
1453 | linking statically, using gzdirect() will include all of the zlib code for | ||
1454 | gzip file reading and decompression, which may not be desired.) | ||
1443 | */ | 1455 | */ |
1444 | 1456 | ||
1445 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | 1457 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); |