=========================================================================== * 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)
| 1165 | * (See also flush_pending()). |
| 1166 | */ |
| 1167 | local 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 |
no test coverage detected