=========================================================================== * 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()). */
| 1070 | * (See also flush_pending()). |
| 1071 | */ |
| 1072 | local int read_buf(z_streamp strm, Bytef *buf, unsigned size) |
| 1073 | { |
| 1074 | unsigned len = strm->avail_in; |
| 1075 | |
| 1076 | if (len > size) len = size; |
| 1077 | if (len == 0) return 0; |
| 1078 | |
| 1079 | strm->avail_in -= len; |
| 1080 | |
| 1081 | zmemcpy(buf, strm->next_in, len); |
| 1082 | if (strm->state->wrap == 1) { |
| 1083 | strm->adler = adler32(strm->adler, buf, len); |
| 1084 | } |
| 1085 | #ifdef GZIP |
| 1086 | else if (strm->state->wrap == 2) { |
| 1087 | strm->adler = crc32(strm->adler, buf, len); |
| 1088 | } |
| 1089 | #endif |
| 1090 | strm->next_in += len; |
| 1091 | strm->total_in += len; |
| 1092 | |
| 1093 | return (int)len; |
| 1094 | } |
| 1095 | |
| 1096 | /* =========================================================================== |
| 1097 | * Initialize the "longest match" routines for a new zlib stream |
no test coverage detected