From: Andrei Pavel Date: Mon, 20 Oct 2025 13:30:40 +0000 (+0300) Subject: [#3451] Address Wshadow warnings from g++ X-Git-Tag: Kea-3.1.3~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f35f03669acf5561e33564156b475d562103a91;p=thirdparty%2Fkea.git [#3451] Address Wshadow warnings from g++ --- diff --git a/src/bin/d2/tests/d2_command_unittest.cc b/src/bin/d2/tests/d2_command_unittest.cc index 53a997d27e..68786c44a9 100644 --- a/src/bin/d2/tests/d2_command_unittest.cc +++ b/src/bin/d2/tests/d2_command_unittest.cc @@ -1418,8 +1418,8 @@ TEST_F(CtrlChannelD2Test, connectionTimeoutPartialCommand) { // Let's wait up to 15s for the server's response. The response // should arrive sooner assuming that the timeout mechanism for // the server is working properly. - const unsigned int timeout = 15; - ASSERT_TRUE(client->getResponse(response, timeout)); + const unsigned int timeout_15 = 15; + ASSERT_TRUE(client->getResponse(response, timeout_15)); // Explicitly close the client's connection. client->disconnectFromServer(); @@ -1466,8 +1466,8 @@ TEST_F(CtrlChannelD2Test, connectionTimeoutNoData) { // Let's wait up to 15s for the server's response. The response // should arrive sooner assuming that the timeout mechanism for // the server is working properly. - const unsigned int timeout = 15; - ASSERT_TRUE(client->getResponse(response, timeout)); + const unsigned int timeout_15 = 15; + ASSERT_TRUE(client->getResponse(response, timeout_15)); // Explicitly close the client's connection. client->disconnectFromServer(); diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index b1de5c68a8..ca8ce1164a 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -3341,10 +3341,10 @@ Dhcpv4Srv::assignLease(Dhcpv4Exchange& ex) { try { createNameChangeRequests(lease, ctx->old_lease_, *ex.getContext()->getDdnsParams()); - } catch (const Exception& ex) { + } catch (const Exception& exception) { LOG_ERROR(ddns4_logger, DHCP4_NCR_CREATION_FAILED) .arg(query->getLabel()) - .arg(ex.what()); + .arg(exception.what()); } } @@ -5000,11 +5000,11 @@ void Dhcpv4Srv::evaluateAdditionalClasses(Dhcpv4Exchange& ex) { // Matching: add the class query->addClass(cclass); } - } catch (const Exception& ex) { + } catch (const Exception& exception) { LOG_ERROR(dhcp4_logger, DHCP4_ADDITIONAL_CLASS_EVAL_ERROR) .arg(query->getLabel()) .arg(cclass) - .arg(ex.what()); + .arg(exception.what()); } } } diff --git a/src/bin/dhcp4/tests/config_backend_unittest.cc b/src/bin/dhcp4/tests/config_backend_unittest.cc index c1703b04bb..f450b2670b 100644 --- a/src/bin/dhcp4/tests/config_backend_unittest.cc +++ b/src/bin/dhcp4/tests/config_backend_unittest.cc @@ -62,10 +62,10 @@ protected: db2_.reset(new TestConfigBackendDHCPv4(params)); ConfigBackendDHCPv4Mgr::instance().registerBackendFactory("memfile", - [this](const DatabaseConnection::ParameterMap& params) + [this](const DatabaseConnection::ParameterMap& parameters) -> ConfigBackendDHCPv4Ptr { - auto host = params.find("host"); - if (host != params.end()) { + auto host = parameters.find("host"); + if (host != parameters.end()) { if (host->second == "db1") { return (db1_); } else if (host->second == "db2") { @@ -74,7 +74,7 @@ protected: } // Apparently we're looking for a new one. - return (TestConfigBackendDHCPv4Ptr(new TestConfigBackendDHCPv4(params))); + return (TestConfigBackendDHCPv4Ptr(new TestConfigBackendDHCPv4(parameters))); }); } diff --git a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc index 11a4adff30..a5ba6e3f13 100644 --- a/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc +++ b/src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc @@ -1027,7 +1027,9 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configSetLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* f) { + reinterpret_cast(f)->deleteFile(); + }); // Send the config-set command sendUnixCommand(os.str(), response); @@ -1860,7 +1862,9 @@ TEST_F(CtrlChannelDhcpv4SrvTest, configReloadLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* pf) { + reinterpret_cast(pf)->deleteFile(); + }); // Now tell Kea to reload its config. sendUnixCommand("{ \"command\": \"config-reload\" }", response); diff --git a/src/bin/dhcp4/tests/http_control_socket_unittest.cc b/src/bin/dhcp4/tests/http_control_socket_unittest.cc index ee901f162b..9e9f453eef 100644 --- a/src/bin/dhcp4/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp4/tests/http_control_socket_unittest.cc @@ -1326,7 +1326,9 @@ TEST_F(HttpCtrlChannelDhcpv4Test, configSetLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* f) { + reinterpret_cast(f)->deleteFile(); + }); // Send the config-set command sendHttpCommand(os.str(), response); @@ -1669,7 +1671,9 @@ TEST_F(HttpsCtrlChannelDhcpv4Test, configSetLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* f) { + reinterpret_cast(f)->deleteFile(); + }); // Send the config-set command sendHttpCommand(os.str(), response); @@ -2879,8 +2883,9 @@ BaseCtrlChannelDhcpv4Test::testConfigReloadLFCRunning() { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); - + std::unique_ptr p(static_cast(&pid_file), [](void* pf) { + reinterpret_cast(pf)->deleteFile(); + }); // This command should reload test8.json config. sendHttpCommand("{ \"command\": \"config-reload\" }", response); diff --git a/src/bin/dhcp4/tests/shared_network_unittest.cc b/src/bin/dhcp4/tests/shared_network_unittest.cc index 053102b1ac..c43d33b1d8 100644 --- a/src/bin/dhcp4/tests/shared_network_unittest.cc +++ b/src/bin/dhcp4/tests/shared_network_unittest.cc @@ -2947,12 +2947,12 @@ TEST_F(Dhcpv4SharedNetworkTest, precedenceReservation) { TEST_F(Dhcpv4SharedNetworkTest, authoritative) { // Each scenario will be defined using those parameters. - typedef struct scenario { + struct scenario { bool exp_success; AuthoritativeFlag global; AuthoritativeFlag subnet1; AuthoritativeFlag subnet2; - } scenario; + }; // We have the following scenarios. The default is no. // The only allowed combinations are those that end up with diff --git a/src/bin/dhcp6/tests/config_backend_unittest.cc b/src/bin/dhcp6/tests/config_backend_unittest.cc index ebcc241cb4..61509ac229 100644 --- a/src/bin/dhcp6/tests/config_backend_unittest.cc +++ b/src/bin/dhcp6/tests/config_backend_unittest.cc @@ -64,10 +64,10 @@ protected: db2_.reset(new TestConfigBackendDHCPv6(params)); ConfigBackendDHCPv6Mgr::instance().registerBackendFactory("memfile", - [this](const DatabaseConnection::ParameterMap& params) + [this](const DatabaseConnection::ParameterMap& parameters) -> ConfigBackendDHCPv6Ptr { - auto host = params.find("host"); - if (host != params.end()) { + auto host = parameters.find("host"); + if (host != parameters.end()) { if (host->second == "db1") { return (db1_); } else if (host->second == "db2") { @@ -76,7 +76,7 @@ protected: } // Apparently we're looking for a new one. - return (TestConfigBackendDHCPv6Ptr(new TestConfigBackendDHCPv6(params))); + return (TestConfigBackendDHCPv6Ptr(new TestConfigBackendDHCPv6(parameters))); }); } diff --git a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc index 0134ff17ca..196c7eedaf 100644 --- a/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc +++ b/src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc @@ -1039,7 +1039,9 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configSetLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* f) { + reinterpret_cast(f)->deleteFile(); + }); // Send the config-set command sendUnixCommand(os.str(), response); @@ -1844,15 +1846,14 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configReloadLFCRunning) { " { \"subnet\": \"2001:db8:2::/64\", \"id\": 2 }" " ]," " \"lease-database\": {" - " \"type\": \"memfile\", \"persist\": false }" "} }"; ofstream f("test8.json", ios::trunc); f << cfg_txt; f.close(); - // Create the backend configuration. + // Creuate the backend configuration. DatabaseConnection::ParameterMap pmap; - pmap["type"] = "memfile"; + pmap["teype"] = "memfile"; pmap["universe"] = "6"; pmap["name"] = getLeaseFilePath("kea-leases6.csv"); pmap["lfc-interval"] = "1"; @@ -1863,7 +1864,9 @@ TEST_F(CtrlChannelDhcpv6SrvTest, configReloadLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* pf) { + reinterpret_cast(pf)->deleteFile(); + }); // Now tell Kea to reload its config. sendUnixCommand("{ \"command\": \"config-reload\" }", response); diff --git a/src/bin/dhcp6/tests/http_control_socket_unittest.cc b/src/bin/dhcp6/tests/http_control_socket_unittest.cc index a9dae620bc..7124a04e13 100644 --- a/src/bin/dhcp6/tests/http_control_socket_unittest.cc +++ b/src/bin/dhcp6/tests/http_control_socket_unittest.cc @@ -1345,7 +1345,9 @@ TEST_F(HttpCtrlChannelDhcpv6Test, configSetLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* f) { + reinterpret_cast(f)->deleteFile(); + }); // Send the config-set command sendHttpCommand(os.str(), response); @@ -1690,7 +1692,9 @@ TEST_F(HttpsCtrlChannelDhcpv6Test, configSetLFCRunning) { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); + std::unique_ptr p(static_cast(&pid_file), [](void* f) { + reinterpret_cast(f)->deleteFile(); + }); // Send the config-set command sendHttpCommand(os.str(), response); @@ -2877,8 +2881,9 @@ BaseCtrlChannelDhcpv6Test::testConfigReloadLFCRunning() { PIDFile pid_file(Memfile_LeaseMgr::appendSuffix(pmap["name"], Memfile_LeaseMgr::FILE_PID)); pid_file.write(); - std::unique_ptr p(static_cast(&pid_file), [](void* p) { reinterpret_cast(p)->deleteFile(); }); - + std::unique_ptr p(static_cast(&pid_file), [](void* pf) { + reinterpret_cast(pf)->deleteFile(); + }); // This command should reload test8.json config. sendHttpCommand("{ \"command\": \"config-reload\" }", response); diff --git a/src/hooks/d2/gss_tsig/tests/gss_tsig_impl_unittests.cc b/src/hooks/d2/gss_tsig/tests/gss_tsig_impl_unittests.cc index 958a7a0378..c0f56c54c1 100644 --- a/src/hooks/d2/gss_tsig/tests/gss_tsig_impl_unittests.cc +++ b/src/hooks/d2/gss_tsig/tests/gss_tsig_impl_unittests.cc @@ -220,9 +220,9 @@ TEST_F(GssTsigImplTest, envVars) { char* ktname = getenv("KRB5_CLIENT_KTNAME"); ASSERT_TRUE(ktname); EXPECT_EQ("foo", string(ktname)); - char* ccname = getenv("KRB5CCNAME"); - ASSERT_TRUE(ccname); - EXPECT_EQ("bar", string(ccname)); + char* krb5ccname = getenv("KRB5CCNAME"); + ASSERT_TRUE(krb5ccname); + EXPECT_EQ("bar", string(krb5ccname)); } /// @brief Tests status-get command processed handler. diff --git a/src/hooks/dhcp/high_availability/ha_service.cc b/src/hooks/dhcp/high_availability/ha_service.cc index 6ee2156ee6..9321637733 100644 --- a/src/hooks/dhcp/high_availability/ha_service.cc +++ b/src/hooks/dhcp/high_availability/ha_service.cc @@ -1457,13 +1457,13 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, request, response, [this, weak_query, parking_lot, config] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { // Get the shared pointer of the query. The server should keep the // pointer to the query and then park it. Therefore, we don't really // expect it to be null. If it is null, something is really wrong. - QueryPtrType query = weak_query.lock(); - if (!query) { + QueryPtrType query_ptr = weak_query.lock(); + if (!query_ptr) { isc_throw(Unexpected, "query is null while receiving response from" " HA peer. This is programmatic error"); } @@ -1483,7 +1483,7 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, if (ec || !error_str.empty()) { LOG_WARN(ha_logger, HA_LEASE_UPDATE_COMMUNICATIONS_FAILED) .arg(config_->getThisServerName()) - .arg(query->getLabel()) + .arg(query_ptr->getLabel()) .arg(config->getLogLabel()) .arg(ec ? ec.message() : error_str); @@ -1495,20 +1495,20 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, try { int rcode = 0; - auto args = verifyAsyncResponse(response, rcode); + auto args = verifyAsyncResponse(http_response, rcode); // In the v6 case the server may return a list of failed lease // updates and we should log them. - logFailedLeaseUpdates(query, args); + logFailedLeaseUpdates(query_ptr, args); } catch (const ConflictError& ex) { // Handle forth group of errors. lease_update_conflict = true; lease_update_success = false; - communication_state_->reportRejectedLeaseUpdate(query); + communication_state_->reportRejectedLeaseUpdate(query_ptr); LOG_WARN(ha_logger, HA_LEASE_UPDATE_CONFLICT) .arg(config_->getThisServerName()) - .arg(query->getLabel()) + .arg(query_ptr->getLabel()) .arg(config->getLogLabel()) .arg(ex.what()); @@ -1516,7 +1516,7 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, // Handle third group of errors. LOG_WARN(ha_logger, HA_LEASE_UPDATE_FAILED) .arg(config_->getThisServerName()) - .arg(query->getLabel()) + .arg(query_ptr->getLabel()) .arg(config->getLogLabel()) .arg(ex.what()); @@ -1541,7 +1541,7 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, } else { // Lease update successful and we may need to clear some previously // rejected lease updates. - communication_state_->reportSuccessfulLeaseUpdate(query); + communication_state_->reportSuccessfulLeaseUpdate(query_ptr); } } @@ -1554,7 +1554,7 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, // case the DHCP exchange fails. if (!lease_update_success) { if (parking_lot) { - parking_lot->drop(query); + parking_lot->drop(query_ptr); } } } else { @@ -1563,7 +1563,7 @@ HAService::asyncSendLeaseUpdate(const QueryPtrType& query, return; } - if (leaseUpdateComplete(query, parking_lot)) { + if (leaseUpdateComplete(query_ptr, parking_lot)) { // If we have finished sending the lease updates we need to run the // state machine until the state machine finds that additional events // are required, such as next heartbeat or a lease update. The runModel() @@ -1643,9 +1643,7 @@ HAService::logFailedLeaseUpdates(const PktPtr& query, // Instead of duplicating the code between the failed-deleted-leases and // failed-leases, let's just have one function that does it for both. - auto log_proc = [](const PktPtr query, const ConstElementPtr& args, - const std::string& param_name, const log::MessageID& mesid) { - + auto log_proc = [query, args](const std::string& param_name, const log::MessageID& mesid) { // Check if there are any failed leases. auto failed_leases = args->get(param_name); @@ -1679,10 +1677,10 @@ HAService::logFailedLeaseUpdates(const PktPtr& query, }; // Process "failed-deleted-leases" - log_proc(query, args, "failed-deleted-leases", HA_LEASE_UPDATE_DELETE_FAILED_ON_PEER); + log_proc("failed-deleted-leases", HA_LEASE_UPDATE_DELETE_FAILED_ON_PEER); // Process "failed-leases". - log_proc(query, args, "failed-leases", HA_LEASE_UPDATE_CREATE_UPDATE_FAILED_ON_PEER); + log_proc("failed-leases", HA_LEASE_UPDATE_CREATE_UPDATE_FAILED_ON_PEER); } ConstElementPtr @@ -1808,7 +1806,7 @@ HAService::asyncSendHeartbeat() { request, response, [this, partner_config, sync_complete_notified] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { // There are three possible groups of errors during the heartbeat. @@ -1834,7 +1832,7 @@ HAService::asyncSendHeartbeat() { // Response must contain arguments and the arguments must // be a map. int rcode = 0; - ConstElementPtr args = verifyAsyncResponse(response, rcode); + ConstElementPtr args = verifyAsyncResponse(http_response, rcode); if (!args || args->getType() != Element::map) { isc_throw(CtrlChannelError, "returned arguments in the response" " must be a map"); @@ -1974,7 +1972,7 @@ HAService::asyncDisableDHCPService(HttpClient& http_client, request, response, [this, remote_config, post_request_action] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { // There are three possible groups of errors during the heartbeat. @@ -1998,7 +1996,7 @@ HAService::asyncDisableDHCPService(HttpClient& http_client, // Handle third group of errors. try { - static_cast(verifyAsyncResponse(response, rcode)); + static_cast(verifyAsyncResponse(http_response, rcode)); } catch (const std::exception& ex) { error_message = ex.what(); @@ -2052,7 +2050,7 @@ HAService::asyncEnableDHCPService(HttpClient& http_client, request, response, [this, remote_config, post_request_action] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { // There are three possible groups of errors during the heartbeat. @@ -2076,7 +2074,7 @@ HAService::asyncEnableDHCPService(HttpClient& http_client, // Handle third group of errors. try { - static_cast(verifyAsyncResponse(response, rcode)); + static_cast(verifyAsyncResponse(http_response, rcode)); } catch (const std::exception& ex) { error_message = ex.what(); @@ -2197,12 +2195,12 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, request, response, [this, remote_config, post_sync_action, &http_client, max_period, dhcp_disabled] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { // Holds last lease received on the page of leases. If the last // page was hit, this value remains null. - LeasePtr last_lease; + LeasePtr last_lease_in_callback; // There are three possible groups of errors during the heartbeat. // One is the IO error causing issues in communication with the peer. @@ -2224,7 +2222,7 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, // Handle third group of errors. try { int rcode = 0; - ConstElementPtr args = verifyAsyncResponse(response, rcode); + ConstElementPtr args = verifyAsyncResponse(http_response, rcode); // Arguments must be a map. if (args && (args->getType() != Element::map)) { @@ -2260,7 +2258,7 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, // lease4-get-page command. if ((leases_element.size() >= config_->getSyncPageLimit()) && (l + 1 == leases_element.end())) { - last_lease = boost::dynamic_pointer_cast(lease); + last_lease_in_callback = boost::dynamic_pointer_cast(lease); } if (!lease_sync_filter_.shouldSync(lease)) { @@ -2299,7 +2297,7 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, // lease6-get-page command. if ((leases_element.size() >= config_->getSyncPageLimit()) && (l + 1 == leases_element.end())) { - last_lease = boost::dynamic_pointer_cast(lease); + last_lease_in_callback = boost::dynamic_pointer_cast(lease); } if (!lease_sync_filter_.shouldSync(lease)) { @@ -2358,10 +2356,10 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client, if (!error_message.empty()) { communication_state_->setPartnerUnavailable(); - } else if (last_lease) { + } else if (last_lease_in_callback) { // This indicates that there are more leases to be fetched. // Therefore, we have to send another leaseX-get-page command. - asyncSyncLeases(http_client, remote_config, max_period, last_lease, + asyncSyncLeases(http_client, remote_config, max_period, last_lease_in_callback, post_sync_action, dhcp_disabled); return; } @@ -2428,22 +2426,22 @@ HAService::synchronize(std::string& status_message, // partner. if (success) { asyncSyncCompleteNotify(client, remote_config, - [&](const bool success, - const std::string& error_message, + [&](const bool /* success */, + const std::string& error_message_1, const int rcode) { // This command may not be supported by the partner when it // runs an older Kea version. In that case, send the dhcp-enable // command as in previous Kea version. if (rcode == CONTROL_RESULT_COMMAND_UNSUPPORTED) { asyncEnableDHCPService(client, remote_config, - [&](const bool success, - const std::string& error_message, + [&](const bool is_success, + const std::string& error_message_2, const int) { // It is possible that we have already recorded an error // message while synchronizing the lease database. Don't // override the existing error message. - if (!success && status_message.empty()) { - status_message = error_message; + if (!is_success && status_message.empty()) { + status_message = error_message_2; } // The synchronization process is completed, so let's break @@ -2456,7 +2454,7 @@ HAService::synchronize(std::string& status_message, // ha-sync-complete-notify command was delivered to the partner. // The synchronization process ends here. if (!success && status_message.empty()) { - status_message = error_message; + status_message = error_message_1; } io_service->stop(); @@ -2469,11 +2467,11 @@ HAService::synchronize(std::string& status_message, // ha-sync-complete-notify command in this case. It is only sent in // the case when synchronization ends successfully. asyncEnableDHCPService(client, remote_config, - [&](const bool success, - const std::string& error_message, + [&](const bool is_success, + const std::string& error_message_1, const int) { - if (!success && status_message.empty()) { - status_message = error_message; + if (!is_success && status_message.empty()) { + status_message = error_message_1; } // The synchronization process is completed, so let's break @@ -2574,7 +2572,7 @@ HAService::asyncSendLeaseUpdatesFromBacklog(HttpClient& http_client, request, response, [this, &http_client, config, post_request_action] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { int rcode = 0; @@ -2590,7 +2588,7 @@ HAService::asyncSendLeaseUpdatesFromBacklog(HttpClient& http_client, } else { // Handle third group of errors. try { - auto args = verifyAsyncResponse(response, rcode); + auto args = verifyAsyncResponse(http_response, rcode); } catch (const std::exception& ex) { error_message = ex.what(); LOG_WARN(ha_logger, HA_LEASES_BACKLOG_FAILED) @@ -2684,7 +2682,7 @@ HAService::asyncSendHAReset(HttpClient& http_client, request, response, [this, config, post_request_action] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { int rcode = 0; @@ -2700,7 +2698,7 @@ HAService::asyncSendHAReset(HttpClient& http_client, } else { // Handle third group of errors. try { - auto args = verifyAsyncResponse(response, rcode); + auto args = verifyAsyncResponse(http_response, rcode); } catch (const std::exception& ex) { error_message = ex.what(); LOG_WARN(ha_logger, HA_RESET_FAILED) @@ -2856,7 +2854,7 @@ HAService::processMaintenanceStart() { [this, remote_config, &io_service, &captured_ec, &captured_error_message, &captured_rcode] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { io_service->stop(); @@ -2881,7 +2879,7 @@ HAService::processMaintenanceStart() { // Handle third group of errors. try { - static_cast(verifyAsyncResponse(response, captured_rcode)); + static_cast(verifyAsyncResponse(http_response, captured_rcode)); } catch (const std::exception& ex) { error_message = ex.what(); @@ -2990,7 +2988,7 @@ HAService::processMaintenanceCancel() { request, response, [this, remote_config, &io_service, &error_message] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { io_service->stop(); @@ -3008,7 +3006,7 @@ HAService::processMaintenanceCancel() { // Handle third group of errors. try { int rcode = 0; - ConstElementPtr args = verifyAsyncResponse(response, rcode); + ConstElementPtr args = verifyAsyncResponse(http_response, rcode); // Partner's state has changed after the notification. However, we don't know // its new state. We'll check if the partner returned its state. If it didn't, @@ -3102,7 +3100,7 @@ HAService::asyncSyncCompleteNotify(HttpClient& http_client, request, response, [this, remote_config, post_request_action] (const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& error_str) { // There are three possible groups of errors. One is the IO error @@ -3126,7 +3124,7 @@ HAService::asyncSyncCompleteNotify(HttpClient& http_client, // Handle third group of errors. try { - static_cast(verifyAsyncResponse(response, rcode)); + static_cast(verifyAsyncResponse(http_response, rcode)); } catch (const CommandUnsupportedError& ex) { rcode = CONTROL_RESULT_COMMAND_UNSUPPORTED; diff --git a/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc b/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc index 0d39c88803..4e4e557c8a 100644 --- a/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc +++ b/src/hooks/dhcp/mysql/mysql_cb_dhcp4.cc @@ -2682,13 +2682,13 @@ public: // reporting the parsing error. The dependency check is performed later // at the database level. parser.parse(expression, Element::create(client_class->getTest()), AF_INET, - [&dependencies, &depend_on_known](const ClientClass& client_class) -> bool { - if (isClientClassBuiltIn(client_class)) { - if ((client_class == "KNOWN") || (client_class == "UNKNOWN")) { + [&dependencies, &depend_on_known](const ClientClass& cc) -> bool { + if (isClientClassBuiltIn(cc)) { + if ((cc == "KNOWN") || (cc == "UNKNOWN")) { depend_on_known = true; } } else { - dependencies.push_back(client_class); + dependencies.push_back(cc); } return (true); }); diff --git a/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc b/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc index 6b337da757..f30ea0eb0f 100644 --- a/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc +++ b/src/hooks/dhcp/mysql/mysql_cb_dhcp6.cc @@ -3078,13 +3078,13 @@ public: // reporting the parsing error. The dependency check is performed later // at the database level. parser.parse(expression, Element::create(client_class->getTest()), AF_INET6, - [&dependencies, &depend_on_known](const ClientClass& client_class) -> bool { - if (isClientClassBuiltIn(client_class)) { - if ((client_class == "KNOWN") || (client_class == "UNKNOWN")) { + [&dependencies, &depend_on_known](const ClientClass& cc) -> bool { + if (isClientClassBuiltIn(cc)) { + if ((cc == "KNOWN") || (cc == "UNKNOWN")) { depend_on_known = true; } } else { - dependencies.push_back(client_class); + dependencies.push_back(cc); } return (true); }); diff --git a/src/hooks/dhcp/mysql/mysql_cb_impl.cc b/src/hooks/dhcp/mysql/mysql_cb_impl.cc index aa5f63f17b..18224dd409 100644 --- a/src/hooks/dhcp/mysql/mysql_cb_impl.cc +++ b/src/hooks/dhcp/mysql/mysql_cb_impl.cc @@ -315,9 +315,9 @@ MySqlConfigBackendImpl::getGlobalParameters(const int index, // tag is provided), it takes precedence over the same parameter // specified for all servers. Therefore, we check if the given // parameter already exists and belongs to 'all'. - auto& index = local_parameters.get(); - auto existing = index.find(name); - if (existing != index.end()) { + auto& name_index = local_parameters.get(); + auto existing = name_index.find(name); + if (existing != name_index.end()) { // This parameter was already fetched. Let's check if we should // replace it or not. if (!last_param_server_tag.amAll() && (*existing)->hasAllServerTag()) { @@ -332,7 +332,7 @@ MySqlConfigBackendImpl::getGlobalParameters(const int index, // If there is no such parameter yet or the existing parameter // belongs to a different server and the inserted parameter is // not for all servers. - if ((existing == index.end()) || + if ((existing == name_index.end()) || (!(*existing)->hasServerTag(last_param_server_tag) && !last_param_server_tag.amAll())) { local_parameters.insert(last_param); @@ -448,8 +448,8 @@ MySqlConfigBackendImpl::getOptionDefs(const int index, // the same option definition specified for all servers. // Therefore, we check if the given option already exists and // belongs to 'all'. - auto& index = local_option_defs.get<1>(); - auto existing_it_pair = index.equal_range(last_def->getCode()); + auto& code_index = local_option_defs.get<1>(); + auto existing_it_pair = code_index.equal_range(last_def->getCode()); auto existing_it = existing_it_pair.first; bool found = false; for ( ; existing_it != existing_it_pair.second; ++existing_it) { @@ -458,7 +458,7 @@ MySqlConfigBackendImpl::getOptionDefs(const int index, // This option definition was already fetched. Let's check // if we should replace it or not. if (!last_def_server_tag.amAll() && (*existing_it)->hasAllServerTag()) { - index.replace(existing_it, last_def); + code_index.replace(existing_it, last_def); return; } break; @@ -793,8 +793,8 @@ MySqlConfigBackendImpl::getOptions(const int index, // tag is provided), it takes precedence over the same option // specified for all servers. Therefore, we check if the given // option already exists and belongs to 'all'. - auto& index = local_options.get<1>(); - auto existing_it_pair = index.equal_range(desc->option_->getType()); + auto& type_index = local_options.get<1>(); + auto existing_it_pair = type_index.equal_range(desc->option_->getType()); auto existing_it = existing_it_pair.first; bool found = false; for ( ; existing_it != existing_it_pair.second; ++existing_it) { @@ -804,7 +804,7 @@ MySqlConfigBackendImpl::getOptions(const int index, // This option was already fetched. Let's check if we should // replace it or not. if (!last_option_server_tag.amAll() && existing_it->hasAllServerTag()) { - index.replace(existing_it, *desc); + type_index.replace(existing_it, *desc); return; } break; diff --git a/src/hooks/dhcp/perfmon/perfmon_mgr.cc b/src/hooks/dhcp/perfmon/perfmon_mgr.cc index dcd044fcac..2841218d6f 100644 --- a/src/hooks/dhcp/perfmon/perfmon_mgr.cc +++ b/src/hooks/dhcp/perfmon/perfmon_mgr.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2024-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -28,8 +28,8 @@ using namespace isc::stats; using namespace isc::util; using namespace boost::posix_time; -PerfMonMgr::PerfMonMgr(uint16_t family_) - : PerfMonConfig(family_), mutex_(new std::mutex) { +PerfMonMgr::PerfMonMgr(uint16_t family) + : PerfMonConfig(family), mutex_(new std::mutex) { init(); } diff --git a/src/hooks/dhcp/pgsql/pgsql_cb_impl.cc b/src/hooks/dhcp/pgsql/pgsql_cb_impl.cc index 5e8a0e103d..f1fecdc7fa 100644 --- a/src/hooks/dhcp/pgsql/pgsql_cb_impl.cc +++ b/src/hooks/dhcp/pgsql/pgsql_cb_impl.cc @@ -295,9 +295,9 @@ PgSqlConfigBackendImpl::getGlobalParameters(const int index, // specified for all servers. Therefore, we check if the given // parameter already exists and belongs to 'all'. ServerTag last_param_server_tag(server_tag_str); - auto& index = local_parameters.get(); - auto existing = index.find(name); - if (existing != index.end()) { + auto& name_index = local_parameters.get(); + auto existing = name_index.find(name); + if (existing != name_index.end()) { // This parameter was already fetched. Let's check if we should // replace it or not. if (!last_param_server_tag.amAll() && (*existing)->hasAllServerTag()) { @@ -312,7 +312,7 @@ PgSqlConfigBackendImpl::getGlobalParameters(const int index, // If there is no such parameter yet or the existing parameter // belongs to a different server and the inserted parameter is // not for all servers. - if ((existing == index.end()) || + if ((existing == name_index.end()) || (!(*existing)->hasServerTag(last_param_server_tag) && !last_param_server_tag.amAll())) { local_parameters.insert(last_param); @@ -413,8 +413,8 @@ PgSqlConfigBackendImpl::getOptionDefs(const int index, // the same option definition specified for all servers. // Therefore, we check if the given option already exists and // belongs to 'all'. - auto& index = local_option_defs.get<1>(); - auto existing_it_pair = index.equal_range(last_def->getCode()); + auto& code_index = local_option_defs.get<1>(); + auto existing_it_pair = code_index.equal_range(last_def->getCode()); auto existing_it = existing_it_pair.first; bool found = false; for ( ; existing_it != existing_it_pair.second; ++existing_it) { @@ -423,7 +423,7 @@ PgSqlConfigBackendImpl::getOptionDefs(const int index, // This option definition was already fetched. Let's check // if we should replace it or not. if (!last_def_server_tag.amAll() && (*existing_it)->hasAllServerTag()) { - index.replace(existing_it, last_def); + code_index.replace(existing_it, last_def); return; } break; @@ -723,8 +723,8 @@ PgSqlConfigBackendImpl::getOptions(const int index, // tag is provided), it takes precedence over the same option // specified for all servers. Therefore, we check if the given // option already exists and belongs to 'all'. - auto& index = local_options.get<1>(); - auto existing_it_pair = index.equal_range(desc->option_->getType()); + auto& type_index = local_options.get<1>(); + auto existing_it_pair = type_index.equal_range(desc->option_->getType()); auto existing_it = existing_it_pair.first; bool found = false; for ( ; existing_it != existing_it_pair.second; ++existing_it) { @@ -734,7 +734,7 @@ PgSqlConfigBackendImpl::getOptions(const int index, // This option was already fetched. Let's check if we should // replace it or not. if (!last_option_server_tag.amAll() && existing_it->hasAllServerTag()) { - index.replace(existing_it, *desc); + type_index.replace(existing_it, *desc); return; } break; diff --git a/src/hooks/dhcp/radius/tests/access_unittests.cc b/src/hooks/dhcp/radius/tests/access_unittests.cc index d97fe16f14..17980fbf3e 100644 --- a/src/hooks/dhcp/radius/tests/access_unittests.cc +++ b/src/hooks/dhcp/radius/tests/access_unittests.cc @@ -517,9 +517,9 @@ AccessTest::server() { IntervalTimer::ONE_SHOT); // Get the requests. - auto receive_handler = [this](boost::system::error_code ec, size_t size) { + auto receive_handler = [this](boost::system::error_code erc, size_t size) { lock_guard lock(mutex_); - error_codes_.push_back(ec); + error_codes_.push_back(erc); sizes_.push_back(size); }; vector clients(expected_received_); diff --git a/src/hooks/dhcp/radius/tests/accounting_unittests.cc b/src/hooks/dhcp/radius/tests/accounting_unittests.cc index 9af3040647..3cb8357ee7 100644 --- a/src/hooks/dhcp/radius/tests/accounting_unittests.cc +++ b/src/hooks/dhcp/radius/tests/accounting_unittests.cc @@ -577,9 +577,9 @@ AccountingTest::server() { IntervalTimer::ONE_SHOT); // Get the requests. - auto receive_handler = [this](boost::system::error_code ec, size_t size) { + auto receive_handler = [this](boost::system::error_code erc, size_t size) { lock_guard lock(mutex_); - error_codes_.push_back(ec); + error_codes_.push_back(erc); sizes_.push_back(size); }; vector clients(expected_received_); diff --git a/src/hooks/dhcp/radius/tests/attribute_test.cc b/src/hooks/dhcp/radius/tests/attribute_test.cc index dc3e0c45f4..fdca70de4c 100644 --- a/src/hooks/dhcp/radius/tests/attribute_test.cc +++ b/src/hooks/dhcp/radius/tests/attribute_test.cc @@ -45,8 +45,8 @@ AttributeTest::compare(ConstAttributePtr first, ConstAttributePtr second) { bool AttributeTest::compare(const Attributes& first, const Attributes& second) { - auto f = [&](ConstAttributePtr first, ConstAttributePtr second) { - return (AttributeTest::compare(first, second)); + auto f = [&](ConstAttributePtr first_attr, ConstAttributePtr second_attr) { + return (AttributeTest::compare(first_attr, second_attr)); }; return (std::equal(first.cbegin(), first.cend(), second.cbegin(), second.cend(), f)); } diff --git a/src/hooks/dhcp/subnet_cmds/subnet_cmds.cc b/src/hooks/dhcp/subnet_cmds/subnet_cmds.cc index 5cc4dc6ef0..1b7bec8680 100644 --- a/src/hooks/dhcp/subnet_cmds/subnet_cmds.cc +++ b/src/hooks/dhcp/subnet_cmds/subnet_cmds.cc @@ -161,7 +161,6 @@ public: /// @brief function which returns true if the pair of option elements /// refer to the same option in the configuration. auto const& option_match = [&](ElementPtr& left, ElementPtr& right) -> bool { - std::string space = space_; std::string left_space = space; std::string right_space = space; if (left->get("space")) { diff --git a/src/lib/asiolink/asio_wrapper.h b/src/lib/asiolink/asio_wrapper.h index e037678bc3..b00967524c 100644 --- a/src/lib/asiolink/asio_wrapper.h +++ b/src/lib/asiolink/asio_wrapper.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2022 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/src/lib/asiolink/testutils/botan_sample_client.cc b/src/lib/asiolink/testutils/botan_sample_client.cc index 7c05db616b..56163bedb2 100644 --- a/src/lib/asiolink/testutils/botan_sample_client.cc +++ b/src/lib/asiolink/testutils/botan_sample_client.cc @@ -178,12 +178,12 @@ private: { boost::asio::async_read(socket_, boost::asio::buffer(reply_, length), - [this](const boost::system::error_code& error, std::size_t length) + [this](const boost::system::error_code& error, std::size_t len) { if (!error) { std::cout << "Reply: "; - std::cout.write(reply_, length); + std::cout.write(reply_, len); std::cout << "\n"; } else diff --git a/src/lib/asiolink/testutils/openssl_sample_client.cc b/src/lib/asiolink/testutils/openssl_sample_client.cc index 36f1dcddb0..8da8ff5a0c 100644 --- a/src/lib/asiolink/testutils/openssl_sample_client.cc +++ b/src/lib/asiolink/testutils/openssl_sample_client.cc @@ -121,12 +121,12 @@ private: { boost::asio::async_read(socket_, boost::asio::buffer(reply_, length), - [this](const boost::system::error_code& error, std::size_t length) + [this](const boost::system::error_code& error, std::size_t len) { if (!error) { std::cout << "Reply: "; - std::cout.write(reply_, length); + std::cout.write(reply_, len); std::cout << "\n"; } else diff --git a/src/lib/config/unix_command_mgr.cc b/src/lib/config/unix_command_mgr.cc index 102047656d..02053c0044 100644 --- a/src/lib/config/unix_command_mgr.cc +++ b/src/lib/config/unix_command_mgr.cc @@ -365,7 +365,9 @@ Connection::receiveHandler(const boost::system::error_code& ec, defer_shutdown_ = true; - std::unique_ptr p(this, [](Connection* p) { p->defer_shutdown_ = false; }); + std::unique_ptr p(this, [](Connection* c) { + c->defer_shutdown_ = false; + }); // Cancel the timer to make sure that long lasting command // processing doesn't cause the timeout. diff --git a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc index 90aa61eebe..088ca7be2f 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr4_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -58,9 +58,9 @@ public: mgr().registerPacketQueueFactory(queue_type, [](data::ConstElementPtr parameters) -> PacketQueue4Ptr { - std::string queue_type ; + std::string queue_type_from_parameters; try { - queue_type = data::SimpleParser::getString(parameters, "queue-type"); + queue_type_from_parameters = data::SimpleParser::getString(parameters, "queue-type"); } catch (const std::exception& ex) { isc_throw(InvalidQueueParameter, "queue-type missing or invalid: " << ex.what()); @@ -74,7 +74,7 @@ public: "'capacity' missing or invalid: " << ex.what()); } - return (PacketQueue4Ptr(new PacketQueueRing4(queue_type, capacity))); + return (PacketQueue4Ptr(new PacketQueueRing4(queue_type_from_parameters, capacity))); }); return did_it; diff --git a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc index b97f7e9fde..178445bb9b 100644 --- a/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue_mgr6_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -47,9 +47,9 @@ public: mgr().registerPacketQueueFactory(queue_type, [](data::ConstElementPtr parameters) -> PacketQueue6Ptr { - std::string queue_type ; + std::string queue_type_from_parameters; try { - queue_type = data::SimpleParser::getString(parameters, "queue-type"); + queue_type_from_parameters = data::SimpleParser::getString(parameters, "queue-type"); } catch (const std::exception& ex) { isc_throw(InvalidQueueParameter, "queue-type missing or invalid: " << ex.what()); @@ -63,7 +63,7 @@ public: "'capacity' missing or invalid: " << ex.what()); } - return (PacketQueue6Ptr(new PacketQueueRing6(queue_type, capacity))); + return (PacketQueue6Ptr(new PacketQueueRing6(queue_type_from_parameters, capacity))); }); return did_it; diff --git a/src/lib/dhcp_ddns/ncr_io.cc b/src/lib/dhcp_ddns/ncr_io.cc index a629d1d086..0823325a98 100644 --- a/src/lib/dhcp_ddns/ncr_io.cc +++ b/src/lib/dhcp_ddns/ncr_io.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2013-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -125,7 +125,7 @@ NameChangeListener::invokeRecvHandler(const Result result, if (amListening()) { try { receiveNext(); - } catch (const isc::Exception& ex) { + } catch (const isc::Exception& isc_ex) { // It is possible though unlikely, for doReceive to fail without // scheduling the read. While, unlikely, it does mean the callback // will not get called with a failure. A throw here would surface @@ -133,7 +133,7 @@ NameChangeListener::invokeRecvHandler(const Result result, // close the window by invoking the application handler with // a failed result, and let the application layer sort it out. LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_NCR_RECV_NEXT_ERROR) - .arg(ex.what()); + .arg(isc_ex.what()); // Call the registered application layer handler. // Surround the invocation with a try-catch. The invoked handler is @@ -143,10 +143,10 @@ NameChangeListener::invokeRecvHandler(const Result result, try { io_pending_ = false; (*recv_handler_)(ERROR, empty); - } catch (const std::exception& ex) { + } catch (const std::exception& std_ex) { LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_UNCAUGHT_NCR_RECV_HANDLER_ERROR) - .arg(ex.what()); + .arg(std_ex.what()); } } } @@ -337,7 +337,7 @@ NameChangeSender::invokeSendHandlerInternal(const NameChangeSender::Result resul if (amSending()) { sendNext(); } - } catch (const isc::Exception& ex) { + } catch (const isc::Exception& isc_ex) { // It is possible though unlikely, for sendNext to fail without // scheduling the send. While, unlikely, it does mean the callback // will not get called with a failure. A throw here would surface @@ -345,7 +345,7 @@ NameChangeSender::invokeSendHandlerInternal(const NameChangeSender::Result resul // close the window by invoking the application handler with // a failed result, and let the application layer sort it out. LOG_ERROR(dhcp_ddns_logger, DHCP_DDNS_NCR_SEND_NEXT_ERROR) - .arg(ex.what()); + .arg(isc_ex.what()); // Invoke the completion handler passing in failed result. // Surround the invocation with a try-catch. The invoked handler is @@ -353,9 +353,9 @@ NameChangeSender::invokeSendHandlerInternal(const NameChangeSender::Result resul // report it. try { (*send_handler_)(ERROR, ncr_to_send_); - } catch (const std::exception& ex) { + } catch (const std::exception& std_ex) { LOG_ERROR(dhcp_ddns_logger, - DHCP_DDNS_UNCAUGHT_NCR_SEND_HANDLER_ERROR).arg(ex.what()); + DHCP_DDNS_UNCAUGHT_NCR_SEND_HANDLER_ERROR).arg(std_ex.what()); } } } diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc index 2a78e83b44..5740e190a3 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp4_unittest.cc @@ -1044,24 +1044,25 @@ GenericConfigBackendDHCPv4Test::getSubnet4Test() { SCOPED_TRACE(test_case_name); // Test fetching subnet by id. - Subnet4Ptr returned_subnet; - ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet4(server_selector, subnet->getID())); - ASSERT_TRUE(returned_subnet); + Subnet4Ptr returned_subnet_2; + ASSERT_NO_THROW_LOG( + returned_subnet_2 = cbptr_->getSubnet4(server_selector, subnet->getID())); + ASSERT_TRUE(returned_subnet_2); - ASSERT_EQ(1, returned_subnet->getServerTags().size()); - EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag))); + ASSERT_EQ(1, returned_subnet_2->getServerTags().size()); + EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag))); - ASSERT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str()); + ASSERT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str()); // Test fetching subnet by prefix. - ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet4(server_selector, - subnet->toText())); - ASSERT_TRUE(returned_subnet); + ASSERT_NO_THROW_LOG( + returned_subnet_2 = cbptr_->getSubnet4(server_selector, subnet->toText())); + ASSERT_TRUE(returned_subnet_2); - ASSERT_EQ(1, returned_subnet->getServerTags().size()); - EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag))); + ASSERT_EQ(1, returned_subnet_2->getServerTags().size()); + EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag))); - EXPECT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str()); + EXPECT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str()); }; { diff --git a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc index ce561bf7ba..cc3bcbd247 100644 --- a/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc +++ b/src/lib/dhcpsrv/testutils/generic_cb_dhcp6_unittest.cc @@ -1064,30 +1064,31 @@ GenericConfigBackendDHCPv6Test::getSubnet6Test() { isc::InvalidOperation); // Test that this subnet will be fetched for various server selectors. - auto test_get_subnet = [this, &subnet] (const std::string& test_case_name, - const ServerSelector& server_selector, - const std::string& expected_tag = ServerTag::ALL) { + auto test_get_subnet = [this, &subnet](const std::string& test_case_name, + const ServerSelector& server_selector, + const std::string& expected_tag = ServerTag::ALL) { SCOPED_TRACE(test_case_name); // Test fetching subnet by id. - Subnet6Ptr returned_subnet; - ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet6(server_selector, subnet->getID())); - ASSERT_TRUE(returned_subnet); + Subnet6Ptr returned_subnet_2; + ASSERT_NO_THROW_LOG( + returned_subnet_2 = cbptr_->getSubnet6(server_selector, subnet->getID())); + ASSERT_TRUE(returned_subnet_2); - ASSERT_EQ(1, returned_subnet->getServerTags().size()); - EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag))); + ASSERT_EQ(1, returned_subnet_2->getServerTags().size()); + EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag))); - ASSERT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str()); + ASSERT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str()); // Test fetching subnet by prefix. - ASSERT_NO_THROW_LOG(returned_subnet = cbptr_->getSubnet6(server_selector, - subnet->toText())); - ASSERT_TRUE(returned_subnet); + ASSERT_NO_THROW_LOG( + returned_subnet_2 = cbptr_->getSubnet6(server_selector, subnet->toText())); + ASSERT_TRUE(returned_subnet_2); - ASSERT_EQ(1, returned_subnet->getServerTags().size()); - EXPECT_TRUE(returned_subnet->hasServerTag(ServerTag(expected_tag))); + ASSERT_EQ(1, returned_subnet_2->getServerTags().size()); + EXPECT_TRUE(returned_subnet_2->hasServerTag(ServerTag(expected_tag))); - EXPECT_EQ(subnet->toElement()->str(), returned_subnet->toElement()->str()); + EXPECT_EQ(subnet->toElement()->str(), returned_subnet_2->toElement()->str()); }; { diff --git a/src/lib/dns/tests/labelsequence_unittest.cc b/src/lib/dns/tests/labelsequence_unittest.cc index 1e8f232681..66e38e4e82 100644 --- a/src/lib/dns/tests/labelsequence_unittest.cc +++ b/src/lib/dns/tests/labelsequence_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2012-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -653,8 +653,8 @@ TEST_F(LabelSequenceTest, toRawText) { // toRawText is not supposed to do any sanity checks. // Let's try with a very weird name. - Name n2("xtra\tchars\n.in.name"); - LabelSequence l2(n2); + Name name2("xtra\tchars\n.in.name"); + LabelSequence l2(name2); EXPECT_EQ("xtra\tchars\n.in.name.", l2.toRawText(false)); } diff --git a/src/lib/dns/tests/master_lexer_state_unittest.cc b/src/lib/dns/tests/master_lexer_state_unittest.cc index 4413ba5629..1c8c5bbfd7 100644 --- a/src/lib/dns/tests/master_lexer_state_unittest.cc +++ b/src/lib/dns/tests/master_lexer_state_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2012-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -390,42 +390,42 @@ TEST_F(MasterLexerStateTest, quotedString) { // If QSTRING is specified in option, '"' is regarded as a beginning of // a quoted string. - const MasterLexer::Options options = common_options | MasterLexer::QSTRING; - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + const MasterLexer::Options my_options = common_options | MasterLexer::QSTRING; + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); EXPECT_FALSE(s_string.wasLastEOL(lexer)); // EOL is canceled due to '"' s_qstring.handle(lexer); stringTokenCheck("quoted string", s_string.getToken(lexer), true); // Empty string is okay as qstring - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("", s_string.getToken(lexer), true); // Also checks other separator characters within a qstring - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("quoted()\t\rstring", s_string.getToken(lexer), true); // escape character mostly doesn't have any effect in the qstring // processing - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("escape\\ in quote", s_string.getToken(lexer), true); // The only exception is the quotation mark itself. Note that the escape // only works on the quotation mark immediately after it. - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("escaped\"", s_string.getToken(lexer), true); // quoted '\' then '"'. Unlike the previous case '"' shouldn't be // escaped. - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("escaped backslash\\\\", s_string.getToken(lexer), true); // ';' has no meaning in a quoted string (not indicating a comment) - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("no;comment", s_string.getToken(lexer), true); } @@ -437,28 +437,28 @@ TEST_F(MasterLexerStateTest, brokenQuotedString) { lexer.pushSource(ss); // EOL is encountered without closing the quote - const MasterLexer::Options options = common_options | MasterLexer::QSTRING; - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + const MasterLexer::Options my_options = common_options | MasterLexer::QSTRING; + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); ASSERT_EQ(Token::ERROR, s_qstring.getToken(lexer).getType()); EXPECT_EQ(Token::UNBALANCED_QUOTES, s_qstring.getToken(lexer).getErrorCode()); // We can resume after the error from the '\n' - EXPECT_EQ(s_null, State::start(lexer, options)); + EXPECT_EQ(s_null, State::start(lexer, my_options)); EXPECT_EQ(Token::END_OF_LINE, s_crlf.getToken(lexer).getType()); // \n is okay in a quoted string if escaped - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); stringTokenCheck("quoted\\\n", s_string.getToken(lexer), true); // EOF is encountered without closing the quote - EXPECT_EQ(&s_qstring, State::start(lexer, options)); + EXPECT_EQ(&s_qstring, State::start(lexer, my_options)); s_qstring.handle(lexer); ASSERT_EQ(Token::ERROR, s_qstring.getToken(lexer).getType()); EXPECT_EQ(Token::UNEXPECTED_END, s_qstring.getToken(lexer).getErrorCode()); // If we continue we'll simply see the EOF - EXPECT_EQ(s_null, State::start(lexer, options)); + EXPECT_EQ(s_null, State::start(lexer, my_options)); EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType()); } @@ -478,52 +478,52 @@ TEST_F(MasterLexerStateTest, basicNumbers) { lexer.pushSource(ss); // Ask the lexer to recognize numbers as well - const MasterLexer::Options options = common_options | MasterLexer::NUMBER; + const MasterLexer::Options my_options = common_options | MasterLexer::NUMBER; - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(0, s_number.getToken(lexer).getNumber()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(1, s_number.getToken(lexer).getNumber()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(12345, s_number.getToken(lexer).getNumber()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(4294967295u, s_number.getToken(lexer).getNumber()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(Token::NUMBER_OUT_OF_RANGE, s_number.getToken(lexer).getErrorCode()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(Token::NUMBER_OUT_OF_RANGE, s_number.getToken(lexer).getErrorCode()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(5, s_number.getToken(lexer).getNumber()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(42, s_number.getToken(lexer).getNumber()); - EXPECT_EQ(s_null, State::start(lexer, options)); + EXPECT_EQ(s_null, State::start(lexer, my_options)); EXPECT_TRUE(s_crlf.wasLastEOL(lexer)); EXPECT_EQ(Token::END_OF_LINE, s_crlf.getToken(lexer).getType()); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); EXPECT_EQ(37, s_number.getToken(lexer).getNumber()); // If we continue we'll simply see the EOF - EXPECT_EQ(s_null, State::start(lexer, options)); + EXPECT_EQ(s_null, State::start(lexer, my_options)); EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType()); } @@ -554,52 +554,52 @@ TEST_F(MasterLexerStateTest, stringNumbers) { stringTokenCheck("123", s_string.getToken(lexer), false); // Ask the lexer to recognize numbers as well - const MasterLexer::Options options = common_options | MasterLexer::NUMBER; + const MasterLexer::Options my_options = common_options | MasterLexer::NUMBER; - EXPECT_EQ(&s_string, State::start(lexer, options)); + EXPECT_EQ(&s_string, State::start(lexer, my_options)); s_string.handle(lexer); stringTokenCheck("-1", s_string.getToken(lexer), false); // Starts out as a number, but ends up being a string - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); stringTokenCheck("123abc456", s_number.getToken(lexer), false); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); stringTokenCheck("123\\456", s_number.getToken(lexer), false); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' at end stringTokenCheck("3scaped\\ space", s_number.getToken(lexer)); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' at end stringTokenCheck("3scaped\\\ttab", s_number.getToken(lexer)); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' at end stringTokenCheck("3scaped\\(paren", s_number.getToken(lexer)); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' at end stringTokenCheck("3scaped\\)close", s_number.getToken(lexer)); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' at end stringTokenCheck("3scaped\\;comment", s_number.getToken(lexer)); - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' in mid stringTokenCheck("3scaped\\\\", s_number.getToken(lexer)); // Confirm the word that follows the escaped '\' is correctly recognized. - EXPECT_EQ(&s_number, State::start(lexer, options)); + EXPECT_EQ(&s_number, State::start(lexer, my_options)); s_number.handle(lexer); // recognize str, see ' ' at end stringTokenCheck("8ackslash", s_number.getToken(lexer)); // If we continue we'll simply see the EOF - EXPECT_EQ(s_null, State::start(lexer, options)); + EXPECT_EQ(s_null, State::start(lexer, my_options)); EXPECT_EQ(Token::END_OF_FILE, s_crlf.getToken(lexer).getType()); } diff --git a/src/lib/dns/tests/rdata_tkey_unittest.cc b/src/lib/dns/tests/rdata_tkey_unittest.cc index 40ca68b789..d9c6ec4a32 100644 --- a/src/lib/dns/tests/rdata_tkey_unittest.cc +++ b/src/lib/dns/tests/rdata_tkey_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2021-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2021-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -238,7 +238,7 @@ TEST_F(Rdata_TKEY_Test, createFromWireWithOtherData) { matchWireData(&expect_key[0], expect_key.size(), tkey.getKey(), tkey.getKeyLen()); - vector expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' }; + expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' }; matchWireData(&expect_data[0], expect_data.size(), tkey.getOtherData(), tkey.getOtherLen()); } @@ -250,7 +250,7 @@ TEST_F(Rdata_TKEY_Test, createFromWireWithoutKey) { EXPECT_EQ(0, tkey.getKeyLen()); EXPECT_FALSE(tkey.getKey()); - vector expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' }; + expect_data = { 'a', 'b', 'c', 'd', '0', '1', '2', '3' }; matchWireData(&expect_data[0], expect_data.size(), tkey.getOtherData(), tkey.getOtherLen()); } diff --git a/src/lib/dns/tests/tsig_unittest.cc b/src/lib/dns/tests/tsig_unittest.cc index 2eb418b6f6..b59d0da42f 100644 --- a/src/lib/dns/tests/tsig_unittest.cc +++ b/src/lib/dns/tests/tsig_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -361,9 +361,9 @@ TEST_F(TSIGTest, signAtActualTime) { TEST_F(TSIGTest, signBadData) { // some specific bad data should be rejected proactively. - const unsigned char dummy_data = 0; + const unsigned char dummy = 0; EXPECT_THROW(tsig_ctx->sign(0, 0, 10), InvalidParameter); - EXPECT_THROW(tsig_ctx->sign(0, &dummy_data, 0), InvalidParameter); + EXPECT_THROW(tsig_ctx->sign(0, &dummy, 0), InvalidParameter); } TEST_F(TSIGTest, verifyBadData) { diff --git a/src/lib/eval/tests/evaluate_unittest.cc b/src/lib/eval/tests/evaluate_unittest.cc index da73bb2593..71fb61a00d 100644 --- a/src/lib/eval/tests/evaluate_unittest.cc +++ b/src/lib/eval/tests/evaluate_unittest.cc @@ -589,7 +589,7 @@ TEST_F(ExpressionsTest, popOrBranchTrue) { ASSERT_NO_THROW(label.reset(new TokenLabel(123))); TokenPtr left; TokenPtr right; - bool result_(false); + bool result(false); // False or false == false. ASSERT_NO_THROW(left.reset(new TokenString("false"))); @@ -598,8 +598,8 @@ TEST_F(ExpressionsTest, popOrBranchTrue) { e_.push_back(branch); e_.push_back(right); e_.push_back(label); - ASSERT_NO_THROW(result_ = evaluateBool(e_, *pkt4_)); - EXPECT_FALSE(result_); + ASSERT_NO_THROW(result = evaluateBool(e_, *pkt4_)); + EXPECT_FALSE(result); e_.clear(); // False or true == true. @@ -634,7 +634,7 @@ TEST_F(ExpressionsTest, popOrBranchFalse) { ASSERT_NO_THROW(label.reset(new TokenLabel(123))); TokenPtr left; TokenPtr right; - bool result_(false); + bool result(false); // True and true == true. ASSERT_NO_THROW(left.reset(new TokenString("true"))); @@ -643,8 +643,8 @@ TEST_F(ExpressionsTest, popOrBranchFalse) { e_.push_back(branch); e_.push_back(right); e_.push_back(label); - ASSERT_NO_THROW(result_ = evaluateBool(e_, *pkt4_)); - EXPECT_TRUE(result_); + ASSERT_NO_THROW(result = evaluateBool(e_, *pkt4_)); + EXPECT_TRUE(result); e_.clear(); // True and false == false. @@ -654,8 +654,8 @@ TEST_F(ExpressionsTest, popOrBranchFalse) { e_.push_back(branch); e_.push_back(right); e_.push_back(label); - ASSERT_NO_THROW(result_ = evaluateBool(e_, *pkt4_)); - EXPECT_FALSE(result_); + ASSERT_NO_THROW(result = evaluateBool(e_, *pkt4_)); + EXPECT_FALSE(result); e_.clear(); // False and any thing == false. @@ -665,8 +665,8 @@ TEST_F(ExpressionsTest, popOrBranchFalse) { e_.push_back(branch); e_.push_back(right); e_.push_back(label); - EXPECT_NO_THROW(result_ = evaluateBool(e_, *pkt6_)); - EXPECT_FALSE(result_); + EXPECT_NO_THROW(result = evaluateBool(e_, *pkt6_)); + EXPECT_FALSE(result); } // Tests the pop and branch when false / lazy if. @@ -689,7 +689,7 @@ TEST_F(ExpressionsTest, popAndBranchFalse) { ASSERT_NO_THROW(bar.reset(new TokenString("bar"))); TokenPtr extra; ASSERT_NO_THROW(extra.reset(new TokenString("extra token"))); - string result_(""); + string result(""); // if true then foo else bar == foo ASSERT_NO_THROW(test.reset(new TokenString("true"))); @@ -701,8 +701,8 @@ TEST_F(ExpressionsTest, popAndBranchFalse) { e_.push_back(bar); e_.push_back(extra); e_.push_back(label2); - ASSERT_NO_THROW(result_ = evaluateString(e_, *pkt4_)); - EXPECT_EQ("foo", result_); + ASSERT_NO_THROW(result = evaluateString(e_, *pkt4_)); + EXPECT_EQ("foo", result); e_.clear(); // if false then foo else bar == bar @@ -715,8 +715,8 @@ TEST_F(ExpressionsTest, popAndBranchFalse) { e_.push_back(label1); e_.push_back(bar); e_.push_back(label2); - ASSERT_NO_THROW(result_ = evaluateString(e_, *pkt6_)); - EXPECT_EQ("bar", result_); + ASSERT_NO_THROW(result = evaluateString(e_, *pkt6_)); + EXPECT_EQ("bar", result); } } diff --git a/src/lib/http/connection.cc b/src/lib/http/connection.cc index bff0f4fb8a..f6fef33b1b 100644 --- a/src/lib/http/connection.cc +++ b/src/lib/http/connection.cc @@ -548,7 +548,9 @@ HttpConnection::socketReadCallback(HttpConnection::TransactionPtr transaction, defer_shutdown_ = true; - std::unique_ptr p(this, [](HttpConnection* p) { p->defer_shutdown_ = false; }); + std::unique_ptr p(this, [](HttpConnection* c) { + c->defer_shutdown_ = false; + }); // Create the response from the received request using the custom // response creator. diff --git a/src/lib/http/tests/client_mt_unittests.cc b/src/lib/http/tests/client_mt_unittests.cc index 5a265cc04f..7898bdeafa 100644 --- a/src/lib/http/tests/client_mt_unittests.cc +++ b/src/lib/http/tests/client_mt_unittests.cc @@ -338,12 +338,12 @@ public: } // Get stringified thread-id. - std::stringstream ss; - ss << std::this_thread::get_id(); + std::stringstream tid_ss; + tid_ss << std::this_thread::get_id(); // Create the ClientRR. ClientRRPtr clientRR(new ClientRR()); - clientRR->thread_id_ = ss.str(); + clientRR->thread_id_ = tid_ss.str(); clientRR->request_ = request_json; clientRR->response_ = response_json; @@ -400,12 +400,12 @@ public: ASSERT_FALSE(ec) << "asyncSendRequest failed, ec: " << ec; // Get stringified thread-id. - std::stringstream ss; - ss << std::this_thread::get_id(); + std::stringstream tid_ss; + tid_ss << std::this_thread::get_id(); // Create the ClientRR. ClientRRPtr clientRR(new ClientRR()); - clientRR->thread_id_ = ss.str(); + clientRR->thread_id_ = tid_ss.str(); clientRR->request_ = request_json; clientRR->response_ = response_json; diff --git a/src/lib/http/tests/http_client_test.h b/src/lib/http/tests/http_client_test.h index 90d058ef07..74a61aa11d 100644 --- a/src/lib/http/tests/http_client_test.h +++ b/src/lib/http/tests/http_client_test.h @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2017-2025 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -423,7 +423,7 @@ public: ASSERT_NO_THROW(client.asyncSendRequest(url, client_context_, request, response, [this](const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string& parsing_error) { io_service_->stop(); // There should be no IO error (answer from the server is received). @@ -431,7 +431,7 @@ public: ADD_FAILURE() << "asyncSendRequest failed: " << ec.message(); } // The response object is NULL because it couldn't be finalized. - EXPECT_FALSE(response); + EXPECT_FALSE(http_response); // The message parsing error should be returned. EXPECT_FALSE(parsing_error.empty()); })); @@ -524,7 +524,7 @@ public: ASSERT_NO_THROW(client.asyncSendRequest(url, client_context_, request, response, [this, &cb_num](const boost::system::error_code& ec, - const HttpResponsePtr& response, + const HttpResponsePtr& http_response, const std::string&) { if (++cb_num > 1) { io_service_->stop(); @@ -534,7 +534,7 @@ public: // error code. EXPECT_TRUE(ec.value() == boost::asio::error::timed_out); // There should be no response returned. - EXPECT_FALSE(response); + EXPECT_FALSE(http_response); }, HttpClient::RequestTimeout(100), diff --git a/src/lib/http/testutils/test_http_client.h b/src/lib/http/testutils/test_http_client.h index ed8af55fc3..84397c3ab4 100644 --- a/src/lib/http/testutils/test_http_client.h +++ b/src/lib/http/testutils/test_http_client.h @@ -413,10 +413,10 @@ public: } } stream_.async_handshake(roleToImpl(TlsRole::CLIENT), - [this, request](const boost::system::error_code& ec) { - if (ec) { + [this, request](const boost::system::error_code& erc) { + if (erc) { ADD_FAILURE() << "error occurred during handshake: " - << ec.message(); + << erc.message(); io_service_->stop(); return; } diff --git a/src/lib/tcp/tests/tcp_test_client.h b/src/lib/tcp/tests/tcp_test_client.h index ba1538ce9f..60da352cbd 100644 --- a/src/lib/tcp/tests/tcp_test_client.h +++ b/src/lib/tcp/tests/tcp_test_client.h @@ -136,9 +136,9 @@ public: } if (useTls()) { - SocketCallback socket_cb( - [this](boost::system::error_code ec, size_t /*length */) { - if (ec) { + SocketCallback tls_socket_cb( + [this](boost::system::error_code erc, size_t /*length */) { + if (erc) { handshake_failed_ = true; done_callback_(); } else { @@ -146,7 +146,7 @@ public: } }); - tls_socket_->handshake(socket_cb); + tls_socket_->handshake(tls_socket_cb); } else { sendNextRequest(); }