Skip to content

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

@smoe

Description

@smoe

--- 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
    +}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions