gzrt icon indicating copy to clipboard operation
gzrt copied to clipboard

probably just variable type issue - number less than zero

Open mnmnm opened this issue 10 years ago • 2 comments

Opened input file for reading: ../firefly-rk3288_sdk_git.tar.gz Opened output file for writing: firefly-rk3288_sdk_git.tar.recovered Found error at byte -394639277 in input stream Found good data at byte -395313152 in input stream Total decompressed output = -334166016 bytes

In [2]: 2**32 -394639277 Out[2]: 3900328019

very good utility for (re)downloading files from chinese baidu.com site. thanks a lot !!

mnmnm avatar Sep 30 '14 11:09 mnmnm

$ diff -ubrNdp gzrecover.c.ori gzrecover.c.new --- gzrecover.c.ori 2014-09-30 13:44:48.643503244 +0200 +++ gzrecover.c.new 2014-09-30 14:32:23.762568982 +0200 @@ -28,7 +28,7 @@ #include <string.h> #include <zlib.h>

-#define VERSION "0.8" +#define VERSION "0.8a"

/* Global contants _/ #define DEFAULT_INBUF_SIZE (1024_1024) @@ -185,7 +185,7 @@ skip_gzip_header(z_stream _d_stream) int main(int argc, char *_argv) {

  • int opt, rc, rc2, ifd, ofd, founderr=0, foundgood=0;
  • int64_t opt, rc, rc2, ifd, ofd, founderr=0, foundgood=0; ssize_t bytes_read=0, tot_written=0; off_t errpos=0, errinc=0, readpos=0; char _infile; @@ -306,8 +306,8 @@ main(int argc, char *_argv) errpos = bytes_read - d_stream.avail_in;
       if (verbose_mode)
  •            fprintf(stderr, "Found error at byte %d in input stream\n",
    
  •                    (int)(readpos - (bytes_read - errpos)));
    
  •            fprintf(stderr, "Found error at byte %ld in input stream\n",
    
  •                    (int64_t)(readpos - (bytes_read - errpos)));
    
           if (d_stream.avail_in == 0)
             {
    

    @@ -374,8 +374,8 @@ main(int argc, char **argv) errinc = 0;

      if (verbose_mode)
    
  •        fprintf(stderr, "Found good data at byte %d in input stream\n",
    
  •                (int)(readpos - (bytes_read - d_stream.avail_in)));
    
  •        fprintf(stderr, "Found good data at byte %ld in input stream\n",
    
  •                (int64_t)(readpos - (bytes_read - d_stream.avail_in)));
    
       if (split_mode)
         {
    

    @@ -433,8 +433,8 @@ main(int argc, char **argv) close(ifd);

    if (verbose_mode)

  • fprintf(stderr, "Total decompressed output = %d bytes\n",

  •        (int)tot_written);
    
  • fprintf(stderr, "Total decompressed output = %ld bytes\n",

  •        (int64_t)tot_written);
    

    free(inbuf); free(outbuf);

mnmnm avatar Sep 30 '14 13:09 mnmnm

Thanks for the patch. I'll try to give it a look in the next couple months as I'm swamped with work at present, but this looks straightforward.

arenn avatar Oct 01 '14 01:10 arenn