aboutsummaryrefslogtreecommitdiff
path: root/lib/fstream/compress/gzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fstream/compress/gzip.c')
-rw-r--r--lib/fstream/compress/gzip.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/fstream/compress/gzip.c b/lib/fstream/compress/gzip.c
index f604b71..e69f183 100644
--- a/lib/fstream/compress/gzip.c
+++ b/lib/fstream/compress/gzip.c
@@ -20,7 +20,15 @@ static int flush_inbuf(ostream_comp_t *base, bool finish)
size_t have;
int ret;
- gzip->strm.avail_in = base->inbuf_used;
+ if (sizeof(size_t) > sizeof(uInt)) {
+ gzip->strm.avail_in = ~((uInt)0);
+
+ if ((size_t)gzip->strm.avail_in > base->inbuf_used)
+ gzip->strm.avail_in = (uInt)base->inbuf_used;
+ } else {
+ gzip->strm.avail_in = (uInt)base->inbuf_used;
+ }
+
gzip->strm.next_in = base->inbuf;
do {