From: Soeren Apel Date: Thu, 21 May 2020 20:29:30 +0000 (+0200) Subject: Fix compile issues with some compiler versions X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1e948182f3f9353bd74875a37cacc833312a8c8e;p=pulseview.git Fix compile issues with some compiler versions --- diff --git a/pv/data/decode/annotation.cpp b/pv/data/decode/annotation.cpp index b1dc6ef6..7f233478 100644 --- a/pv/data/decode/annotation.cpp +++ b/pv/data/decode/annotation.cpp @@ -35,7 +35,7 @@ namespace data { namespace decode { Annotation::Annotation(uint64_t start_sample, uint64_t end_sample, - const vector* texts, Class ann_class_id, const RowData *data) : + const vector* texts, uint32_t ann_class_id, const RowData *data) : start_sample_(start_sample), end_sample_(end_sample), texts_(texts), @@ -91,7 +91,7 @@ uint64_t Annotation::length() const return end_sample_ - start_sample_; } -Annotation::Class Annotation::ann_class_id() const +uint32_t Annotation::ann_class_id() const { return ann_class_id_; } diff --git a/pv/data/decode/annotation.hpp b/pv/data/decode/annotation.hpp index edc27bee..717206a4 100644 --- a/pv/data/decode/annotation.hpp +++ b/pv/data/decode/annotation.hpp @@ -26,6 +26,8 @@ #include #include +#include "pv/data/decode/row.hpp" + using std::vector; struct srd_proto_data; @@ -34,17 +36,13 @@ namespace pv { namespace data { namespace decode { -class Row; class RowData; class Annotation { -public: - typedef uint32_t Class; - public: Annotation(uint64_t start_sample, uint64_t end_sample, - const vector* texts, Class ann_class_id, const RowData *data); + const vector* texts, uint32_t ann_class_id, const RowData *data); Annotation(Annotation&& a); Annotation& operator=(Annotation&& a); @@ -55,7 +53,7 @@ public: uint64_t end_sample() const; uint64_t length() const; - Class ann_class_id() const; + uint32_t ann_class_id() const; const QString ann_class_name() const; const QString ann_class_description() const; @@ -74,7 +72,7 @@ private: uint64_t start_sample_; uint64_t end_sample_; const vector* texts_; - Class ann_class_id_; + uint32_t ann_class_id_; const RowData* data_; }; diff --git a/pv/data/decode/decoder.hpp b/pv/data/decode/decoder.hpp index 2c433747..6e11e83f 100644 --- a/pv/data/decode/decoder.hpp +++ b/pv/data/decode/decoder.hpp @@ -30,11 +30,11 @@ #include -#include #include using std::deque; using std::map; +using std::shared_ptr; using std::string; using std::vector; diff --git a/pv/data/decode/row.hpp b/pv/data/decode/row.hpp index 8e76dfa0..80aa114c 100644 --- a/pv/data/decode/row.hpp +++ b/pv/data/decode/row.hpp @@ -20,16 +20,18 @@ #ifndef PULSEVIEW_PV_DATA_DECODE_ROW_HPP #define PULSEVIEW_PV_DATA_DECODE_ROW_HPP +#include #include +#include #include -#include -#include - struct srd_decoder; struct srd_decoder_annotation_row; +using std::map; +using std::vector; + namespace pv { namespace data { namespace decode { diff --git a/pv/data/decode/rowdata.cpp b/pv/data/decode/rowdata.cpp index a9c2e2a8..3d250f49 100644 --- a/pv/data/decode/rowdata.cpp +++ b/pv/data/decode/rowdata.cpp @@ -104,7 +104,7 @@ 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. // This implies that if the longest text is the same, the shorter texts diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 0b09439b..d9b4691b 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -697,7 +697,7 @@ void DecodeTrace::mouse_left_press_event(const QMouseEvent* event) void DecodeTrace::draw_annotations(deque& annotations, QPainter &p, const ViewItemPaintParams &pp, int y, const DecodeTraceRow& row) { - Annotation::Class block_class = 0; + uint32_t block_class = 0; bool block_class_uniform = true; qreal block_start = 0; int block_ann_count = 0; @@ -802,7 +802,7 @@ void DecodeTrace::draw_annotation(const Annotation* a, QPainter &p, } void DecodeTrace::draw_annotation_block(qreal start, qreal end, - Annotation::Class ann_class, bool use_ann_format, QPainter &p, int y, + uint32_t ann_class, bool use_ann_format, QPainter &p, int y, const DecodeTraceRow& row) const { const double top = y + .5 - annotation_height_ / 2; diff --git a/pv/views/trace/decodetrace.hpp b/pv/views/trace/decodetrace.hpp index 4d6d4f8e..4a65d5ba 100644 --- a/pv/views/trace/decodetrace.hpp +++ b/pv/views/trace/decodetrace.hpp @@ -198,7 +198,7 @@ private: void draw_annotation(const Annotation* a, QPainter &p, const ViewItemPaintParams &pp, int y, const DecodeTraceRow& row) const; - void draw_annotation_block(qreal start, qreal end, Annotation::Class ann_class, + void draw_annotation_block(qreal start, qreal end, uint32_t ann_class, bool use_ann_format, QPainter &p, int y, const DecodeTraceRow& row) const; void draw_instant(const Annotation* a, QPainter &p, qreal x, int y) const;