From: Soeren Apel Date: Fri, 10 Feb 2017 19:22:51 +0000 (+0100) Subject: MainBar: Properly limit the lower value of the sample range X-Git-Tag: pulseview-0.4.0~194 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=49ec9e075c345c18feb7be1eb59c31578ef532f0;p=pulseview.git MainBar: Properly limit the lower value of the sample range This fixes bug #890. --- diff --git a/pv/toolbars/mainbar.cpp b/pv/toolbars/mainbar.cpp index 9bebda80..188786f1 100644 --- a/pv/toolbars/mainbar.cpp +++ b/pv/toolbars/mainbar.cpp @@ -611,9 +611,10 @@ void MainBar::export_file(shared_ptr format, const pv::util::Timestamp& start_time = trace_view->cursors()->first()->time(); const pv::util::Timestamp& end_time = trace_view->cursors()->second()->time(); - const uint64_t start_sample = - std::max((double)0, start_time.convert_to() * samplerate); - const uint64_t end_sample = end_time.convert_to() * samplerate; + const uint64_t start_sample = (uint64_t)std::max( + (double)0, start_time.convert_to() * samplerate); + const uint64_t end_sample = (uint64_t)std::max( + (double)0, end_time.convert_to() * samplerate); sample_range = std::make_pair(start_sample, end_sample); } else {