MCPcopy Create free account
hub / github.com/RsyncProject/rsync / read_buf

Function read_buf

zlib/deflate.c:1072–1094  ·  view source on GitHub ↗

=========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */

Source from the content-addressed store, hash-verified

1070 * (See also flush_pending()).
1071 */
1072local int read_buf(z_streamp strm, Bytef *buf, unsigned size)
1073{
1074 unsigned len = strm->avail_in;
1075
1076 if (len > size) len = size;
1077 if (len == 0) return 0;
1078
1079 strm->avail_in -= len;
1080
1081 zmemcpy(buf, strm->next_in, len);
1082 if (strm->state->wrap == 1) {
1083 strm->adler = adler32(strm->adler, buf, len);
1084 }
1085#ifdef GZIP
1086 else if (strm->state->wrap == 2) {
1087 strm->adler = crc32(strm->adler, buf, len);
1088 }
1089#endif
1090 strm->next_in += len;
1091 strm->total_in += len;
1092
1093 return (int)len;
1094}
1095
1096/* ===========================================================================
1097 * Initialize the "longest match" routines for a new zlib stream

Callers 1

fill_windowFunction · 0.70

Calls 2

zmemcpyFunction · 0.85
adler32Function · 0.85

Tested by

no test coverage detected