fixed a potential int overflow

This commit is contained in:
Heng Li 2011-10-24 14:22:39 -04:00
parent 1f970b4557
commit 8f3c780552
2 changed files with 4 additions and 3 deletions

View File

@ -410,7 +410,8 @@ static void print_hits(const bntseq_t *bns, const bsw2opt_t *opt, bsw2seq1_t *ks
}
for (i = 0; b && i < b->n; ++i) {
bsw2hit_t *p = b->hits + i;
int32_t seqid = -1, coor = -1;
int seqid = -1;
int64_t coor = -1;
int j, qual, nn = 0;
int beg, end;
if (p->l == 0) {
@ -419,7 +420,7 @@ static void print_hits(const bntseq_t *bns, const bsw2opt_t *opt, bsw2seq1_t *ks
coor = p->k - bns->anns[seqid].offset;
}
ksprintf(&str, "%s\t%d", ks->name, p->flag&0x10);
ksprintf(&str, "\t%s\t%d", seqid>=0? bns->anns[seqid].name : "*", coor + 1);
ksprintf(&str, "\t%s\t%ld", seqid>=0? bns->anns[seqid].name : "*", (long)coor + 1);
if (p->l == 0) {
{ // estimate mapping quality
float c = 1.0;

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.6.0-r53-dev"
#define PACKAGE_VERSION "0.6.0-r54-dev"
#endif
static int usage()