aboutsummaryrefslogtreecommitdiff
path: root/trees.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-08-12 18:08:52 -0700
committerMark Adler <madler@alumni.caltech.edu>2012-08-13 00:02:40 -0700
commit62d6112a7981ad7c34f3b43cffdf00d4662a4f25 (patch)
treeaed93070f7e1be31868dce1d62a1de6ffc1360f9 /trees.c
parentfb4e0599a5ddaef9eee726f786b9edef4943432b (diff)
downloadzlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.tar.gz
zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.tar.bz2
zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.zip
Clean up the usage of z_const and respect const usage within zlib.
This patch allows zlib to compile cleanly with the -Wcast-qual gcc warning enabled, but only if ZLIB_CONST is defined, which adds const to next_in and msg in z_stream and in the in_func prototype. A --const option is added to ./configure which adds -DZLIB_CONST to the compile flags, and adds -Wcast-qual to the compile flags when ZLIBGCCWARN is set in the environment.
Diffstat (limited to 'trees.c')
-rw-r--r--trees.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/trees.c b/trees.c
index 8c32b21..1fd7759 100644
--- a/trees.c
+++ b/trees.c
@@ -146,8 +146,8 @@ local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
146local int build_bl_tree OF((deflate_state *s)); 146local int build_bl_tree OF((deflate_state *s));
147local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, 147local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
148 int blcodes)); 148 int blcodes));
149local void compress_block OF((deflate_state *s, ct_data *ltree, 149local void compress_block OF((deflate_state *s, const ct_data *ltree,
150 ct_data *dtree)); 150 const ct_data *dtree));
151local int detect_data_type OF((deflate_state *s)); 151local int detect_data_type OF((deflate_state *s));
152local unsigned bi_reverse OF((unsigned value, int length)); 152local unsigned bi_reverse OF((unsigned value, int length));
153local void bi_windup OF((deflate_state *s)); 153local void bi_windup OF((deflate_state *s));
@@ -972,7 +972,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
972 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { 972 } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
973#endif 973#endif
974 send_bits(s, (STATIC_TREES<<1)+last, 3); 974 send_bits(s, (STATIC_TREES<<1)+last, 3);
975 compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); 975 compress_block(s, (const ct_data *)static_ltree,
976 (const ct_data *)static_dtree);
976#ifdef DEBUG 977#ifdef DEBUG
977 s->compressed_len += 3 + s->static_len; 978 s->compressed_len += 3 + s->static_len;
978#endif 979#endif
@@ -980,7 +981,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
980 send_bits(s, (DYN_TREES<<1)+last, 3); 981 send_bits(s, (DYN_TREES<<1)+last, 3);
981 send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, 982 send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
982 max_blindex+1); 983 max_blindex+1);
983 compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); 984 compress_block(s, (const ct_data *)s->dyn_ltree,
985 (const ct_data *)s->dyn_dtree);
984#ifdef DEBUG 986#ifdef DEBUG
985 s->compressed_len += 3 + s->opt_len; 987 s->compressed_len += 3 + s->opt_len;
986#endif 988#endif
@@ -1057,8 +1059,8 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
1057 */ 1059 */
1058local void compress_block(s, ltree, dtree) 1060local void compress_block(s, ltree, dtree)
1059 deflate_state *s; 1061 deflate_state *s;
1060 ct_data *ltree; /* literal tree */ 1062 const ct_data *ltree; /* literal tree */
1061 ct_data *dtree; /* distance tree */ 1063 const ct_data *dtree; /* distance tree */
1062{ 1064{
1063 unsigned dist; /* distance of matched string */ 1065 unsigned dist; /* distance of matched string */
1064 int lc; /* match length or unmatched char (if dist == 0) */ 1066 int lc; /* match length or unmatched char (if dist == 0) */