Skip to content

patch to avoid uninitialised values, correcting cast int->uint64 for long files #8

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

Open
smoe opened this issue Jul 18, 2013 · 1 comment

Comments

@smoe
Copy link
Contributor

smoe commented Jul 18, 2013

--- grabix-0.0git20130718.orig/grabix.cpp
+++ grabix-0.0
git20130718/grabix.cpp
@@ -261,7 +261,7 @@
srand(seed);

     // reservoir sample
  •    size_t s, N, result_size;
    
  •    uint64_t N=0, result_size=0;
     vector<string> sample;
     kstring_t *line;
     line = new kstring_t;
    

    @@ -282,7 +282,7 @@
    }
    else
    {

  •            s = (int) ((double)rand()/(double)RAND_MAX \* N);
    
  •            uint64_t s = (uint64_t) ((double)rand()/(double)RAND_MAX * N);
             if (s < K)
                 sample[s] = line->s;
         }
    

    @@ -327,4 +327,4 @@
    }

    return EXIT_SUCCESS;
    -}
    \ No newline at end of file
    +}

@arq5x
Copy link
Owner

arq5x commented Jul 24, 2013

Thanks so much for all of these changes. I have been swamped with other work, but will get back to integrating all of this when I return from vacation in mid August. Cheers.

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