=========================================================================== * 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)
| 1265 | * (See also flush_pending()). |
| 1266 | */ |
| 1267 | local unsigned read_buf(strm, buf, size) |
| 1268 | z_streamp strm; |
| 1269 | Bytef* buf; |
| 1270 | |
| 1271 | unsigned 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 |
no test coverage detected