Adds support for saving the content file in .gz format

This commit is contained in:
Andrea Mazzoleni 2013-08-09 13:56:03 +02:00
parent b9849c82b9
commit b31dbf7fff
9 changed files with 410 additions and 44 deletions

16
util.h
View file

@ -41,6 +41,11 @@ struct stream {
int state_index; /**< Index of the handle causing a state change. */
unsigned handle_size; /**< Number of handles. */
struct stream_handle* handle; /**< Set of handles. */
#if HAVE_LIBZ
int compress; /**< If the file is compressed. */
unsigned char* zbuffer; /**< Buffer for the compressed data. */
z_stream z; /**< State for zlib. */
#endif
};
/**
@ -53,11 +58,6 @@ typedef struct stream STREAM;
*/
STREAM* sopen_read(const char* file);
/**
* Opens a stream for writing. Like fopen("w").
*/
STREAM* sopen_write(const char* file);
/**
* Opens a set of streams for writing. Like fopen("w").
*/
@ -92,6 +92,12 @@ int sfill(STREAM* s);
*/
int sflush(STREAM* s);
/**
* Finish the write stream buffer.
* It can be called just before sclose() or ssync() to ensure that all the output is written.
*/
int sfinish(STREAM* s);
/**
* Checks if the buffer has enough data loaded.
*/