Index: third_party/zlib/inftrees.c |
diff --git a/third_party/zlib/inftrees.c b/third_party/zlib/inftrees.c |
index 44d89cf24e1c2aa20c3b4f0e68bff0d15ae3a5d7..2ea08fc13ea8ec50fad1f7574fa287aa6362abc4 100644 |
--- a/third_party/zlib/inftrees.c |
+++ b/third_party/zlib/inftrees.c |
@@ -1,5 +1,5 @@ |
/* inftrees.c -- generate Huffman trees for efficient decoding |
- * Copyright (C) 1995-2013 Mark Adler |
+ * Copyright (C) 1995-2017 Mark Adler |
* For conditions of distribution and use, see copyright notice in zlib.h |
*/ |
@@ -9,7 +9,7 @@ |
#define MAXBITS 15 |
const char inflate_copyright[] = |
- " inflate 1.2.8 Copyright 1995-2013 Mark Adler "; |
+ " inflate 1.2.11 Copyright 1995-2017 Mark Adler "; |
/* |
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 |
@@ -54,7 +54,7 @@ unsigned short FAR *work; |
code FAR *next; /* next available space in table */ |
const unsigned short FAR *base; /* base value table to use */ |
const unsigned short FAR *extra; /* extra bits table to use */ |
- int end; /* use base and extra for symbol > end */ |
+ unsigned match; /* use base and extra for symbol >= match */ |
unsigned short count[MAXBITS+1]; /* number of codes of each length */ |
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ |
static const unsigned short lbase[31] = { /* Length codes 257..285 base */ |
@@ -62,7 +62,7 @@ unsigned short FAR *work; |
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; |
static const unsigned short lext[31] = { /* Length codes 257..285 extra */ |
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, |
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78}; |
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202}; |
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ |
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, |
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, |
@@ -181,19 +181,17 @@ unsigned short FAR *work; |
switch (type) { |
case CODES: |
base = extra = work; /* dummy value--not used */ |
- end = 19; |
+ match = 20; |
break; |
case LENS: |
base = lbase; |
- base -= 257; |
extra = lext; |
- extra -= 257; |
- end = 256; |
+ match = 257; |
break; |
- default: /* DISTS */ |
+ default: /* DISTS */ |
base = dbase; |
extra = dext; |
- end = -1; |
+ match = 0; |
} |
/* initialize state for loop */ |
@@ -216,13 +214,13 @@ unsigned short FAR *work; |
for (;;) { |
/* create table entry */ |
here.bits = (unsigned char)(len - drop); |
- if ((int)(work[sym]) < end) { |
+ if (work[sym] + 1U < match) { |
here.op = (unsigned char)0; |
here.val = work[sym]; |
} |
- else if ((int)(work[sym]) > end) { |
- here.op = (unsigned char)(extra[work[sym]]); |
- here.val = base[work[sym]]; |
+ else if (work[sym] >= match) { |
+ here.op = (unsigned char)(extra[work[sym] - match]); |
+ here.val = base[work[sym] - match]; |
} |
else { |
here.op = (unsigned char)(32 + 64); /* end of block */ |