mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
zlib: minimize diffs with upstream to prepare zlib upgrade
This commit is contained in:
parent
f30511f1a2
commit
b6d074cc9f
19 changed files with 122 additions and 128 deletions
|
@ -1,15 +1,6 @@
|
||||||
|
|
||||||
ChangeLog file for zlib
|
ChangeLog file for zlib
|
||||||
|
|
||||||
Changes in 1.2.8.f-Proxmark3 (for Proxmark3 project only) (26 May 2015)
|
|
||||||
- disable decoding of fixed code blocks in deflate (eliminates the need
|
|
||||||
to store the fixed tree in RAM or ROM)
|
|
||||||
- disable generating fixed code blocks in inflate
|
|
||||||
- look harder for local optimum of consecutive matches and single literals
|
|
||||||
in inflate.
|
|
||||||
- stripped down version - unnecessary files from original distribution
|
|
||||||
are not included
|
|
||||||
|
|
||||||
Changes in 1.2.8 (28 Apr 2013)
|
Changes in 1.2.8 (28 Apr 2013)
|
||||||
- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
|
- Update contrib/minizip/iowin32.c for Windows RT [Vollant]
|
||||||
- Do not force Z_CONST for C++
|
- Do not force Z_CONST for C++
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
// The rest of this file consists of the original README content
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ZLIB DATA COMPRESSION LIBRARY
|
ZLIB DATA COMPRESSION LIBRARY
|
||||||
|
|
||||||
zlib 1.2.8 is a general purpose data compression library. All the code is
|
zlib 1.2.8 is a general purpose data compression library. All the code is
|
||||||
|
|
19
common/zlib/README_proxmark3
Normal file
19
common/zlib/README_proxmark3
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
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.
|
||||||
|
|
||||||
|
Current zlib base version is 1.2.8
|
||||||
|
|
||||||
|
|
||||||
|
ChangeLog for Proxmark3 project only
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
Changes in 1.2.8.f-Proxmark3 (26 May 2015)
|
||||||
|
- disable decoding of fixed code blocks in deflate (eliminates the need
|
||||||
|
to store the fixed tree in RAM or ROM)
|
||||||
|
- disable generating fixed code blocks in inflate
|
||||||
|
- look harder for local optimum of consecutive matches and single literals
|
||||||
|
in inflate.
|
||||||
|
- stripped down version - unnecessary files from original distribution
|
||||||
|
are not included
|
|
@ -177,3 +177,4 @@ z_off64_t len2;
|
||||||
{
|
{
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,11 @@
|
||||||
#include "deflate.h"
|
#include "deflate.h"
|
||||||
|
|
||||||
const char deflate_copyright[] =
|
const char deflate_copyright[] =
|
||||||
|
#ifdef ZLIB_PM3_TUNED
|
||||||
" deflate 1.2.8.f-Proxmark3 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
|
" deflate 1.2.8.f-Proxmark3 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
|
||||||
|
#else
|
||||||
|
" deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
@ -60,15 +64,6 @@ const char deflate_copyright[] =
|
||||||
copyright string in the executable of your product.
|
copyright string in the executable of your product.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// 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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Function prototypes.
|
* Function prototypes.
|
||||||
*/
|
*/
|
||||||
|
@ -190,14 +185,14 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
|
||||||
*/
|
*/
|
||||||
#ifdef FASTEST
|
#ifdef FASTEST
|
||||||
#define INSERT_STRING(s, str, match_head) \
|
#define INSERT_STRING(s, str, match_head) \
|
||||||
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
|
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
|
||||||
match_head = s->head[s->ins_h], \
|
match_head = s->head[s->ins_h], \
|
||||||
s->head[s->ins_h] = (Pos)(str))
|
s->head[s->ins_h] = (Pos)(str))
|
||||||
#else
|
#else
|
||||||
#define INSERT_STRING(s, str, match_head) \
|
#define INSERT_STRING(s, str, match_head) \
|
||||||
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
|
(UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
|
||||||
match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
|
match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
|
||||||
s->head[s->ins_h] = (Pos)(str))
|
s->head[s->ins_h] = (Pos)(str))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
@ -1155,7 +1150,7 @@ IPos cur_match; /* current match */
|
||||||
{
|
{
|
||||||
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
||||||
register Bytef *scan = s->window + s->strstart; /* current string */
|
register Bytef *scan = s->window + s->strstart; /* current string */
|
||||||
register Bytef *match; /* matched string */
|
register Bytef *match; /* matched string */
|
||||||
register int len; /* length of current match */
|
register int len; /* length of current match */
|
||||||
#ifdef ZLIB_PM3_TUNED
|
#ifdef ZLIB_PM3_TUNED
|
||||||
int best_len = MIN_MATCH - 1; /* lift the restriction on prev-length */
|
int best_len = MIN_MATCH - 1; /* lift the restriction on prev-length */
|
||||||
|
@ -1544,21 +1539,21 @@ deflate_state *s;
|
||||||
* IN assertion: strstart is set to the end of the current match.
|
* IN assertion: strstart is set to the end of the current match.
|
||||||
*/
|
*/
|
||||||
#define FLUSH_BLOCK_ONLY(s, last) { \
|
#define FLUSH_BLOCK_ONLY(s, last) { \
|
||||||
_tr_flush_block(s, (s->block_start >= 0L ? \
|
_tr_flush_block(s, (s->block_start >= 0L ? \
|
||||||
(charf *)&s->window[(unsigned)s->block_start] : \
|
(charf *)&s->window[(unsigned)s->block_start] : \
|
||||||
(charf *)Z_NULL), \
|
(charf *)Z_NULL), \
|
||||||
(ulg)((long)s->strstart - s->block_start), \
|
(ulg)((long)s->strstart - s->block_start), \
|
||||||
(last)); \
|
(last)); \
|
||||||
s->block_start = s->strstart; \
|
s->block_start = s->strstart; \
|
||||||
flush_pending(s->strm); \
|
flush_pending(s->strm); \
|
||||||
Tracev((stderr,"[FLUSH]")); \
|
Tracev((stderr,"[FLUSH]")); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same but force premature exit if necessary. */
|
/* Same but force premature exit if necessary. */
|
||||||
#define FLUSH_BLOCK(s, last) { \
|
#define FLUSH_BLOCK(s, last) { \
|
||||||
FLUSH_BLOCK_ONLY(s, last); \
|
FLUSH_BLOCK_ONLY(s, last); \
|
||||||
if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
|
if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Copy without compression as much as possible from the input stream, return
|
* Copy without compression as much as possible from the input stream, return
|
||||||
|
@ -1840,7 +1835,8 @@ int flush;
|
||||||
INSERT_STRING(s, s->strstart, hash_head);
|
INSERT_STRING(s, s->strstart, hash_head);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the longest match, discarding those <= prev_length. */
|
/* Find the longest match, discarding those <= prev_length.
|
||||||
|
*/
|
||||||
s->prev_length = s->match_length, s->prev_match = s->match_start;
|
s->prev_length = s->match_length, s->prev_match = s->match_start;
|
||||||
s->match_length = MIN_MATCH - 1;
|
s->match_length = MIN_MATCH - 1;
|
||||||
|
|
||||||
|
@ -2054,3 +2050,4 @@ int flush;
|
||||||
FLUSH_BLOCK(s, 0);
|
FLUSH_BLOCK(s, 0);
|
||||||
return block_done;
|
return block_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
||||||
ulg stored_len, int last));
|
ulg stored_len, int last));
|
||||||
|
|
||||||
#define d_code(dist) \
|
#define d_code(dist) \
|
||||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||||
/* Mapping from a distance to a distance code. dist is the distance - 1 and
|
/* Mapping from a distance to a distance code. dist is the distance - 1 and
|
||||||
* must not have side effects. _dist_code[256] and _dist_code[257] are never
|
* must not have side effects. _dist_code[256] and _dist_code[257] are never
|
||||||
* used.
|
* used.
|
||||||
|
@ -321,26 +321,27 @@ extern const uch ZLIB_INTERNAL _dist_code[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define _tr_tally_lit(s, c, flush) \
|
# define _tr_tally_lit(s, c, flush) \
|
||||||
{ uch cc = (c); \
|
{ uch cc = (c); \
|
||||||
s->d_buf[s->last_lit] = 0; \
|
s->d_buf[s->last_lit] = 0; \
|
||||||
s->l_buf[s->last_lit++] = cc; \
|
s->l_buf[s->last_lit++] = cc; \
|
||||||
s->dyn_ltree[cc].Freq++; \
|
s->dyn_ltree[cc].Freq++; \
|
||||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
flush = (s->last_lit == s->lit_bufsize-1); \
|
||||||
}
|
}
|
||||||
# define _tr_tally_dist(s, distance, length, flush) \
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
{ uch len = (length); \
|
{ uch len = (length); \
|
||||||
ush dist = (distance); \
|
ush dist = (distance); \
|
||||||
s->d_buf[s->last_lit] = dist; \
|
s->d_buf[s->last_lit] = dist; \
|
||||||
s->l_buf[s->last_lit++] = len; \
|
s->l_buf[s->last_lit++] = len; \
|
||||||
dist--; \
|
dist--; \
|
||||||
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
||||||
s->dyn_dtree[d_code(dist)].Freq++; \
|
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
flush = (s->last_lit == s->lit_bufsize-1); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
||||||
# define _tr_tally_dist(s, distance, length, flush) \
|
# define _tr_tally_dist(s, distance, length, flush) \
|
||||||
flush = _tr_tally(s, distance, length)
|
flush = _tr_tally(s, distance, length)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* DEFLATE_H */
|
#endif /* DEFLATE_H */
|
||||||
|
|
||||||
|
|
|
@ -329,3 +329,4 @@ dodist:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif /* !ASMINF */
|
#endif /* !ASMINF */
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,4 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
||||||
|
|
||||||
|
|
|
@ -92,3 +92,4 @@ static const code distfix[32] = {
|
||||||
{16, 5, 4}, {24, 5, 769}, {20, 5, 49}, {28, 5, 12289}, {18, 5, 13}, {26, 5, 3073},
|
{16, 5, 4}, {24, 5, 769}, {20, 5, 49}, {28, 5, 12289}, {18, 5, 13}, {26, 5, 3073},
|
||||||
{22, 5, 193}, {64, 5, 0}
|
{22, 5, 193}, {64, 5, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,15 +80,6 @@
|
||||||
* The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
|
* The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// 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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "zutil.h"
|
#include "zutil.h"
|
||||||
#include "inftrees.h"
|
#include "inftrees.h"
|
||||||
#include "inflate.h"
|
#include "inflate.h"
|
||||||
|
@ -1520,3 +1511,4 @@ z_streamp strm;
|
||||||
(state->mode == COPY ? state->length :
|
(state->mode == COPY ? state->length :
|
||||||
(state->mode == MATCH ? state->was - state->length : 0));
|
(state->mode == MATCH ? state->was - state->length : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,3 +120,4 @@ struct inflate_state {
|
||||||
int back; /* bits back of last unprocessed length/lit */
|
int back; /* bits back of last unprocessed length/lit */
|
||||||
unsigned was; /* initial length of match */
|
unsigned was; /* initial length of match */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@
|
||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate_copyright[] =
|
const char inflate_copyright[] =
|
||||||
|
#ifdef ZLIB_PM3_TUNED
|
||||||
" inflate 1.2.8.f-Proxmark3 Copyright 1995-2013 Mark Adler ";
|
" inflate 1.2.8.f-Proxmark3 Copyright 1995-2013 Mark Adler ";
|
||||||
|
#else
|
||||||
|
" inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
@ -300,3 +304,4 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
|
||||||
*bits = root;
|
*bits = root;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,3 +60,4 @@ typedef enum {
|
||||||
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||||
unsigned codes, code FAR *FAR *table,
|
unsigned codes, code FAR *FAR *table,
|
||||||
unsigned FAR *bits, unsigned short FAR *work));
|
unsigned FAR *bits, unsigned short FAR *work));
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,8 @@
|
||||||
|
|
||||||
/* @(#) $Id$ */
|
/* @(#) $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 */
|
/* #define GEN_TREES_H */
|
||||||
|
|
||||||
|
|
||||||
#include "deflate.h"
|
#include "deflate.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -173,8 +165,8 @@ local void gen_trees_header OF((void));
|
||||||
|
|
||||||
#else /* DEBUG */
|
#else /* DEBUG */
|
||||||
# define send_code(s, c, tree) \
|
# define send_code(s, c, tree) \
|
||||||
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
|
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
|
||||||
send_bits(s, tree[c].Code, tree[c].Len); }
|
send_bits(s, tree[c].Code, tree[c].Len); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
@ -182,9 +174,9 @@ local void gen_trees_header OF((void));
|
||||||
* IN assertion: there is enough room in pendingBuf.
|
* IN assertion: there is enough room in pendingBuf.
|
||||||
*/
|
*/
|
||||||
#define put_short(s, w) { \
|
#define put_short(s, w) { \
|
||||||
put_byte(s, (uch)((w) & 0xff)); \
|
put_byte(s, (uch)((w) & 0xff)); \
|
||||||
put_byte(s, (uch)((ush)(w) >> 8)); \
|
put_byte(s, (uch)((ush)(w) >> 8)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send a value on a given number of bits.
|
* Send a value on a given number of bits.
|
||||||
|
@ -219,18 +211,18 @@ int length; /* number of bits */
|
||||||
#else /* !DEBUG */
|
#else /* !DEBUG */
|
||||||
|
|
||||||
#define send_bits(s, value, length) \
|
#define send_bits(s, value, length) \
|
||||||
{ int len = length;\
|
{ int len = length;\
|
||||||
if (s->bi_valid > (int)Buf_size - len) {\
|
if (s->bi_valid > (int)Buf_size - len) {\
|
||||||
int val = value;\
|
int val = value;\
|
||||||
s->bi_buf |= (ush)val << s->bi_valid;\
|
s->bi_buf |= (ush)val << s->bi_valid;\
|
||||||
put_short(s, s->bi_buf);\
|
put_short(s, s->bi_buf);\
|
||||||
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
|
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
|
||||||
s->bi_valid += len - Buf_size;\
|
s->bi_valid += len - Buf_size;\
|
||||||
} else {\
|
} else {\
|
||||||
s->bi_buf |= (ush)(value) << s->bi_valid;\
|
s->bi_buf |= (ush)(value) << s->bi_valid;\
|
||||||
s->bi_valid += len;\
|
s->bi_valid += len;\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
|
||||||
|
@ -329,8 +321,8 @@ local void tr_static_init() {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define SEPARATOR(i, last, width) \
|
# define SEPARATOR(i, last, width) \
|
||||||
((i) == (last)? "\n};\n\n" : \
|
((i) == (last)? "\n};\n\n" : \
|
||||||
((i) % (width) == (width)-1 ? ",\n" : ", "))
|
((i) % (width) == (width)-1 ? ",\n" : ", "))
|
||||||
|
|
||||||
void gen_trees_header() {
|
void gen_trees_header() {
|
||||||
FILE *header = fopen("trees.h", "w");
|
FILE *header = fopen("trees.h", "w");
|
||||||
|
@ -436,19 +428,19 @@ deflate_state *s;
|
||||||
* one less element. Updates heap and heap_len.
|
* one less element. Updates heap and heap_len.
|
||||||
*/
|
*/
|
||||||
#define pqremove(s, tree, top) \
|
#define pqremove(s, tree, top) \
|
||||||
{\
|
{\
|
||||||
top = s->heap[SMALLEST]; \
|
top = s->heap[SMALLEST]; \
|
||||||
s->heap[SMALLEST] = s->heap[s->heap_len--]; \
|
s->heap[SMALLEST] = s->heap[s->heap_len--]; \
|
||||||
pqdownheap(s, tree, SMALLEST); \
|
pqdownheap(s, tree, SMALLEST); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Compares to subtrees, using the tree depth as tie breaker when
|
* Compares to subtrees, using the tree depth as tie breaker when
|
||||||
* the subtrees have equal frequency. This minimizes the worst case length.
|
* the subtrees have equal frequency. This minimizes the worst case length.
|
||||||
*/
|
*/
|
||||||
#define smaller(tree, n, m, depth) \
|
#define smaller(tree, n, m, depth) \
|
||||||
(tree[n].Freq < tree[m].Freq || \
|
(tree[n].Freq < tree[m].Freq || \
|
||||||
(tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
|
(tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Restore the heap property by moving down the tree starting at node k,
|
* Restore the heap property by moving down the tree starting at node k,
|
||||||
|
@ -1021,7 +1013,8 @@ int last; /* one if this is the last block for a file */
|
||||||
s->compressed_len += 7; /* align on byte boundary */
|
s->compressed_len += 7; /* align on byte boundary */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len >> 3, s->compressed_len - 7 * last));
|
Tracev((stderr, "\ncomprlen %lu(%lu) ", s->compressed_len >> 3,
|
||||||
|
s->compressed_len - 7 * last));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
@ -1245,3 +1238,4 @@ int header; /* true if block header must be written */
|
||||||
put_byte(s, *buf++);
|
put_byte(s, *buf++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,3 +126,4 @@ local const int base_dist[D_CODES] = {
|
||||||
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
|
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -509,3 +509,4 @@ typedef unsigned long z_crc_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ZCONF_H */
|
#endif /* ZCONF_H */
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,6 @@
|
||||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// 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.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef ZLIB_H
|
#ifndef ZLIB_H
|
||||||
#define ZLIB_H
|
#define ZLIB_H
|
||||||
|
|
||||||
|
@ -1663,18 +1656,18 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
|
||||||
const char *version,
|
const char *version,
|
||||||
int stream_size));
|
int stream_size));
|
||||||
#define deflateInit(strm, level) \
|
#define deflateInit(strm, level) \
|
||||||
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||||
#define inflateInit(strm) \
|
#define inflateInit(strm) \
|
||||||
inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
|
inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||||
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
|
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
|
||||||
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
|
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
|
||||||
(strategy), ZLIB_VERSION, (int)sizeof(z_stream))
|
(strategy), ZLIB_VERSION, (int)sizeof(z_stream))
|
||||||
#define inflateInit2(strm, windowBits) \
|
#define inflateInit2(strm, windowBits) \
|
||||||
inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
|
inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
|
||||||
(int)sizeof(z_stream))
|
(int)sizeof(z_stream))
|
||||||
#define inflateBackInit(strm, windowBits, window) \
|
#define inflateBackInit(strm, windowBits, window) \
|
||||||
inflateBackInit_((strm), (windowBits), (window), \
|
inflateBackInit_((strm), (windowBits), (window), \
|
||||||
ZLIB_VERSION, (int)sizeof(z_stream))
|
ZLIB_VERSION, (int)sizeof(z_stream))
|
||||||
|
|
||||||
#ifndef Z_SOLO
|
#ifndef Z_SOLO
|
||||||
|
|
||||||
|
@ -1694,10 +1687,10 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
|
||||||
#ifdef Z_PREFIX_SET
|
#ifdef Z_PREFIX_SET
|
||||||
# undef z_gzgetc
|
# undef z_gzgetc
|
||||||
# define z_gzgetc(g) \
|
# define z_gzgetc(g) \
|
||||||
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
|
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
|
||||||
#else
|
#else
|
||||||
# define gzgetc(g) \
|
# define gzgetc(g) \
|
||||||
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
|
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
|
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
|
||||||
|
@ -1784,3 +1777,4 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ZLIB_H */
|
#endif /* ZLIB_H */
|
||||||
|
|
||||||
|
|
|
@ -341,3 +341,4 @@ voidpf ptr;
|
||||||
#endif /* MY_ZCALLOC */
|
#endif /* MY_ZCALLOC */
|
||||||
|
|
||||||
#endif /* !Z_SOLO */
|
#endif /* !Z_SOLO */
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ extern z_const char *const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
||||||
|
|
||||||
#define ERR_RETURN(strm,err) \
|
#define ERR_RETURN(strm,err) \
|
||||||
return (strm->msg = ERR_MSG(err), (err))
|
return (strm->msg = ERR_MSG(err), (err))
|
||||||
/* To be used only when the state is known to be valid */
|
/* To be used only when the state is known to be valid */
|
||||||
|
|
||||||
/* common constants */
|
/* common constants */
|
||||||
|
@ -104,7 +104,7 @@ void *_Cdecl farmalloc(unsigned long nbytes);
|
||||||
#if defined(VAXC) || defined(VMS)
|
#if defined(VAXC) || defined(VMS)
|
||||||
# define OS_CODE 0x02
|
# define OS_CODE 0x02
|
||||||
# define F_OPEN(name, mode) \
|
# define F_OPEN(name, mode) \
|
||||||
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ATARI) || defined(atarist)
|
#if defined(ATARI) || defined(atarist)
|
||||||
|
@ -242,7 +242,7 @@ void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
#define ZALLOC(strm, items, size) \
|
||||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||||
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
||||||
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
||||||
|
|
||||||
|
@ -251,3 +251,4 @@ void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
||||||
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
|
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
|
||||||
|
|
||||||
#endif /* ZUTIL_H */
|
#endif /* ZUTIL_H */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue