MCPcopy Create free account
hub / github.com/F-Stack/f-stack / read_buf

Function read_buf

freebsd/contrib/zlib/deflate.c:1167–1192  ·  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()). */

(strm, buf, size)

Source from the content-addressed store, hash-verified

1165 * (See also flush_pending()).
1166 */
1167local unsigned read_buf(strm, buf, size)
1168 z_streamp strm;
1169 Bytef *buf;
1170 unsigned size;
1171{
1172 unsigned len = strm->avail_in;
1173
1174 if (len > size) len = size;
1175 if (len == 0) return 0;
1176
1177 strm->avail_in -= len;
1178
1179 zmemcpy(buf, strm->next_in, len);
1180 if (strm->state->wrap == 1) {
1181 strm->adler = adler32(strm->adler, buf, len);
1182 }
1183#ifdef GZIP
1184 else if (strm->state->wrap == 2) {
1185 strm->adler = crc32(strm->adler, buf, len);
1186 }
1187#endif
1188 strm->next_in += len;
1189 strm->total_in += len;
1190
1191 return len;
1192}
1193
1194/* ===========================================================================
1195 * Initialize the "longest match" routines for a new zlib stream

Callers 2

fill_windowFunction · 0.85
deflate_storedFunction · 0.85

Calls 2

zmemcpyFunction · 0.85
adler32Function · 0.85

Tested by

no test coverage detected