X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=pysam.git;a=blobdiff_plain;f=samtools%2Fbedidx.c.pysam.c;h=2bbb05f5347849eaf7f2689fb78152cae732c241;hp=c3ab06ff5a82be4e4c377bdb9c343f30754418c4;hb=ca46ef4ba4a883c57cea62d5bf1bc021f1185109;hpb=d02fe5283ed7a93a2f76a5d6dc6e37b40c11b9b1 diff --git a/samtools/bedidx.c.pysam.c b/samtools/bedidx.c.pysam.c index c3ab06f..2bbb05f 100644 --- a/samtools/bedidx.c.pysam.c +++ b/samtools/bedidx.c.pysam.c @@ -6,6 +6,10 @@ #include #include +#ifdef _WIN32 +#define drand48() ((double)rand() / RAND_MAX) +#endif + #include "ksort.h" KSORT_INIT_GENERIC(uint64_t) @@ -121,8 +125,10 @@ void *bed_read(const char *fn) if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { beg = atoi(str->s); // begin if (dret != '\n') { - if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) + if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) { end = atoi(str->s); // end + if (end < beg) end = -1; + } } } }