From 03a692c88fd086d8bb2ad3fa4dbddb898bfd9bff Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sun, 25 Sep 2022 18:55:41 +0200 Subject: Fix failing cppcheck fixes https://github.com/AyatanaIndicators/ayatana-indicator-display/issues/58 --- src/exporter.cpp | 4 +++- tests/CMakeLists.txt | 2 +- tests/unit/adbd-client-test.cpp | 4 +++- tests/unit/usb-snap-test.cpp | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/exporter.cpp b/src/exporter.cpp index b3d586b..2db9a01 100644 --- a/src/exporter.cpp +++ b/src/exporter.cpp @@ -1,5 +1,6 @@ /* * Copyright 2014 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +16,7 @@ * * Authors: * Charles Kerr + * Robert Tari */ #include @@ -81,7 +83,7 @@ private: export_actions(m_indicator); - for (auto& profile : m_indicator->profiles()) + for (const auto& profile : m_indicator->profiles()) export_profile(m_indicator, profile); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4c1b9b8..33684d6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,7 +29,7 @@ endif() add_compile_options(${CXX_WARNING_ARGS}) -add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter) +add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem --suppress=uninitDerivedMemberVar --suppress=unmatchedSuppression --suppress=constParameter --suppress=unusedFunction) add_subdirectory(integration) add_subdirectory(unit) diff --git a/tests/unit/adbd-client-test.cpp b/tests/unit/adbd-client-test.cpp index b9e7a49..8e318d4 100644 --- a/tests/unit/adbd-client-test.cpp +++ b/tests/unit/adbd-client-test.cpp @@ -1,5 +1,6 @@ /* * Copyright 2016 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +16,7 @@ * * Authors: * Charles Kerr + * Robert Tari */ #include @@ -56,7 +58,7 @@ TEST_F(AdbdClientFixture, SocketPlumbing) const std::string expected_pk; AdbdClient::PKResponse response; const std::string expected_response; - } tests[] = { + } const tests[] = { { "PKHelloWorld", "HelloWorld", AdbdClient::PKResponse::ALLOW, "OK" }, { "PKHelloWorld", "HelloWorld", AdbdClient::PKResponse::DENY, "NO" }, { "PKFooBar", "FooBar", AdbdClient::PKResponse::ALLOW, "OK" }, diff --git a/tests/unit/usb-snap-test.cpp b/tests/unit/usb-snap-test.cpp index 05c797d..80b3929 100644 --- a/tests/unit/usb-snap-test.cpp +++ b/tests/unit/usb-snap-test.cpp @@ -1,5 +1,6 @@ /* * Copyright 2016 Canonical Ltd. + * Copyright 2022 Robert Tari * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +16,7 @@ * * Authors: * Charles Kerr + * Robert Tari */ #include @@ -68,7 +70,7 @@ TEST_F(UsbSnapFixture, TestRoundTrip) const char* fingerprint; const char* action_to_invoke; const AdbdClient::PKResponse expected_response; - } tests[] = { + } const tests[] = { { "Fingerprint", "allow", AdbdClient::PKResponse::ALLOW }, { "Fingerprint", "deny", AdbdClient::PKResponse::DENY } }; -- cgit v1.2.3