Permalink
Browse files

Merge pull request #66 from wandai330/master

int type overflow
  • Loading branch information...
2 parents e556e16 + 12ce104 commit bd148d4654fe26d8e218ef8f634fb6a6df9fede1 @ExpressionAnalysis committed on GitHub Jun 20, 2017
Showing with 7 additions and 5 deletions.
  1. +4 −4 clipper/fastq-multx.cpp
  2. +3 −1 clipper/fastq-stats.cpp
View
@@ -43,7 +43,7 @@ struct bc {
char *out[6]; // one output per input
FILE *fout[6];
bool gzout[6];
- int cnt; // count found
+ uint64_t cnt; // count found
bool shifted; // count found in 1-shifted position
char * dual; // is this a dual-indexed barcode? if so, this points to the second index.
int dual_n; // length of dual
@@ -1072,17 +1072,17 @@ int main (int argc, char **argv) {
int j;
printf("Id\tCount\tFile(s)\n");
- int tot=0;
+ uint64_t tot=0;
for (i=0;i<=bcnt;++i) {
- printf("%s\t%d", bc[i].id.s, bc[i].cnt);
+ printf("%s\t%lu", bc[i].id.s, bc[i].cnt);
tot+=bc[i].cnt;
for (j=0;j<f_n;++j) {
if (bc[i].out[j])
printf("\t%s", bc[i].out[j]);
}
printf("\n");
}
- printf("total\t%d\n", tot);
+ printf("total\t%lu\n", tot);
if (!io_ok)
return 3;
View
@@ -153,7 +153,7 @@ int window = 2000000;
int cyclemax = 35;
int gcCyclemax = 100; // to compare with fastqc, seq is rounded to nearest 100 to reduce # of gc models; for < 200 length, this is teh same as max=100
float gcSum;
-int gcTotal;
+uint64_t gcTotal;
int show_max = 10;
bool debug = 0;
@@ -565,6 +565,8 @@ int main( int argc, char**argv ) {
if(gc) {
// put these where they belong
+ if (debug)
+ printf("gcTotal\t%lu\tgcSum\t%f\n\n", gcTotal, gcSum);
printf("pct-gc cycle-max\t%d\n", gcCyclemax);
printf("pct-gc mean\t%.2f\n", 100.0 * gcSum / gcTotal);
}

0 comments on commit bd148d4

Please sign in to comment.