#include "cdflib.h"
#include "cdflib64.h"
Classes | |
struct | config |
struct | ct_data |
struct | tree_desc |
struct | huft |
struct | gZipStruct |
struct | gUnZipStruct |
Defines | |
#define | N_BORDER 19 |
#define | N_CPLENS 31 |
#define | N_CPLEXT 31 |
#define | N_CPDIST 30 |
#define | N_CPDEXT 30 |
#define | N_MASK_BITS 17 |
#define | N_CRC_32_TAB 256 |
#define | BL_CODES 19 |
#define | MAX_BITS 15 |
#define | LITERALS 256 |
#define | LENGTH_CODES 29 |
#define | L_CODES (LITERALS+1+LENGTH_CODES) |
#define | D_CODES 30 |
#define | HEAP_SIZE (2*L_CODES+1) |
#define | MIN_MATCH 3 |
#define | MAX_MATCH 258 |
#define | LIT_BUFSIZE 0x8000 |
#define | OS_CODE 0xFF |
#define | OF(args) PROTOARGs(args) |
#define | memzero(s, n) memset((void*)(s),0,(n)) |
#define | DEFLATED 8 |
#define | INBUFSIZ 0x8000 |
#define | INBUF_EXTRA 64 |
#define | OUTBUFSIZ 16384 |
#define | OUTBUF_EXTRA 2048 |
#define | DIST_BUFSIZE 0x8000 |
#define | GZIP_MAGIC "\037\213" |
#define | ASCII_FLAG 0x01 |
#define | CONTINUATION 0x02 |
#define | EXTRA_FIELD 0x04 |
#define | ORIG_NAME 0x08 |
#define | COMMENT 0x10 |
#define | ENCRYPTED 0x20 |
#define | RESERVED 0xC0 |
#define | WSIZE 0x8000 |
#define | WINDOW_SIZE ((ulg)2*WSIZE) |
#define | MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) |
#define | MAX_DIST (WSIZE-MIN_LOOKAHEAD) |
#define | SH(p) ((ush)(uch)((p)[0]) | ((ush)(uch)((p)[1]) << 8)) |
#define | LG(p) ((ulg)(SH(p)) | ((ulg)(SH((p)+2)) << 16)) |
#define | LBITS 9 |
#define | DBITS 6 |
#define | BITSx 16 |
#define | INIT_BITS 9 |
#define | BUF_SIZE (8 * 2*sizeof(char)) |
#define | HASH_BITS 15 |
#define | HASH_SIZE (unsigned)(1<<HASH_BITS) |
#define | HASH_MASK (HASH_SIZE-1) |
#define | WMASK (WSIZE-1) |
#define | NIL 0 |
#define | FAST 4 |
#define | SLOW 2 |
#define | TOO_FAR 4096 |
#define | H_SHIFT ((HASH_BITS+MIN_MATCH-1)/MIN_MATCH) |
#define | MAX_BL_BITS 7 |
#define | END_BLOCK 256 |
#define | STORED_BLOCK 0 |
#define | STATIC_TREES 1 |
#define | DYN_TREES 2 |
#define | REP_3_6 16 |
#define | REPZ_3_10 17 |
#define | REPZ_11_138 18 |
#define | send_code(gz_, c_, tree_) send_bits(gz_, tree_[c_].fc.code, tree_[c_].dl.len) |
#define | d_code(dist_, dist_code_) ((dist_) < 256 ? dist_code_[dist_] : dist_code_[256+((dist_)>>7)]) |
#define | NEEDBITS(gu_, b_, k_, n_) |
#define | DUMPBITS(b_, k_, n_) |
#define | BMAX 16 |
#define | N_MAX 288 |
#define | SMALLEST 1 |
#define | smaller(tree_, depth_, n_, m_) |
Typedefs | |
typedef unsigned char | uch |
typedef unsigned short | ush |
typedef unsigned long | ulg |
typedef ush | Pos |
typedef unsigned | IPos |
typedef struct gZipStruct | GZ |
typedef struct gZipStruct * | GZp |
typedef struct gUnZipStruct | GU |
typedef struct gUnZipStruct * | GUp |
Functions | |
static void initCRC | OF ((ulg crc_32_tab[N_CRC_32_TAB])) |
static Logical PutByte | OF ((GZp gz, unsigned c)) |
static Logical PutShort | OF ((GZp gz, unsigned w)) |
static Logical PutLong | OF ((GZp gz, ulg n)) |
static Logical PutLongLong | OF ((GZp gz, OFF_T n)) |
static Logical GetByte | OF ((GUp gu, uch *byte)) |
static CDFstatus zip | OF ((vFILE *iFp, OFF_T iSize, CDFstatus iError, vFILE *oFp, OFF_T *oSize, CDFstatus oError, Int32 level)) |
static GZp initZip | OF ((vFILE *iFp, vFILE *oFp, OFF_T iSize, Int32 level, CDFstatus iError, CDFstatus oError)) |
static void freeZip | OF ((GZp gz)) |
static int file_read | OF ((GZp gz, char *buf, unsigned size)) |
static CDFstatus unzip | OF ((vFILE *iFp, vFILE *oFp, CDFstatus iError, CDFstatus oError)) |
static void freeUnZip | OF ((GUp gu)) |
static Logical lm_init | OF ((GZp gz, ush *flags)) |
static int ct_tally | OF ((GZp gz, int dist, int lc)) |
static Logical flush_block | OF ((GZp gz, char *buf, OFF_T stored_len, int eof)) |
static Logical send_bits | OF ((GZp gz, int value, int length)) |
static unsigned bi_reverse | OF ((unsigned value, int length)) |
static Logical copy_block | OF ((GZp gz, char *buf, unsigned len, int header)) |
static ulg updcrc | OF ((uch *s, unsigned n, ulg *crcReg, ulg crc_32_tab[N_CRC_32_TAB])) |
static Logical write_buf | OF ((vFILE *vFp, void *buf, unsigned cnt)) |
static int longest_match | OF ((GZp gz, IPos cur_match)) |
static void pqdownheap | OF ((GZp gz, ct_data *tree, int k)) |
static void gen_bitlen | OF ((GZp gz, tree_desc *desc)) |
static void gen_codes | OF ((GZp gz, ct_data *tree, int max_code)) |
static Logical send_all_trees | OF ((GZp gz, int lcodes, int dcodes, int blcodes)) |
static Logical compress_block | OF ((GZp gz, ct_data *ltree, ct_data *dtree)) |
static int huft_build | OF ((GUp gu, unsigned *b, unsigned n, unsigned s, ush *d, ush *e, struct huft **t, int *m)) |
static int huft_free | OF ((struct huft *t)) |
static int inflate_codes | OF ((GUp gu, struct huft *tl, struct huft *td, int bl, int bd)) |
static int inflate_block | OF ((GUp gu, int *e)) |
STATICforIDL CDFstatus | CompressGZIP_64 (vFILE *srcFp, OFF_T srcOffset, OFF_T srcSize, CDFstatus srcError, vFILE *destFp, OFF_T destOffset, OFF_T *destSize, CDFstatus destError, Int32 level) |
STATICforIDL CDFstatus | DecompressGZIP_64 (vFILE *srcFp, OFF_T srcOffset, CDFstatus srcError, vFILE *destFp, OFF_T destOffset, CDFstatus destError) |
static CDFstatus | zip (vFILE *iFp, OFF_T iSize, CDFstatus iError, vFILE *oFp, OFF_T *oSize, CDFstatus oError, Int32 level) |
static GZp | initZip (vFILE *iFp, vFILE *oFp, OFF_T iSize, Int32 level, CDFstatus iError, CDFstatus oError) |
static void | freeZip (GZp gz) |
static CDFstatus | unzip (vFILE *iFp, vFILE *oFp, CDFstatus iError, CDFstatus oError) |
static GUp | initUnZip (vFILE *iFp, vFILE *oFp, CDFstatus iError, CDFstatus oError) |
static void | freeUnZip (GUp gu) |
static int | file_read (GZp gz, char *buf, unsigned size) |
static void | bi_init (GZp gz) |
static Logical | send_bits (GZp gz, int value, int length) |
static unsigned | bi_reverse (unsigned code, int len) |
static Logical | bi_windup (GZp gz) |
static Logical | copy_block (GZp gz, char *buf, unsigned len, int header) |
static Logical | lm_init (GZp gz, ush *flags) |
static int | longest_match (GZp gz, IPos cur_match) |
static Logical | fill_window (GZp gz) |
static CDFstatus | deflate_fast (GZp gz) |
static CDFstatus | deflate (GZp gz) |
static void | ct_init (GZp gz) |
static void | init_block (GZp gz) |
static void | pqdownheap (GZp gz, ct_data *tree, int k) |
static void | gen_bitlen (GZp gz, tree_desc *desc) |
static void | gen_codes (GZp gz, ct_data *tree, int max_code) |
static void | build_tree_gz (GZp gz, tree_desc *desc) |
static void | scan_tree (GZp gz, ct_data *tree, int max_code) |
static Logical | send_tree (GZp gz, ct_data *tree, int max_code) |
static int | build_bl_tree (GZp gz) |
static Logical | send_all_trees (GZp gz, int lcodes, int dcodes, int blcodes) |
static Logical | flush_block (GZp gz, char *buf, OFF_T stored_len, int eof) |
static int | ct_tally (GZp gz, int dist, int lc) |
static Logical | compress_block (GZp gz, ct_data *ltree, ct_data *dtree) |
static ulg | updcrc (uch *s, unsigned n, ulg *crcReg, crc_32_tab) |
static Logical | fill_inbuf (GUp gu, uch *byte) |
static Logical | flush_outbuf (GZp gz) |
static Logical | flush_window (GUp gu) |
static Logical | write_buf (vFILE *vFp, void *buf, unsigned cnt) |
static int | huft_build (GUp gu, unsigned *b, unsigned n, unsigned s, ush *d, ush *e, struct huft **t, int *m) |
static int | huft_free (struct huft *t) |
static int | inflate_codes (GUp gu, struct huft *tl, struct huft *td, int bl, int bd) |
static int | inflate_stored (GUp gu) |
static int | inflate_fixed (GUp gu) |
static int | inflate_dynamic (GUp gu) |
static int | inflate_block (GUp gu, int *e) |
static int | inflate (GUp gu) |
static Logical | PutByte (GZp gz, unsigned c) |
static Logical | PutShort (GZp gz, unsigned w) |
static Logical | PutLong (GZp gz, ulg n) |
static Logical | PutLongLong (GZp gz, OFF_T n) |
static Logical | GetByte (GUp gu, uch *byte) |
static void | initCRC (crc_32_tab) |
Variables | |
error | __pad0__ |
error | c_ |
#define ASCII_FLAG 0x01 |
#define BITSx 16 |
#define BL_CODES 19 |
#define BMAX 16 |
#define BUF_SIZE (8 * 2*sizeof(char)) |
#define COMMENT 0x10 |
#define CONTINUATION 0x02 |
#define d_code | ( | dist_, | |||
dist_code_ | ) | ((dist_) < 256 ? dist_code_[dist_] : dist_code_[256+((dist_)>>7)]) |
#define D_CODES 30 |
#define DBITS 6 |
#define DEFLATED 8 |
#define DIST_BUFSIZE 0x8000 |
#define DUMPBITS | ( | b_, | |||
k_, | |||||
n_ | ) |
Value:
{ \ b_ >>= (n_); \ k_ -= (n_); \ }
#define DYN_TREES 2 |
#define ENCRYPTED 0x20 |
#define END_BLOCK 256 |
#define EXTRA_FIELD 0x04 |
#define FAST 4 |
#define GZIP_MAGIC "\037\213" |
#define H_SHIFT ((HASH_BITS+MIN_MATCH-1)/MIN_MATCH) |
#define HASH_BITS 15 |
#define HASH_MASK (HASH_SIZE-1) |
#define HASH_SIZE (unsigned)(1<<HASH_BITS) |
#define HEAP_SIZE (2*L_CODES+1) |
#define INBUF_EXTRA 64 |
#define INBUFSIZ 0x8000 |
#define INIT_BITS 9 |
#define L_CODES (LITERALS+1+LENGTH_CODES) |
#define LBITS 9 |
#define LENGTH_CODES 29 |
#define LIT_BUFSIZE 0x8000 |
#define LITERALS 256 |
#define MAX_BITS 15 |
#define MAX_BL_BITS 7 |
#define MAX_DIST (WSIZE-MIN_LOOKAHEAD) |
#define MAX_MATCH 258 |
#define memzero | ( | s, | |||
n | ) | memset((void*)(s),0,(n)) |
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) |
#define MIN_MATCH 3 |
#define N_BORDER 19 |
#define N_CPDEXT 30 |
#define N_CPDIST 30 |
#define N_CPLENS 31 |
#define N_CPLEXT 31 |
#define N_CRC_32_TAB 256 |
#define N_MASK_BITS 17 |
#define N_MAX 288 |
#define NEEDBITS | ( | gu_, | |||
b_, | |||||
k_, | |||||
n_ | ) |
#define NIL 0 |
#define OF | ( | args | ) | PROTOARGs(args) |
#define ORIG_NAME 0x08 |
#define OS_CODE 0xFF |
#define OUTBUF_EXTRA 2048 |
#define OUTBUFSIZ 16384 |
#define REP_3_6 16 |
#define REPZ_11_138 18 |
#define REPZ_3_10 17 |
#define RESERVED 0xC0 |
#define SLOW 2 |
#define smaller | ( | tree_, | |||
depth_, | |||||
n_, | |||||
m_ | ) |
Value:
(tree_[n_].fc.freq < tree_[m_].fc.freq || \ (tree_[n_].fc.freq == tree_[m_].fc.freq && depth_[n_] <= depth_[m_]))
#define SMALLEST 1 |
#define STATIC_TREES 1 |
#define STORED_BLOCK 0 |
#define TOO_FAR 4096 |
#define WINDOW_SIZE ((ulg)2*WSIZE) |
#define WMASK (WSIZE-1) |
#define WSIZE 0x8000 |
typedef struct gUnZipStruct GU |
typedef struct gUnZipStruct* GUp |
typedef struct gZipStruct GZ |
typedef struct gZipStruct* GZp |
typedef unsigned IPos |
typedef unsigned char uch |
typedef unsigned long ulg |
typedef unsigned short ush |
static void bi_init | ( | GZp | gz | ) | [static] |
static unsigned bi_reverse | ( | unsigned | code, | |
int | len | |||
) | [static] |
static int build_bl_tree | ( | GZp | gz | ) | [static] |
STATICforIDL CDFstatus CompressGZIP_64 | ( | vFILE * | srcFp, | |
OFF_T | srcOffset, | |||
OFF_T | srcSize, | |||
CDFstatus | srcError, | |||
vFILE * | destFp, | |||
OFF_T | destOffset, | |||
OFF_T * | destSize, | |||
CDFstatus | destError, | |||
Int32 | level | |||
) |
static void ct_init | ( | GZp | gz | ) | [static] |
static int ct_tally | ( | GZp | gz, | |
int | dist, | |||
int | lc | |||
) | [static] |
STATICforIDL CDFstatus DecompressGZIP_64 | ( | vFILE * | srcFp, | |
OFF_T | srcOffset, | |||
CDFstatus | srcError, | |||
vFILE * | destFp, | |||
OFF_T | destOffset, | |||
CDFstatus | destError | |||
) |
static int file_read | ( | GZp | gz, | |
char * | buf, | |||
unsigned | size | |||
) | [static] |
static void freeUnZip | ( | GUp | gu | ) | [static] |
static void freeZip | ( | GZp | gz | ) | [static] |
static int huft_build | ( | GUp | gu, | |
unsigned * | b, | |||
unsigned | n, | |||
unsigned | s, | |||
ush * | d, | |||
ush * | e, | |||
struct huft ** | t, | |||
int * | m | |||
) | [static] |
static int huft_free | ( | struct huft * | t | ) | [static] |
static int inflate | ( | GUp | gu | ) | [static] |
static int inflate_block | ( | GUp | gu, | |
int * | e | |||
) | [static] |
static int inflate_dynamic | ( | GUp | gu | ) | [static] |
static int inflate_fixed | ( | GUp | gu | ) | [static] |
static int inflate_stored | ( | GUp | gu | ) | [static] |
static void init_block | ( | GZp | gz | ) | [static] |
static void initCRC | ( | crc_32_tab | ) | [static] |
static GZp initZip | ( | vFILE * | iFp, | |
vFILE * | oFp, | |||
OFF_T | iSize, | |||
Int32 | level, | |||
CDFstatus | iError, | |||
CDFstatus | oError | |||
) | [static] |
static int inflate_block OF | ( | (GUp gu, int *e) | ) | [static] |
static int huft_free OF | ( | (struct huft *t) | ) | [static] |
static int huft_build OF | ( | (GUp gu, unsigned *b, unsigned n, unsigned s, ush *d, ush *e, struct huft **t, int *m) | ) | [static] |
static unsigned bi_reverse OF | ( | (unsigned value, int length) | ) | [static] |
static int ct_tally OF | ( | (GZp gz, int dist, int lc) | ) | [static] |
static int inflate OF | ( | (GUp gu) | ) | [static] |
static int file_read OF | ( | (GZp gz, char *buf, unsigned size) | ) | [static] |
static int build_bl_tree OF | ( | (GZp gz) | ) | [static] |
static GZp initZip OF | ( | (vFILE *iFp, vFILE *oFp, OFF_T iSize, Int32 level, CDFstatus iError, CDFstatus oError) | ) | [static] |
static CDFstatus zip OF | ( | (vFILE *iFp, OFF_T iSize, CDFstatus iError, vFILE *oFp, OFF_T *oSize, CDFstatus oError, Int32 level) | ) | [static] |
static void initCRC OF | ( | (ulg crc_32_tab[N_CRC_32_TAB]) | ) | [static] |
static CDFstatus zip | ( | vFILE * | iFp, | |
OFF_T | iSize, | |||
CDFstatus | iError, | |||
vFILE * | oFp, | |||
OFF_T * | oSize, | |||
CDFstatus | oError, | |||
Int32 | level | |||
) | [static] |