X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fdata%2Fdecodesignal.cpp;h=ce38fbe3df15b90abec65378851ad20cbcae758f;hb=feda6c6bbde575242cf01c769c0ecd3e89f9f7a0;hp=d6eb924755b15452323c684cf2bdc285cd774a2c;hpb=5d3ca591b02ce030239ad4b86d9b172b925b4c5d;p=pulseview.git diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index d6eb9247..ce38fbe3 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -35,17 +35,13 @@ using std::forward_list; using std::lock_guard; -using std::make_pair; using std::make_shared; using std::min; using std::out_of_range; using std::shared_ptr; using std::unique_lock; -using pv::data::decode::Annotation; using pv::data::decode::AnnotationClass; using pv::data::decode::DecodeChannel; -using pv::data::decode::Decoder; -using pv::data::decode::Row; namespace pv { namespace data { @@ -474,17 +470,15 @@ uint64_t DecodeSignal::get_annotation_count(const Row* row, uint32_t segment_id) auto row_it = segment->annotation_rows.find(row); const RowData* rd; - if (row_it == segment->annotation_rows.end()) { - // FIXME Use the fallback row, but how? - assert(false); + if (row_it == segment->annotation_rows.end()) return 0; - } else + else rd = &(row_it->second); return rd->get_annotation_count(); } -void DecodeSignal::get_annotation_subset(vector &dest, +void DecodeSignal::get_annotation_subset(vector &dest, const Row* row, uint32_t segment_id, uint64_t start_sample, uint64_t end_sample) const { @@ -498,29 +492,27 @@ void DecodeSignal::get_annotation_subset(vector &dest, auto row_it = segment->annotation_rows.find(row); const RowData* rd; - if (row_it == segment->annotation_rows.end()) { - // FIXME Use the fallback row, but how? - assert(false); + if (row_it == segment->annotation_rows.end()) return; - } else + else rd = &(row_it->second); rd->get_annotation_subset(dest, start_sample, end_sample); } -void DecodeSignal::get_annotation_subset(vector &dest, +void DecodeSignal::get_annotation_subset(vector &dest, uint32_t segment_id, uint64_t start_sample, uint64_t end_sample) const { // Use forward_lists for faster merging - forward_list *all_ann_list = new forward_list(); + forward_list *all_ann_list = new forward_list(); vector rows = get_rows(); for (const Row* row : rows) { - vector *ann_vector = new vector(); + vector *ann_vector = new vector(); get_annotation_subset(*ann_vector, row, segment_id, start_sample, end_sample); - forward_list *ann_list = - new forward_list(ann_vector->begin(), ann_vector->end()); + forward_list *ann_list = + new forward_list(ann_vector->begin(), ann_vector->end()); delete ann_vector; all_ann_list->merge(*ann_list); @@ -1370,7 +1362,7 @@ void DecodeSignal::create_decode_segment() segments_.emplace_back(DecodeSegment()); // Add annotation classes - for (const shared_ptr dec : stack_) + for (const shared_ptr& dec : stack_) for (Row* row : dec->get_rows()) segments_.back().annotation_rows.emplace(row, RowData(row));