diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2015-07-28 22:44:31 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2015-07-28 22:44:31 -0700 |
commit | 51a223def4382fdd0c9531ba77bd10724eae9f5f (patch) | |
tree | 10310a523d1dc8bbef4b007fa2c7c3bb433ba5e5 /trees.c | |
parent | 0b22337126401ef68ac5cf0308413239a4fb9c83 (diff) | |
download | zlib-51a223def4382fdd0c9531ba77bd10724eae9f5f.tar.gz zlib-51a223def4382fdd0c9531ba77bd10724eae9f5f.tar.bz2 zlib-51a223def4382fdd0c9531ba77bd10724eae9f5f.zip |
Avoid use of DEBUG macro -- change to ZLIB_DEBUG.
Diffstat (limited to 'trees.c')
-rw-r--r-- | trees.c | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #include "deflate.h" | 37 | #include "deflate.h" |
38 | 38 | ||
39 | #ifdef DEBUG | 39 | #ifdef ZLIB_DEBUG |
40 | # include <ctype.h> | 40 | # include <ctype.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
@@ -159,11 +159,11 @@ local void copy_block OF((deflate_state *s, charf *buf, unsigned len, | |||
159 | local void gen_trees_header OF((void)); | 159 | local void gen_trees_header OF((void)); |
160 | #endif | 160 | #endif |
161 | 161 | ||
162 | #ifndef DEBUG | 162 | #ifndef ZLIB_DEBUG |
163 | # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) | 163 | # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) |
164 | /* Send a code of the given tree. c and tree must not have side effects */ | 164 | /* Send a code of the given tree. c and tree must not have side effects */ |
165 | 165 | ||
166 | #else /* DEBUG */ | 166 | #else /* !ZLIB_DEBUG */ |
167 | # define send_code(s, c, tree) \ | 167 | # define send_code(s, c, tree) \ |
168 | { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ | 168 | { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ |
169 | send_bits(s, tree[c].Code, tree[c].Len); } | 169 | send_bits(s, tree[c].Code, tree[c].Len); } |
@@ -182,7 +182,7 @@ local void gen_trees_header OF((void)); | |||
182 | * Send a value on a given number of bits. | 182 | * Send a value on a given number of bits. |
183 | * IN assertion: length <= 16 and value fits in length bits. | 183 | * IN assertion: length <= 16 and value fits in length bits. |
184 | */ | 184 | */ |
185 | #ifdef DEBUG | 185 | #ifdef ZLIB_DEBUG |
186 | local void send_bits OF((deflate_state *s, int value, int length)); | 186 | local void send_bits OF((deflate_state *s, int value, int length)); |
187 | 187 | ||
188 | local void send_bits(s, value, length) | 188 | local void send_bits(s, value, length) |
@@ -208,7 +208,7 @@ local void send_bits(s, value, length) | |||
208 | s->bi_valid += length; | 208 | s->bi_valid += length; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | #else /* !DEBUG */ | 211 | #else /* !ZLIB_DEBUG */ |
212 | 212 | ||
213 | #define send_bits(s, value, length) \ | 213 | #define send_bits(s, value, length) \ |
214 | { int len = length;\ | 214 | { int len = length;\ |
@@ -223,7 +223,7 @@ local void send_bits(s, value, length) | |||
223 | s->bi_valid += len;\ | 223 | s->bi_valid += len;\ |
224 | }\ | 224 | }\ |
225 | } | 225 | } |
226 | #endif /* DEBUG */ | 226 | #endif /* ZLIB_DEBUG */ |
227 | 227 | ||
228 | 228 | ||
229 | /* the arguments must not have side effects */ | 229 | /* the arguments must not have side effects */ |
@@ -317,7 +317,7 @@ local void tr_static_init() | |||
317 | * Genererate the file trees.h describing the static trees. | 317 | * Genererate the file trees.h describing the static trees. |
318 | */ | 318 | */ |
319 | #ifdef GEN_TREES_H | 319 | #ifdef GEN_TREES_H |
320 | # ifndef DEBUG | 320 | # ifndef ZLIB_DEBUG |
321 | # include <stdio.h> | 321 | # include <stdio.h> |
322 | # endif | 322 | # endif |
323 | 323 | ||
@@ -394,7 +394,7 @@ void ZLIB_INTERNAL _tr_init(s) | |||
394 | 394 | ||
395 | s->bi_buf = 0; | 395 | s->bi_buf = 0; |
396 | s->bi_valid = 0; | 396 | s->bi_valid = 0; |
397 | #ifdef DEBUG | 397 | #ifdef ZLIB_DEBUG |
398 | s->compressed_len = 0L; | 398 | s->compressed_len = 0L; |
399 | s->bits_sent = 0L; | 399 | s->bits_sent = 0L; |
400 | #endif | 400 | #endif |
@@ -869,7 +869,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) | |||
869 | int last; /* one if this is the last block for a file */ | 869 | int last; /* one if this is the last block for a file */ |
870 | { | 870 | { |
871 | send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ | 871 | send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ |
872 | #ifdef DEBUG | 872 | #ifdef ZLIB_DEBUG |
873 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; | 873 | s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; |
874 | s->compressed_len += (stored_len + 4) << 3; | 874 | s->compressed_len += (stored_len + 4) << 3; |
875 | #endif | 875 | #endif |
@@ -894,7 +894,7 @@ void ZLIB_INTERNAL _tr_align(s) | |||
894 | { | 894 | { |
895 | send_bits(s, STATIC_TREES<<1, 3); | 895 | send_bits(s, STATIC_TREES<<1, 3); |
896 | send_code(s, END_BLOCK, static_ltree); | 896 | send_code(s, END_BLOCK, static_ltree); |
897 | #ifdef DEBUG | 897 | #ifdef ZLIB_DEBUG |
898 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ | 898 | s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ |
899 | #endif | 899 | #endif |
900 | bi_flush(s); | 900 | bi_flush(s); |
@@ -974,7 +974,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) | |||
974 | send_bits(s, (STATIC_TREES<<1)+last, 3); | 974 | send_bits(s, (STATIC_TREES<<1)+last, 3); |
975 | compress_block(s, (const ct_data *)static_ltree, | 975 | compress_block(s, (const ct_data *)static_ltree, |
976 | (const ct_data *)static_dtree); | 976 | (const ct_data *)static_dtree); |
977 | #ifdef DEBUG | 977 | #ifdef ZLIB_DEBUG |
978 | s->compressed_len += 3 + s->static_len; | 978 | s->compressed_len += 3 + s->static_len; |
979 | #endif | 979 | #endif |
980 | } else { | 980 | } else { |
@@ -983,7 +983,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) | |||
983 | max_blindex+1); | 983 | max_blindex+1); |
984 | compress_block(s, (const ct_data *)s->dyn_ltree, | 984 | compress_block(s, (const ct_data *)s->dyn_ltree, |
985 | (const ct_data *)s->dyn_dtree); | 985 | (const ct_data *)s->dyn_dtree); |
986 | #ifdef DEBUG | 986 | #ifdef ZLIB_DEBUG |
987 | s->compressed_len += 3 + s->opt_len; | 987 | s->compressed_len += 3 + s->opt_len; |
988 | #endif | 988 | #endif |
989 | } | 989 | } |
@@ -995,7 +995,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) | |||
995 | 995 | ||
996 | if (last) { | 996 | if (last) { |
997 | bi_windup(s); | 997 | bi_windup(s); |
998 | #ifdef DEBUG | 998 | #ifdef ZLIB_DEBUG |
999 | s->compressed_len += 7; /* align on byte boundary */ | 999 | s->compressed_len += 7; /* align on byte boundary */ |
1000 | #endif | 1000 | #endif |
1001 | } | 1001 | } |
@@ -1193,7 +1193,7 @@ local void bi_windup(s) | |||
1193 | } | 1193 | } |
1194 | s->bi_buf = 0; | 1194 | s->bi_buf = 0; |
1195 | s->bi_valid = 0; | 1195 | s->bi_valid = 0; |
1196 | #ifdef DEBUG | 1196 | #ifdef ZLIB_DEBUG |
1197 | s->bits_sent = (s->bits_sent+7) & ~7; | 1197 | s->bits_sent = (s->bits_sent+7) & ~7; |
1198 | #endif | 1198 | #endif |
1199 | } | 1199 | } |
@@ -1213,11 +1213,11 @@ local void copy_block(s, buf, len, header) | |||
1213 | if (header) { | 1213 | if (header) { |
1214 | put_short(s, (ush)len); | 1214 | put_short(s, (ush)len); |
1215 | put_short(s, (ush)~len); | 1215 | put_short(s, (ush)~len); |
1216 | #ifdef DEBUG | 1216 | #ifdef ZLIB_DEBUG |
1217 | s->bits_sent += 2*16; | 1217 | s->bits_sent += 2*16; |
1218 | #endif | 1218 | #endif |
1219 | } | 1219 | } |
1220 | #ifdef DEBUG | 1220 | #ifdef ZLIB_DEBUG |
1221 | s->bits_sent += (ulg)len<<3; | 1221 | s->bits_sent += (ulg)len<<3; |
1222 | #endif | 1222 | #endif |
1223 | while (len--) { | 1223 | while (len--) { |