summaryrefslogtreecommitdiff
path: root/inflate.c
diff options
context:
space:
mode:
authorSebastian Pop <s.pop@samsung.com>2019-03-06 14:00:30 -0600
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-03-21 11:22:36 +0100
commita1d4af095bef56c42b168ebdb53b545af8f82c5f (patch)
treed097a5d9bb4fe4b8f5c60dca8edadf283973e5d0 /inflate.c
parent9f6bacbfed2a6da3734a273be28b1891bb4d0dfb (diff)
factor out code
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/inflate.c b/inflate.c
index c4241cc..293081a 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1164,25 +1164,21 @@ int ZEXPORT PREFIX(inflate)(PREFIX3(stream) *strm, int flush) {
copy = state->length;
if (copy > left)
copy = left;
- left -= copy;
- state->length -= copy;
if (copy >= sizeof(uint64_t))
put = chunk_memcpy(put, from, copy);
else
put = copy_bytes(put, from, copy);
} else { /* copy from output */
- unsigned offset = state->offset;
- from = put - offset;
copy = state->length;
if (copy > left)
copy = left;
- left -= copy;
- state->length -= copy;
if (copy >= sizeof(uint64_t))
- put = chunk_memset(put, from, offset, copy);
+ put = chunk_memset(put, put - state->offset, state->offset, copy);
else
- put = set_bytes(put, from, offset, copy);
+ put = set_bytes(put, put - state->offset, state->offset, copy);
}
+ left -= copy;
+ state->length -= copy;
if (state->length == 0)
state->mode = LEN;
break;