MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / read_buf

Function read_buf

zlib/deflate.c:956–981  ·  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

954 * (See also flush_pending()).
955 */
956local int read_buf(strm, buf, size)
957 z_streamp strm;
958 Bytef *buf;
959 unsigned size;
960{
961 unsigned len = strm->avail_in;
962
963 if (len > size) len = size;
964 if (len == 0) return 0;
965
966 strm->avail_in -= len;
967
968 if (strm->state->wrap == 1) {
969 strm->adler = adler32(strm->adler, strm->next_in, len);
970 }
971#ifdef GZIP
972 else if (strm->state->wrap == 2) {
973 strm->adler = crc32(strm->adler, strm->next_in, len);
974 }
975#endif
976 zmemcpy(buf, strm->next_in, len);
977 strm->next_in += len;
978 strm->total_in += len;
979
980 return (int)len;
981}
982
983/* ===========================================================================
984 * Initialize the "longest match" routines for a new zlib stream

Callers 1

fill_windowFunction · 0.85

Calls 2

adler32Function · 0.85
zmemcpyFunction · 0.85

Tested by

no test coverage detected