Skip to content

Commit f40fa49

Browse files
committed
[#3163] fix warnings on modified files
- 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]
1 parent af91168 commit f40fa49

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CtrlChannelDhcpv4SrvTest : public ::testing::Test {
142142
IfaceMgr::instance().clearIfaces();
143143
IfaceMgr::instance().closeSockets();
144144
IfaceMgr::instance().detectIfaces();
145-
};
145+
}
146146

147147
/// @brief Returns pointer to the server's IO service.
148148
///
@@ -2167,7 +2167,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, longCommand) {
21672167

21682168
// This is the desired size of the command sent to the server (1MB). The
21692169
// actual size sent will be slightly greater than that.
2170-
const size_t command_size = 1024 * 1000;
2170+
const ssize_t command_size = 1024 * 1000;
21712171

21722172
while (command.tellp() < command_size) {
21732173

@@ -2280,7 +2280,7 @@ TEST_F(CtrlChannelDhcpv4SrvTest, longResponse) {
22802280

22812281
// Remember the response size so as we know when we should stop
22822282
// receiving.
2283-
const size_t long_response_size = reference_response.size();
2283+
const ssize_t long_response_size = reference_response.size();
22842284

22852285
// Create the client and connect it to the server.
22862286
boost::scoped_ptr<UnixControlClient> client(new UnixControlClient());
@@ -2349,8 +2349,8 @@ TEST_F(CtrlChannelDhcpv4SrvTest, connectionTimeoutPartialCommand) {
23492349
// Let's wait up to 15s for the server's response. The response
23502350
// should arrive sooner assuming that the timeout mechanism for
23512351
// the server is working properly.
2352-
const unsigned int timeout = 15;
2353-
ASSERT_TRUE(client->getResponse(response, timeout));
2352+
const unsigned int response_timeout = 15;
2353+
ASSERT_TRUE(client->getResponse(response, response_timeout));
23542354

23552355
// Explicitly close the client's connection.
23562356
client->disconnectFromServer();
@@ -2399,8 +2399,8 @@ TEST_F(CtrlChannelDhcpv4SrvTest, connectionTimeoutNoData) {
23992399
// Let's wait up to 15s for the server's response. The response
24002400
// should arrive sooner assuming that the timeout mechanism for
24012401
// the server is working properly.
2402-
const unsigned int timeout = 15;
2403-
ASSERT_TRUE(client->getResponse(response, timeout));
2402+
const unsigned int response_timeout = 15;
2403+
ASSERT_TRUE(client->getResponse(response, response_timeout));
24042404

24052405
// Explicitly close the client's connection.
24062406
client->disconnectFromServer();

src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class CtrlDhcpv6SrvTest : public BaseServerTest {
113113
CommandMgr::instance().setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
114114

115115
reset();
116-
};
116+
}
117117

118118
/// @brief Reset hooks data
119119
///
@@ -178,7 +178,7 @@ class CtrlChannelDhcpv6SrvTest : public CtrlDhcpv6SrvTest {
178178
IfaceMgr::instance().clearIfaces();
179179
IfaceMgr::instance().closeSockets();
180180
IfaceMgr::instance().detectIfaces();
181-
};
181+
}
182182

183183
/// @brief Returns pointer to the server's IO service.
184184
///
@@ -261,7 +261,7 @@ class CtrlChannelDhcpv6SrvTest : public CtrlDhcpv6SrvTest {
261261
}
262262

263263
/// @brief Reset
264-
void reset() {
264+
void reset() override {
265265
CtrlDhcpv6SrvTest::reset();
266266

267267
// Remove unix socket file
@@ -2205,7 +2205,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, longCommand) {
22052205

22062206
// This is the desired size of the command sent to the server (1MB). The
22072207
// actual size sent will be slightly greater than that.
2208-
const size_t command_size = 1024 * 1000;
2208+
const ssize_t command_size = 1024 * 1000;
22092209

22102210
while (command.tellp() < command_size) {
22112211

@@ -2318,7 +2318,7 @@ TEST_F(CtrlChannelDhcpv6SrvTest, longResponse) {
23182318

23192319
// Remember the response size so as we know when we should stop
23202320
// receiving.
2321-
const size_t long_response_size = reference_response.size();
2321+
const ssize_t long_response_size = reference_response.size();
23222322

23232323
// Create the client and connect it to the server.
23242324
boost::scoped_ptr<UnixControlClient> client(new UnixControlClient());
@@ -2387,8 +2387,8 @@ TEST_F(CtrlChannelDhcpv6SrvTest, connectionTimeoutPartialCommand) {
23872387
// Let's wait up to 15s for the server's response. The response
23882388
// should arrive sooner assuming that the timeout mechanism for
23892389
// the server is working properly.
2390-
const unsigned int timeout = 15;
2391-
ASSERT_TRUE(client->getResponse(response, timeout));
2390+
const unsigned int response_timeout = 15;
2391+
ASSERT_TRUE(client->getResponse(response, response_timeout));
23922392

23932393
// Explicitly close the client's connection.
23942394
client->disconnectFromServer();
@@ -2437,8 +2437,8 @@ TEST_F(CtrlChannelDhcpv6SrvTest, connectionTimeoutNoData) {
24372437
// Let's wait up to 15s for the server's response. The response
24382438
// should arrive sooner assuming that the timeout mechanism for
24392439
// the server is working properly.
2440-
const unsigned int timeout = 15;
2441-
ASSERT_TRUE(client->getResponse(response, timeout));
2440+
const unsigned int response_timeout = 15;
2441+
ASSERT_TRUE(client->getResponse(response, response_timeout));
24422442

24432443
// Explicitly close the client's connection.
24442444
client->disconnectFromServer();

src/bin/dhcp6/tests/dhcp6_srv_unittest.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,7 +2418,7 @@ TEST_F(Dhcpv6SrvTest, testUnicast) {
24182418
DHCPV6_INFORMATION_REQUEST
24192419
};
24202420
// Iterate over these messages and make sure they are discarded.
2421-
for (int i = 0; i < sizeof(not_allowed_unicast); ++i) {
2421+
for (size_t i = 0; i < sizeof(not_allowed_unicast); ++i) {
24222422
Pkt6Ptr msg = Pkt6Ptr(new Pkt6(not_allowed_unicast[i], 1234));
24232423
msg->setLocalAddr(IOAddress("2001:db8:1::1"));
24242424
EXPECT_FALSE(srv.testUnicast(msg))
@@ -2438,7 +2438,7 @@ TEST_F(Dhcpv6SrvTest, testUnicast) {
24382438
};
24392439
// Iterate over these messages and check that they are accepted being
24402440
// sent to unicast.
2441-
for (int i = 0; i < sizeof(allowed_unicast); ++i) {
2441+
for (size_t i = 0; i < sizeof(allowed_unicast); ++i) {
24422442
Pkt6Ptr msg = Pkt6Ptr(new Pkt6(allowed_unicast[i], 1234));
24432443
msg->setLocalAddr(IOAddress("2001:db8:1::1"));
24442444
msg->addOption(srv.getServerID());
@@ -2930,8 +2930,7 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) {
29302930
// Simulate that we have received that traffic
29312931
sol->pack();
29322932
EXPECT_EQ(DHCPV6_RELAY_FORW, sol->getBuffer()[0]);
2933-
Pkt6Ptr query(new Pkt6(static_cast<const uint8_t*>
2934-
(sol->getBuffer().getData()),
2933+
Pkt6Ptr query(new Pkt6(sol->getBuffer().getData(),
29352934
sol->getBuffer().getLength()));
29362935
query->setRemoteAddr(sol->getRemoteAddr());
29372936
query->setRemotePort(sol->getRemotePort());
@@ -2962,8 +2961,7 @@ TEST_F(Dhcpv6SrvTest, relaySourcePort) {
29622961
EXPECT_EQ(DHCPV6_RELAY_REPL, rsp->getBuffer()[0]);
29632962

29642963
// Get Advertise
2965-
Pkt6Ptr adv(new Pkt6(static_cast<const uint8_t*>
2966-
(rsp->getBuffer().getData()),
2964+
Pkt6Ptr adv(new Pkt6(rsp->getBuffer().getData(),
29672965
rsp->getBuffer().getLength()));
29682966
adv->unpack();
29692967

0 commit comments

Comments
 (0)