Commit 8f19841c authored by Francis Dupont's avatar Francis Dupont

[3833] some signed for loop variables aka #3833

parent 39167c04
...@@ -28,7 +28,7 @@ ClientClasses::ClientClasses(const std::string& class_names) ...@@ -28,7 +28,7 @@ ClientClasses::ClientClasses(const std::string& class_names)
std::vector<std::string> split_text; std::vector<std::string> split_text;
boost::split(split_text, class_names, boost::is_any_of(","), boost::split(split_text, class_names, boost::is_any_of(","),
boost::algorithm::token_compress_off); 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]); std::string trimmed = util::str::trim(split_text[i]);
// Ignore empty class names. // Ignore empty class names.
if (!trimmed.empty()) { if (!trimmed.empty()) {
......
...@@ -710,7 +710,7 @@ void initOptionSpace(OptionDefContainer& defs, ...@@ -710,7 +710,7 @@ void initOptionSpace(OptionDefContainer& defs,
size_t params_size) { size_t params_size) {
defs.clear(); 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); std::string encapsulates(params[i].encapsulates);
if (!encapsulates.empty() && params[i].array) { if (!encapsulates.empty() && params[i].array) {
isc_throw(isc::BadValue, "invalid standard option definition: " isc_throw(isc::BadValue, "invalid standard option definition: "
...@@ -740,7 +740,7 @@ void initOptionSpace(OptionDefContainer& defs, ...@@ -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]); definition->addRecordField(params[i].records[rec]);
} }
......
...@@ -151,7 +151,7 @@ uint16_t Option::len() { ...@@ -151,7 +151,7 @@ uint16_t Option::len() {
// option header) // option header)
// length of the whole option is header and data stored in this option... // 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 // ... and sum of lengths of all suboptions
for (OptionCollection::iterator it = options_.begin(); for (OptionCollection::iterator it = options_.begin();
......
...@@ -504,7 +504,7 @@ OptionCustom::unpack(OptionBufferConstIter begin, ...@@ -504,7 +504,7 @@ OptionCustom::unpack(OptionBufferConstIter begin,
uint16_t uint16_t
OptionCustom::len() { OptionCustom::len() {
// The length of the option is a sum of option header ... // 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 ... // ... lengths of all buffers that hold option data ...
for (std::vector<OptionBuffer>::const_iterator buf = buffers_.begin(); for (std::vector<OptionBuffer>::const_iterator buf = buffers_.begin();
......
// 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 // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
// Pack option header. // Pack option header.
packHeader(buf); packHeader(buf);
// Pack option data. // 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 // Depending on the data type length we use different utility functions
// writeUint16 or writeUint32 which write the data in the network byte // writeUint16 or writeUint32 which write the data in the network byte
// order to the provided buffer. The same functions can be safely used // order to the provided buffer. The same functions can be safely used
......
// 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 // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -174,7 +174,7 @@ OptionVendorClass::toText(int indent) { ...@@ -174,7 +174,7 @@ OptionVendorClass::toText(int indent) {
s << "type=" << getType() << ", len=" << len() - getHeaderLen() << ", " s << "type=" << getType() << ", len=" << len() - getHeaderLen() << ", "
" enterprise id=0x" << std::hex << getVendorId() << std::dec; " enterprise id=0x" << std::hex << getVendorId() << std::dec;
// Iterate over all tuples and print their size and contents. // 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. // The DHCPv4 V-I Vendor Class has enterprise id before every tuple.
if ((getUniverse() == V4) && (i > 0)) { if ((getUniverse() == V4) && (i > 0)) {
s << ", enterprise id=0x" << std::hex << getVendorId() << std::dec; s << ", enterprise id=0x" << std::hex << getVendorId() << std::dec;
......
...@@ -575,7 +575,7 @@ void Pkt6::copyRelayInfo(const Pkt6Ptr& question) { ...@@ -575,7 +575,7 @@ void Pkt6::copyRelayInfo(const Pkt6Ptr& question) {
// We use index rather than iterator, because we need that as a parameter // We use index rather than iterator, because we need that as a parameter
// passed to getRelayOption() // 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; RelayInfo info;
info.msg_type_ = DHCPV6_RELAY_REPL; info.msg_type_ = DHCPV6_RELAY_REPL;
info.hop_count_ = question->relay_info_[i].hop_count_; info.hop_count_ = question->relay_info_[i].hop_count_;
......
...@@ -77,14 +77,14 @@ TEST(IfaceTest, readBuffer) { ...@@ -77,14 +77,14 @@ TEST(IfaceTest, readBuffer) {
ASSERT_FALSE(buf_ptr == NULL); ASSERT_FALSE(buf_ptr == NULL);
// Use the pointer to set some data. // 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; buf_ptr[i] = i;
} }
// Get the pointer again and validate the data. // Get the pointer again and validate the data.
buf_ptr = iface.getReadBuffer(); buf_ptr = iface.getReadBuffer();
ASSERT_EQ(256, iface.getReadBufferSize()); 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 // Use assert so as it fails on the first failure, no need
// to continue further checks. // to continue further checks.
ASSERT_EQ(i, buf_ptr[i]); ASSERT_EQ(i, buf_ptr[i]);
...@@ -552,7 +552,7 @@ TEST_F(IfaceMgrTest, closeSockets) { ...@@ -552,7 +552,7 @@ TEST_F(IfaceMgrTest, closeSockets) {
// Create set of V4 and V6 sockets on the loopback interface. // Create set of V4 and V6 sockets on the loopback interface.
// They must differ by a port they are bound to. // 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. // Every other socket will be IPv4.
if (i % 2) { if (i % 2) {
ASSERT_NO_THROW( ASSERT_NO_THROW(
...@@ -1099,7 +1099,7 @@ TEST_F(IfaceMgrTest, sendReceive6) { ...@@ -1099,7 +1099,7 @@ TEST_F(IfaceMgrTest, sendReceive6) {
// prepare dummy payload // prepare dummy payload
uint8_t data[128]; uint8_t data[128];
for (int i = 0; i < 128; i++) { for (uint8_t i = 0; i < 128; i++) {
data[i] = i; data[i] = i;
} }
Pkt6Ptr sendPkt = Pkt6Ptr(new Pkt6(data, 128)); Pkt6Ptr sendPkt = Pkt6Ptr(new Pkt6(data, 128));
...@@ -2115,7 +2115,7 @@ TEST_F(IfaceMgrTest, iface_methods) { ...@@ -2115,7 +2115,7 @@ TEST_F(IfaceMgrTest, iface_methods) {
EXPECT_EQ(42, iface.getHWType()); EXPECT_EQ(42, iface.getHWType());
uint8_t mac[Iface::MAX_MAC_LEN+10]; 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; mac[i] = 255 - i;
EXPECT_EQ("foo", iface.getName()); EXPECT_EQ("foo", iface.getName());
......
// Copyright (C) 2011-2014 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -309,7 +309,7 @@ TEST_F(LibDhcpTest, packOptions6) { ...@@ -309,7 +309,7 @@ TEST_F(LibDhcpTest, packOptions6) {
isc::dhcp::OptionCollection opts; // list of options isc::dhcp::OptionCollection opts; // list of options
// generate content for options // generate content for options
for (int i = 0; i < 64; i++) { for (unsigned i = 0; i < 64; i++) {
buf[i]=i+100; buf[i]=i+100;
} }
...@@ -476,7 +476,7 @@ static uint8_t v4_opts[] = { ...@@ -476,7 +476,7 @@ static uint8_t v4_opts[] = {
TEST_F(LibDhcpTest, packOptions4) { TEST_F(LibDhcpTest, packOptions4) {
vector<uint8_t> payload[5]; 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].resize(3);
payload[i][0] = i*10; payload[i][0] = i*10;
payload[i][1] = i*10+1; payload[i][1] = i*10+1;
......
// 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 // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -267,7 +267,7 @@ TEST(OpaqueDataTuple, pack1Byte) { ...@@ -267,7 +267,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError); EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError);
// Set the data for tuple. // Set the data for tuple.
std::vector<uint8_t> data; std::vector<uint8_t> data;
for (int i = 0; i < 100; ++i) { for (unsigned i = 0; i < 100; ++i) {
data.push_back(i); data.push_back(i);
} }
tuple.assign(data.begin(), data.size()); tuple.assign(data.begin(), data.size());
...@@ -289,7 +289,7 @@ TEST(OpaqueDataTuple, pack1Byte) { ...@@ -289,7 +289,7 @@ TEST(OpaqueDataTuple, pack1Byte) {
out_buf.clear(); out_buf.clear();
// Fill in the tuple buffer so as it reaches maximum allowed length. The // 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. // maximum length is 255 when the size of the length field is one byte.
for (int i = 100; i < 255; ++i) { for (unsigned i = 100; i < 255; ++i) {
data.push_back(i); data.push_back(i);
} }
ASSERT_EQ(255, data.size()); ASSERT_EQ(255, data.size());
...@@ -326,7 +326,7 @@ TEST(OpaqueDataTuple, pack2Bytes) { ...@@ -326,7 +326,7 @@ TEST(OpaqueDataTuple, pack2Bytes) {
EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError); EXPECT_THROW(tuple.pack(out_buf), OpaqueDataTupleError);
// Set the data for tuple. // Set the data for tuple.
std::vector<uint8_t> data; std::vector<uint8_t> data;
for (int i = 0; i < 512; ++i) { for (unsigned i = 0; i < 512; ++i) {
data.push_back(i); data.push_back(i);
} }
tuple.assign(data.begin(), data.size()); tuple.assign(data.begin(), data.size());
......
// Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2011-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -39,7 +39,7 @@ namespace { ...@@ -39,7 +39,7 @@ namespace {
class Option6AddrLstTest : public ::testing::Test { class Option6AddrLstTest : public ::testing::Test {
public: public:
Option6AddrLstTest(): buf_(255), outBuf_(255) { Option6AddrLstTest(): buf_(255), outBuf_(255) {
for (int i = 0; i < 255; i++) { for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i; buf_[i] = 255 - i;
} }
} }
......
// Copyright (C) 2011-2012 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2011-2012, 2015 Internet Systems Consortium, Inc. ("ISC")
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -40,7 +40,7 @@ namespace { ...@@ -40,7 +40,7 @@ namespace {
class Option6IATest : public ::testing::Test { class Option6IATest : public ::testing::Test {
public: public:
Option6IATest(): buf_(255), outBuf_(255) { Option6IATest(): buf_(255), outBuf_(255) {
for (int i = 0; i < 255; i++) { for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i; buf_[i] = 255 - i;
} }
} }
......
// Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2011-2013, 2015 Internet Systems Consortium, Inc. ("ISC")
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -36,7 +36,7 @@ namespace { ...@@ -36,7 +36,7 @@ namespace {
class Option6IAAddrTest : public ::testing::Test { class Option6IAAddrTest : public ::testing::Test {
public: public:
Option6IAAddrTest() : buf_(255), outBuf_(255) { Option6IAAddrTest() : buf_(255), outBuf_(255) {
for (int i = 0; i < 255; i++) { for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i; buf_[i] = 255 - i;
} }
} }
......
// Copyright (C) 2011-2014 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -37,7 +37,7 @@ namespace { ...@@ -37,7 +37,7 @@ namespace {
class Option6IAPrefixTest : public ::testing::Test { class Option6IAPrefixTest : public ::testing::Test {
public: public:
Option6IAPrefixTest() : buf_(255), out_buf_(255) { Option6IAPrefixTest() : buf_(255), out_buf_(255) {
for (int i = 0; i < 255; i++) { for (unsigned i = 0; i < 255; i++) {
buf_[i] = 255 - i; buf_[i] = 255 - i;
} }
} }
......
// 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 // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -196,7 +196,7 @@ TEST_F(OptionCustomTest, binaryData) { ...@@ -196,7 +196,7 @@ TEST_F(OptionCustomTest, binaryData) {
// used as reference when we read back the data from a created // used as reference when we read back the data from a created
// option. // option.
OptionBuffer buf_in(14); OptionBuffer buf_in(14);
for (int i = 0; i < 14; ++i) { for (unsigned i = 0; i < 14; ++i) {
buf_in[i] = i; buf_in[i] = i;
} }
...@@ -603,7 +603,7 @@ TEST_F(OptionCustomTest, uint32DataArray) { ...@@ -603,7 +603,7 @@ TEST_F(OptionCustomTest, uint32DataArray) {
// Store these values in a buffer. // Store these values in a buffer.
OptionBuffer buf; 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); writeInt<uint32_t>(values[i], buf);
} }
// Create custom option using the input buffer. // Create custom option using the input buffer.
...@@ -649,7 +649,7 @@ TEST_F(OptionCustomTest, ipv4AddressDataArray) { ...@@ -649,7 +649,7 @@ TEST_F(OptionCustomTest, ipv4AddressDataArray) {
// Store the collection of IPv4 addresses into the buffer. // Store the collection of IPv4 addresses into the buffer.
OptionBuffer buf; OptionBuffer buf;
for (int i = 0; i < addresses.size(); ++i) { for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf); writeAddress(addresses[i], buf);
} }
...@@ -699,7 +699,7 @@ TEST_F(OptionCustomTest, ipv6AddressDataArray) { ...@@ -699,7 +699,7 @@ TEST_F(OptionCustomTest, ipv6AddressDataArray) {
// Store the collection of IPv6 addresses into the buffer. // Store the collection of IPv6 addresses into the buffer.
OptionBuffer buf; OptionBuffer buf;
for (int i = 0; i < addresses.size(); ++i) { for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf); writeAddress(addresses[i], buf);
} }
...@@ -968,7 +968,7 @@ TEST_F(OptionCustomTest, setBinaryData) { ...@@ -968,7 +968,7 @@ TEST_F(OptionCustomTest, setBinaryData) {
EXPECT_TRUE(buf.empty()); EXPECT_TRUE(buf.empty());
// Prepare input buffer with some dummy data. // Prepare input buffer with some dummy data.
OptionBuffer buf_in(10); 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; buf_in[i] = i;
} }
// Try to override the default binary buffer. // Try to override the default binary buffer.
...@@ -1433,7 +1433,7 @@ TEST_F(OptionCustomTest, unpack) { ...@@ -1433,7 +1433,7 @@ TEST_F(OptionCustomTest, unpack) {
// Store the collection of IPv4 addresses into the buffer. // Store the collection of IPv4 addresses into the buffer.
OptionBuffer buf; OptionBuffer buf;
for (int i = 0; i < addresses.size(); ++i) { for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf); writeAddress(addresses[i], buf);
} }
...@@ -1464,7 +1464,7 @@ TEST_F(OptionCustomTest, unpack) { ...@@ -1464,7 +1464,7 @@ TEST_F(OptionCustomTest, unpack) {
// Clear the buffer as we need to store new addresses in it. // Clear the buffer as we need to store new addresses in it.
buf.clear(); buf.clear();
for (int i = 0; i < addresses.size(); ++i) { for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf); writeAddress(addresses[i], buf);
} }
...@@ -1495,7 +1495,7 @@ TEST_F(OptionCustomTest, initialize) { ...@@ -1495,7 +1495,7 @@ TEST_F(OptionCustomTest, initialize) {
// Store the collection of IPv6 addresses into the buffer. // Store the collection of IPv6 addresses into the buffer.
OptionBuffer buf; OptionBuffer buf;
for (int i = 0; i < addresses.size(); ++i) { for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf); writeAddress(addresses[i], buf);
} }
...@@ -1525,7 +1525,7 @@ TEST_F(OptionCustomTest, initialize) { ...@@ -1525,7 +1525,7 @@ TEST_F(OptionCustomTest, initialize) {
// Clear the buffer as we need to store new addresses in it. // Clear the buffer as we need to store new addresses in it.
buf.clear(); buf.clear();
for (int i = 0; i < addresses.size(); ++i) { for (size_t i = 0; i < addresses.size(); ++i) {
writeAddress(addresses[i], buf); writeAddress(addresses[i], buf);
} }
......
// 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 // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above // purpose with or without fee is hereby granted, provided that the above
...@@ -356,7 +356,7 @@ TEST_F(OptionDefinitionTest, ipv6AddressArray) { ...@@ -356,7 +356,7 @@ TEST_F(OptionDefinitionTest, ipv6AddressArray) {
// Write addresses to the buffer. // Write addresses to the buffer.
OptionBuffer buf(addrs.size() * asiolink::V6ADDRESS_LEN); 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(); const std::vector<uint8_t>& vec = addrs[i].toBytes();
ASSERT_EQ(asiolink::V6ADDRESS_LEN, vec.size()); ASSERT_EQ(asiolink::V6ADDRESS_LEN, vec.size());
std::copy(vec.begin(), vec.end(), std::copy(vec.begin(), vec.end(),
...@@ -454,7 +454,7 @@ TEST_F(OptionDefinitionTest, ipv4AddressArray) { ...@@ -454,7 +454,7 @@ TEST_F(OptionDefinitionTest, ipv4AddressArray) {
// Write addresses to the buffer. // Write addresses to the buffer.
OptionBuffer buf(addrs.size() * asiolink::V4ADDRESS_LEN); 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(); const std::vector<uint8_t> vec = addrs[i].toBytes();
ASSERT_EQ(asiolink::V4ADDRESS_LEN, vec.size()); ASSERT_EQ(asiolink::V4ADDRESS_LEN, vec.size());
std::copy(vec.begin(), vec.end(), std::copy(vec.begin(), vec.end(),
...@@ -613,7 +613,7 @@ TEST_F(OptionDefinitionTest, binary) { ...@@ -613,7 +613,7 @@ TEST_F(OptionDefinitionTest, binary) {
// Prepare some dummy data (serverid): 0, 1, 2 etc. // Prepare some dummy data (serverid): 0, 1, 2 etc.
OptionBuffer buf(14); OptionBuffer buf(14);
for (int i = 0; i < 14; ++i) { for (unsigned i = 0; i < 14; ++i) {
buf[i] = i; buf[i] = i;
} }
// Create option instance with the factory function. // Create option instance with the factory function.
...@@ -666,7 +666,7 @@ TEST_F(OptionDefinitionTest, recordIA6) { ...@@ -666,7 +666,7 @@ TEST_F(OptionDefinitionTest, recordIA6) {
// Check the positive scenario. // Check the positive scenario.
OptionBuffer buf(12); OptionBuffer buf(12);
for (int i = 0; i < buf.size(); ++i) { for (size_t i = 0; i < buf.size(); ++i) {
buf[i] = i; buf[i] = i;
} }
OptionPtr option_v6; OptionPtr option_v6;
...@@ -708,7 +708,9 @@ TEST_F(OptionDefinitionTest, recordIAAddr6) { ...@@ -708,7 +708,9 @@ TEST_F(OptionDefinitionTest, recordIAAddr6) {
ASSERT_EQ(asiolink::V6ADDRESS_LEN, vec.size()); ASSERT_EQ(asiolink::V6ADDRESS_LEN, vec.size());
std::copy(vec.begin(), vec.end(), buf.begin()); 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); buf.push_back(i);
} }
ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR, buf)); ASSERT_NO_THROW(option_v6 = opt_def.optionFactory(Option::V6, D6O_IAADDR, buf));
...@@ -1030,7 +1032,7 @@ TEST_F(OptionDefinitionTest, uint16Array) { ...@@ -1030,7 +1032,7 @@ TEST_F(OptionDefinitionTest, uint16Array) {
// multiple of uint16_t size. // multiple of uint16_t size.
// buffer elements will be: 0x112233. // buffer elements will be: 0x112233.
OptionBuffer buf(6); OptionBuffer buf(6);
for (int i = 0; i < 6; ++i) { for (unsigned i = 0; i < 6; ++i) {
buf[i] = i / 2; buf[i] = i / 2;
} }
// Constructor should succeed because buffer has correct size.