aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_zlib.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-11-22 14:43:40 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-11-23 09:09:39 +0100
commitd6f75af39e88a613f822b99ceb06f408bdefe3e4 (patch)
tree8494ed9bdbe2e5eb2e0fb98a2d8d27af06da32dd /executor/common_zlib.h
parentf46b2272283056876fb9df794e3c67d3a2c3c059 (diff)
executor: remove support for zlib length calculation
zlib can calculate uncompressed output size if given NULL destination buffer. We don't use that. Remove.
Diffstat (limited to 'executor/common_zlib.h')
-rw-r--r--executor/common_zlib.h38
1 files changed, 14 insertions, 24 deletions
diff --git a/executor/common_zlib.h b/executor/common_zlib.h
index d5fd480d3..e7e47e0fd 100644
--- a/executor/common_zlib.h
+++ b/executor/common_zlib.h
@@ -99,15 +99,10 @@ static int puff_stored(struct puff_state* s)
// copy len bytes from in to out
if (s->incnt + len > s->inlen)
return 2; // not enough input
- if (s->out != (unsigned char*)0) {
- if (s->outcnt + len > s->outlen)
- return 1; // not enough output space
- while (len--)
- s->out[s->outcnt++] = s->in[s->incnt++];
- } else { // just scanning
- s->outcnt += len;
- s->incnt += len;
- }
+ if (s->outcnt + len > s->outlen)
+ return 1; // not enough output space
+ while (len--)
+ s->out[s->outcnt++] = s->in[s->incnt++];
// done with a valid stored block
return 0;
@@ -260,11 +255,9 @@ static int puff_codes(struct puff_state* s,
return symbol; // invalid symbol
if (symbol < 256) { // literal: symbol is the byte
// write out the literal
- if (s->out != (unsigned char*)0) {
- if (s->outcnt == s->outlen)
- return 1;
- s->out[s->outcnt] = symbol;
- }
+ if (s->outcnt == s->outlen)
+ return 1;
+ s->out[s->outcnt] = symbol;
s->outcnt++;
} else if (symbol > 256) { // length
// get and compute length
@@ -282,16 +275,13 @@ static int puff_codes(struct puff_state* s,
return -11; // distance too far back
// copy length bytes from distance bytes back
- if (s->out != (unsigned char*)0) {
- if (s->outcnt + len > s->outlen)
- return 1;
- while (len--) {
- s->out[s->outcnt] =
- dist > s->outcnt ? 0 : s->out[s->outcnt - dist];
- s->outcnt++;
- }
- } else
- s->outcnt += len;
+ if (s->outcnt + len > s->outlen)
+ return 1;
+ while (len--) {
+ s->out[s->outcnt] =
+ dist > s->outcnt ? 0 : s->out[s->outcnt - dist];
+ s->outcnt++;
+ }
}
} while (symbol != 256); // end of block symbol