X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fstoresession.cpp;h=4642ed62314473f1bc07ad1c72c778ac6a3608ef;hp=309fa1b37062c8facf922bccbc5f433418cd23bb;hb=2ad82c2e40b6865481733913a2c32735602f63c4;hpb=d2fc6be9af3ba409032da6dcabc4630c657bb56c diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 309fa1b..4642ed6 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 ++; @@ -211,8 +216,7 @@ void StoreSession::store_proc(shared_ptr segment) const unsigned int samples_per_block = BlockSize / unit_size; - while (!interrupt_ && sample_count_) - { + while (!interrupt_ && sample_count_) { progress_updated(); const uint64_t packet_len =