*strm->next_out = (unsigned char)state->bi_buf;
/* Honor history and check value */
param->nt = 0;
- param->cv = state->wrap == 2 ? ZSWAP32(strm->adler) : strm->adler;
+ param->cv = state->wrap == 2 ? ZSWAP32(state->crc_fold.value) : strm->adler;
/* When opening a block, choose a Huffman-Table Type */
if (!param->bcf) {
state->bi_buf = 0; /* Avoid accessing next_out */
else
state->bi_buf = *strm->next_out & ((1 << state->bi_valid) - 1);
- strm->adler = state->wrap == 2 ? ZSWAP32(param->cv) : param->cv;
+ if (state->wrap == 2)
+ state->crc_fold.value = ZSWAP32(param->cv);
+ else
+ strm->adler = param->cv;
/* Unmask the input data */
strm->avail_in += masked_avail_in;