From: Joel Holdsworth Date: Fri, 17 Apr 2015 23:22:02 +0000 (+0100) Subject: Session: Use Device::read_config to read sample limit X-Git-Tag: pulseview-0.3.0~204 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4365a4406b5a81a12c6a7d0fbaed01f6d59df882;p=pulseview.git Session: Use Device::read_config to read sample limit --- diff --git a/pv/session.cpp b/pv/session.cpp index ecbb4722..2a4814f8 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -477,18 +477,8 @@ void Session::feed_in_logic(shared_ptr logic) set_capture_state(Running); // Get sample limit. - assert(device_); - const std::shared_ptr device = - device_->device(); - assert(device); - const auto keys = device->config_keys( - ConfigKey::DEVICE_OPTIONS); - const auto iter = keys.find(ConfigKey::LIMIT_SAMPLES); - const uint64_t sample_limit = (iter != keys.end() && - (*iter).second.find(sigrok::GET) != - (*iter).second.end()) ? - VariantBase::cast_dynamic>( - device->config_get(ConfigKey::LIMIT_SAMPLES)).get() : 0; + const uint64_t sample_limit = device_->read_config( + ConfigKey::LIMIT_SAMPLES); // Create a new data segment cur_logic_segment_ = shared_ptr(