MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / read_buf

Function read_buf

extern/zlib/src/deflate.c:218–239  ·  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

216 * (See also flush_pending()).
217 */
218local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
219 unsigned len = strm->avail_in;
220
221 if (len > size) len = size;
222 if (len == 0) return 0;
223
224 strm->avail_in -= len;
225
226 zmemcpy(buf, strm->next_in, len);
227 if (strm->state->wrap == 1) {
228 strm->adler = adler32(strm->adler, buf, len);
229 }
230#ifdef GZIP
231 else if (strm->state->wrap == 2) {
232 strm->adler = crc32(strm->adler, buf, len);
233 }
234#endif
235 strm->next_in += len;
236 strm->total_in += len;
237
238 return len;
239}
240
241/* ===========================================================================
242 * Fill the window when the lookahead becomes insufficient.

Callers 2

fill_windowFunction · 0.85
deflate_storedFunction · 0.85

Calls 2

zmemcpyFunction · 0.85
adler32Function · 0.85

Tested by

no test coverage detected