ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/perl/dist/cpan/Compress-Raw-Zlib/zlib-src/inftrees.c
(Generate patch)

Comparing vendor/perl/dist/cpan/Compress-Raw-Zlib/zlib-src/inftrees.c (file contents):
Revision 12125 by laffer1, Sun Oct 1 18:15:06 2017 UTC vs.
Revision 12126 by laffer1, Sat Dec 22 22:55:19 2018 UTC

# Line 1 | Line 1
1   /* inftrees.c -- generate Huffman trees for efficient decoding
2 < * Copyright (C) 1995-2013 Mark Adler
2 > * Copyright (C) 1995-2017 Mark Adler
3   * For conditions of distribution and use, see copyright notice in zlib.h
4   */
5  
# Line 9 | Line 9
9   #define MAXBITS 15
10  
11   const char inflate_copyright[] =
12 <   " inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
12 >   " inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
13   /*
14    If you use the zlib library in a product, an acknowledgment is welcome
15    in the documentation of your product. If for some reason you cannot
# Line 54 | Line 54 | int ZLIB_INTERNAL inflate_table(
54      code FAR *next;             /* next available space in table */
55      const unsigned short FAR *base;     /* base value table to use */
56      const unsigned short FAR *extra;    /* extra bits table to use */
57 <    int end;                    /* use base and extra for symbol > end */
57 >    unsigned match;             /* use base and extra for symbol >= match */
58      unsigned short count[MAXBITS+1];    /* number of codes of each length */
59      unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
60      static const unsigned short lbase[31] = { /* Length codes 257..285 base */
# Line 62 | Line 62 | int ZLIB_INTERNAL inflate_table(
62          35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
63      static const unsigned short lext[31] = { /* Length codes 257..285 extra */
64          16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65 <        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78};
65 >        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
66      static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
67          1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
68          257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
# Line 181 | Line 181 | int ZLIB_INTERNAL inflate_table(
181      switch (type) {
182      case CODES:
183          base = extra = work;    /* dummy value--not used */
184 <        end = 19;
184 >        match = 20;
185          break;
186      case LENS:
187          base = lbase;
188        base -= 257;
188          extra = lext;
189 <        extra -= 257;
191 <        end = 256;
189 >        match = 257;
190          break;
191 <    default:            /* DISTS */
191 >    default:    /* DISTS */
192          base = dbase;
193          extra = dext;
194 <        end = -1;
194 >        match = 0;
195      }
196  
197      /* initialize state for loop */
# Line 216 | Line 214 | int ZLIB_INTERNAL inflate_table(
214      for (;;) {
215          /* create table entry */
216          here.bits = (unsigned char)(len - drop);
217 <        if ((int)(work[sym]) < end) {
217 >        if (work[sym] + 1U < match) {
218              here.op = (unsigned char)0;
219              here.val = work[sym];
220          }
221 <        else if ((int)(work[sym]) > end) {
222 <            here.op = (unsigned char)(extra[work[sym]]);
223 <            here.val = base[work[sym]];
221 >        else if (work[sym] >= match) {
222 >            here.op = (unsigned char)(extra[work[sym] - match]);
223 >            here.val = base[work[sym] - match];
224          }
225          else {
226              here.op = (unsigned char)(32 + 64);         /* end of block */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines