#include "match_p.h"
#include "functable.h"
-const char deflate_copyright[] = " deflate 1.2.11.f Copyright 1995-2016 Jean-loup Gailly and Mark Adler ";
+const char zng_deflate_copyright[] = " deflate 1.2.11.f Copyright 1995-2016 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
strm->msg = NULL;
if (strm->zalloc == NULL) {
- strm->zalloc = zcalloc;
+ strm->zalloc = zng_calloc;
strm->opaque = NULL;
}
if (strm->zfree == NULL)
- strm->zfree = zcfree;
+ strm->zfree = zng_cfree;
if (level == Z_DEFAULT_COMPRESSION)
level = 6;
strm->adler = functable.adler32(0L, NULL, 0);
s->last_flush = -2;
- _tr_init(s);
+ zng_tr_init(s);
DEFLATE_RESET_KEEP_HOOK(strm); /* hook for IBM Z DFLTCC */
put = bits;
s->bi_buf |= (uint16_t)((value & ((1 << put) - 1)) << s->bi_valid);
s->bi_valid += put;
- _tr_flush_bits(s);
+ zng_tr_flush_bits(s);
value >>= put;
bits -= put;
} while (bits);
uint32_t len;
deflate_state *s = strm->state;
- _tr_flush_bits(s);
+ zng_tr_flush_bits(s);
len = s->pending;
if (len > strm->avail_out)
len = strm->avail_out;
}
if (bstate == block_done) {
if (flush == Z_PARTIAL_FLUSH) {
- _tr_align(s);
+ zng_tr_align(s);
} else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
+ zng_tr_stored_block(s, (char*)0, 0L, 0);
/* For a full flush, this empty block will be recognized
* as a special marker by inflate_sync().
*/
* including any pending bits. This also updates the debugging counts.
*/
last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
- _tr_stored_block(s, (char *)0, 0L, last);
+ zng_tr_stored_block(s, (char *)0, 0L, last);
/* Replace the lengths in the dummy stored block with len. */
s->pending_buf[s->pending - 4] = len;
len = MIN(left, have);
last = flush == Z_FINISH && s->strm->avail_in == 0 &&
len == left ? 1 : 0;
- _tr_stored_block(s, (char *)s->window + s->block_start, len, last);
+ zng_tr_stored_block(s, (char *)s->window + s->block_start, len, last);
s->block_start += len;
flush_pending(s->strm);
}
if (s->match_length >= MIN_MATCH) {
check_match(s, s->strstart, s->strstart - 1, s->match_length);
- _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
+ zng_tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
s->lookahead -= s->match_length;
s->strstart += s->match_length;
} else {
/* No match, output a literal byte */
Tracevv((stderr, "%c", s->window[s->strstart]));
- _tr_tally_lit(s, s->window[s->strstart], bflush);
+ zng_tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
/* Output a literal byte */
s->match_length = 0;
Tracevv((stderr, "%c", s->window[s->strstart]));
- _tr_tally_lit(s, s->window[s->strstart], bflush);
+ zng_tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
if (bflush)
void ZLIB_INTERNAL fill_window_c(deflate_state *s);
/* in trees.c */
-void ZLIB_INTERNAL _tr_init(deflate_state *s);
-int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
-void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
-void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
-void ZLIB_INTERNAL _tr_align(deflate_state *s);
-void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
+void ZLIB_INTERNAL zng_tr_init(deflate_state *s);
+int ZLIB_INTERNAL zng_tr_tally(deflate_state *s, unsigned dist, unsigned lc);
+void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
+void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s);
+void ZLIB_INTERNAL zng_tr_align(deflate_state *s);
+void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
void ZLIB_INTERNAL bi_windup(deflate_state *s);
unsigned ZLIB_INTERNAL bi_reverse(unsigned code, int len);
void ZLIB_INTERNAL flush_pending(PREFIX3(streamp) strm);
-#define d_code(dist) ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+#define d_code(dist) ((dist) < 256 ? zng_dist_code[dist] : zng_dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
- * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * must not have side effects. zng_dist_code[256] and zng_dist_code[257] are never
* used.
*/
/* Inline versions of _tr_tally for speed: */
# if defined(GEN_TREES_H)
- extern unsigned char ZLIB_INTERNAL _length_code[];
- extern unsigned char ZLIB_INTERNAL _dist_code[];
+ extern unsigned char ZLIB_INTERNAL zng_length_code[];
+ extern unsigned char ZLIB_INTERNAL zng_dist_code[];
# else
- extern const unsigned char ZLIB_INTERNAL _length_code[];
- extern const unsigned char ZLIB_INTERNAL _dist_code[];
+ extern const unsigned char ZLIB_INTERNAL zng_length_code[];
+ extern const unsigned char ZLIB_INTERNAL zng_dist_code[];
# endif
-# define _tr_tally_lit(s, c, flush) \
+# define zng_tr_tally_lit(s, c, flush) \
{ unsigned char cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
s->sym_buf[s->sym_next++] = 0; \
s->dyn_ltree[cc].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
-# define _tr_tally_dist(s, distance, length, flush) \
+# define zng_tr_tally_dist(s, distance, length, flush) \
{ unsigned char len = (unsigned char)(length); \
uint16_t dist = (uint16_t)(distance); \
s->sym_buf[s->sym_next++] = dist; \
s->sym_buf[s->sym_next++] = dist >> 8; \
s->sym_buf[s->sym_next++] = len; \
dist--; \
- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
#else
-# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
-# define _tr_tally_dist(s, distance, length, flush) \
- flush = _tr_tally(s, (unsigned)(distance), (unsigned)(length))
+# define zng_tr_tally_lit(s, c, flush) flush = zng_tr_tally(s, 0, c)
+# define zng_tr_tally_dist(s, distance, length, flush) \
+ flush = zng_tr_tally(s, (unsigned)(distance), (unsigned)(length))
#endif
/* ===========================================================================
if (s->match_length >= MIN_MATCH) {
check_match(s, s->strstart, s->match_start, s->match_length);
- _tr_tally_dist(s, s->strstart - s->match_start, s->match_length - MIN_MATCH, bflush);
+ zng_tr_tally_dist(s, s->strstart - s->match_start, s->match_length - MIN_MATCH, bflush);
s->lookahead -= s->match_length;
} else {
/* No match, output a literal byte */
Tracevv((stderr, "%c", s->window[s->strstart]));
- _tr_tally_lit(s, s->window[s->strstart], bflush);
+ zng_tr_tally_lit(s, s->window[s->strstart], bflush);
s->lookahead--;
s->strstart++;
}
#define MAX_DIST2 ((1 << MAX_WBITS) - MIN_LOOKAHEAD)
static int tr_tally_dist(deflate_state *s, int distance, int length) {
- return _tr_tally(s, distance, length);
+ return zng_tr_tally(s, distance, length);
}
static int tr_tally_lit(deflate_state *s, int c) {
- return _tr_tally(s, 0, c);
+ return zng_tr_tally(s, 0, c);
}
static int emit_match(deflate_state *s, struct match match) {
* IN assertion: strstart is set to the end of the current match.
*/
#define FLUSH_BLOCK_ONLY(s, last) { \
- _tr_flush_block(s, (s->block_start >= 0L ? \
+ zng_tr_flush_block(s, (s->block_start >= 0L ? \
(char *)&s->window[(unsigned)s->block_start] : \
NULL), \
(unsigned long)((long)s->strstart - s->block_start), \
check_match(s, s->strstart-1, s->prev_match, s->prev_length);
- _tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH, bflush);
+ zng_tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH, bflush);
/* Insert in hash table all strings up to the end of the match.
* strstart-1 and strstart are already inserted. If there is not
* is longer, truncate the previous match to a single literal.
*/
Tracevv((stderr, "%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ zng_tr_tally_lit(s, s->window[s->strstart-1], bflush);
if (bflush) {
FLUSH_BLOCK_ONLY(s, 0);
}
Assert(flush != Z_NO_FLUSH, "no flush?");
if (s->match_available) {
Tracevv((stderr, "%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ zng_tr_tally_lit(s, s->window[s->strstart-1], bflush);
s->match_available = 0;
}
s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
return Z_STREAM_ERROR;
strm->msg = NULL; /* in case we return an error */
if (strm->zalloc == NULL) {
- strm->zalloc = zcalloc;
+ strm->zalloc = zng_calloc;
strm->opaque = NULL;
}
if (strm->zfree == NULL)
- strm->zfree = zcfree;
+ strm->zfree = zng_cfree;
state = (struct inflate_state *)ZALLOC(strm, 1, sizeof(struct inflate_state));
if (state == NULL)
return Z_MEM_ERROR;
next = fixed;
lenfix = next;
bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+ zng_inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
/* distance table */
sym = 0;
while (sym < 32) state->lens[sym++] = 5;
distfix = next;
bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+ zng_inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
/* do this just once */
virgin = 0;
state->next = state->codes;
state->lencode = (code const *)(state->next);
state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
+ ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid code lengths set";
state->mode = BAD;
state->next = state->codes;
state->lencode = (code const *)(state->next);
state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
+ ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid literal/lengths set";
state->mode = BAD;
}
state->distcode = (code const *)(state->next);
state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
strm->msg = (char *)"invalid distances set";
RESTORE();
if (state->whave < state->wsize)
state->whave = state->wsize - left;
- inflate_fast(strm, state->wsize);
+ zng_inflate_fast(strm, state->wsize);
LOAD();
break;
}
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
-void ZLIB_INTERNAL inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
+void ZLIB_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) {
/* start: inflate()'s starting value for strm->avail_out */
struct inflate_state *state;
const unsigned char *in; /* local strm->next_in */
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL inflate_fast(PREFIX3(stream) *strm, unsigned long start);
+void ZLIB_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start);
#define INFLATE_FAST_MIN_HAVE 8
#define INFLATE_FAST_MIN_LEFT 258
return Z_STREAM_ERROR;
strm->msg = NULL; /* in case we return an error */
if (strm->zalloc == NULL) {
- strm->zalloc = zcalloc;
+ strm->zalloc = zng_calloc;
strm->opaque = NULL;
}
if (strm->zfree == NULL)
- strm->zfree = zcfree;
+ strm->zfree = zng_cfree;
state = (struct inflate_state *) ZALLOC_STATE(strm, 1, sizeof(struct inflate_state));
if (state == NULL)
return Z_MEM_ERROR;
next = fixed;
lenfix = next;
bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
+ zng_inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
/* distance table */
sym = 0;
while (sym < 32) state->lens[sym++] = 5;
distfix = next;
bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
+ zng_inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
/* do this just once */
virgin = 0;
state->next = state->codes;
state->lencode = (const code *)(state->next);
state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
+ ret = zng_inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid code lengths set";
state->mode = BAD;
state->next = state->codes;
state->lencode = (const code *)(state->next);
state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
+ ret = zng_inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work);
if (ret) {
strm->msg = (char *)"invalid literal/lengths set";
state->mode = BAD;
}
state->distcode = (const code *)(state->next);
state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ ret = zng_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
strm->msg = (char *)"invalid distances set";
if (have >= INFLATE_FAST_MIN_HAVE &&
left >= INFLATE_FAST_MIN_LEFT) {
RESTORE();
- inflate_fast(strm, out);
+ zng_inflate_fast(strm, out);
LOAD();
if (state->mode == TYPE)
state->back = -1;
#define MAXBITS 15
-const char inflate_copyright[] = " inflate 1.2.11.f Copyright 1995-2016 Mark Adler ";
+const char zng_inflate_copyright[] = " inflate 1.2.11.f Copyright 1995-2016 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
-int ZLIB_INTERNAL inflate_table(codetype type, uint16_t *lens, unsigned codes,
+int ZLIB_INTERNAL zng_inflate_table(codetype type, uint16_t *lens, unsigned codes,
code * *table, unsigned *bits, uint16_t *work) {
unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */
DISTS
} codetype;
-int ZLIB_INTERNAL inflate_table (codetype type, uint16_t *lens, unsigned codes,
+int ZLIB_INTERNAL zng_inflate_table (codetype type, uint16_t *lens, unsigned codes,
code * *table, unsigned *bits, uint16_t *work);
#endif /* INFTREES_H_ */
ZLIB_INTERNAL ct_data static_ltree[L_CODES+2];
/* The static literal tree. Since the bit lengths are imposed, there is no
* need for the L_CODES extra codes used during heap construction. However
- * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+ * The codes 286 and 287 are needed to build a canonical tree (see zng_tr_init
* below).
*/
* 5 bits.)
*/
-unsigned char _dist_code[DIST_CODE_LEN];
+unsigned char zng_dist_code[DIST_CODE_LEN];
/* Distance codes. The first 256 values correspond to the distances
* 3 .. 258, the last 256 values correspond to the top 8 bits of
* the 15 bit distances.
*/
-unsigned char _length_code[MAX_MATCH-MIN_MATCH+1];
+unsigned char zng_length_code[MAX_MATCH-MIN_MATCH+1];
/* length code for each normalized match length (0 == MIN_MATCH) */
static int base_length[LENGTH_CODES];
for (code = 0; code < LENGTH_CODES-1; code++) {
base_length[code] = length;
for (n = 0; n < (1 << extra_lbits[code]); n++) {
- _length_code[length++] = (unsigned char)code;
+ zng_length_code[length++] = (unsigned char)code;
}
}
Assert(length == 256, "tr_static_init: length != 256");
* in two different ways: code 284 + 5 bits or code 285, so we
* overwrite length_code[255] to use the best encoding:
*/
- _length_code[length-1] = (unsigned char)code;
+ zng_length_code[length-1] = (unsigned char)code;
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
dist = 0;
for (code = 0 ; code < 16; code++) {
base_dist[code] = dist;
for (n = 0; n < (1 << extra_dbits[code]); n++) {
- _dist_code[dist++] = (unsigned char)code;
+ zng_dist_code[dist++] = (unsigned char)code;
}
}
Assert(dist == 256, "tr_static_init: dist != 256");
for ( ; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1 << (extra_dbits[code]-7)); n++) {
- _dist_code[256 + dist++] = (unsigned char)code;
+ zng_dist_code[256 + dist++] = (unsigned char)code;
}
}
Assert(dist == 256, "tr_static_init: 256+dist != 512");
fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
}
- fprintf(header, "const unsigned char ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
+ fprintf(header, "const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = {\n");
for (i = 0; i < DIST_CODE_LEN; i++) {
- fprintf(header, "%2u%s", _dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20));
+ fprintf(header, "%2u%s", zng_dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20));
}
- fprintf(header, "const unsigned char ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+ fprintf(header, "const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
- fprintf(header, "%2u%s", _length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+ fprintf(header, "%2u%s", zng_length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
}
fprintf(header, "static const int base_length[LENGTH_CODES] = {\n");
/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
-void ZLIB_INTERNAL _tr_init(deflate_state *s) {
+void ZLIB_INTERNAL zng_tr_init(deflate_state *s) {
tr_static_init();
s->l_desc.dyn_tree = s->dyn_ltree;
/* ===========================================================================
* Send a stored block
*/
-void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
+void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
/* buf: input block */
/* stored_len: length of input block */
/* last: one if this is the last block for a file */
/* ===========================================================================
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/
-void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) {
+void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s) {
bi_flush(s);
}
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
*/
-void ZLIB_INTERNAL _tr_align(deflate_state *s) {
+void ZLIB_INTERNAL zng_tr_align(deflate_state *s) {
send_bits(s, STATIC_TREES << 1, 3);
send_code(s, END_BLOCK, static_ltree);
#ifdef ZLIB_DEBUG
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block.
*/
-void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
+void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
/* buf: input block, or NULL if too old */
/* stored_len: length of input block */
/* last: one if this is the last block for a file */
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
* transform a block into a stored block.
*/
- _tr_stored_block(s, buf, stored_len, last);
+ zng_tr_stored_block(s, buf, stored_len, last);
#ifdef FORCE_STATIC
} else if (static_lenb >= 0) { /* force static trees */
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
-int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
+int ZLIB_INTERNAL zng_tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
/* dist: distance of matched string */
/* lc: match length-MIN_MATCH or unmatched char (if dist==0) */
s->sym_buf[s->sym_next++] = dist;
dist--; /* dist = match distance - 1 */
Assert((uint16_t)dist < (uint16_t)MAX_DIST(s) &&
(uint16_t)lc <= (uint16_t)(MAX_MATCH-MIN_MATCH) &&
- (uint16_t)d_code(dist) < (uint16_t)D_CODES, "_tr_tally: bad match");
+ (uint16_t)d_code(dist) < (uint16_t)D_CODES, "zng_tr_tally: bad match");
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+ s->dyn_ltree[zng_length_code[lc]+LITERALS+1].Freq++;
s->dyn_dtree[d_code(dist)].Freq++;
}
return (s->sym_next == s->sym_end);
Tracecv(isgraph(lc), (stderr, " '%c' ", lc));
} else {
/* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
+ code = zng_length_code[lc];
send_code(s, code+LITERALS+1, ltree); /* send the length code */
extra = extra_lbits[code];
if (extra != 0) {
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
};
-const unsigned char ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
+const unsigned char ZLIB_INTERNAL zng_dist_code[DIST_CODE_LEN] = {
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
};
-const unsigned char ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
+const unsigned char ZLIB_INTERNAL zng_length_code[MAX_MATCH-MIN_MATCH+1]= {
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
# include "malloc.h"
#endif
-const char * const z_errmsg[10] = {
+const char * const zng_errmsg[10] = {
(const char *)"need dictionary", /* Z_NEED_DICT 2 */
(const char *)"stream end", /* Z_STREAM_END 1 */
(const char *)"", /* Z_OK 0 */
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size)
+void ZLIB_INTERNAL *zng_calloc (void *opaque, unsigned items, unsigned size)
{
(void)opaque;
#ifndef UNALIGNED_OK
#endif
}
-void ZLIB_INTERNAL zcfree (void *opaque, void *ptr)
+void ZLIB_INTERNAL zng_cfree (void *opaque, void *ptr)
{
(void)opaque;
free(ptr);
typedef uint16_t ush; /* Included for compatibility with external code only */
typedef unsigned long ulg;
-extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+extern const char * const zng_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+#define ERR_MSG(err) zng_errmsg[Z_NEED_DICT-(err)]
#define ERR_RETURN(strm, err) return (strm->msg = ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */
# define Tracecv(c, x)
#endif
-void ZLIB_INTERNAL *zcalloc(void *opaque, unsigned items, unsigned size);
-void ZLIB_INTERNAL zcfree(void *opaque, void *ptr);
+void ZLIB_INTERNAL *zng_calloc(void *opaque, unsigned items, unsigned size);
+void ZLIB_INTERNAL zng_cfree(void *opaque, void *ptr);
#define ZALLOC(strm, items, size) (*((strm)->zalloc))((strm)->opaque, (items), (size))
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (void *)(addr))