From 8a2acbffc86012de3523ecf91db2c4ea1b1c4ea2 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Fri, 9 Sep 2011 23:13:27 -0700 Subject: zlib 1.0-pre --- inftrees.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'inftrees.c') diff --git a/inftrees.c b/inftrees.c index 11967c8..e4d7bdf 100644 --- a/inftrees.c +++ b/inftrees.c @@ -1,12 +1,12 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-1996 Mark Adler + * Copyright (C) 1995 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" -char inflate_copyright[] = " inflate 1.0 Copyright 1995-1996 Mark Adler "; +char inflate_copyright[] = " inflate 1.0 Copyright 1995 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 @@ -38,18 +38,18 @@ local voidpf falloc OF(( uInt)); /* size of item */ /* Tables for deflate from PKZIP's appnote.txt. */ -local uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */ +local uInt cplens[] = { /* Copy lengths for literal codes 257..285 */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; /* actually lengths - 2; also see note #13 above about 258 */ -local uInt cplext[31] = { /* Extra bits for literal codes 257..285 */ +local uInt cplext[] = { /* Extra bits for literal codes 257..285 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}; /* 192==invalid */ -local uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */ +local uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */ 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, 8193, 12289, 16385, 24577}; -local uInt cpdext[30] = { /* Extra bits for distance codes */ +local uInt cpdext[] = { /* Extra bits for distance codes */ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; @@ -307,11 +307,11 @@ z_stream *z; /* for zfree function */ r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, z); if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed dynamic bit lengths tree"; + z->msg = "oversubscribed dynamic bit lengths tree"; else if (r == Z_BUF_ERROR) { inflate_trees_free(*tb, z); - z->msg = (char*)"incomplete dynamic bit lengths tree"; + z->msg = "incomplete dynamic bit lengths tree"; r = Z_DATA_ERROR; } return r; @@ -334,11 +334,11 @@ z_stream *z; /* for zfree function */ if ((r = huft_build(c, nl, 257, cplens, cplext, tl, bl, z)) != Z_OK) { if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed literal/length tree"; + z->msg = "oversubscribed literal/length tree"; else if (r == Z_BUF_ERROR) { inflate_trees_free(*tl, z); - z->msg = (char*)"incomplete literal/length tree"; + z->msg = "incomplete literal/length tree"; r = Z_DATA_ERROR; } return r; @@ -348,14 +348,14 @@ z_stream *z; /* for zfree function */ if ((r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, z)) != Z_OK) { if (r == Z_DATA_ERROR) - z->msg = (char*)"oversubscribed literal/length tree"; + z->msg = "oversubscribed literal/length tree"; else if (r == Z_BUF_ERROR) { #ifdef PKZIP_BUG_WORKAROUND r = Z_OK; } #else inflate_trees_free(*td, z); - z->msg = (char*)"incomplete literal/length tree"; + z->msg = "incomplete literal/length tree"; r = Z_DATA_ERROR; } inflate_trees_free(*tl, z); @@ -385,7 +385,7 @@ uInt s; /* size of item */ { Assert(s == sizeof(inflate_huft) && n <= *(intf *)q, "inflate_trees falloc overflow"); - *(intf *)q -= n+s-s; /* s-s to avoid warning */ + *(intf *)q -= n; return (voidpf)(fixed_mem + *(intf *)q); } -- cgit v1.2.3-55-g6feb