LibreOffice Module hwpfilter (master) 1
Classes | Functions
hgzip.h File Reference
#include <zlib.h>
Include dependency graph for hgzip.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gz_stream
 Structure for using z_stream. More...
 

Functions

gz_streamgz_open (HStream &_stream)
 Opens a gzipped stream for reading. More...
 
int gz_close (gz_stream *file)
 Flushes all pending output if necessary, closes the compressed stream and deallocates all the (de)compression state. More...
 
size_t gz_read (gz_stream *file, voidp buf, unsigned len)
 Reads the given number of uncompressed bytes from the compressed stream. More...
 
int gz_flush (gz_stream *file, int flush)
 Flushes all pending output into the compressed file gz_flush should be called only when strictly necessary because it can degrade compression. More...
 

Function Documentation

◆ gz_close()

int gz_close ( gz_stream file)

Flushes all pending output if necessary, closes the compressed stream and deallocates all the (de)compression state.

Definition at line 278 of file hgzip.cxx.

References gz_stream::crc, destroy(), err, gz_flush(), gz_stream::mode, and gz_stream::stream.

Referenced by HStreamIODev::setCompressed(), and HStreamIODev::~HStreamIODev().

◆ gz_flush()

int gz_flush ( gz_stream file,
int  flush 
)

Flushes all pending output into the compressed file gz_flush should be called only when strictly necessary because it can degrade compression.

Parameters
flushIs as in the deflate() function

Definition at line 215 of file hgzip.cxx.

References gz_stream::mode, gz_stream::stream, Z_BUFSIZE, and gz_stream::z_err.

Referenced by HStreamIODev::flush(), gz_close(), and HStreamIODev::setCompressed().

◆ gz_open()

gz_stream * gz_open ( HStream _stream)

Opens a gzipped stream for reading.

gz_open returns NULL if the stream could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR).

Parameters
_streamReference of stream object having binary data.

Definition at line 47 of file hgzip.cxx.

References gz_stream::_inputstream, ALLOC, Byte, gz_stream::crc, destroy(), err, gz_stream::inbuf, gz_stream::mode, gz_stream::msg, gz_stream::stream, Z_BUFSIZE, gz_stream::z_eof, and gz_stream::z_err.

Referenced by HStreamIODev::setCompressed().

◆ gz_read()

size_t gz_read ( gz_stream file,
voidp  buf,
unsigned  len 
)

Reads the given number of uncompressed bytes from the compressed stream.

Parameters
fileGzipped stream
bufBuffer to have the data to be read
lenLength of data to be read
Returns
The number of bytes actually read

Definition at line 151 of file hgzip.cxx.

References gz_stream::_inputstream, gz_stream::crc, getLong(), gz_stream::inbuf, HStream::readBytes(), start, gz_stream::stream, Z_BUFSIZE, gz_stream::z_eof, and gz_stream::z_err.