Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Submit enhancement from Michael Zimmerman to allow --suffix to be used
[rsync/rsync.git]
/
zlib
/
infcodes.c
diff --git
a/zlib/infcodes.c
b/zlib/infcodes.c
index
1d3baa9
..
9abe541
100644
(file)
--- a/
zlib/infcodes.c
+++ b/
zlib/infcodes.c
@@
-1,5
+1,5
@@
/* infcodes.c -- process literals and length/distance pairs
/* infcodes.c -- process literals and length/distance pairs
- * Copyright (C) 1995-
1998
Mark Adler
+ * Copyright (C) 1995-
2002
Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@
-196,15
+196,9
@@
int r;
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */
-#ifndef __TURBOC__ /* Turbo C bug for following expression */
- f = (uInt)(q - s->window) < c->sub.copy.dist ?
- s->end - (c->sub.copy.dist - (q - s->window)) :
- q - c->sub.copy.dist;
-#else
f = q - c->sub.copy.dist;
f = q - c->sub.copy.dist;
- if ((uInt)(q - s->window) < c->sub.copy.dist)
- f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
-#endif
+ while (f < s->window) /* modulo window size-"while" instead */
+ f += s->end - s->window; /* of "if" handles invalid distances */
while (c->len)
{
NEEDOUT
while (c->len)
{
NEEDOUT
@@
-221,6
+215,13
@@
int r;
c->mode = START;
break;
case WASH: /* o: got eob, possibly more output */
c->mode = START;
break;
case WASH: /* o: got eob, possibly more output */
+ if (k > 7) /* return unused byte, if any */
+ {
+ Assert(k < 16, "inflate_codes grabbed too many bytes")
+ k -= 8;
+ n++;
+ p--; /* can always return one */
+ }
FLUSH
if (s->read != s->write)
LEAVE
FLUSH
if (s->read != s->write)
LEAVE