Linux Kernel
3.7.1
|
#include <stddef.h>
#include "string.h"
#include "stdio.h"
#include "ops.h"
#include "gunzip_util.h"
Go to the source code of this file.
Macros | |
#define | HEAD_CRC 2 |
#define | EXTRA_FIELD 4 |
#define | ORIG_NAME 8 |
#define | COMMENT 0x10 |
#define | RESERVED 0xe0 |
Functions | |
void | gunzip_start (struct gunzip_state *state, void *src, int srclen) |
int | gunzip_partial (struct gunzip_state *state, void *dst, int dstlen) |
void | gunzip_exactly (struct gunzip_state *state, void *dst, int dstlen) |
void | gunzip_discard (struct gunzip_state *state, int len) |
int | gunzip_finish (struct gunzip_state *state, void *dst, int dstlen) |
#define COMMENT 0x10 |
Definition at line 20 of file gunzip_util.c.
#define EXTRA_FIELD 4 |
Definition at line 18 of file gunzip_util.c.
#define HEAD_CRC 2 |
Definition at line 17 of file gunzip_util.c.
#define ORIG_NAME 8 |
Definition at line 19 of file gunzip_util.c.
#define RESERVED 0xe0 |
Definition at line 21 of file gunzip_util.c.
void gunzip_discard | ( | struct gunzip_state * | state, |
int | len | ||
) |
gunzip_discard - discard bytes from a gzip data stream : gzip state structure previously initialized by gunzip_start() : number of bytes to discard
This function extracts, then discards exactly bytes from the data stream previously associated with by gunzip_start(). Subsequent gunzip_partial(), gunzip_exactly() or gunzip_finish() calls will extract the data following the discarded bytes in the data stream.
If there are less bytes available in the data stream, or if any other errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called.
Definition at line 165 of file gunzip_util.c.
void gunzip_exactly | ( | struct gunzip_state * | state, |
void * | dst, | ||
int | dstlen | ||
) |
gunzip_exactly - extract a fixed number of bytes from a gzip data stream : gzip state structure previously initialized by gunzip_start() : buffer to store extracted data : number of bytes to extract
This function extracts exactly bytes from the data stream previously associated with by gunzip_start(), decompressing if necessary.
If there are less bytes available in the data stream, or if any other errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called.
Definition at line 140 of file gunzip_util.c.
int gunzip_finish | ( | struct gunzip_state * | state, |
void * | dst, | ||
int | dstlen | ||
) |
gunzip_finish - extract all remaining bytes from a gzip data stream : gzip state structure previously initialized by gunzip_start() : buffer to store extracted data : maximum number of bytes to extract
This function extracts all remaining data, or at most bytes, from the stream previously associated with by gunzip_start(). zlib is then shut down, so it is an error to use any of the functions in this file on until it is re-initialized with another call to gunzip_start().
If any errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called.
Definition at line 193 of file gunzip_util.c.
int gunzip_partial | ( | struct gunzip_state * | state, |
void * | dst, | ||
int | dstlen | ||
) |
gunzip_partial - extract bytes from a gzip data stream : gzip state structure previously initialized by gunzip_start() : buffer to store extracted data : maximum number of bytes to extract
This function extracts at most bytes from the data stream previously associated with by gunzip_start(), decompressing if necessary. Exactly bytes are extracted unless the data stream doesn't contain enough bytes, in which case the entire remainder of the stream is decompressed.
Returns the actual number of bytes extracted. If any errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called.
Definition at line 102 of file gunzip_util.c.
void gunzip_start | ( | struct gunzip_state * | state, |
void * | src, | ||
int | srclen | ||
) |
gunzip_start - prepare to decompress gzip data : decompressor state structure to be initialized : buffer containing gzip compressed or uncompressed data : size in bytes of the buffer at src
If the buffer at contains a gzip header, this function initializes zlib to decompress the data, storing the decompression state in . The other functions in this file can then be used to decompress data from the gzipped stream.
If the buffer at does not contain a gzip header, it is assumed to contain uncompressed data. The buffer information is recorded in and the other functions in this file will simply copy data from the uncompressed data stream at .
Any errors, such as bad compressed data, cause an error to be printed an the platform's exit() function to be called.
Definition at line 42 of file gunzip_util.c.