]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Cleanup user-defined types for 'unsigned char' 36/head
authorMika Lindqvist <postmaster@raasu.org>
Fri, 22 May 2015 22:17:27 +0000 (01:17 +0300)
committerMika Lindqvist <postmaster@raasu.org>
Fri, 22 May 2015 22:22:20 +0000 (01:22 +0300)
* Change 'uch' to 'unsigned char'
* Change 'Byte' to 'unsigned char'

deflate.c
deflate.h
test/example.c
trees.c
trees.h
uncompr.c

index ae4ae10e1a215dfc150ca9e513e7bc5594e3bcd6..4bfe231a8a6a3331a1a7804d130b2898e44dbb2f 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -331,7 +331,7 @@ int ZEXPORT deflateInit2_(z_stream *strm, int level, int method, int windowBits,
     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 ||
@@ -1041,7 +1041,7 @@ int ZEXPORT deflateCopy (z_stream *dest, z_stream *source)
     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) {
index ce09d087e1889483fc3887bc9ede634492b6f2ca..baf7bf12dd045adc3934455cc2d4956276a8d41d 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -220,11 +220,11 @@ typedef struct internal_state {
      * 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
@@ -314,8 +314,8 @@ typedef enum {
 }
 #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
 
@@ -353,22 +353,22 @@ void ZLIB_INTERNAL bi_windup (deflate_state *s);
 /* 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; \
index 4d232cf55497cec8304e130bcf960644083e0fac..7ff64c8075500e66604ff75ba83ee825ae920739 100644 (file)
@@ -71,7 +71,7 @@ void test_compress(unsigned char *compr, uLong comprLen, unsigned char *uncompr,
 
 #ifdef WITH_GZFILEOP
 void test_gzio          (const char *fname,
-                            Byte *uncompr, uLong uncomprLen);
+                            unsigned char *uncompr, uLong uncomprLen);
 
 /* ===========================================================================
  * Test read/write of .gz files
diff --git a/trees.c b/trees.c
index 0349f5c2716dd0b0e4660d89079a8f84c039e006..518c24f2849b14f56a2124f45de1478780d789e4 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -65,7 +65,7 @@ local const int extra_dbits[D_CODES] /* extra bits for each distance code */
 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.
@@ -183,7 +183,7 @@ local void tr_static_init()
     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");
@@ -191,14 +191,14 @@ local void tr_static_init()
      * 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");
@@ -206,7 +206,7 @@ local void tr_static_init()
     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");
@@ -270,14 +270,14 @@ void gen_trees_header()
                 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));
@@ -591,8 +591,8 @@ local void build_tree(deflate_state *s, tree_desc *desc)
 
         /* 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) {
@@ -922,7 +922,7 @@ int ZLIB_INTERNAL _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->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++;
diff --git a/trees.h b/trees.h
index 9a4ce94daa5a938b61b10c5485fb0b402eb16c7f..777e1bb17d86601cef4ac71625126e01a02c7ce4 100644 (file)
--- a/trees.h
+++ b/trees.h
@@ -70,7 +70,7 @@ local const ct_data static_dtree[D_CODES] = {
 {{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,
@@ -99,7 +99,7 @@ const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
 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,
index 556b8678dc0056560a8889115c47475c84545c11..2a3eee48deaafd7088549149c7260b115d0b1af5 100644 (file)
--- a/uncompr.c
+++ b/uncompr.c
@@ -21,7 +21,7 @@
    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;