X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib%2Fgunzip.c;h=da0c76c500d1cf2db8362ebc753defb61f1474ea;hb=02499e4edc885b3064c76f8b6e84d9ff8d7a6b4b;hp=4128a1871c998836dde4bded2c6784d2b1826768;hpb=536266231a340c0c5e571e1012bf3f8fc835b251;p=u-boot diff --git a/lib/gunzip.c b/lib/gunzip.c index 4128a1871c..da0c76c500 100644 --- a/lib/gunzip.c +++ b/lib/gunzip.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -69,6 +70,7 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp) return zunzip(dst, dstlen, src, lenp, 1, i); } +#ifdef CONFIG_CMD_UNZIP __weak void gzwrite_progress_init(u64 expectedsize) { @@ -230,8 +232,7 @@ int gzwrite(unsigned char *src, int len, gzwrite_progress(iteration++, totalfilled, szexpected); - blocks_written = dev->block_write(dev->dev, - outblock, + blocks_written = dev->block_write(dev, outblock, writeblocks, writebuf); outblock += blocks_written; @@ -258,6 +259,7 @@ out: return r; } +#endif /* * Uncompress blocks compressed with zlib without headers @@ -284,12 +286,11 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, do { r = inflate(&s, Z_FINISH); if (stoponerr == 1 && r != Z_STREAM_END && - (s.avail_out == 0 || r != Z_BUF_ERROR)) { + (s.avail_in == 0 || s.avail_out == 0 || r != Z_BUF_ERROR)) { printf("Error: inflate() returned %d\n", r); err = -1; break; } - s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst); } while (r == Z_BUF_ERROR); *lenp = s.next_out - (unsigned char *) dst; inflateEnd(&s);