From 93af06f69c1db6b7efc6ea95c2e9898525d707dd Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Thu, 7 Nov 2024 15:11:52 -0700 Subject: [PATCH] address cppcheck --- src/alfalfa/AlfalfaJSON.cpp | 2 +- src/alfalfa/test/AlfalfaJSON_GTest.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/alfalfa/AlfalfaJSON.cpp b/src/alfalfa/AlfalfaJSON.cpp index c8ddedb40e..edfd8bc02a 100644 --- a/src/alfalfa/AlfalfaJSON.cpp +++ b/src/alfalfa/AlfalfaJSON.cpp @@ -84,7 +84,7 @@ namespace alfalfa { Json::Value AlfalfaJSON_Impl::toJSON() const { Json::Value root; int i = 0; - for (auto& point : points()) { + for (const auto& point : points()) { // No guard here as the toJSON call will throw an exception if the id does not exist. root[i++] = point.toJSON(); } diff --git a/src/alfalfa/test/AlfalfaJSON_GTest.cpp b/src/alfalfa/test/AlfalfaJSON_GTest.cpp index 31ddd94bfe..f528eef5d8 100644 --- a/src/alfalfa/test/AlfalfaJSON_GTest.cpp +++ b/src/alfalfa/test/AlfalfaJSON_GTest.cpp @@ -196,7 +196,7 @@ TEST(AlfalfaJSON, json_serialization) { EXPECT_TRUE(parsing_success); EXPECT_EQ(alfalfa.toJSON(), root); int i = 0; - for (auto& point : alfalfa.points()) { + for (const auto& point : alfalfa.points()) { EXPECT_EQ(root[i++], point.toJSON()); } }