]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - lib/gunzip.c
efi_loader: Split drive add into function
[karo-tx-uboot.git] / lib / gunzip.c
index d86aa87f688477219a16550f69ba6c3cdb1cebba..6d65ccccffa018582ed33497f5ae9361c6252f23 100644 (file)
@@ -70,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)
 {
@@ -104,7 +105,7 @@ void gzwrite_progress_finish(int returnval,
 }
 
 int gzwrite(unsigned char *src, int len,
-           struct block_dev_desc *dev,
+           struct blk_desc *dev,
            unsigned long szwritebuf,
            u64 startoffs,
            u64 szexpected)
@@ -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);