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
The count of chunks should really be an int32, not a size_t,
[rsync/rsync.git]
/
zlib
/
deflate.c
diff --git
a/zlib/deflate.c
b/zlib/deflate.c
index
490813f
..
07814c7
100644
(file)
--- a/
zlib/deflate.c
+++ b/
zlib/deflate.c
@@
-1,5
+1,5
@@
/* deflate.c -- compress data using the deflation algorithm
/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-
1998
Jean-loup Gailly.
+ * Copyright (C) 1995-
2002
Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@
-52,7
+52,7
@@
#include "deflate.h"
const char deflate_copyright[] =
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.1.
2 Copyright 1995-1998
Jean-loup Gailly ";
+ " deflate 1.1.
4 Copyright 1995-2002
Jean-loup Gailly ";
/*
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
/*
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
@@
-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 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
d
read_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));
#ifdef ASMV
void match_init OF((void)); /* asm code initialization */
uInt longest_match OF((deflate_state *s, IPos cur_match));
@@
-242,7
+242,7
@@
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
windowBits = -windowBits;
}
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
windowBits = -windowBits;
}
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
- windowBits <
8
|| windowBits > 15 || level < 0 || level > 9 ||
+ windowBits <
9
|| windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR;
}
strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR;
}
@@
-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.
* 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
d
read_buf()).
*/
local void flush_pending(strm)
z_streamp strm;
*/
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 ||
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;
return Z_STREAM_ERROR;
}
s = strm->state;
@@
-608,11
+608,13
@@
int ZEXPORT deflateCopy (dest, source)
deflate_state *ss;
ushf *overlay;
deflate_state *ss;
ushf *overlay;
- ss = source->state;
- if (source == Z_NULL || dest == Z_NULL || s
s
== Z_NULL) {
+ if (source == Z_NULL || dest == Z_NULL || s
ource->state
== Z_NULL) {
return Z_STREAM_ERROR;
}
return Z_STREAM_ERROR;
}
+
+ ss = source->state;
+
*dest = *source;
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
*dest = *source;
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
@@
-657,7
+659,7
@@
int ZEXPORT deflateCopy (dest, source)
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
-local int read_buf(strm, buf, size)
+local int
d
read_buf(strm, buf, size)
z_streamp strm;
Bytef *buf;
unsigned size;
z_streamp strm;
Bytef *buf;
unsigned size;
@@
-1028,7
+1030,7
@@
local void fill_window(s)
*/
Assert(more >= 2, "more < 2");
*/
Assert(more >= 2, "more < 2");
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ n =
d
read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
s->lookahead += n;
/* Initialize the hash value now that we have some input: */
s->lookahead += n;
/* Initialize the hash value now that we have some input: */
@@
-1108,6
+1110,11
@@
local block_state deflate_stored(s, flush)
s->strstart += s->lookahead;
s->lookahead = 0;
s->strstart += s->lookahead;
s->lookahead = 0;
+ if (flush == Z_INSERT_ONLY) {
+ s->block_start = s->strstart;
+ continue;
+ }
+
/* Emit a stored block if pending_buf will be full: */
max_start = s->block_start + max_block_size;
if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
/* Emit a stored block if pending_buf will be full: */
max_start = s->block_start + max_block_size;
if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
@@
-1123,6
+1130,11
@@
local block_state deflate_stored(s, flush)
FLUSH_BLOCK(s, 0);
}
}
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;
}
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
@@
-1162,6
+1174,12
@@
local block_state deflate_fast(s, flush)
INSERT_STRING(s, s->strstart, hash_head);
}
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
*/
/* Find the longest match, discarding those <= prev_length.
* At this point we have always match_length < MIN_MATCH
*/
@@
-1221,6
+1239,10
@@
local block_state deflate_fast(s, flush)
}
if (bflush) FLUSH_BLOCK(s, 0);
}
}
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;
}
FLUSH_BLOCK(s, flush == Z_FINISH);
return flush == Z_FINISH ? finish_done : block_done;
}
@@
-1259,6
+1281,12
@@
local block_state deflate_slow(s, flush)
INSERT_STRING(s, s->strstart, hash_head);
}
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;
/* Find the longest match, discarding those <= prev_length.
*/
s->prev_length = s->match_length, s->prev_match = s->match_start;
@@
-1337,6
+1365,10
@@
local block_state deflate_slow(s, flush)
s->lookahead--;
}
}
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]));
Assert (flush != Z_NO_FLUSH, "no flush?");
if (s->match_available) {
Tracevv((stderr,"%c", s->window[s->strstart-1]));