Fix clazy warnings
authorSoeren Apel <soeren@apelpie.net>
Wed, 20 Nov 2019 19:23:04 +0000 (20:23 +0100)
committerSoeren Apel <soeren@apelpie.net>
Sun, 24 Nov 2019 19:27:23 +0000 (20:27 +0100)
pv/mainwindow.cpp
pv/subwindows/decoder_selector/subwindow.cpp
pv/subwindows/subwindowbase.cpp
pv/widgets/wellarray.hpp

index e79b045945c1b255c18826ce9ee77723adfbd949..0b68b1d7a9a9b2530bd58872b119f3ad5ae65fe2 100644 (file)
@@ -261,7 +261,7 @@ shared_ptr<subwindows::SubWindowBase> MainWindow::add_subwindow(
        shared_ptr<subwindows::SubWindowBase> v;
 
        QMainWindow *main_window = nullptr;
-       for (auto entry : session_windows_)
+       for (auto& entry : session_windows_)
                if (entry.first.get() == &session)
                        main_window = entry.second;
 
@@ -304,7 +304,7 @@ shared_ptr<subwindows::SubWindowBase> MainWindow::add_subwindow(
                QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable);
 
        QAbstractButton *close_btn =
-               dock->findChildren<QAbstractButton*>
+               dock->findChildren<QAbstractButton*>  // clazy:exclude=detaching-temporary
                        ("qt_dockwidget_closebutton").front();
 
        connect(close_btn, SIGNAL(clicked(bool)),
@@ -868,7 +868,7 @@ void MainWindow::on_show_decoder_selector(Session *session)
 {
 #ifdef ENABLE_DECODE
        // Close dock widget if it's already showing and return
-       for (auto entry : sub_windows_) {
+       for (auto& entry : sub_windows_) {
                QDockWidget* dock = entry.first;
                shared_ptr<subwindows::SubWindowBase> decoder_selector =
                        dynamic_pointer_cast<subwindows::decoder_selector::SubWindow>(entry.second);
@@ -881,7 +881,7 @@ void MainWindow::on_show_decoder_selector(Session *session)
        }
 
        // We get a pointer and need a reference
-       for (shared_ptr<Session> s : sessions_)
+       for (shared_ptr<Session>& s : sessions_)
                if (s.get() == session)
                        add_subwindow(subwindows::SubWindowTypeDecoderSelector, *s);
 #endif
index 63cab9f94a6ab6f7ee9a026570107ed030c54c0b..0b49c34aa190af74235473839dec121ce2392651 100644 (file)
@@ -39,7 +39,8 @@ namespace subwindows {
 namespace decoder_selector {
 
 const char *initial_notice =
-       QT_TRANSLATE_NOOP("pv::subwindows::decoder_selector::SubWindow", "Select a decoder to see its description here.");
+       QT_TRANSLATE_NOOP("pv::subwindows::decoder_selector::SubWindow",
+               "Select a decoder to see its description here.");  // clazy:exclude=non-pod-global-static
 
 const int min_width_margin = 75;
 
index de08c4409ca452f7b5255b1c7ab69dfc46bee193..f81b35821e8b0cb4ae0d4472f6275518fb8d7472 100644 (file)
@@ -67,7 +67,7 @@ unordered_set< shared_ptr<data::SignalBase> > SubWindowBase::signalbases() const
 
 void SubWindowBase::clear_signalbases()
 {
-       for (shared_ptr<data::SignalBase> signalbase : signalbases_) {
+       for (const shared_ptr<data::SignalBase>& signalbase : signalbases_) {
                disconnect(signalbase.get(), SIGNAL(samples_cleared()),
                        this, SLOT(on_data_updated()));
                disconnect(signalbase.get(), SIGNAL(samples_added(uint64_t, uint64_t, uint64_t)),
index 4c67ca114d0f4ba236a4428bab30a7fcbdfa61bb..8b2e1ef2759b058d6ea647916fc3bd4c136c70d0 100644 (file)
@@ -52,8 +52,8 @@ struct WellArrayData;
 class WellArray : public QWidget
 {
     Q_OBJECT
-    Q_PROPERTY(int selectedColumn READ selectedColumn)  // clazy-exclude:qproperty-without-notify
-    Q_PROPERTY(int selectedRow READ selectedRow)  // clazy-exclude:qproperty-without-notify
+    Q_PROPERTY(int selectedColumn READ selectedColumn)  // clazy:exclude=qproperty-without-notify
+    Q_PROPERTY(int selectedRow READ selectedRow)  // clazy:exclude=qproperty-without-notify
 
 public:
     WellArray(int rows, int cols, QWidget* parent = nullptr);