From: Thomas Markwalder Date: Thu, 28 Aug 2025 14:12:10 +0000 (-0400) Subject: [#3531] Addressed review comments X-Git-Tag: Kea-3.1.2~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95040b39837ddf7c8515b118b213e46b40242e53;p=thirdparty%2Fkea.git [#3531] Addressed review comments modified: src/bin/dhcp4/dhcp4_messages.mes modified: src/lib/util/str.cc modified: src/lib/util/tests/str_unittests.cc --- diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index de0b4308e1..9fd9cf45f9 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -907,7 +907,7 @@ Logged at debug log level 55. A debug message printing the details of the received packet. The first argument includes the client and the transaction identification information. Packet fields ciaddr, yiaddr, siaddr, giaddr, sname, and file -will be included not empty. +will be included when not empty. % DHCP4_QUERY_LABEL received query: %1 This information message indicates that a query was received. It displays @@ -1015,7 +1015,7 @@ to the client. The first argument contains the client and the transaction identification information. The second and third argument contains the packet name and type respectively. The fourth argument contains detailed packet information. Packet fields ciaddr, yiaddr, siaddr, giaddr, sname, -and file will be included not empty. +and file will be included when not empty. % DHCP4_RESPONSE_FQDN_DATA %1: including FQDN option in the server's response: %2 Logged at debug log level 55. diff --git a/src/lib/util/str.cc b/src/lib/util/str.cc index 843c135fb3..4198aa4a1f 100644 --- a/src/lib/util/str.cc +++ b/src/lib/util/str.cc @@ -351,13 +351,11 @@ std::string printOrDump(const std::vector& data, size_t max_dump) { auto it = data.begin(); bool print_it = true; - while (it != data.end() && *it != 0) { + for ( ; it != data.end() && *it != 0; ++it) { if (!isprint(*it)) { print_it = false; break; } - - ++it; } if (print_it && it != data.begin()) { @@ -367,7 +365,7 @@ printOrDump(const std::vector& data, size_t max_dump) { bool zeros = std::all_of(data.begin(), data.end(), [](int i) { return i==0; }); if (!zeros) { if (data.size() > max_dump) { - return (std::string(dumpAsHex(&data[0], max_dump) + std::string(".."))); + return (dumpAsHex(&data[0], max_dump) + std::string("..")); } return (dumpAsHex(&data[0], data.size())); diff --git a/src/lib/util/tests/str_unittests.cc b/src/lib/util/tests/str_unittests.cc index e1a87bb8f9..9e35086403 100644 --- a/src/lib/util/tests/str_unittests.cc +++ b/src/lib/util/tests/str_unittests.cc @@ -527,7 +527,7 @@ TEST_F(StringUtilTest, vectorIsPrintable) { EXPECT_FALSE(isPrintable(content)); } -// Verifies the printOrDUmp operates correctly. +// Verifies the printOrDump operates correctly. TEST_F(StringUtilTest, printOrDump) { struct Scenario { size_t line_;