Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

probably just variable type issue - number less than zero #1

Open
mnmnm opened this issue Sep 30, 2014 · 2 comments
Open

probably just variable type issue - number less than zero #1

mnmnm opened this issue Sep 30, 2014 · 2 comments

Comments

@mnmnm
Copy link

mnmnm commented Sep 30, 2014

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
Copy link
Author

mnmnm commented Sep 30, 2014

$ 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);

@arenn
Copy link
Owner

arenn commented Oct 1, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants