X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=samtools.git;a=blobdiff_plain;f=bedidx.c;h=ec75a1067f5905c69ead868ff42d2073189bb690;hp=722877dcc2aa1d414460c328e6e022a22befecfe;hb=d59366b97f0e6a0cbb0dfcdc5679f0ed88c8fe1e;hpb=b7c06ea4740153b8f27c7c2374131dbd607b6113 diff --git a/bedidx.c b/bedidx.c index 722877d..ec75a10 100644 --- a/bedidx.c +++ b/bedidx.c @@ -4,6 +4,10 @@ #include #include +#ifdef _WIN32 +#define drand48() ((double)rand() / RAND_MAX) +#endif + #include "ksort.h" KSORT_INIT_GENERIC(uint64_t) @@ -119,8 +123,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; + } } } }