From c14e8453649b002ecd9e31f63f3af3ee782a2aad Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 3 Feb 2023 14:42:03 -0500 Subject: Suppress/fix new warnings in clang-tidy 15 --- .clang-tidy | 3 +++ src/jalv_qt.cpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 89606da..7f72b15 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -5,6 +5,7 @@ Checks: > -*-named-parameter, -*-narrowing-conversions, -altera-*, + -bugprone-assignment-in-if-condition, -bugprone-branch-clone, -bugprone-easily-swappable-parameters, -cert-err33-c, @@ -24,6 +25,8 @@ Checks: > -llvm-header-guard, -llvmlibc-*, -misc-no-recursion, + -modernize-macro-to-enum, + -modernize-use-nodiscard, -modernize-use-trailing-return-type, -readability-function-cognitive-complexity, -readability-identifier-length, diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp index 5c3cd59..028d412 100644 --- a/src/jalv_qt.cpp +++ b/src/jalv_qt.cpp @@ -213,10 +213,10 @@ FlowLayout::doLayout(const QRect& rect, bool testOnly) const int bottom = 0; getContentsMargins(&left, &top, &right, &bottom); - QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); - int x = effectiveRect.x(); - int y = effectiveRect.y(); - int lineHeight = 0; + const QRect effectiveRect = rect.adjusted(+left, +top, -right, -bottom); + int x = effectiveRect.x(); + int y = effectiveRect.y(); + int lineHeight = 0; QLayoutItem* item = nullptr; foreach (item, itemList) { @@ -396,7 +396,7 @@ Control::Control(PortContainer portContainer, QWidget* parent) } // Find and set min, max and default values for port - float defaultValue = ndef ? lilv_node_as_float(ndef) : port->control; + const float defaultValue = ndef ? lilv_node_as_float(ndef) : port->control; setRange(lilv_node_as_float(nmin), lilv_node_as_float(nmax)); setValue(defaultValue); @@ -524,7 +524,7 @@ Control::stringWidth(const QString& str) void Control::dialChanged(int) { - float value = getValue(); + const float value = getValue(); label->setText(getValueLabel(value)); port->control = value; @@ -578,8 +578,8 @@ build_control_widget(Jalv* jalv) LilvNode* lastGroup = nullptr; QHBoxLayout* groupLayout = nullptr; for (int i = 0; i < portContainers.count(); ++i) { - PortContainer portContainer = portContainers[i]; - Port* port = portContainer.port; + const PortContainer portContainer = portContainers[i]; + Port* const port = portContainer.port; auto* const control = new Control(portContainer, nullptr); LilvNode* group = @@ -608,7 +608,7 @@ build_control_widget(Jalv* jalv) lilv_node_free(lastGroup); lastGroup = group; - uint32_t index = lilv_port_get_index(plugin, port->lilv_port); + const uint32_t index = lilv_port_get_index(plugin, port->lilv_port); jalv->ports[index].widget = control; } lilv_node_free(lastGroup); @@ -696,7 +696,7 @@ jalv_frontend_open(Jalv* jalv) auto* const timer = new Timer(jalv); timer->start(1000 / jalv->ui_update_hz); - int ret = app->exec(); + const int ret = app->exec(); zix_sem_post(&jalv->done); return ret; } -- cgit v1.2.1