X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fstoresession.cpp;h=4642ed62314473f1bc07ad1c72c778ac6a3608ef;hp=5500292a8df777563b624a5365a241bd7e93978b;hb=d9ea96280ab1128427143660ae375c30b19aa0cb;hpb=3d79f521396c8e908fd237f5328153165099f5c3 diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 5500292a..4642ed62 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 @@ -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 =