X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/f39198789b82c1dd545743778f9d2633a2af8bd8..refs/pull/450/head:/zlib/trees.c diff --git a/zlib/trees.c b/zlib/trees.c index 1fd7759e..dbfa49c9 100644 --- a/zlib/trees.c +++ b/zlib/trees.c @@ -32,8 +32,16 @@ /* @(#) $Id$ */ +//----------------------------------------------------------------------------- +// This version of zlib is modified for use within the Proxmark3 project. +// Files from the original distribution which are not required for this +// purpose are not included. All modifications can easily be found +// by searching for #ifdef ZLIB_PM3_TUNED and #ifndef ZLIB_PM3_TUNED. +//----------------------------------------------------------------------------- + /* #define GEN_TREES_H */ + #include "deflate.h" #ifdef DEBUG @@ -910,12 +918,13 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) ulg stored_len; /* length of input block */ int last; /* one if this is the last block for a file */ { - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ +#ifndef ZLIB_PM3_TUNED + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { - +#endif /* Check if the file is binary or text */ if (s->strm->data_type == Z_UNKNOWN) s->strm->data_type = detect_data_type(s); @@ -937,6 +946,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) */ max_blindex = build_bl_tree(s); +#ifndef ZLIB_PM3_TUNED /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; @@ -978,7 +988,8 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) s->compressed_len += 3 + s->static_len; #endif } else { - send_bits(s, (DYN_TREES<<1)+last, 3); +#endif /* !ZLIB_PM3_TUNED */ + send_bits(s, (DYN_TREES<<1)+last, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); compress_block(s, (const ct_data *)s->dyn_ltree, @@ -986,7 +997,9 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif +#ifndef ZLIB_PM3_TUNED } +#endif Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits.