From 9b2eb4e6fdaa2016d0809d25f3e375ff66383761 Mon Sep 17 00:00:00 2001 From: Aaron <aaronquinlan@gmail.com> Date: Thu, 5 Aug 2010 15:50:14 -0400 Subject: [PATCH] Fixed overflow bug in slopBed causing starts and ends beyod the size of the chrom. --- src/slopBed/slopBed.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/slopBed/slopBed.cpp b/src/slopBed/slopBed.cpp index 8da78f56..a47e1764 100644 --- a/src/slopBed/slopBed.cpp +++ b/src/slopBed/slopBed.cpp @@ -62,20 +62,20 @@ void BedSlop::AddSlop(BED &bed) { if ( (_forceStrand) && (bed.strand == "-") ) { // inspect the start - if ((bed.start - _rightSlop) > 0) bed.start -= _rightSlop; + if ( (static_cast<int>(bed.start) - _rightSlop) > 0 ) bed.start -= _rightSlop; else bed.start = 0; // inspect the start - if ((bed.end + _leftSlop) <= chromSize) bed.end += _leftSlop; + if ( (static_cast<int>(bed.end) + _leftSlop) <= static_cast<int>(chromSize)) bed.end += _leftSlop; else bed.end = chromSize; } else { // inspect the start - if ((bed.start - _leftSlop) > 0) bed.start -= _leftSlop; + if ( (static_cast<int>(bed.start) - _leftSlop) > 0) bed.start -= _leftSlop; else bed.start = 0; // inspect the end - if ((bed.end + _rightSlop) <= chromSize) bed.end += _rightSlop; + if ( (static_cast<int>(bed.end) + _rightSlop) <= static_cast<int>(chromSize)) bed.end += _rightSlop; else bed.end = chromSize; } } -- GitLab