]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3163] fix warnings on modified files
authorAndrei Pavel <andrei@isc.org>
Mon, 29 Apr 2024 17:03:15 +0000 (20:03 +0300)
committerAndrei Pavel <andrei@isc.org>
Wed, 1 May 2024 10:23:17 +0000 (13:23 +0300)
- ctrl_dhcp4_srv_unittest.cc:145:6: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
- ctrl_dhcp4_srv_unittest.cc:2172:28: warning: comparison of integer expressions of different signedness: ‘std::streamoff’ {aka ‘long int’} and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
- ctrl_dhcp4_srv_unittest.cc:2191:33: warning: comparison of integer expressions of different signedness: ‘std::streamoff’ {aka ‘long int’} and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
- ctrl_dhcp4_srv_unittest.cc:2295:33: warning: comparison of integer expressions of different signedness: ‘std::streamoff’ {aka ‘long int’} and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
- ctrl_dhcp4_srv_unittest.cc:2352:28: warning: declaration of ‘timeout’ shadows a previous local [-Wshadow]
- ctrl_dhcp4_srv_unittest.cc:2402:28: warning: declaration of ‘timeout’ shadows a previous local [-Wshadow]
- ctrl_dhcp6_srv_unittest.cc:116:6: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
- ctrl_dhcp6_srv_unittest.cc:181:6: warning: extra ‘;’ after in-class function definition [-Wextra-semi]
- ctrl_dhcp6_srv_unittest.cc:264:10: warning: ‘virtual void {anonymous}::CtrlChannelDhcpv6SrvTest::reset()’ can be marked override [-Wsuggest-override]
- ctrl_dhcp6_srv_unittest.cc:2210:28: warning: comparison of integer expressions of different signedness: ‘std::streamoff’ {aka ‘long int’} and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
- ctrl_dhcp6_srv_unittest.cc:2229:33: warning: comparison of integer expressions of different signedness: ‘std::streamoff’ {aka ‘long int’} and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
- ctrl_dhcp6_srv_unittest.cc:2333:33: warning: comparison of integer expressions of different signedness: ‘std::streamoff’ {aka ‘long int’} and ‘const size_t’ {aka ‘const long unsigned int’} [-Wsign-compare]
- ctrl_dhcp6_srv_unittest.cc:2390:28: warning: declaration of ‘timeout’ shadows a previous local [-Wshadow]
- ctrl_dhcp6_srv_unittest.cc:2440:28: warning: declaration of ‘timeout’ shadows a previous local [-Wshadow]
- dhcp6_srv_unittest.cc:2420:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
- dhcp6_srv_unittest.cc:2440:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
- dhcp6_srv_unittest.cc:2932:28: warning: useless cast to type ‘const uint8_t*’ {aka ‘const unsigned char*’} [-Wuseless-cast]
- dhcp6_srv_unittest.cc:2964:26: warning: useless cast to type ‘const uint8_t*’ {aka ‘const unsigned char*’} [-Wuseless-cast]

src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc
src/bin/dhcp6/tests/dhcp6_srv_unittest.cc

index a0be312596ed823ca230110cb64ff47ce97c11a1..15e49b52ad62e385d21d6a7ac68d2dc4349d126f 100644 (file)
@@ -142,7 +142,7 @@ public:
         IfaceMgr::instance().clearIfaces();
         IfaceMgr::instance().closeSockets();
         IfaceMgr::instance().detectIfaces();
-    };
+    }
 
     /// @brief Returns pointer to the server's IO service.
     ///
@@ -2167,7 +2167,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, longCommand) {
 
     // This is the desired size of the command sent to the server (1MB). The
     // actual size sent will be slightly greater than that.
-    const size_t command_size = 1024 * 1000;
+    const ssize_t command_size = 1024 * 1000;
 
     while (command.tellp() < command_size) {
 
@@ -2280,7 +2280,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, longResponse) {
 
         // Remember the response size so as we know when we should stop
         // receiving.
-        const size_t long_response_size = reference_response.size();
+        const ssize_t long_response_size = reference_response.size();
 
         // Create the client and connect it to the server.
         boost::scoped_ptr<UnixControlClient> client(new UnixControlClient());
@@ -2349,8 +2349,8 @@ TEST_F(CtrlChannelDhcpv4SrvTest, 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 response_timeout = 15;
+        ASSERT_TRUE(client->getResponse(response, response_timeout));
 
         // Explicitly close the client's connection.
         client->disconnectFromServer();
@@ -2399,8 +2399,8 @@ TEST_F(CtrlChannelDhcpv4SrvTest, 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 response_timeout = 15;
+        ASSERT_TRUE(client->getResponse(response, response_timeout));
 
         // Explicitly close the client's connection.
         client->disconnectFromServer();
index 8f2dc86942873e59dfc509b9d2630028679b78ac..98aed2d7702d081ab42e786d9df5c8ff734ec72d 100644 (file)
@@ -113,7 +113,7 @@ public:
         CommandMgr::instance().setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
 
         reset();
-    };
+    }
 
     /// @brief Reset hooks data
     ///
@@ -178,7 +178,7 @@ public:
         IfaceMgr::instance().clearIfaces();
         IfaceMgr::instance().closeSockets();
         IfaceMgr::instance().detectIfaces();
-    };
+    }
 
     /// @brief Returns pointer to the server's IO service.
     ///
