MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / read_buf

Function read_buf

extlibs/minizip/src/deflate.c:1267–1295  ·  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

1265 * (See also flush_pending()).
1266 */
1267local unsigned read_buf(strm, buf, size)
1268z_streamp strm;
1269Bytef* buf;
1270
1271unsigned size;
1272{
1273 unsigned len = strm->avail_in;
1274
1275 if (len > size) len = size;
1276 if (len == 0) return 0;
1277
1278 strm->avail_in -= len;
1279
1280 zmemcpy(buf, strm->next_in, len);
1281 if (strm->state->wrap == 1)
1282 {
1283 strm->adler = adler32(strm->adler, buf, len);
1284 }
1285#ifdef GZIP
1286 else if (strm->state->wrap == 2)
1287 {
1288 strm->adler = crc32(strm->adler, buf, len);
1289 }
1290#endif
1291 strm->next_in += len;
1292 strm->total_in += len;
1293
1294 return len;
1295}
1296
1297/* ===========================================================================
1298 * 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