X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fstoresession.cpp;h=bdb0f27981839087fac4f01c90ee05cac4b5cb47;hb=3e8a7cc6af5558a249c114b1609ececa2a381774;hp=309fa1b37062c8facf922bccbc5f433418cd23bb;hpb=d2fc6be9af3ba409032da6dcabc4630c657bb56c;p=pulseview.git diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 309fa1b..bdb0f27 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -149,8 +149,13 @@ bool StoreSession::start() start_sample_ = 0; sample_count_ = segment->get_sample_count(); } else { - start_sample_ = std::min(sample_range_.first, sample_range_.second); - sample_count_ = std::abs(sample_range_.second - sample_range_.first); + if (sample_range_.first > sample_range_.second) { + start_sample_ = sample_range_.second; + sample_count_ = sample_range_.first - sample_range_.second; + } else { + start_sample_ = sample_range_.first; + sample_count_ = sample_range_.second - sample_range_.first; + } } // Begin storing @@ -202,7 +207,7 @@ void StoreSession::store_proc(shared_ptr segment) const int unit_size = segment->unit_size(); assert(unit_size != 0); - // Qt needs the progress values to fit inside an int. If they would + // Qt needs the progress values to fit inside an int. If they would // not, scale the current and max values down until they do. while ((sample_count_ >> progress_scale) > INT_MAX) progress_scale ++;