|
LibreOffice Module hwpfilter (master) 1
|
#include "precompile.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include <errno.h>#include "hgzip.h"#include "hstream.hxx"Go to the source code of this file.
Macros | |
| #define | Z_BUFSIZE (1024 * 4) |
| #define | ALLOC(size) malloc(size) |
| #define | TRYFREE(p) {if (p) free(p);} |
Functions | |
| static int | get_byte (gz_stream *s) |
| static int | destroy (gz_stream *s) |
| static uLong | getLong (gz_stream *s) |
| gz_stream * | gz_open (HStream &_stream) |
| Opens a gzipped stream for reading. 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... | |
| int | gz_close (gz_stream *file) |
| Flushes all pending output if necessary, closes the compressed stream and deallocates all the (de)compression state. More... | |
Definition at line 123 of file hgzip.cxx.
References err, gz_stream::inbuf, gz_stream::msg, gz_stream::stream, TRYFREE, and gz_stream::z_err.
Referenced by gz_close(), and gz_open().
Definition at line 98 of file hgzip.cxx.
References gz_stream::_inputstream, gz_stream::inbuf, HStream::readBytes(), gz_stream::stream, Z_BUFSIZE, and gz_stream::z_eof.
Referenced by getLong().
|
static |
Definition at line 259 of file hgzip.cxx.
References get_byte(), x, gz_stream::z_eof, and gz_stream::z_err.
Referenced by gz_read().
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().
Flushes all pending output into the compressed file gz_flush should be called only when strictly necessary because it can degrade compression.
| flush | Is 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().
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).
| _stream | Reference 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().
| size_t gz_read | ( | gz_stream * | file, |
| voidp | buf, | ||
| unsigned | len | ||
| ) |
Reads the given number of uncompressed bytes from the compressed stream.
| file | Gzipped stream |
| buf | Buffer to have the data to be read |
| len | Length of data to be 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.