aboutsummaryrefslogtreecommitdiffstats
path: root/zlib
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>1998-05-22 06:58:52 +0000
committerPaul Mackerras <paulus@samba.org>1998-05-22 06:58:52 +0000
commit5914bf15d2bb62003de56cea1d95f62b5830618a (patch)
treec9e19e5ce84e25903e43e2ada10b48e12484f447 /zlib
parent45f133b9769fb45a329d3d41e121109d430e307d (diff)
downloadandroid_external_rsync-5914bf15d2bb62003de56cea1d95f62b5830618a.tar.gz
android_external_rsync-5914bf15d2bb62003de56cea1d95f62b5830618a.tar.bz2
android_external_rsync-5914bf15d2bb62003de56cea1d95f62b5830618a.zip
Update to use the new zlib-1.1.2 code.
The compressed token code now handles the null (-2) token from the match logic.
Diffstat (limited to 'zlib')
-rw-r--r--zlib/deflate.c30
-rw-r--r--zlib/zlib.h1
-rw-r--r--zlib/zutil.h3
3 files changed, 29 insertions, 5 deletions
diff --git a/zlib/deflate.c b/zlib/deflate.c
index 490813fe..95b84d0d 100644
--- a/zlib/deflate.c
+++ b/zlib/deflate.c
@@ -80,7 +80,7 @@ local block_state deflate_slow OF((deflate_state *s, int flush));
local void lm_init OF((deflate_state *s));
local void putShortMSB OF((deflate_state *s, uInt b));
local void flush_pending OF((z_streamp strm));
-local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
+local int dread_buf OF((z_streamp strm, Bytef *buf, unsigned size));
#ifdef ASMV
void match_init OF((void)); /* asm code initialization */
uInt longest_match OF((deflate_state *s, IPos cur_match));
@@ -411,7 +411,7 @@ local void putShortMSB (s, b)
* Flush as much pending output as possible. All deflate() output goes
* through this function so some applications may wish to modify it
* to avoid allocating a large strm->next_out buffer and copying into it.
- * (See also read_buf()).
+ * (See also dread_buf()).
*/
local void flush_pending(strm)
z_streamp strm;
@@ -441,7 +441,7 @@ int ZEXPORT deflate (strm, flush)
deflate_state *s;
if (strm == Z_NULL || strm->state == Z_NULL ||
- flush > Z_FINISH || flush < 0) {
+ flush > Z_INSERT_ONLY || flush < 0) {
return Z_STREAM_ERROR;
}
s = strm->state;
@@ -657,7 +657,7 @@ int ZEXPORT deflateCopy (dest, source)
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
-local int read_buf(strm, buf, size)
+local int dread_buf(strm, buf, size)
z_streamp strm;
Bytef *buf;
unsigned size;
@@ -1028,7 +1028,7 @@ local void fill_window(s)
*/
Assert(more >= 2, "more < 2");
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ n = dread_buf(s->strm, s->window + s->strstart + s->lookahead, more);
s->lookahead += n;
/* Initialize the hash value now that we have some input: */
@@ -1162,6 +1162,12 @@ local block_state deflate_fast(s, flush)
INSERT_STRING(s, s->strstart, hash_head);
}
+ if (flush == Z_INSERT_ONLY) {
+ s->strstart++;
+ s->lookahead--;
+ continue;
+ }
+
/* Find the longest match, discarding those <= prev_length.
* At this point we have always match_length < MIN_MATCH
*/
@@ -1221,6 +1227,10 @@ local block_state deflate_fast(s, flush)
}
if (bflush) FLUSH_BLOCK(s, 0);
}
+ if (flush == Z_INSERT_ONLY) {
+ s->block_start = s->strstart;
+ return need_more;
+ }
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
@@ -1259,6 +1269,12 @@ local block_state deflate_slow(s, flush)
INSERT_STRING(s, s->strstart, hash_head);
}
+ if (flush == Z_INSERT_ONLY) {
+ s->strstart++;
+ s->lookahead--;
+ continue;
+ }
+
/* Find the longest match, discarding those <= prev_length.
*/
s->prev_length = s->match_length, s->prev_match = s->match_start;
@@ -1337,6 +1353,10 @@ local block_state deflate_slow(s, flush)
s->lookahead--;
}
}
+ if (flush == Z_INSERT_ONLY) {
+ s->block_start = s->strstart;
+ return need_more;
+ }
Assert (flush != Z_NO_FLUSH, "no flush?");
if (s->match_available) {
Tracevv((stderr,"%c", s->window[s->strstart-1]));
diff --git a/zlib/zlib.h b/zlib/zlib.h
index 787b5fd9..d0edd792 100644
--- a/zlib/zlib.h
+++ b/zlib/zlib.h
@@ -127,6 +127,7 @@ typedef z_stream FAR *z_streamp;
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
+#define Z_INSERT_ONLY 5
/* Allowed flush values; see deflate() below for details */
#define Z_OK 0
diff --git a/zlib/zutil.h b/zlib/zutil.h
index 5e403d1d..b11655be 100644
--- a/zlib/zutil.h
+++ b/zlib/zutil.h
@@ -13,8 +13,10 @@
#ifndef _Z_UTIL_H
#define _Z_UTIL_H
+#include "../rsync.h"
#include "zlib.h"
+#if 0
#ifdef STDC
# include <stddef.h>
# include <string.h>
@@ -25,6 +27,7 @@
#else
# include <errno.h>
#endif
+#endif
#ifndef local
# define local static