]> sigrok.org Git - pulseview.git/commitdiff
clang-tidy and clazy proposals
authorSoeren Apel <redacted>
Mon, 6 Jan 2020 20:22:31 +0000 (21:22 +0100)
committerUwe Hermann <redacted>
Tue, 7 Jan 2020 21:01:29 +0000 (22:01 +0100)
pv/data/decode/decoder.cpp
pv/data/decodesignal.cpp
pv/data/decodesignal.hpp
pv/mainwindow.cpp
pv/views/decoder_output/QHexView.hpp
pv/views/decoder_output/view.cpp
pv/views/decoder_output/view.hpp
pv/views/trace/decodetrace.cpp
pv/views/trace/view.cpp
pv/widgets/flowlayout.cpp

index 9792ace43412ad6d01bb44596d3676641b24f9cc..0f12fec8bd753024c53c859f4a44427bfb7a5f81 100644 (file)
@@ -69,7 +69,7 @@ Decoder::Decoder(const srd_decoder *const dec) :
        for (const GSList *rl = srd_decoder_->annotation_rows; rl; rl = rl->next) {
                const srd_decoder_annotation_row *const srd_row = (srd_decoder_annotation_row *)rl->data;
                assert(srd_row);
-               rows_.push_back({i++, this, srd_row});
+               rows_.emplace_back(i++, this, srd_row);
 
                // FIXME PV can crash from .at() if a PD's ann classes are defined incorrectly
                for (const GSList *cl = srd_row->ann_classes; cl; cl = cl->next)
@@ -78,7 +78,7 @@ Decoder::Decoder(const srd_decoder *const dec) :
 
        if (rows_.empty()) {
                // Make sure there is a row for PDs without row declarations
-               rows_.push_back({0, this});
+               rows_.emplace_back(0, this);
 
                for (AnnotationClass& c : ann_classes_)
                        c.row = &(rows_.back());
index 831c8e7f90c41964dee9b2a496705ccd170db0ce..ce38fbe3df15b90abec65378851ad20cbcae758f 100644 (file)
@@ -35,7 +35,6 @@
 
 using std::forward_list;
 using std::lock_guard;
-using std::make_pair;
 using std::make_shared;
 using std::min;
 using std::out_of_range;
@@ -1363,7 +1362,7 @@ void DecodeSignal::create_decode_segment()
        segments_.emplace_back(DecodeSegment());
 
        // Add annotation classes
-       for (const shared_ptr<Decoder> dec : stack_)
+       for (const shared_ptr<Decoder>& dec : stack_)
                for (Row* row : dec->get_rows())
                        segments_.back().annotation_rows.emplace(row, RowData(row));
 
index f8994adbeb87955c2fe3a675141d2e8cd7600c73..c59b20b816d6a29ce4dee4dd60891a5d9fa07f92 100644 (file)
@@ -42,7 +42,6 @@ using std::condition_variable;
 using std::deque;
 using std::map;
 using std::mutex;
-using std::pair;
 using std::vector;
 using std::shared_ptr;
 
index 2823adc0ec08e1f9f3f341ef7e52415c506471b0..799f10d4b7c3bb7d3f8ccabd70e319df988ec990 100644 (file)
@@ -146,7 +146,7 @@ shared_ptr<views::ViewBase> MainWindow::add_view(views::ViewType type,
        // Only use the view type in the name if it's not the main view
        QString title;
        if (main_bar)
-               title = QString("%1 (%2)").arg(session.name()).arg(views::ViewTypeNames[type]);
+               title = QString("%1 (%2)").arg(session.name()views::ViewTypeNames[type]);
        else
                title = session.name();
 
index 71b06cdd71ff3a84d8b6f72e485b152fe9d9a839..e3c182a7a1d344cca8421fca8f5bcfd6fb8fcc88 100644 (file)
@@ -50,7 +50,7 @@ public:
        };
 
 public:
-       QHexView(QWidget *parent = 0);
+       QHexView(QWidget *parent = nullptr);
 
        void set_mode(Mode m);
        void set_data(const DecodeBinaryClass* data);
index 325fa716db78bd1800bce41c249770aac009d28a..f22f6c5d508bf47dfeeaecc61c588501dbf7ff3b 100644 (file)
 using pv::data::DecodeSignal;
 using pv::data::SignalBase;
 using pv::data::decode::Decoder;
-using pv::util::TimeUnit;
 using pv::util::Timestamp;
 
-using std::dynamic_pointer_cast;
-using std::numeric_limits;
 using std::shared_ptr;
 
 namespace pv {
@@ -135,10 +132,6 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
        reset_view_state();
 }
 
-View::~View()
-{
-}
-
 ViewType View::get_type() const
 {
        return ViewTypeDecoderOutput;
index a6362ede7ac59646e1b08e43124c741abaab96d9..16d35e82e2823af56cfe83cd5738798360667e6c 100644 (file)
@@ -57,8 +57,6 @@ class View : public ViewBase
 public:
        explicit View(Session &session, bool is_main_view=false, QMainWindow *parent = nullptr);
 
-       ~View();
-
        virtual ViewType get_type() const;
 
        /**
index f9b7158e518278f8296b78d04d70d14a41d6e77f..bb0843a52cbe8f1b3e5bb3fc7bc540d30721b2fd 100644 (file)
@@ -67,7 +67,6 @@ using std::make_pair;
 using std::max;
 using std::min;
 using std::numeric_limits;
-using std::out_of_range;
 using std::pair;
 using std::shared_ptr;
 using std::tie;
index ea1c290c8dccf95774d3e9805b77b4c7b8e656bb..7a68c6e93408c113ae58c6d7876a49b2883b8a50 100644 (file)
@@ -307,7 +307,7 @@ shared_ptr<Signal> View::get_signal_by_signalbase(shared_ptr<data::SignalBase> b
 {
        shared_ptr<Signal> ret_val;
 
-       for (const shared_ptr<Signal> s : signals_)
+       for (const shared_ptr<Signal>& s : signals_)
                if (s->base() == base) {
                        ret_val = s;
                        break;
index 31ba7fed425e53b74774363480499f85313e06ed..74c5036d725cec4c661c09db341b0715e66ad6f6 100644 (file)
@@ -102,7 +102,7 @@ QLayoutItem *FlowLayout::takeAt(int index)
        if ((index >= 0) && (index < itemList.size()))
                return itemList.takeAt(index);
        else
-               return 0;
+               return nullptr;
 }
 
 Qt::Orientations FlowLayout::expandingDirections() const
@@ -206,7 +206,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
 
        if (parent->isWidgetType()) {
                QWidget *pw = qobject_cast<QWidget*>(parent);
-               return pw->style()->pixelMetric(pm, 0, pw);
+               return pw->style()->pixelMetric(pm, nullptr, pw);
        } else
                return static_cast<QLayout*>(parent)->spacing();
 }