s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
overlay = (uint16_t *) ZALLOC(strm, s->lit_bufsize, sizeof(uint16_t)+2);
- s->pending_buf = (uch *) overlay;
+ s->pending_buf = (unsigned char *) overlay;
s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(uint16_t)+2L);
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
ds->prev = (Pos *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Pos *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
overlay = (uint16_t *) ZALLOC(dest, ds->lit_bufsize, sizeof(uint16_t)+2);
- ds->pending_buf = (uch *) overlay;
+ ds->pending_buf = (unsigned char *) overlay;
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
* The same heap array is used to build all trees.
*/
- uch depth[2*L_CODES+1];
+ unsigned char depth[2*L_CODES+1];
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
- uch *l_buf; /* buffer for literals or lengths */
+ unsigned char *l_buf; /* buffer for literals or lengths */
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
}
#else
#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((uint16_t)(w) >> 8)); \
+ put_byte(s, (unsigned char)((w) & 0xff)); \
+ put_byte(s, (unsigned char)((uint16_t)(w) >> 8)); \
}
#endif
/* Inline versions of _tr_tally for speed: */
#if defined(GEN_TREES_H)
- extern uch ZLIB_INTERNAL _length_code[];
- extern uch ZLIB_INTERNAL _dist_code[];
+ extern unsigned char ZLIB_INTERNAL _length_code[];
+ extern unsigned char ZLIB_INTERNAL _dist_code[];
#else
- extern const uch ZLIB_INTERNAL _length_code[];
- extern const uch ZLIB_INTERNAL _dist_code[];
+ extern const unsigned char ZLIB_INTERNAL _length_code[];
+ extern const unsigned char ZLIB_INTERNAL _dist_code[];
#endif
# define _tr_tally_lit(s, c, flush) \
- { uch cc = (c); \
+ { unsigned char cc = (c); \
s->d_buf[s->last_lit] = 0; \
s->l_buf[s->last_lit++] = cc; \
s->dyn_ltree[cc].Freq++; \
flush = (s->last_lit == s->lit_bufsize-1); \
}
# define _tr_tally_dist(s, distance, length, flush) \
- { uch len = (length); \
+ { unsigned char len = (length); \
uint16_t dist = (distance); \
s->d_buf[s->last_lit] = dist; \
s->l_buf[s->last_lit++] = len; \
#ifdef WITH_GZFILEOP
void test_gzio (const char *fname,
- Byte *uncompr, uLong uncomprLen);
+ unsigned char *uncompr, uLong uncomprLen);
/* ===========================================================================
* Test read/write of .gz files
local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-local const uch bl_order[BL_CODES]
+local const unsigned char bl_order[BL_CODES]
= {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
/* The lengths of the bit length codes are sent in order of decreasing
* probability, to avoid transmitting the lengths for unused bit 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++] = (uch)code;
+ _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] = (uch)code;
+ _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++] = (uch)code;
+ _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++] = (uch)code;
+ _dist_code[256 + dist++] = (unsigned char)code;
}
}
Assert (dist == 256, "tr_static_init: 256+dist != 512");
static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
}
- fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
+ fprintf(header, "const unsigned char ZLIB_INTERNAL _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,
- "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+ "const unsigned char ZLIB_INTERNAL _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));
/* Create a new node father of n and m */
tree[node].Freq = tree[n].Freq + tree[m].Freq;
- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
- s->depth[n] : s->depth[m]) + 1);
+ s->depth[node] = (unsigned char)((s->depth[n] >= s->depth[m] ?
+ s->depth[n] : s->depth[m]) + 1);
tree[n].Dad = tree[m].Dad = (uint16_t)node;
#ifdef DUMP_BL_TREE
if (tree == s->bl_tree) {
/* dist: distance of matched string */
/* lc: match length-MIN_MATCH or unmatched char (if dist==0) */
s->d_buf[s->last_lit] = (uint16_t)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
+ s->l_buf[s->last_lit++] = (unsigned char)lc;
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
};
-const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
+const unsigned char ZLIB_INTERNAL _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 uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
+const unsigned char ZLIB_INTERNAL _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,
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
-int ZEXPORT uncompress (Byte *dest, uLong *destLen, const unsigned char *source, uLong sourceLen)
+int ZEXPORT uncompress (unsigned char *dest, uLong *destLen, const unsigned char *source, uLong sourceLen)
{
z_stream stream;
int err;