=========================================================================== * 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)
| 954 | * (See also flush_pending()). |
| 955 | */ |
| 956 | local 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 |
no test coverage detected