aboutsummaryrefslogtreecommitdiff
path: root/inffast.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:06:52 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:06:52 -0700
commit64b2e892035cf6ea98800c54dce0d63730d50272 (patch)
treee3b569f87e413eaef4a13469acfd4224b2a63d3a /inffast.c
parent4ca984fb447ac57120c394cf2fbba23837ed31c2 (diff)
downloadzlib-64b2e892035cf6ea98800c54dce0d63730d50272.tar.gz
zlib-64b2e892035cf6ea98800c54dce0d63730d50272.tar.bz2
zlib-64b2e892035cf6ea98800c54dce0d63730d50272.zip
zlib 0.9v0.9
Diffstat (limited to 'inffast.c')
-rw-r--r--inffast.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/inffast.c b/inffast.c
index 29c97e2..980a925 100644
--- a/inffast.c
+++ b/inffast.c
@@ -73,6 +73,7 @@ z_stream *z;
73 e = -e; 73 e = -e;
74 if (e & 64) /* end of block */ 74 if (e & 64) /* end of block */
75 { 75 {
76 Tracevv((stderr, "inflate: * end of block\n"));
76 UNGRAB 77 UNGRAB
77 UPDATE 78 UPDATE
78 return Z_STREAM_END; 79 return Z_STREAM_END;
@@ -83,6 +84,9 @@ z_stream *z;
83 /* process literal or length (end of block already trapped) */ 84 /* process literal or length (end of block already trapped) */
84 if (e & 16) /* then it's a literal */ 85 if (e & 16) /* then it's a literal */
85 { 86 {
87 Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
88 "inflate: * literal '%c'\n" :
89 "inflate: * literal 0x%02x\n", t->base));
86 *q++ = (Byte)t->base; 90 *q++ = (Byte)t->base;
87 m--; 91 m--;
88 } 92 }
@@ -91,6 +95,7 @@ z_stream *z;
91 /* get length of block to copy (already have extra bits) */ 95 /* get length of block to copy (already have extra bits) */
92 c = t->base + ((uInt)b & inflate_mask[e]); 96 c = t->base + ((uInt)b & inflate_mask[e]);
93 DUMPBITS(e); 97 DUMPBITS(e);
98 Tracevv((stderr, "inflate: * length %u\n", c));
94 99
95 /* decode distance base of block to copy */ 100 /* decode distance base of block to copy */
96 GRABBITS(15); /* max bits for distance code */ 101 GRABBITS(15); /* max bits for distance code */
@@ -109,13 +114,14 @@ z_stream *z;
109 DUMPBITS(t->bits) 114 DUMPBITS(t->bits)
110 115
111 /* get extra bits to add to distance base */ 116 /* get extra bits to add to distance base */
112 GRABBITS(e) /* get extra bits (up to 13) */ 117 GRABBITS((uInt)e) /* get extra bits (up to 13) */
113 d = t->base + ((uInt)b & inflate_mask[e]); 118 d = t->base + ((uInt)b & inflate_mask[e]);
114 DUMPBITS(e) 119 DUMPBITS(e)
120 Tracevv((stderr, "inflate: * distance %u\n", d));
115 121
116 /* do the copy */ 122 /* do the copy */
117 m -= c; 123 m -= c;
118 if (q - s->window >= d) /* if offset before destination, */ 124 if ((uInt)(q - s->window) >= d) /* if offset before destination, */
119 { /* just copy */ 125 { /* just copy */
120 r = q - d; 126 r = q - d;
121 *q++ = *r++; c--; /* minimum count is three, */ 127 *q++ = *r++; c--; /* minimum count is three, */
@@ -128,7 +134,7 @@ z_stream *z;
128 { 134 {
129 e = d - (q - s->window); /* bytes from offset to end */ 135 e = d - (q - s->window); /* bytes from offset to end */
130 r = s->end - e; /* pointer to offset */ 136 r = s->end - e; /* pointer to offset */
131 if (c > e) /* if source crosses, */ 137 if (c > (uInt)e) /* if source crosses, */
132 { 138 {
133 c -= e; /* copy to end of window */ 139 c -= e; /* copy to end of window */
134 do { 140 do {