Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

zlib_util.h File Reference


Detailed Description

Zlib wrapper functions.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.h>

Go to the source code of this file.

Data Structures

struct  zlib_deflater_t
 Incremental deflater stream. More...


Defines

#define zlib_deflater_out(z)   ((z)->out)
#define zlib_deflater_outlen(z)   ((z)->outlen)
#define zlib_deflater_inlen(z)   ((z)->inlen_total)

Functions

gchar * zlib_strerror (gint errnum)
 Maps the given error code to an error message.

zlib_deflater_tzlib_deflater_make (gconstpointer data, gint len, gint level)
 Creates an incremental zlib deflater for `len' bytes starting at `data', with specified compression `level'.

zlib_deflater_tzlib_deflater_make_into (gconstpointer data, gint len, gpointer dest, gint destlen, gint level)
 Creates an incremental zlib deflater for `len' bytes starting at `data', with specified compression `level'.

gint zlib_deflate (zlib_deflater_t *zd, gint amount)
 Incrementally deflate more data, the `amount' specified.

gboolean zlib_deflate_data (zlib_deflater_t *zd, gconstpointer data, gint len)
 Deflate the data supplied, but do not close the stream when all the data have been compressed.

gboolean zlib_deflate_close (zlib_deflater_t *zd)
 Marks the end of the data: flush the stream and close.

void zlib_deflater_free (zlib_deflater_t *zd, gboolean output)
 Dispose of the incremental deflater.

gpointer zlib_uncompress (gconstpointer data, gint len, gulong uncompressed_len)
 Inflate data, whose final uncompressed size is known.

gboolean zlib_is_valid_header (gconstpointer data, gint len)
 Check whether first bytes of data make up a valid zlib marker.


Define Documentation

#define zlib_deflater_inlen  )     ((z)->inlen_total)
 

#define zlib_deflater_out  )     ((z)->out)
 

#define zlib_deflater_outlen  )     ((z)->outlen)
 


Function Documentation

gint zlib_deflate zlib_deflater_t zd,
gint  amount
 

Incrementally deflate more data, the `amount' specified.

When all the data have been compressed, the stream is closed.

Returns:
-1 on error, 1 if work remains, 0 when done.

gboolean zlib_deflate_close zlib_deflater_t zd  ) 
 

Marks the end of the data: flush the stream and close.

Returns:
TRUE if OK, FALSE on error.

gboolean zlib_deflate_data zlib_deflater_t zd,
gconstpointer  data,
gint  len
 

Deflate the data supplied, but do not close the stream when all the data have been compressed.

Needs to call zlib_deflate_close() for that.

Returns:
TRUE if OK, FALSE on error.

void zlib_deflater_free zlib_deflater_t zd,
gboolean  output
 

Dispose of the incremental deflater.

If `output' is true, also free the output buffer.

zlib_deflater_t* zlib_deflater_make gconstpointer  data,
gint  len,
gint  level
 

Creates an incremental zlib deflater for `len' bytes starting at `data', with specified compression `level'.

Data will be compressed into a dynamically allocated buffer, resized as needed.

If `data' is NULL, data to compress will have to be fed to the deflater via zlib_deflate_data() calls. Otherwise, calls to zlib_deflate() will incrementally compress the initial buffer.

Returns:
new deflater, or NULL if error.

zlib_deflater_t* zlib_deflater_make_into gconstpointer  data,
gint  len,
gpointer  dest,
gint  destlen,
gint  level
 

Creates an incremental zlib deflater for `len' bytes starting at `data', with specified compression `level'.

Data will be compressed into the supplied buffer starting at `dest'.

If `data' is NULL, data to compress will have to be fed to the deflater via zlib_deflate_data() calls. Otherwise, calls to zlib_deflate() will incrementally compress the initial buffer.

Returns:
new deflater, or NULL if error.

gboolean zlib_is_valid_header gconstpointer  data,
gint  len
 

Check whether first bytes of data make up a valid zlib marker.

gchar* zlib_strerror gint  errnum  ) 
 

Maps the given error code to an error message.

Returns:
human-readable error string corresponding to error code `errnum'.

gpointer zlib_uncompress gconstpointer  data,
gint  len,
gulong  uncompressed_len
 

Inflate data, whose final uncompressed size is known.

Returns:
allocated uncompressed data if OK, NULL on error.


Generated on Sun Feb 12 10:50:10 2006 for Gtk-Gnutella by doxygen 1.3.6