@@ -261,7 +261,7 @@ public:
     }
 
     /// @brief Reset
-    void reset() {
+    void reset() override {
         CtrlDhcpv6SrvTest::reset();
 
         // Remove unix socket file
@@ -2205,7 +2205,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, longCommand) {
 
     // This is the desired size of the command sent to the server (1MB). The
     // actual size sent will be slightly greater than that.
-    const size_t command_size = 1024 * 1000;
+    const ssize_t command_size = 1024 * 1000;
 
     while (command.tellp() < command_size) {
 
@@ -2318,7 +2318,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, longResponse) {
 
         // Remember the response size so as we know when we should stop
         // receiving.
-        const size_t long_response_size = reference_response.size();
+        const ssize_t long_response_size = reference_response.size();
 
         // Create the client and connect it to the server.
         boost::scoped_ptr<UnixControlClient> client(new UnixControlClient());
@@ -2387,8 +2387,8 @@ TEST_F(CtrlChannelDhcpv6SrvTest, 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 response_timeout = 15;
+        ASSERT_TRUE(client->getResponse(response, response_timeout));
 
         // Explicitly close the client's connection.
         client->disconnectFromServer();
@@ -2437,8 +2437,8 @@ TEST_F(CtrlChannelDhcpv6SrvTest, 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 response_timeout = 15;
+        ASSERT_TRUE(client->getResponse(response, response_timeout));
 
         // Explicitly close the client's connection.
         client->disconnectFromServer();
index 5577e44259c28b9bf6e7b338db23a28569157c1b..0de8a2a8e23d87e77822f2d58745b54fe35aed13 100644 (file)
@@ -2418,7 +2418,7 @@ TEST_F(Dhcpv6SrvTest, testUnicast) {
         DHCPV6_INFORMATION_REQUEST
     };
     // Iterate over these messages and make sure they are discarded.
-    for (int i = 0; i < sizeof(not_allowed_unicast); ++i) {
+    for (size_t i = 0; i < sizeof(not_allowed_unicast); ++i) {
         Pkt6Ptr msg = Pkt6Ptr(new Pkt6(not_allowed_unicast[i], 1234));
         msg->setLocalAddr(IOAddress("2001:db8:1::1"));
         EXPECT_FALSE(srv.testUnicast(msg))
@@ -2438,7 +2438,7 @@ TEST_F(Dhcpv6SrvTest, testUnicast) {
     };
     // Iterate over these messages and check that they are accepted being
     // sent to unicast.
-    for (int i = 0; i < sizeof(allowed_unicast); ++i) {
+    for (size_t i = 0; i < sizeof(allowed_unicast); ++i) {
         Pkt6Ptr msg = Pkt6Ptr(new Pkt6(allowed_unicast[i], 1234));
         msg->setLocalAddr(IOAddress("2001:db8:1::1"));
         msg->addOption(srv.getServerID());
@@ -2930,8 +2930,7 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) {
     // Simulate that we have received that traffic
     sol->pack();
     EXPECT_EQ(DHCPV6_RELAY_FORW, sol->getBuffer()[0]);
-    Pkt6Ptr query(new Pkt6(static_cast<const uint8_t*>
-                           (sol->getBuffer().getData()),
+    Pkt6Ptr query(new Pkt6(sol->getBuffer().getData(),
                            sol->getBuffer().getLength()));
     query->setRemoteAddr(sol->getRemoteAddr());
     query->setRemotePort(sol->getRemotePort());
@@ -2962,8 +2961,7 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) {
     EXPECT_EQ(DHCPV6_RELAY_REPL, rsp->getBuffer()[0]);
 
     // Get Advertise
-    Pkt6Ptr adv(new Pkt6(static_cast<const uint8_t*>
-                         (rsp->getBuffer().getData()),
+    Pkt6Ptr adv(new Pkt6(rsp->getBuffer().getData(),
                          rsp->getBuffer().getLength()));
     adv->unpack();