state->head->hcrc = (int)((state->flags >> 9) & 1);
state->head->done = 1;
}
- strm->adler = state->check = functable.crc32_fold_reset(&state->crc_fold);
+ /* compute crc32 checksum if not in raw mode */
+ if ((state->wrap & 4) && state->flags)
+ strm->adler = state->check = functable.crc32_fold_reset(&state->crc_fold);
state->mode = TYPE;
break;
#endif
state->total += out;
if (INFLATE_NEED_CHECKSUM(strm) && strm->total_out) {
- if (state->flags)
+ /* compute crc32 final value if not in raw mode */
+ if ((state->wrap & 4) && state->flags)
strm->adler = state->check = functable.crc32_fold_final(&state->crc_fold);
}
out = left;
if (!INFLATE_NEED_CHECKSUM(strm))
return;
- /* check function to use adler32() for zlib or crc32() for gzip */
+ /* compute checksum if not in raw mode */
+ if (state->wrap & 4) {
+ /* check flags to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
- if (state->flags)
- functable.crc32_fold_copy(&state->crc_fold, dst, src, len);
- else
+ if (state->flags)
+ functable.crc32_fold_copy(&state->crc_fold, dst, src, len);
+ else
#endif
- {
+ {
+ memcpy(dst, src, len);
+ strm->adler = state->check = functable.adler32(state->check, dst, len);
+ }
+ } else {
memcpy(dst, src, len);
- strm->adler = state->check = functable.adler32(state->check, dst, len);
}
}