]> sigrok.org Git - pulseview.git/commitdiff
SignalBase: Allow checking for logic data directly
authorSoeren Apel <redacted>
Tue, 14 Mar 2017 21:54:20 +0000 (22:54 +0100)
committerSoeren Apel <redacted>
Wed, 22 Mar 2017 21:46:20 +0000 (22:46 +0100)
If we always return a valid pointer, we need to look
at the channel type to figure out if this data is
supposed to be valid or not. This isn't useful.

pv/data/signalbase.cpp

index ccdc1da7f931fa4b69e0523986876c93467b3aca..e29bbe8745352ff84c0257391bf950949683a2bb 100644 (file)
@@ -122,7 +122,7 @@ shared_ptr<data::Analog> SignalBase::analog_data() const
        if (channel_type_ == AnalogChannel)
                return dynamic_pointer_cast<data::Analog>(data_);
        else
-               return shared_ptr<data::Analog>();
+               return nullptr;
 }
 
 shared_ptr<data::Logic> SignalBase::logic_data() const
@@ -130,7 +130,7 @@ shared_ptr<data::Logic> SignalBase::logic_data() const
        if (channel_type_ == LogicChannel)
                return dynamic_pointer_cast<data::Logic>(data_);
        else
-               return shared_ptr<data::Logic>();
+               return nullptr;
 }
 
 #ifdef ENABLE_DECODE