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
- always flush the IO write buffer when reading
[rsync/rsync.git]
/
zlib
/
deflate.c
diff --git
a/zlib/deflate.c
b/zlib/deflate.c
index
490813f
..
95b84d0
100644
(file)
--- 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 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));
@@
-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;
@@
-657,7
+657,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
+1028,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: */
@@
-1162,6
+1162,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
+1227,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
+1269,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
+1353,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]));