summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2015-06-13 13:07:43 +0200
committerFrancis Dupont <fdupont@isc.org>2015-06-13 13:07:43 +0200
commit3db9f1d78f59856b982a1ff84c3b5a1ba7ea39df (patch)
tree1dd966421c4170f356b1ae11915ea50864f437ea /src/lib
parent[master] Update the git hash to the last commit (diff)
parent[3833] Updated copyright (diff)
downloadkea-3db9f1d78f59856b982a1ff84c3b5a1ba7ea39df.tar.xz
kea-3db9f1d78f59856b982a1ff84c3b5a1ba7ea39df.zip
[master] Finished merge of trac3833 (unsigned for indexes)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dhcp/classify.cc2
-rw-r--r--src/lib/dhcp/libdhcp++.cc4
-rw-r--r--src/lib/dhcp/option.cc6
-rw-r--r--src/lib/dhcp/option_custom.cc4
-rw-r--r--src/lib/dhcp/option_int_array.h4
-rw-r--r--src/lib/dhcp/option_vendor_class.cc4
-rw-r--r--src/lib/dhcp/pkt6.cc2
-rw-r--r--src/lib/dhcp/tests/iface_mgr_unittest.cc13
-rw-r--r--src/lib/dhcp/tests/libdhcp++_unittest.cc4
-rw-r--r--src/lib/dhcp/tests/opaque_data_tuple_unittest.cc10
-rw-r--r--src/lib/dhcp/tests/option6_addrlst_unittest.cc2
-rw-r--r--src/lib/dhcp/tests/option6_ia_unittest.cc2
-rw-r--r--src/lib/dhcp/tests/option6_iaaddr_unittest.cc2
-rw-r--r--src/lib/dhcp/tests/option6_iaprefix_unittest.cc2
-rw-r--r--src/lib/dhcp/tests/option_custom_unittest.cc20
-rw-r--r--src/lib/dhcp/tests/option_definition_unittest.cc22
-rw-r--r--src/lib/dhcp/tests/option_int_array_unittest.cc4
-rw-r--r--src/lib/dhcp/tests/option_int_unittest.cc4
-rw-r--r--src/lib/dhcp/tests/option_unittest.cc10
-rw-r--r--src/lib/dhcp/tests/pkt4_unittest.cc30
-rw-r--r--src/lib/dhcp/tests/pkt6_unittest.cc2
-rw-r--r--src/lib/dhcp/tests/protocol_util_unittest.cc6
-rw-r--r--src/lib/dhcpsrv/parsers/dhcp_parsers.cc2
-rw-r--r--src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc22
-rw-r--r--src/lib/dhcpsrv/tests/d2_udp_unittest.cc6
-rw-r--r--src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc24
-rw-r--r--src/lib/dhcpsrv/tests/host_mgr_unittest.cc6
-rw-r--r--src/lib/dns/master_loader.cc4
-rw-r--r--src/lib/dns/tests/rdata_sshfp_unittest.cc4
-rw-r--r--src/lib/dns/tests/zone_checker_unittest.cc8
-rw-r--r--src/lib/hooks/library_manager.cc6
-rw-r--r--src/lib/hooks/library_manager_collection.cc4
-rw-r--r--src/lib/hooks/tests/server_hooks_unittest.cc4
-rw-r--r--src/lib/util/csv_file.cc10
34 files changed, 133 insertions, 126 deletions
diff --git a/src/lib/dhcp/classify.cc b/src/lib/dhcp/classify.cc
index 046bbdabf1..3b11b71abb 100644
--- a/src/lib/dhcp/classify.cc
+++ b/src/lib/dhcp/classify.cc
@@ -28,7 +28,7 @@ ClientClasses::ClientClasses(const std::string& class_names)
std::vector<std::string> split_text;
boost::split(split_text, class_names, boost::is_any_of(","),
boost::algorithm::token_compress_off);
- for (int i = 0; i < split_text.size(); ++i) {
+ for (size_t i = 0; i < split_text.size(); ++i) {
std::string trimmed = util::str::trim(split_text[i]);
// Ignore empty class names.
if (!trimmed.empty()) {
diff --git a/src/lib/dhcp/libdhcp++.cc b/src/lib/dhcp/libdhcp++.cc
index be7095533d..7d13b48768 100644
--- a/src/lib/dhcp/libdhcp++.cc
+++ b/src/lib/dhcp/libdhcp++.cc
@@ -710,7 +710,7 @@ void initOptionSpace(OptionDefContainer& defs,
size_t params_size) {
defs.clear();
- for (int i = 0; i < params_size; ++i) {
+ for (size_t i = 0; i < params_size; ++i) {
std::string encapsulates(params[i].encapsulates);
if (!encapsulates.empty() && params[i].array) {
isc_throw(isc::BadValue, "invalid standard option definition: "
@@ -740,7 +740,7 @@ void initOptionSpace(OptionDefContainer& defs,
}
- for (int rec = 0; rec < params[i].records_size; ++rec) {
+ for (size_t rec = 0; rec < params[i].records_size; ++rec) {
definition->addRecordField(params[i].records[rec]);
}
diff --git a/src/lib/dhcp/option.cc b/src/lib/dhcp/option.cc
index 8a796c58b0..c74a16909b 100644
--- a/src/lib/dhcp/option.cc
+++ b/src/lib/dhcp/option.cc
@@ -151,7 +151,7 @@ uint16_t Option::len() {
// option header)
// length of the whole option is header and data stored in this option...
- int length = getHeaderLen() + data_.size();
+ size_t length = getHeaderLen() + data_.size();
// ... and sum of lengths of all suboptions
for (OptionCollection::iterator it = options_.begin();
@@ -160,10 +160,10 @@ uint16_t Option::len() {
length += (*it).second->len();
}
- // note that this is not equal to lenght field. This value denotes
+ // note that this is not equal to length field. This value denotes
// number of bytes required to store this option. length option should
// contain (len()-getHeaderLen()) value.
- return (length);
+ return (static_cast<uint16_t>(length));
}
bool
diff --git a/src/lib/dhcp/option_custom.cc b/src/lib/dhcp/option_custom.cc
index 971998fdfd..25982ab4c6 100644
--- a/src/lib/dhcp/option_custom.cc
+++ b/src/lib/dhcp/option_custom.cc
@@ -504,7 +504,7 @@ OptionCustom::unpack(OptionBufferConstIter begin,
uint16_t
OptionCustom::len() {
// The length of the option is a sum of option header ...
- int length = getHeaderLen();
+ size_t length = getHeaderLen();
// ... lengths of all buffers that hold option data ...
for (std::vector<OptionBuffer>::const_iterator buf = buffers_.begin();
@@ -519,7 +519,7 @@ OptionCustom::len() {
length += (*it).second->len();
}
- return (length);
+ return (static_cast<uint16_t>(length));
}
void OptionCustom::initialize(const OptionBufferConstIter first,
diff --git a/src/lib/dhcp/option_int_array.h b/src/lib/dhcp/option_int_array.h
index 40ca97a327..8b03aa9636 100644
--- a/src/lib/dhcp/option_int_array.h
+++ b/src/lib/dhcp/option_int_array.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2013,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -143,7 +143,7 @@ public:
// Pack option header.
packHeader(buf);
// Pack option data.
- for (int i = 0; i < values_.size(); ++i) {
+ for (size_t i = 0; i < values_.size(); ++i) {
// Depending on the data type length we use different utility functions
// writeUint16 or writeUint32 which write the data in the network byte
// order to the provided buffer. The same functions can be safely used
diff --git a/src/lib/dhcp/option_vendor_class.cc b/src/lib/dhcp/option_vendor_class.cc
index 1c53fbeae6..f354084510 100644
--- a/src/lib/dhcp/option_vendor_class.cc
+++ b/src/lib/dhcp/option_vendor_class.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -174,7 +174,7 @@ OptionVendorClass::toText(int indent) {
s << "type=" << getType() << ", len=" << len() - getHeaderLen() << ", "
" enterprise id=0x" << std::hex << getVendorId() << std::dec;
// Iterate over all tuples and print their size and contents.
- for (int i = 0; i < getTuplesNum(); ++i) {
+ for (unsigned i = 0; i < getTuplesNum(); ++i) {
// The DHCPv4 V-I Vendor Class has enterprise id before every tuple.
if ((getUniverse() == V4) && (i > 0)) {
s << ", enterprise id=0x" << std::hex << getVendorId() << std::dec;
diff --git a/src/lib/dhcp/pkt6.cc b/src/lib/dhcp/pkt6.cc
index 1866053cb1..529801b944 100644
--- a/src/lib/dhcp/pkt6.cc
+++ b/src/lib/dhcp/pkt6.cc
@@ -639,7 +639,7 @@ void Pkt6::copyRelayInfo(const Pkt6Ptr& question) {
// We use index rather than iterator, because we need that as a parameter
// passed to getRelayOption()
- for (int i = 0; i < question->relay_info_.size(); ++i) {
+ for (size_t i = 0; i < question->relay_info_.size(); ++i) {
RelayInfo info;
info.msg_type_ = DHCPV6_RELAY_REPL;
info.hop_count_ = question->relay_info_[i].hop_count_;
diff --git a/src/lib/dhcp/tests/iface_mgr_unittest.cc b/src/lib/dhcp/tests/iface_mgr_unittest.cc
index c4f74ecb65..a8064b573c 100644
--- a/src/lib/dhcp/tests/iface_mgr_unittest.cc
+++ b/src/lib/dhcp/tests/iface_mgr_unittest.cc
@@ -77,14 +77,14 @@ TEST(IfaceTest, readBuffer) {
ASSERT_FALSE(buf_ptr == NULL);
// Use the pointer to set some data.
- for (int i = 0; i < iface.getReadBufferSize(); ++i) {
+ for (size_t i = 0; i < iface.getReadBufferSize(); ++i) {
buf_ptr[i] = i;
}
// Get the pointer again and validate the data.
buf_ptr = iface.getReadBuffer();
ASSERT_EQ(256, iface.getReadBufferSize());
- for (int i = 0; i < iface.getReadBufferSize(); ++i) {
+ for (size_t i = 0; i < iface.getReadBufferSize(); ++i) {
// Use assert so as it fails on the first failure, no need
// to continue further checks.
ASSERT_EQ(i, buf_ptr[i]);
@@ -552,7 +552,7 @@ TEST_F(IfaceMgrTest, closeSockets) {
// Create set of V4 and V6 sockets on the loopback interface.
// They must differ by a port they are bound to.
- for (int i = 0; i < 6; ++i) {
+ for (unsigned i = 0; i < 6; ++i) {
// Every other socket will be IPv4.
if (i % 2) {
ASSERT_NO_THROW(
@@ -1099,7 +1099,7 @@ TEST_F(IfaceMgrTest, sendReceive6) {
// prepare dummy payload
uint8_t data[128];
- for (int i = 0; i < 128; i++) {
+ for (uint8_t i = 0; i < 128; i++) {
data[i] = i;
}
Pkt6Ptr sendPkt = Pkt6Ptr(new Pkt6(data, 128));
@@ -2114,9 +2114,12 @@ TEST_F(IfaceMgrTest, iface_methods) {
iface.setHWType(42);
EXPECT_EQ(42, iface.getHWType());
+ ASSERT_LT(Iface::MAX_MAC_LEN + 10, 255);
+
uint8_t mac[Iface::MAX_MAC_LEN+10];
- for (int i = 0; i < Iface::MAX_MAC_LEN + 10; i++)
+ for (uint8_t i = 0; i < Iface::MAX_MAC_LEN + 10; i++) {
mac[i] = 255 - i;
+ }
EXPECT_EQ("foo", iface.getName());
EXPECT_EQ(1234, iface.getIndex());
diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc
index 8ac05ceffd..64d2a4978f 100644
--- a/src/lib/dhcp/tests/libdhcp++_unittest.cc
+++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc
@@ -310,7 +310,7 @@ TEST_F(LibDhcpTest, packOptions6) {
isc::dhcp::OptionCollection opts; // list of options
// generate content for options
- for (int i = 0; i < 64; i++) {
+ for (unsigned i = 0; i < 64; i++) {
buf[i]=i+100;
}
@@ -477,7 +477,7 @@ static uint8_t v4_opts[] = {
TEST_F(LibDhcpTest, packOptions4) {
vector<uint8_t> payload[5];
- for (int i = 0; i < 5; i++) {
+ for (unsigned i = 0; i < 5; i++) {
payload[i].resize(3);
payload[i][0] = i*10;
payload[i][1] = i*10+1;
diff --git a/src/lib/dhcp/tests/opaque_data_tuple_unittest.cc b/src/lib/dhcp/tests/opaque_data_tuple_unittest.cc
index 08ffd5ced1..067f7661cd 100644
--- a/src/lib/dhcp/tests/opaque_data_tuple_unittest.cc
+++ b/src/lib/dhcp/tests/opaque_data_tuple_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -267,7 +267,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError);
// Set the data for tuple.
std::vector<uint8_t> data;
- for (int i = 0; i < 100; ++i) {
+ for (uint8_t i = 0; i < 100; ++i) {
data.push_back(i);
}
tuple.assign(data.begin(), data.size());
@@ -289,7 +289,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
out_buf.clear();
// Fill in the tuple buffer so as it reaches maximum allowed length. The
// maximum length is 255 when the size of the length field is one byte.
- for (int i = 100; i < 255; ++i) {
+ for (uint8_t i = 100; i < 255; ++i) {
data.push_back(i);
}
ASSERT_EQ(255, data.size());
@@ -326,8 +326,8 @@ TEST(OpaqueDataTuple, pack2Bytes) {
EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError);
// Set the data for tuple.
std::vector<uint8_t> data;
- for (int i = 0; i < 512; ++i) {
- data.push_back(i);
+ for (unsigned i = 0; i < 512; ++i) {
+ data.push_back(i & 0xff);
}
tuple.assign(data.begin(), data.size());
// The pack should now succeed.
diff --git a/src/lib/dhcp/tests/option6_addrlst_unittest.cc b/src/lib/dhcp/tests/option6_addrlst_unittest.cc
index b48aeed57d..05be85acbf 100644
--- a/src/lib/dhcp/tests/option6_addrlst_unittest.cc
+++ b/src/lib/dhcp/tests/option6_addrlst_unittest.cc
@@ -39,7 +39,7 @@ namespace {
class Option6AddrLstTest : public ::testing::Test {
public:
Option6AddrLstTest(): buf_(255), outBuf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
diff --git a/src/lib/dhcp/tests/option6_ia_unittest.cc b/src/lib/dhcp/tests/option6_ia_unittest.cc
index c9d472b7e1..4d69e76173 100644
--- a/src/lib/dhcp/tests/option6_ia_unittest.cc
+++ b/src/lib/dhcp/tests/option6_ia_unittest.cc
@@ -40,7 +40,7 @@ namespace {
class Option6IATest : public ::testing::Test {
public:
Option6IATest(): buf_(255), outBuf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
diff --git a/src/lib/dhcp/tests/option6_iaaddr_unittest.cc b/src/lib/dhcp/tests/option6_iaaddr_unittest.cc
index dba2b96acd..a2e4833913 100644
--- a/src/lib/dhcp/tests/option6_iaaddr_unittest.cc
+++ b/src/lib/dhcp/tests/option6_iaaddr_unittest.cc
@@ -38,7 +38,7 @@ namespace {
class Option6IAAddrTest : public ::testing::Test {
public:
Option6IAAddrTest() : buf_(255), outBuf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
diff --git a/src/lib/dhcp/tests/option6_iaprefix_unittest.cc b/src/lib/dhcp/tests/option6_iaprefix_unittest.cc
index f4b5b3a71e..45ad8f7bb6 100644
--- a/src/lib/dhcp/tests/option6_iaprefix_unittest.cc
+++ b/src/lib/dhcp/tests/option6_iaprefix_unittest.cc
@@ -38,7 +38,7 @@ namespace {
class Option6IAPrefixTest : public ::testing::Test {
public:
Option6IAPrefixTest() : buf_(255), out_buf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
diff --git a/src/lib/dhcp/tests/option_custom_unittest.cc b/src/lib/dhcp/tests/option_custom_unittest.cc
index 59fc3b931e..0330dcb883 100644
--- a/src/lib/dhcp/tests/option_custom_unittest.cc
+++ b/src/lib/dhcp/tests/option_custom_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2013,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -196,7 +196,7 @@ TEST_F(OptionCustomTest, binaryData) {
// used as reference when we read back the data from a created
// option.
OptionBuffer buf_in(14);
- for (int i = 0; i < 14; ++i) {
+ for (unsigned i = 0; i < 14; ++i) {
buf_in[i] = i;
}
@@ -603,7 +603,7 @@ TEST_F(OptionCustomTest, uint32DataArray) {
// Store these values in a buffer.
OptionBuffer buf;
- for (int i = 0; i < values.size(); ++i) {
+ for (size_t i = 0; i < values.size(); ++i) {
writeInt<uint32_t>(values[i], buf);
}
// Create custom option using the input buffer.
@@ -649,7 +649,7 @@ TEST_F(OptionCustomTest, ipv4AddressDataArray) {
// Store the collection of IPv4 addresses into the buffer.
OptionBuffer buf;
- for (int i = 0; i < addresses.size(); ++i) {
+ for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf);
}
@@ -699,7 +699,7 @@ TEST_F(OptionCustomTest, ipv6AddressDataArray) {
// Store the collection of IPv6 addresses into the buffer.
OptionBuffer buf;
- for (int i = 0; i < addresses.size(); ++i) {
+ for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf);
}
@@ -968,7 +968,7 @@ TEST_F(OptionCustomTest, setBinaryData) {
EXPECT_TRUE(buf.empty());
// Prepare input buffer with some dummy data.
OptionBuffer buf_in(10);
- for (int i = 0; i < buf_in.size(); ++i) {
+ for (size_t i = 0; i < buf_in.size(); ++i) {
buf_in[i] = i;
}
// Try to override the default binary buffer.
@@ -1433,7 +1433,7 @@ TEST_F(OptionCustomTest, unpack) {
// Store the collection of IPv4 addresses into the buffer.
OptionBuffer buf;
- for (int i = 0; i < addresses.size(); ++i) {
+ for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf);
}
@@ -1464,7 +1464,7 @@ TEST_F(OptionCustomTest, unpack) {
// Clear the buffer as we need to store new addresses in it.
buf.clear();
- for (int i = 0; i < addresses.size(); ++i) {
+ for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf);
}
@@ -1495,7 +1495,7 @@ TEST_F(OptionCustomTest, initialize) {
// Store the collection of IPv6 addresses into the buffer.
OptionBuffer buf;
- for (int i = 0; i < addresses.size(); ++i) {
+ for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf);
}
@@ -1525,7 +1525,7 @@ TEST_F(OptionCustomTest, initialize) {
// Clear the buffer as we need to store new addresses in it.
buf.clear();
- for (int i = 0; i < addresses.size(); ++i) {
+ for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf);
}
diff --git a/src/lib/dhcp/tests/option_definition_unittest.cc b/src/lib/dhcp/tests/option_definition_unittest.cc
index 7608a6bb29..d3c727e23c 100644
--- a/src/lib/dhcp/tests/option_definition_unittest.cc
+++ b/src/lib/dhcp/tests/option_definition_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -356,7 +356,7 @@ TEST_F(OptionDefinitionTest, ipv6AddressArray) {
// Write addresses to the buffer.
OptionBuffer buf(addrs.size() * asiolink::V6ADDRESS_LEN);
- for (int i = 0; i < addrs.size(); ++i) {
+ for (size_t i = 0; i < addrs.size(); ++i) {
const std::vector<uint8_t>& vec = addrs[i].toBytes();
ASSERT_EQ(asiolink::V6ADDRESS_LEN, vec.size());
std::copy(vec.begin(), vec.end(),
@@ -454,7 +454,7 @@ TEST_F(OptionDefinitionTest, ipv4AddressArray) {
// Write addresses to the buffer.
OptionBuffer buf(addrs.size() * asiolink::V4ADDRESS_LEN);
- for (int i = 0; i < addrs.size(); ++i) {
+ for (size_t i = 0; i < addrs.size(); ++i) {
const std::vector<uint8_t> vec = addrs[i].toBytes();
ASSERT_EQ(asiolink::V4ADDRESS_LEN, vec.size());
std::copy(vec.begin(), vec.end(),
@@ -613,7 +613,7 @@ TEST_F(OptionDefinitionTest, binary) {
// Prepare some dummy data (serverid): 0, 1, 2 etc.
OptionBuffer buf(14);
- for (int i = 0; i < 14; ++i) {
+ for (unsigned i = 0; i < 14; ++i) {
buf[i] = i;
}
// Create option instance with the factory function.
@@ -666,7 +666,7 @@ TEST_F(OptionDefinitionTest, recordIA6) {
// Check the positive scenario.
OptionBuffer buf(12);
- for (int i = 0; i < buf.size(); ++i) {
+ for (size_t i = 0; i < buf.size(); ++i) {
buf[i] = i;
}
OptionPtr option_v6;
@@ -708,7 +708,9 @@ TEST_F(OptionDefinitionTest, recordIAAddr6) {
ASSERT_EQ(asiolink::V6ADDRESS_LEN, vec.size());
std::copy(vec.begin(), vec.end(), buf.begin());
- for (int i = 0; i < option6_iaaddr_len - asiolink::V6ADDRESS_LEN; ++i) {
+ for (unsigned i = 0;
+ i < option6_iaaddr_len - asiolink::V6ADDRESS_LEN;
+ ++i) {
buf.push_back(i);
}
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR, buf));
@@ -1030,7 +1032,7 @@ TEST_F(OptionDefinitionTest, uint16Array) {
// multiple of uint16_t size.
// buffer elements will be: 0x112233.
OptionBuffer buf(6);
- for (int i = 0; i < 6; ++i) {
+ for (unsigned i = 0; i < 6; ++i) {
buf[i] = i / 2;
}
// Constructor should succeed because buffer has correct size.
@@ -1042,7 +1044,7 @@ TEST_F(OptionDefinitionTest, uint16Array) {
boost::static_pointer_cast<OptionIntArray<uint16_t> >(option_v6);
// Get the values from the initiated options and validate.
std::vector<uint16_t> values = option_cast_v6->getValues();
- for (int i = 0; i < values.size(); ++i) {
+ for (size_t i = 0; i < values.size(); ++i) {
// Expected value is calculated using on the same pattern
// as the one we used to initiate buffer:
// for i=0, expected = 0x00, for i = 1, expected == 0x11 etc.
@@ -1103,7 +1105,7 @@ TEST_F(OptionDefinitionTest, uint32Array) {
// multiple of uint16_t size.
// buffer elements will be: 0x111122223333.
OptionBuffer buf(12);
- for (int i = 0; i < buf.size(); ++i) {
+ for (size_t i = 0; i < buf.size(); ++i) {
buf[i] = i / 4;
}
// Constructor should succeed because buffer has correct size.
@@ -1115,7 +1117,7 @@ TEST_F(OptionDefinitionTest, uint32Array) {
boost::static_pointer_cast<OptionIntArray<uint32_t> >(option_v6);
// Get the values from the initiated options and validate.
std::vector<uint32_t> values = option_cast_v6->getValues();
- for (int i = 0; i < values.size(); ++i) {
+ for (size_t i = 0; i < values.size(); ++i) {
// Expected value is calculated using on the same pattern
// as the one we used to initiate buffer:
// for i=0, expected = 0x0000, for i = 1, expected == 0x1111 etc.
diff --git a/src/lib/dhcp/tests/option_int_array_unittest.cc b/src/lib/dhcp/tests/option_int_array_unittest.cc
index 6b94ed2a32..df18a3b47e 100644
--- a/src/lib/dhcp/tests/option_int_array_unittest.cc
+++ b/src/lib/dhcp/tests/option_int_array_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -38,7 +38,7 @@ public:
///
/// Initializes the option buffer with some data.
OptionIntArrayTest(): buf_(255), out_buf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
diff --git a/src/lib/dhcp/tests/option_int_unittest.cc b/src/lib/dhcp/tests/option_int_unittest.cc
index cbba30fdee..072bbaeb8a 100644
--- a/src/lib/dhcp/tests/option_int_unittest.cc
+++ b/src/lib/dhcp/tests/option_int_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -41,7 +41,7 @@ public:
///
/// Initializes the option buffer with some data.
OptionIntTest(): buf_(255), out_buf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
diff --git a/src/lib/dhcp/tests/option_unittest.cc b/src/lib/dhcp/tests/option_unittest.cc
index 1715fe62f6..6b24b300fc 100644
--- a/src/lib/dhcp/tests/option_unittest.cc
+++ b/src/lib/dhcp/tests/option_unittest.cc
@@ -102,7 +102,7 @@ public:
class OptionTest : public ::testing::Test {
public:
OptionTest(): buf_(255), outBuf_(255) {
- for (int i = 0; i < 255; i++) {
+ for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i;
}
}
@@ -251,7 +251,7 @@ TEST_F(OptionTest, v6_basic) {
// Tests constructor used in packet reception. Option contains actual data
TEST_F(OptionTest, v6_data1) {
- for (int i = 0; i < 32; i++) {
+ for (unsigned i = 0; i < 32; i++) {
buf_[i] = 100 + i;
}
@@ -324,7 +324,7 @@ TEST_F(OptionTest, v6_data2) {
// +----opt3
//
TEST_F(OptionTest, v6_suboptions1) {
- for (int i = 0; i < 128; i++) {
+ for (unsigned i = 0; i < 128; i++) {
buf_[i] = 100 + i;
}
@@ -367,7 +367,7 @@ TEST_F(OptionTest, v6_suboptions1) {
// +----opt3
//
TEST_F(OptionTest, v6_suboptions2) {
- for (int i = 0; i < 128; i++) {
+ for (unsigned i = 0; i < 128; i++) {
buf_[i] = 100 + i;
}
@@ -399,7 +399,7 @@ TEST_F(OptionTest, v6_suboptions2) {
}
TEST_F(OptionTest, v6_addgetdel) {
- for (int i = 0; i < 128; i++) {
+ for (unsigned i = 0; i < 128; i++) {
buf_[i] = 100 + i;
}
diff --git a/src/lib/dhcp/tests/pkt4_unittest.cc b/src/lib/dhcp/tests/pkt4_unittest.cc
index f7d9ed1ef3..b628d99434 100644
--- a/src/lib/dhcp/tests/pkt4_unittest.cc
+++ b/src/lib/dhcp/tests/pkt4_unittest.cc
@@ -277,7 +277,7 @@ TEST_F(Pkt4Test, constructor) {
// Just some dummy payload.
uint8_t testData[250];
- for (int i = 0; i < 250; i++) {
+ for (uint8_t i = 0; i < 250; i++) {
testData[i] = i;
}
@@ -415,12 +415,12 @@ TEST_F(Pkt4Test, hwAddr) {
scoped_ptr<Pkt4> pkt;
// let's test each hlen, from 0 till 16
- for (int macLen = 0; macLen < Pkt4::MAX_CHADDR_LEN; macLen++) {
- for (int i = 0; i < Pkt4::MAX_CHADDR_LEN; i++) {
+ for (size_t macLen = 0; macLen < Pkt4::MAX_CHADDR_LEN; macLen++) {
+ for (size_t i = 0; i < Pkt4::MAX_CHADDR_LEN; i++) {
mac[i] = 0;
expectedChaddr[i] = 0;
}
- for (int i = 0; i < macLen; i++) {
+ for (size_t i = 0; i < macLen; i++) {
mac[i] = 128 + i;
expectedChaddr[i] = 128 + i;
}
@@ -473,7 +473,7 @@ TEST_F(Pkt4Test, msgTypes) {
};
scoped_ptr<Pkt4> pkt;
- for (int i = 0; i < sizeof(types) / sizeof(msgType); i++) {
+ for (size_t i = 0; i < sizeof(types) / sizeof(msgType); i++) {
pkt.reset(new Pkt4(types[i].dhcp, 0));
EXPECT_EQ(types[i].dhcp, pkt->getType());
EXPECT_EQ(types[i].bootp, pkt->getOp());
@@ -493,11 +493,11 @@ TEST_F(Pkt4Test, sname) {
scoped_ptr<Pkt4> pkt;
// Let's test each sname length, from 0 till 64
- for (int snameLen = 0; snameLen < Pkt4::MAX_SNAME_LEN; ++snameLen) {
- for (int i = 0; i < snameLen; ++i) {
+ for (size_t snameLen = 0; snameLen < Pkt4::MAX_SNAME_LEN; ++snameLen) {
+ for (size_t i = 0; i < snameLen; ++i) {
sname[i] = i + 1;
}
- for (int i = snameLen; i < Pkt4::MAX_SNAME_LEN; ++i) {
+ for (size_t i = snameLen; i < Pkt4::MAX_SNAME_LEN; ++i) {
sname[i] = 0;
}
@@ -531,11 +531,11 @@ TEST_F(Pkt4Test, file) {
scoped_ptr<Pkt4> pkt;
// Let's test each file length, from 0 till 128.
- for (int fileLen = 0; fileLen < Pkt4::MAX_FILE_LEN; ++fileLen) {
- for (int i = 0; i < fileLen; ++i) {
+ for (size_t fileLen = 0; fileLen < Pkt4::MAX_FILE_LEN; ++fileLen) {
+ for (size_t i = 0; i < fileLen; ++i) {
file[i] = i + 1;
}
- for (int i = fileLen; i < Pkt4::MAX_FILE_LEN; ++i) {
+ for (size_t i = fileLen; i < Pkt4::MAX_FILE_LEN; ++i) {
file[i] = 0;
}
@@ -567,7 +567,7 @@ TEST_F(Pkt4Test, options) {
scoped_ptr<Pkt4> pkt(new Pkt4(DHCPOFFER, 0));
vector<uint8_t> payload[5];
- for (int i = 0; i < 5; i++) {
+ for (uint8_t i = 0; i < 5; i++) {
payload[i].push_back(i * 10);
payload[i].push_back(i * 10 + 1);
payload[i].push_back(i * 10 + 2);
@@ -638,7 +638,7 @@ TEST_F(Pkt4Test, unpackOptions) {
expectedFormat.push_back(0x53);
expectedFormat.push_back(0x63);
- for (int i = 0; i < sizeof(v4_opts); i++) {
+ for (size_t i = 0; i < sizeof(v4_opts); i++) {
expectedFormat.push_back(v4_opts[i]);
}
@@ -664,7 +664,7 @@ TEST_F(Pkt4Test, unpackOptionsWithCallback) {
expectedFormat.push_back(0x53);
expectedFormat.push_back(0x63);
- for (int i = 0; i < sizeof(v4_opts); i++) {
+ for (size_t i = 0; i < sizeof(v4_opts); i++) {
expectedFormat.push_back(v4_opts[i]);
}
@@ -904,7 +904,7 @@ TEST_F(Pkt4Test, getLabel) {
// Add a client id to the packet then verify getLabel
OptionBuffer clnt_id(4);
- for (int i = 0; i < 4; i++) {
+ for (uint8_t i = 0; i < 4; i++) {
clnt_id[i] = 100 + i;
}
diff --git a/src/lib/dhcp/tests/pkt6_unittest.cc b/src/lib/dhcp/tests/pkt6_unittest.cc
index 3deefcf537..53c01bd017 100644
--- a/src/lib/dhcp/tests/pkt6_unittest.cc
+++ b/src/lib/dhcp/tests/pkt6_unittest.cc
@@ -505,7 +505,7 @@ TEST_F(Pkt6Test, Timestamp) {
// packet type names.
TEST_F(Pkt6Test, getName) {
// Check all possible packet types
- for (int itype = 0; itype < 256; ++itype) {
+ for (unsigned itype = 0; itype < 256; ++itype) {
uint8_t type = itype;
switch (type) {
diff --git a/src/lib/dhcp/tests/protocol_util_unittest.cc b/src/lib/dhcp/tests/protocol_util_unittest.cc
index 971eb7f820..9801745b3c 100644
--- a/src/lib/dhcp/tests/protocol_util_unittest.cc
+++ b/src/lib/dhcp/tests/protocol_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -247,12 +247,12 @@ TEST(ProtocolUtilTest, writeEthernetHeader) {
// get exact values that are mismatched. If memcmp was used
// the error message would not indicate the values of
// mismatched bytes.
- for (int i = 0; i < 6; ++i) {
+ for (unsigned i = 0; i < 6; ++i) {
EXPECT_EQ(dest_hw_addr[i], buf[i]);
}
// Verify that following 6 bytes comprise the valid source
// HW address.
- for (int i = 0; i < 6; ++i) {
+ for (unsigned i = 0; i < 6; ++i) {
EXPECT_EQ(src_hw_addr[i], buf[i + 6]);
}
diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc
index e822eec753..98a7a877ea 100644
--- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc
+++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc
@@ -254,7 +254,7 @@ HooksLibrariesParser::build(ConstElementPtr value) {
// Construct the list of libraries in error for the message.
string error_list = error_libs[0];
- for (int i = 1; i < error_libs.size(); ++i) {
+ for (size_t i = 1; i < error_libs.size(); ++i) {
error_list += (string(", ") + error_libs[i]);
}
isc_throw(DhcpConfigError, "hooks libraries failed to validate - "
diff --git a/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc b/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
index 74369f760f..189be3d3ac 100644
--- a/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
+++ b/src/lib/dhcpsrv/tests/cfg_hosts_unittest.cc
@@ -65,7 +65,7 @@ CfgHostsTest::CfgHostsTest() {
const uint8_t mac_template[] = {
0x01, 0x02, 0x0A, 0xBB, 0x03, 0x00
};
- for (int i = 0; i < 50; ++i) {
+ for (unsigned i = 0; i < 50; ++i) {
std::vector<uint8_t> vec(mac_template,
mac_template + sizeof(mac_template));
vec[vec.size() - 1] = i;
@@ -76,7 +76,7 @@ CfgHostsTest::CfgHostsTest() {
const uint8_t duid_template[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00
};
- for (int i = 0; i < 50; ++i) {
+ for (unsigned i = 0; i < 50; ++i) {
std::vector<uint8_t> vec(duid_template,
duid_template + sizeof(mac_template));
vec[vec.size() - 1] = i;
@@ -238,7 +238,7 @@ TEST_F(CfgHostsTest, getAll4ByAddress) {
TEST_F(CfgHostsTest, get4) {
CfgHosts cfg;
// Add hosts.
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Add host identified by HW address.
cfg.add(HostPtr(new Host(hwaddrs_[i]->toText(false),
"hw-address",
@@ -251,7 +251,7 @@ TEST_F(CfgHostsTest, get4) {
increase(IOAddress("192.0.2.100"), i))));
}
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Retrieve host by HW address. The DUID is non-null but there is no
// reservation made for the DUID so the reservation is returned for
// HW address.
@@ -284,7 +284,7 @@ TEST_F(CfgHostsTest, get4) {
TEST_F(CfgHostsTest, get6) {
CfgHosts cfg;
// Add hosts.
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Add host identified by HW address.
HostPtr host = HostPtr(new Host(hwaddrs_[i]->toText(false),
"hw-address",
@@ -305,7 +305,7 @@ TEST_F(CfgHostsTest, get6) {
cfg.add(host);
}
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Retrieve host by HW address. The DUID is non-null but there is no
// reservation made for the DUID so the reservation is returned for
// HW address.
@@ -342,7 +342,7 @@ TEST_F(CfgHostsTest, get6) {
TEST_F(CfgHostsTest, get6ByAddr) {
CfgHosts cfg;
// Add hosts.
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Add host identified by DUID.
HostPtr host = HostPtr(new Host(duids_[i]->toText(), "duid",
@@ -354,7 +354,7 @@ TEST_F(CfgHostsTest, get6ByAddr) {
cfg.add(host);
}
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Retrieve host by (subnet-id,address).
HostPtr host = cfg.get6(SubnetID(1 + i % 2),
increase(IOAddress("2001:db8:2::1"), i));
@@ -375,7 +375,7 @@ TEST_F(CfgHostsTest, get6MultipleAddrs) {
CfgHosts cfg;
// Add 25 hosts. Each host has reservations for 5 addresses.
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Add host identified by DUID.
HostPtr host = HostPtr(new Host(duids_[i]->toText(), "duid",
@@ -396,13 +396,13 @@ TEST_F(CfgHostsTest, get6MultipleAddrs) {
// Now check if we can retrieve each of those 25 hosts by using each
// of their addresses.
- for (int i = 0; i < 25; ++i) {
+ for (unsigned i = 0; i < 25; ++i) {
// Check that the host is there.
HostPtr by_duid = cfg.get6(SubnetID(1 + i % 2), duids_[i], hwaddr_not_used);
ASSERT_TRUE(by_duid);
- for (int j = 0; j < 5; ++j) {
+ for (unsigned j = 0; j < 5; ++j) {
std::stringstream tmp;
tmp << "2001:db8:" << i << "::" << j;
diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc
index 93fea40b05..4fb311f52d 100644
--- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc
+++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -431,7 +431,7 @@ TEST_F(D2ClientMgrTest, ifaceRegister) {
ASSERT_NO_THROW(startSender(getErrorHandler()));
// Queue three messages.
- for (int i = 0; i < 3; ++i) {
+ for (unsigned i = 0; i < 3; ++i) {
dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr();
ASSERT_NO_THROW(sendRequest(ncr));
}
@@ -472,7 +472,7 @@ TEST_F(D2ClientMgrTest, udpSuspendUpdates) {
ASSERT_NO_THROW(startSender(getErrorHandler()));
// Send a test request.
- for (int i = 0; i < 3; ++i) {
+ for (unsigned i = 0; i < 3; ++i) {
dhcp_ddns::NameChangeRequestPtr ncr = buildTestNcr();
ASSERT_NO_THROW(sendRequest(ncr));
}
diff --git a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
index 536f6768b8..e6e465ff46 100644
--- a/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
@@ -335,13 +335,13 @@ template <typename T>
void GenericLeaseMgrTest::checkLeasesDifferent(const std::vector<T>& leases) const {
// Check they were created
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
ASSERT_TRUE(leases[i]);
}
// Check they are different
- for (int i = 0; i < (leases.size() - 1); ++i) {
- for (int j = (i + 1); j < leases.size(); ++j) {
+ for (size_t i = 0; i < (leases.size() - 1); ++i) {
+ for (size_t j = (i + 1); j < leases.size(); ++j) {
stringstream s;
s << "Comparing leases " << i << " & " << j << " for equality";
SCOPED_TRACE(s.str());
@@ -355,7 +355,7 @@ GenericLeaseMgrTest::createLeases4() {
// Create leases for each address
vector<Lease4Ptr> leases;
- for (int i = 0; i < straddress4_.size(); ++i) {
+ for (size_t i = 0; i < straddress4_.size(); ++i) {
leases.push_back(initializeLease4(straddress4_[i]));
}
EXPECT_EQ(8, leases.size());
@@ -371,7 +371,7 @@ GenericLeaseMgrTest::createLeases6() {
// Create leases for each address
vector<Lease6Ptr> leases;
- for (int i = 0; i < straddress6_.size(); ++i) {
+ for (size_t i = 0; i < straddress6_.size(); ++i) {
leases.push_back(initializeLease6(straddress6_[i]));
}
EXPECT_EQ(8, leases.size());
@@ -525,7 +525,7 @@ void
GenericLeaseMgrTest::testGetLease4HWAddr2() {
// Get the leases to be used for the test and add to the database
vector<Lease4Ptr> leases = createLeases4();
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
@@ -1038,7 +1038,7 @@ void
GenericLeaseMgrTest::testGetLease4HWAddrSubnetId() {
// Get the leases to be used for the test and add to the database
vector<Lease4Ptr> leases = createLeases4();
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
@@ -1116,7 +1116,7 @@ void
GenericLeaseMgrTest::testGetLease4ClientId2() {
// Get the leases to be used for the test and add to the database
vector<Lease4Ptr> leases = createLeases4();
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
@@ -1191,7 +1191,7 @@ void
GenericLeaseMgrTest::testGetLease4ClientIdSubnetId() {
// Get the leases to be used for the test and add to the database
vector<Lease4Ptr> leases = createLeases4();
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
@@ -1228,7 +1228,7 @@ GenericLeaseMgrTest::testGetLeases6DuidIaid() {
ASSERT_LE(6, leases.size()); // Expect to access leases 0 through 5
// Add them to the database
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
@@ -1391,7 +1391,7 @@ void
GenericLeaseMgrTest::testGetLease6DuidIaidSubnetId() {
// Get the leases to be used for the test and add them to the database.
vector<Lease6Ptr> leases = createLeases6();
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
@@ -1457,7 +1457,7 @@ void
GenericLeaseMgrTest::testUpdateLease4() {
// Get the leases to be used for the test and add them to the database.
vector<Lease4Ptr> leases = createLeases4();
- for (int i = 0; i < leases.size(); ++i) {
+ for (size_t i = 0; i < leases.size(); ++i) {
EXPECT_TRUE(lmptr_->addLease(leases[i]));
}
diff --git a/src/lib/dhcpsrv/tests/host_mgr_unittest.cc b/src/lib/dhcpsrv/tests/host_mgr_unittest.cc
index a447f7d255..551eb11853 100644
--- a/src/lib/dhcpsrv/tests/host_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/host_mgr_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -62,7 +62,7 @@ HostMgrTest::SetUp() {
const uint8_t mac_template[] = {
0x01, 0x02, 0x0A, 0xBB, 0x03, 0x00
};
- for (int i = 0; i < 10; ++i) {
+ for (uint8_t i = 0; i < 10; ++i) {
std::vector<uint8_t> vec(mac_template,
mac_template + sizeof(mac_template));
vec[vec.size() - 1] = i;
@@ -73,7 +73,7 @@ HostMgrTest::SetUp() {
const uint8_t duid_template[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00
};
- for (int i = 0; i < 10; ++i) {
+ for (uint8_t i = 0; i < 10; ++i) {
std::vector<uint8_t> vec(duid_template,
duid_template + sizeof(mac_template));
vec[vec.size() - 1] = i;
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index 80b1053432..94e12ac1bf 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2014 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -821,7 +821,7 @@ MasterLoader::MasterLoaderImpl::doGenerate() {
}
// Generate and add the records.
- for (int i = start; i <= stop; i += step) {
+ for (unsigned int i = start; i <= stop; i += step) {
// Get generated strings for LHS and RHS. LHS goes to form the
// name, RHS goes to form the RDATA of the RR.
const std::string generated_name = generateForIter(lhs, i);
diff --git a/src/lib/dns/tests/rdata_sshfp_unittest.cc b/src/lib/dns/tests/rdata_sshfp_unittest.cc
index cb8640af1a..84cf0295fd 100644
--- a/src/lib/dns/tests/rdata_sshfp_unittest.cc
+++ b/src/lib/dns/tests/rdata_sshfp_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -257,7 +257,7 @@ TEST_F(Rdata_SSHFP_Test, getFingerprint) {
EXPECT_EQ(rdata_sshfp.getFingerprintLength(),
fingerprint.size());
- for (int i = 0; i < fingerprint.size(); ++i) {
+ for (size_t i = 0; i < fingerprint.size(); ++i) {
EXPECT_EQ(rdata_sshfp_wiredata[i + 2],
fingerprint.at(i));
}
diff --git a/src/lib/dns/tests/zone_checker_unittest.cc b/src/lib/dns/tests/zone_checker_unittest.cc
index 320cda628b..c125c1e7a4 100644
--- a/src/lib/dns/tests/zone_checker_unittest.cc
+++ b/src/lib/dns/tests/zone_checker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -79,7 +79,8 @@ protected:
// the caller can check other cases.
void checkIssues() {
EXPECT_EQ(expected_errors_.size(), errors_.size());
- for (int i = 0; i < std::min(expected_errors_.size(), errors_.size());
+ for (size_t i = 0;
+ i < std::min(expected_errors_.size(), errors_.size());
++i) {
// The actual message should begin with the expected message.
EXPECT_EQ(0, errors_[0].find(expected_errors_[0]))
@@ -87,7 +88,8 @@ protected:
expected_errors_[0];
}
EXPECT_EQ(expected_warns_.size(), warns_.size());
- for (int i = 0; i < std::min(expected_warns_.size(), warns_.size());
+ for (size_t i = 0;
+ i < std::min(expected_warns_.size(), warns_.size());
++i) {
EXPECT_EQ(0, warns_[0].find(expected_warns_[0]))
<< "actual message: " << warns_[0] << " expected: " <<
diff --git a/src/lib/hooks/library_manager.cc b/src/lib/hooks/library_manager.cc
index 133d5059b8..1cbb7bcaf0 100644
--- a/src/lib/hooks/library_manager.cc
+++ b/src/lib/hooks/library_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2013,2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -150,7 +150,7 @@ LibraryManager::registerStandardCallouts() {
// Iterate through the list of known hooks
vector<string> hook_names = ServerHooks::getServerHooks().getHookNames();
- for (int i = 0; i < hook_names.size(); ++i) {
+ for (size_t i = 0; i < hook_names.size(); ++i) {
// Look up the symbol
void* dlsym_ptr = dlsym(dl_handle_, hook_names[i].c_str());
@@ -334,7 +334,7 @@ LibraryManager::unloadLibrary() {
// library on all hooks.
vector<string> hooks = ServerHooks::getServerHooks().getHookNames();
manager_->setLibraryIndex(index_);
- for (int i = 0; i < hooks.size(); ++i) {
+ for (size_t i = 0; i < hooks.size(); ++i) {
bool removed = manager_->deregisterAllCallouts(hooks[i]);
if (removed) {
LOG_DEBUG(hooks_logger, HOOKS_DBG_CALLS, HOOKS_CALLOUTS_REMOVED)
diff --git a/src/lib/hooks/library_manager_collection.cc b/src/lib/hooks/library_manager_collection.cc
index b9122e2774..86694fddcf 100644
--- a/src/lib/hooks/library_manager_collection.cc
+++ b/src/lib/hooks/library_manager_collection.cc
@@ -63,7 +63,7 @@ LibraryManagerCollection::loadLibraries() {
callout_manager_.reset(new CalloutManager(library_names_.size()));
// Now iterate through the libraries are load them one by one. We'll
- for (int i = 0; i < library_names_.size(); ++i) {
+ for (size_t i = 0; i < library_names_.size(); ++i) {
// Create a pointer to the new library manager. The index of this
// library is determined by the number of library managers currently
// loaded: note that the library indexes run from 1 to (number of loaded
@@ -116,7 +116,7 @@ LibraryManagerCollection::validateLibraries(
const std::vector<std::string>& libraries) {
std::vector<std::string> failures;
- for (int i = 0; i < libraries.size(); ++i) {
+ for (size_t i = 0; i < libraries.size(); ++i) {
if (!LibraryManager::validateLibrary(libraries[i])) {
failures.push_back(libraries[i]);
}
diff --git a/src/lib/hooks/tests/server_hooks_unittest.cc b/src/lib/hooks/tests/server_hooks_unittest.cc
index ca9b6f0a85..cf04cd0b50 100644
--- a/src/lib/hooks/tests/server_hooks_unittest.cc
+++ b/src/lib/hooks/tests/server_hooks_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
@@ -88,7 +88,7 @@ TEST(ServerHooksTest, GetHookNames) {
expected_names.push_back("beta");
expected_names.push_back("gamma");
expected_names.push_back("delta");
- for (int i = 0; i < expected_names.size(); ++i) {
+ for (size_t i = 0; i < expected_names.size(); ++i) {
hooks.registerHook(expected_names[i].c_str());
};
diff --git a/src/lib/util/csv_file.cc b/src/lib/util/csv_file.cc
index 4f03f48d8a..9051f04390 100644
--- a/src/lib/util/csv_file.cc
+++ b/src/lib/util/csv_file.cc
@@ -49,7 +49,7 @@ CSVRow::readAt(const size_t at) const {
std::string
CSVRow::render() const {
std::ostringstream s;
- for (int i = 0; i < values_.size(); ++i) {
+ for (size_t i = 0; i < values_.size(); ++i) {
// Do not put separator before the first value.
if (i > 0) {
s << separator_;
@@ -203,9 +203,9 @@ CSVFile::size() const {
int
CSVFile::getColumnIndex(const std::string& col_name) const {
- for (int i = 0; i < cols_.size(); ++i) {
+ for (size_t i = 0; i < cols_.size(); ++i) {
if (cols_[i] == col_name) {
- return (i);
+ return (static_cast<int>(i));
}
}
return (-1);
@@ -347,7 +347,7 @@ CSVFile::recreate() {
// Opened successfully. Write a header to it.
try {
CSVRow header(getColumnCount());
- for (int i = 0; i < getColumnCount(); ++i) {
+ for (size_t i = 0; i < getColumnCount(); ++i) {
header.writeAt(i, getColumnName(i));
}
*fs_ << header << std::endl;
@@ -383,7 +383,7 @@ CSVFile::validateHeader(const CSVRow& header) {
return (false);
}
- for (int i = 0; i < getColumnCount(); ++i) {
+ for (size_t i = 0; i < getColumnCount(); ++i) {
if (getColumnName(i) != header.readAt(i)) {
return (false);
}