]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decode/rowdata.cpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / data / decode / rowdata.cpp
index fc635b2452db765e7bd8896b6d6e6c474abc36da..3d250f49472eb03194d1001c6dd693c2ef644ae2 100644 (file)
@@ -63,7 +63,7 @@ void RowData::get_annotation_subset(
 
        uint32_t max_ann_class_id = 0;
        for (AnnotationClass* c : row_->ann_classes()) {
-               if (!c->visible)
+               if (!c->visible())
                        all_ann_classes_enabled = false;
                else
                        all_ann_classes_disabled = false;
@@ -83,7 +83,7 @@ void RowData::get_annotation_subset(
                        vector<size_t> class_visible;
                        class_visible.resize(max_ann_class_id + 1, 0);
                        for (AnnotationClass* c : row_->ann_classes())
-                               if (c->visible)
+                               if (c->visible())
                                        class_visible[c->id] = 1;
 
                        for (const auto& annotation : annotations_)
@@ -95,13 +95,21 @@ void RowData::get_annotation_subset(
        }
 }
 
+const deque<Annotation>& RowData::annotations() const
+{
+       return annotations_;
+}
+
 const Annotation* RowData::emplace_annotation(srd_proto_data *pdata)
 {
        const srd_proto_data_annotation *const pda = (const srd_proto_data_annotation*)pdata->data;
 
-       Annotation::Class ann_class_id = (Annotation::Class)(pda->ann_class);
+       uint32_t ann_class_id = pda->ann_class;
 
-       // Look up the longest annotation text to see if we have it in storage
+       // Look up the longest annotation text to see if we have it in storage.
+       // This implies that if the longest text is the same, the shorter texts
+       // are expected to be the same, too. PDs that violate this assumption
+       // should be considered broken.
        const char* const* ann_texts = (char**)pda->ann_text;
        const QString ann0 = QString::fromUtf8(ann_texts[0]);
        vector<QString>* storage_entry = &(ann_texts_[ann0]);