mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[#3785] Checkpoint
This commit is contained in:
parent
31d33d62cf
commit
6fbf286f98
@ -490,7 +490,7 @@ public:
|
||||
isc_throw(BadValue, "invalid relay value "
|
||||
<< out_bindings[12]->getString());
|
||||
}
|
||||
for (auto i = 0; i < relay_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < relay_element->size(); ++i) {
|
||||
auto relay_address_element = relay_element->get(i);
|
||||
if (relay_address_element->getType() != Element::string) {
|
||||
isc_throw(BadValue, "relay address must be a string");
|
||||
@ -1414,7 +1414,7 @@ public:
|
||||
isc_throw(BadValue, "invalid relay value "
|
||||
<< out_bindings[7]->getString());
|
||||
}
|
||||
for (auto i = 0; i < relay_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < relay_element->size(); ++i) {
|
||||
auto relay_address_element = relay_element->get(i);
|
||||
if (relay_address_element->getType() != Element::string) {
|
||||
isc_throw(BadValue, "relay address must be a string");
|
||||
|
@ -503,7 +503,7 @@ public:
|
||||
isc_throw(BadValue, "invalid relay value "
|
||||
<< out_bindings[8]->getString());
|
||||
}
|
||||
for (auto i = 0; i < relay_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < relay_element->size(); ++i) {
|
||||
auto relay_address_element = relay_element->get(i);
|
||||
if (relay_address_element->getType() != Element::string) {
|
||||
isc_throw(BadValue, "relay address must be a string");
|
||||
@ -1725,7 +1725,7 @@ public:
|
||||
isc_throw(BadValue, "invalid relay value "
|
||||
<< out_bindings[8]->getString());
|
||||
}
|
||||
for (auto i = 0; i < relay_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < relay_element->size(); ++i) {
|
||||
auto relay_address_element = relay_element->get(i);
|
||||
if (relay_address_element->getType() != Element::string) {
|
||||
isc_throw(BadValue, "relay address must be a string");
|
||||
|
@ -927,7 +927,7 @@ MySqlConfigBackendImpl::processOptionDefRow(MySqlBindingCollection::iterator fir
|
||||
|
||||
// This element must contain a list of integers specifying
|
||||
// types of the record fields.
|
||||
for (auto i = 0; i < record_types_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < record_types_element->size(); ++i) {
|
||||
auto type_element = record_types_element->get(i);
|
||||
if (type_element->getType() != Element::integer) {
|
||||
isc_throw(BadValue, "record type values must be integers");
|
||||
|
@ -904,7 +904,7 @@ PgSqlConfigBackendImpl::processOptionDefRow(PgSqlResultRowWorker& worker,
|
||||
|
||||
// This element must contain a list of integers specifying
|
||||
// types of the record fields.
|
||||
for (auto i = 0; i < record_types_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < record_types_element->size(); ++i) {
|
||||
auto type_element = record_types_element->get(i);
|
||||
if (type_element->getType() != Element::integer) {
|
||||
isc_throw(BadValue, "record type values must be integers");
|
||||
@ -1127,7 +1127,7 @@ PgSqlConfigBackendImpl::setRelays(PgSqlResultRowWorker& worker, size_t col, Netw
|
||||
isc_throw(BadValue, "invalid relay list: " << worker.getString(col));
|
||||
}
|
||||
|
||||
for (auto i = 0; i < relay_element->size(); ++i) {
|
||||
for (unsigned i = 0; i < relay_element->size(); ++i) {
|
||||
auto relay_address_element = relay_element->get(i);
|
||||
if (relay_address_element->getType() != Element::string) {
|
||||
isc_throw(BadValue, "elements of relay_addresses list must"
|
||||
|
@ -1446,7 +1446,7 @@ public:
|
||||
/// rows to fetch.
|
||||
bool getNextRow(LeaseStatsRow& row) {
|
||||
// If we're past the end, punt.
|
||||
if (next_row_ >= result_set_->getRows()) {
|
||||
if (static_cast<int>(next_row_) >= result_set_->getRows()) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ IOAddress firstAddrInPrefix6(const IOAddress& prefix, uint8_t len) {
|
||||
}
|
||||
|
||||
// Clear out the remaining bits.
|
||||
for (int i = len / 8; i < sizeof(packed); ++i) {
|
||||
for (unsigned i = len / 8; i < sizeof(packed); ++i) {
|
||||
packed[i] = 0x0;
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ IOAddress lastAddrInPrefix6(const IOAddress& prefix, uint8_t len) {
|
||||
}
|
||||
|
||||
// Finally set remaining bits to 1.
|
||||
for (int i = len / 8; i < sizeof(packed); ++i) {
|
||||
for (unsigned i = len / 8; i < sizeof(packed); ++i) {
|
||||
packed[i] = 0xff;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ void
|
||||
TestServerUnixSocket::generateCustomResponse(const uint64_t response_size) {
|
||||
std::ostringstream s;
|
||||
s << "{";
|
||||
while (s.tellp() < response_size) {
|
||||
while (s.tellp() < static_cast<std::streampos>(response_size)) {
|
||||
s << "\"param\": \"value\",";
|
||||
}
|
||||
s << "}";
|
||||
|
@ -108,7 +108,7 @@ ClientClasses::fromElement(isc::data::ConstElementPtr cc_list) {
|
||||
isc_throw(BadValue, "not a List element");
|
||||
}
|
||||
|
||||
for (auto i = 0; i < cc_list->size(); ++i) {
|
||||
for (unsigned i = 0; i < cc_list->size(); ++i) {
|
||||
auto cclass = cc_list->get(i);
|
||||
if (cclass->getType() != Element::string) {
|
||||
isc_throw(BadValue, "elements of list must be valid strings");
|
||||
|
@ -132,7 +132,7 @@ Iface::getPlainMac() const {
|
||||
ostringstream tmp;
|
||||
tmp.fill('0');
|
||||
tmp << hex;
|
||||
for (int i = 0; i < mac_len_; i++) {
|
||||
for (unsigned i = 0; i < mac_len_; i++) {
|
||||
tmp.width(2);
|
||||
tmp << static_cast<int>(mac_[i]);
|
||||
if (i < mac_len_-1) {
|
||||
|
@ -52,7 +52,7 @@ OpaqueDataTuple::getText() const {
|
||||
|
||||
void
|
||||
OpaqueDataTuple::pack(isc::util::OutputBuffer& buf) const {
|
||||
if ((1 << (getDataFieldSize() * 8)) <= getLength()) {
|
||||
if ((1U << (getDataFieldSize() * 8)) <= getLength()) {
|
||||
isc_throw(OpaqueDataTupleError, "failed to create on-wire format of the"
|
||||
" opaque data field, because current data length "
|
||||
<< getLength() << " exceeds the maximum size for the length"
|
||||
@ -130,7 +130,7 @@ OpaqueDataTuple::unpack(OpaqueDataTuple::InputIterator begin, OpaqueDataTuple::I
|
||||
// reminder of the buffer is long enough.
|
||||
begin += getDataFieldSize();
|
||||
// Attempt to parse as a length-value pair.
|
||||
if (std::distance(begin, end) < len) {
|
||||
if (static_cast<size_t>(std::distance(begin, end)) < len) {
|
||||
if (Option::lenient_parsing_) {
|
||||
// Fallback to parsing the rest of the option as a single value.
|
||||
len = std::distance(begin, end);
|
||||
|
@ -68,7 +68,7 @@ void Option6IA::unpack(OptionBufferConstIter begin,
|
||||
OptionBufferConstIter end) {
|
||||
// IA_NA and IA_PD have 12 bytes content (iaid, t1, t2 fields)
|
||||
// followed by 0 or more sub-options.
|
||||
if (distance(begin, end) < OPTION6_IA_LEN) {
|
||||
if (static_cast<size_t>(distance(begin, end)) < OPTION6_IA_LEN) {
|
||||
isc_throw(OutOfRange, "Option " << type_ << " truncated");
|
||||
}
|
||||
iaid_ = readUint32(&(*begin), distance(begin, end));
|
||||
|
@ -70,7 +70,7 @@ void Option6IAAddr::pack(isc::util::OutputBuffer& buf, bool) const {
|
||||
|
||||
void Option6IAAddr::unpack(OptionBuffer::const_iterator begin,
|
||||
OptionBuffer::const_iterator end) {
|
||||
if ( distance(begin, end) < OPTION6_IAADDR_LEN) {
|
||||
if (static_cast<size_t>(distance(begin, end)) < OPTION6_IAADDR_LEN) {
|
||||
isc_throw(OutOfRange, "Option " << type_ << " truncated");
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ void Option6IAPrefix::pack(isc::util::OutputBuffer& buf, bool) const {
|
||||
|
||||
void Option6IAPrefix::unpack(OptionBuffer::const_iterator begin,
|
||||
OptionBuffer::const_iterator end) {
|
||||
if ( distance(begin, end) < OPTION6_IAPREFIX_LEN) {
|
||||
if (static_cast<size_t>(distance(begin, end)) < OPTION6_IAPREFIX_LEN) {
|
||||
isc_throw(OutOfRange, "Option " << type_ << " truncated");
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ Option6StatusCode::pack(isc::util::OutputBuffer& buf, bool) const {
|
||||
void
|
||||
Option6StatusCode::unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
|
||||
// Make sure that the option is not truncated.
|
||||
if (std::distance(begin, end) < OPTION6_STATUS_CODE_MIN_LEN) {
|
||||
if (static_cast<size_t>(std::distance(begin, end)) < OPTION6_STATUS_CODE_MIN_LEN) {
|
||||
isc_throw(OutOfRange, "Status Code option ("
|
||||
<< D6O_STATUS_CODE << ") truncated");
|
||||
}
|
||||
@ -174,7 +174,7 @@ Option4SlpServiceScope::pack(isc::util::OutputBuffer& buf, bool check) const {
|
||||
void
|
||||
Option4SlpServiceScope::unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
|
||||
// Make sure that the option is not truncated.
|
||||
if (std::distance(begin, end) < OPTION4_SLP_SERVICE_SCOPEMIN_LEN) {
|
||||
if (static_cast<size_t>(std::distance(begin, end)) < OPTION4_SLP_SERVICE_SCOPEMIN_LEN) {
|
||||
isc_throw(OutOfRange, "SLP Service Scope option ("
|
||||
<< DHO_SERVICE_SCOPE << ") truncated");
|
||||
}
|
||||
|
@ -152,7 +152,8 @@ OptionClasslessStaticRoute::parseWireData(OptionBufferConstIter begin, OptionBuf
|
||||
++begin;
|
||||
|
||||
// once we know haw many significant octets there are, check for truncated data again
|
||||
if (distance(begin, end) < (significant_octets + V4ADDRESS_LEN)) {
|
||||
if (static_cast<size_t>(distance(begin, end)) <
|
||||
(significant_octets + V4ADDRESS_LEN)) {
|
||||
isc_throw(OutOfRange,
|
||||
"DHCPv4 OptionClasslessStaticRoute " << type_ << " is truncated.");
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
|
||||
|
||||
// Our data field requires that there is a certain chunk of
|
||||
// data left in the buffer. If not, option is truncated.
|
||||
if (std::distance(data, data_buf.end()) < data_size) {
|
||||
if (static_cast<size_t>(std::distance(data, data_buf.end())) < data_size) {
|
||||
isc_throw(OutOfRange, "option buffer truncated");
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
|
||||
size_t data_size = bufferLength(fields.back(), true,
|
||||
data, data_buf.end());
|
||||
isc_throw_assert(data_size > 0);
|
||||
if (std::distance(data, data_buf.end()) < data_size) {
|
||||
if (static_cast<size_t>(std::distance(data, data_buf.end())) < data_size) {
|
||||
break;
|
||||
}
|
||||
buffers.push_back(OptionBuffer(data, data + data_size));
|
||||
@ -350,7 +350,7 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
|
||||
// Note that data_size returned by getDataTypeLen may be zero
|
||||
// if variable length data is being held by the option but
|
||||
// this will not cause this check to throw exception.
|
||||
if (std::distance(data, data_buf.end()) < data_size) {
|
||||
if (static_cast<size_t>(std::distance(data, data_buf.end())) < data_size) {
|
||||
isc_throw(OutOfRange, "option buffer truncated");
|
||||
}
|
||||
// For an array of values we are taking different path because
|
||||
@ -369,7 +369,7 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
|
||||
// data_size. Note that it is ok to truncate the data if and only
|
||||
// if the data buffer is long enough to keep at least one value.
|
||||
// This has been checked above already.
|
||||
if (std::distance(data, data_buf.end()) < data_size) {
|
||||
if (static_cast<size_t>(std::distance(data, data_buf.end())) < data_size) {
|
||||
break;
|
||||
}
|
||||
buffers.push_back(OptionBuffer(data, data + data_size));
|
||||
@ -380,7 +380,8 @@ OptionCustom::createBuffers(const OptionBuffer& data_buf) {
|
||||
// getDataTypeLen returns zero for variable size data types
|
||||
// such as strings. Simply take whole buffer.
|
||||
data_size = bufferLength(data_type, false, data, data_buf.end());
|
||||
if ((data_size > 0) && (std::distance(data, data_buf.end()) >= data_size)) {
|
||||
if ((data_size > 0) &&
|
||||
(static_cast<size_t>(std::distance(data, data_buf.end())) >= data_size)) {
|
||||
buffers.push_back(OptionBuffer(data, data + data_size));
|
||||
data += data_size;
|
||||
} else {
|
||||
|
@ -772,7 +772,7 @@ OptionPtr
|
||||
OptionDefinition::factoryIA6(uint16_t type,
|
||||
OptionBufferConstIter begin,
|
||||
OptionBufferConstIter end) {
|
||||
if (std::distance(begin, end) < Option6IA::OPTION6_IA_LEN) {
|
||||
if (static_cast<size_t>(std::distance(begin, end)) < Option6IA::OPTION6_IA_LEN) {
|
||||
isc_throw(isc::OutOfRange, "input option buffer has invalid size,"
|
||||
<< " expected at least " << Option6IA::OPTION6_IA_LEN
|
||||
<< " bytes");
|
||||
@ -785,7 +785,7 @@ OptionPtr
|
||||
OptionDefinition::factoryIAAddr6(uint16_t type,
|
||||
OptionBufferConstIter begin,
|
||||
OptionBufferConstIter end) {
|
||||
if (std::distance(begin, end) < Option6IAAddr::OPTION6_IAADDR_LEN) {
|
||||
if (static_cast<size_t>(std::distance(begin, end)) < Option6IAAddr::OPTION6_IAADDR_LEN) {
|
||||
isc_throw(isc::OutOfRange,
|
||||
"input option buffer has invalid size, expected at least "
|
||||
<< Option6IAAddr::OPTION6_IAADDR_LEN << " bytes");
|
||||
@ -799,7 +799,7 @@ OptionPtr
|
||||
OptionDefinition::factoryIAPrefix6(uint16_t type,
|
||||
OptionBufferConstIter begin,
|
||||
OptionBufferConstIter end) {
|
||||
if (std::distance(begin, end) < Option6IAPrefix::OPTION6_IAPREFIX_LEN) {
|
||||
if (static_cast<size_t>(std::distance(begin, end)) < Option6IAPrefix::OPTION6_IAPREFIX_LEN) {
|
||||
isc_throw(isc::OutOfRange,
|
||||
"input option buffer has invalid size, expected at least "
|
||||
<< Option6IAPrefix::OPTION6_IAPREFIX_LEN << " bytes");
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
/// equal to 1, 2 or 4 bytes. The data type is not checked in this function
|
||||
/// because it is checked in a constructor.
|
||||
virtual void unpack(OptionBufferConstIter begin, OptionBufferConstIter end) {
|
||||
if (distance(begin, end) < sizeof(T)) {
|
||||
if (static_cast<size_t>(distance(begin, end)) < sizeof(T)) {
|
||||
isc_throw(OutOfRange, "OptionInt " << getType() << " truncated");
|
||||
}
|
||||
// @todo consider what to do if buffer is longer than data type.
|
||||
|
@ -60,7 +60,7 @@ OptionOpaqueDataTuples::unpack(OptionBufferConstIter begin,
|
||||
|
||||
// Start reading opaque data.
|
||||
size_t offset = 0;
|
||||
while (offset < std::distance(begin, end)) {
|
||||
while (offset < static_cast<size_t>(std::distance(begin, end))) {
|
||||
// Parse a tuple.
|
||||
OpaqueDataTuple tuple(length_field_type_, begin + offset, end);
|
||||
addTuple(tuple);
|
||||
|
@ -71,7 +71,7 @@ OptionVendorClass::unpack(OptionBufferConstIter begin,
|
||||
|
||||
// Start reading opaque data.
|
||||
size_t offset = 0;
|
||||
while (offset < std::distance(begin, end)) {
|
||||
while (offset < static_cast<size_t>(std::distance(begin, end))) {
|
||||
// Parse a tuple.
|
||||
OpaqueDataTuple tuple(OptionDataTypeUtil::getTupleLenFieldType(getUniverse()),
|
||||
begin + offset, end);
|
||||
|
@ -100,7 +100,7 @@ CfgExpiration::rangeCheck(const int64_t value, const uint64_t max_value,
|
||||
isc_throw(OutOfRange, "value for configuration parameter '"
|
||||
<< config_parameter_name << "' must not be negative");
|
||||
|
||||
} else if (value > max_value) {
|
||||
} else if (static_cast<uint64_t>(value) > max_value) {
|
||||
isc_throw(OutOfRange, "out range value '" << value << "' for configuration"
|
||||
" parameter '" << config_parameter_name << "', expected maximum"
|
||||
" value of '" << max_value << "'");
|
||||
|
@ -47,7 +47,7 @@ FreeLeaseQueueAllocator::pickAddressInternal(const ClientClasses& client_classes
|
||||
// Let's first iterate over the pools and identify the ones that
|
||||
// meet client class criteria and are not exhausted.
|
||||
std::vector<uint64_t> available;
|
||||
for (auto i = 0; i < pools.size(); ++i) {
|
||||
for (unsigned i = 0; i < pools.size(); ++i) {
|
||||
// Check if the pool is allowed for the client's classes.
|
||||
if (pools[i]->clientSupported(client_classes)) {
|
||||
// Get or create the pool state.
|
||||
@ -94,7 +94,7 @@ FreeLeaseQueueAllocator::pickPrefixInternal(const ClientClasses& client_classes,
|
||||
// Let's first iterate over the pools and identify the ones that
|
||||
// meet client class criteria and are not exhausted.
|
||||
std::vector<uint64_t> available;
|
||||
for (auto i = 0; i < pools.size(); ++i) {
|
||||
for (unsigned i = 0; i < pools.size(); ++i) {
|
||||
// Check if the pool is allowed for the client's classes.
|
||||
if (pools[i]->clientSupported(client_classes)) {
|
||||
if (!Allocator::isValidPrefixPool(prefix_length_match, pools[i],
|
||||
|
@ -868,7 +868,7 @@ LeaseMgr::upgradeLease6ExtendedInfo(const Lease6Ptr& lease,
|
||||
}
|
||||
|
||||
verifying = "relay";
|
||||
for (i = 0; i < relay_info->size(); ++i) {
|
||||
for (i = 0; static_cast<size_t>(i) < relay_info->size(); ++i) {
|
||||
ElementPtr relay = relay_info->getNonConst(i);
|
||||
if (!relay) {
|
||||
mutable_isc->remove("relay-info");
|
||||
@ -943,7 +943,7 @@ LeaseMgr::upgradeLease6ExtendedInfo(const Lease6Ptr& lease,
|
||||
}
|
||||
|
||||
verifying = "relay";
|
||||
for (i = 0; i < relay_info->size(); ++i) {
|
||||
for (i = 0; static_cast<size_t>(i) < relay_info->size(); ++i) {
|
||||
ElementPtr relay = relay_info->getNonConst(i);
|
||||
if (!upgraded && !relay) {
|
||||
mutable_isc->remove("relay-info");
|
||||
@ -1235,7 +1235,7 @@ LeaseMgr::addExtendedInfo6(const Lease6Ptr& lease) {
|
||||
return (added);
|
||||
}
|
||||
|
||||
for (int i = 0; i < relay_info->size(); ++i) {
|
||||
for (unsigned i = 0; i < relay_info->size(); ++i) {
|
||||
ConstElementPtr relay = relay_info->get(i);
|
||||
if (!relay || (relay->getType() != Element::map) || relay->empty()) {
|
||||
continue;
|
||||
|
@ -83,7 +83,7 @@ ClassLeaseCounter::adjustClassCounts(ConstElementPtr classes, int offset,
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < classes->size(); ++i) {
|
||||
for (unsigned i = 0; i < classes->size(); ++i) {
|
||||
std::string class_name = classes->get(i)->stringValue();
|
||||
adjustClassCount(class_name, offset, ltype);
|
||||
}
|
||||
|
@ -1411,7 +1411,8 @@ Memfile_LeaseMgr::getLeases4Internal(const asiolink::IOAddress& lower_bound_addr
|
||||
|
||||
// Return all other leases being within the page size.
|
||||
for (auto lease = lb;
|
||||
(lease != idx.end()) && (std::distance(lb, lease) < page_size.page_size_);
|
||||
(lease != idx.end()) &&
|
||||
(static_cast<size_t>(std::distance(lb, lease)) < page_size.page_size_);
|
||||
++lease) {
|
||||
collection.push_back(Lease4Ptr(new Lease4(**lease)));
|
||||
}
|
||||
@ -1686,7 +1687,8 @@ Memfile_LeaseMgr::getLeases6Internal(const asiolink::IOAddress& lower_bound_addr
|
||||
|
||||
// Return all other leases being within the page size.
|
||||
for (auto lease = lb;
|
||||
(lease != idx.end()) && (std::distance(lb, lease) < page_size.page_size_);
|
||||
(lease != idx.end()) &&
|
||||
(static_cast<size_t>(std::distance(lb, lease)) < page_size.page_size_);
|
||||
++lease) {
|
||||
collection.push_back(Lease6Ptr(new Lease6(**lease)));
|
||||
}
|
||||
@ -1789,8 +1791,9 @@ Memfile_LeaseMgr::getExpiredLeases4Internal(Lease4Collection& expired_leases,
|
||||
|
||||
// Copy only the number of leases indicated by the max_leases parameter.
|
||||
for (Lease4StorageExpirationIndex::const_iterator lease = index.begin();
|
||||
(lease != ub) && ((max_leases == 0) || (std::distance(index.begin(), lease) <
|
||||
max_leases));
|
||||
(lease != ub) &&
|
||||
((max_leases == 0) ||
|
||||
(static_cast<size_t>(std::distance(index.begin(), lease)) < max_leases));
|
||||
++lease) {
|
||||
expired_leases.push_back(Lease4Ptr(new Lease4(**lease)));
|
||||
}
|
||||
@ -1825,8 +1828,9 @@ Memfile_LeaseMgr::getExpiredLeases6Internal(Lease6Collection& expired_leases,
|
||||
|
||||
// Copy only the number of leases indicated by the max_leases parameter.
|
||||
for (Lease6StorageExpirationIndex::const_iterator lease = index.begin();
|
||||
(lease != ub) && ((max_leases == 0) || (std::distance(index.begin(), lease) <
|
||||
max_leases));
|
||||
(lease != ub) &&
|
||||
((max_leases == 0) ||
|
||||
(static_cast<size_t>(std::distance(index.begin(), lease)) < max_leases));
|
||||
++lease) {
|
||||
expired_leases.push_back(Lease6Ptr(new Lease6(**lease)));
|
||||
}
|
||||
@ -2718,7 +2722,7 @@ Memfile_LeaseMgr::checkLimits4(isc::data::ConstElementPtr const& user_context) c
|
||||
// an "address-limit", check its value against the class's lease count.
|
||||
ConstElementPtr classes = limits->get("client-classes");
|
||||
if (classes) {
|
||||
for (int i = 0; i < classes->size(); ++i) {
|
||||
for (unsigned i = 0; i < classes->size(); ++i) {
|
||||
ConstElementPtr class_elem = classes->get(i);
|
||||
// Get class name.
|
||||
ConstElementPtr name_elem = class_elem->get("name");
|
||||
@ -2776,7 +2780,7 @@ Memfile_LeaseMgr::checkLimits4(isc::data::ConstElementPtr const& user_context) c
|
||||
}
|
||||
|
||||
// If we're over the limit, return the error.
|
||||
if (lease_count >= limit) {
|
||||
if (static_cast<uint64_t>(lease_count) >= limit) {
|
||||
std::ostringstream ss;
|
||||
ss << "address limit " << limit << " for subnet ID " << subnet_id
|
||||
<< ", current lease count " << lease_count;
|
||||
@ -2805,7 +2809,7 @@ Memfile_LeaseMgr::checkLimits6(isc::data::ConstElementPtr const& user_context) c
|
||||
// class lease count.
|
||||
ConstElementPtr classes = limits->get("client-classes");
|
||||
if (classes) {
|
||||
for (int i = 0; i < classes->size(); ++i) {
|
||||
for (unsigned i = 0; i < classes->size(); ++i) {
|
||||
ConstElementPtr class_elem = classes->get(i);
|
||||
// Get class name.
|
||||
ConstElementPtr name_elem = class_elem->get("name");
|
||||
@ -2877,7 +2881,7 @@ Memfile_LeaseMgr::checkLimits6(isc::data::ConstElementPtr const& user_context) c
|
||||
}
|
||||
|
||||
// If we're over the limit, return the error.
|
||||
if (lease_count >= limit) {
|
||||
if (static_cast<uint64_t>(lease_count) >= limit) {
|
||||
std::ostringstream ss;
|
||||
ss << (ltype == Lease::TYPE_NA ? "address" : "prefix")
|
||||
<< " limit " << limit << " for subnet ID " << subnet_id
|
||||
|
@ -180,7 +180,7 @@ PacketFuzzer::transfer(uint8_t const* data, size_t size) const {
|
||||
// Now send the data to the UDP port on which Kea is listening.
|
||||
// Send the data to the main Kea thread. Limit the size of the
|
||||
// packets that can be sent.
|
||||
size_t send_len = (length < MAX_SEND_SIZE) ? length : MAX_SEND_SIZE;
|
||||
size_t send_len = (size < MAX_SEND_SIZE) ? size : MAX_SEND_SIZE;
|
||||
ssize_t sent = sendto(sockfd_, buf, send_len, 0, sockaddr_ptr_,
|
||||
sockaddr_len_);
|
||||
if (sent < 0) {
|
||||
|
@ -36,7 +36,7 @@ RandomAllocator::pickAddressInternal(const ClientClasses& client_classes,
|
||||
// ones.
|
||||
std::vector<uint64_t> available;
|
||||
std::vector<uint64_t> exhausted;
|
||||
for (auto i = 0; i < pools.size(); ++i) {
|
||||
for (unsigned i = 0; i < pools.size(); ++i) {
|
||||
// Check if the pool is allowed for the client's classes.
|
||||
if (pools[i]->clientSupported(client_classes)) {
|
||||
// Get or create the pool state.
|
||||
@ -99,7 +99,7 @@ RandomAllocator::pickPrefixInternal(const ClientClasses& client_classes,
|
||||
// ones.
|
||||
std::vector<uint64_t> available;
|
||||
std::vector<uint64_t> exhausted;
|
||||
for (auto i = 0; i < pools.size(); ++i) {
|
||||
for (unsigned i = 0; i < pools.size(); ++i) {
|
||||
// Check if the pool is allowed for the client's classes.
|
||||
if (pools[i]->clientSupported(client_classes)) {
|
||||
if (!Allocator::isValidPrefixPool(prefix_length_match, pools[i],
|
||||
|
@ -133,7 +133,8 @@ LabelSequence::serialize(void* buf, size_t buf_len) const {
|
||||
std::memcpy(bp, &data_[offsets_[first_label_]], ndata_len);
|
||||
bp += ndata_len;
|
||||
|
||||
isc_throw_assert(bp - reinterpret_cast<const uint8_t*>(buf) == expected_size);
|
||||
isc_throw_assert(bp - reinterpret_cast<const uint8_t*>(buf) ==
|
||||
static_cast<const ssize_t>(expected_size));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -154,7 +154,7 @@ MessageImpl::init() {
|
||||
edns_ = EDNSPtr();
|
||||
tsig_rr_ = ConstTSIGRecordPtr();
|
||||
|
||||
for (int i = 0; i < NUM_SECTIONS; ++i) {
|
||||
for (unsigned int i = 0; i < NUM_SECTIONS; ++i) {
|
||||
counts_[i] = 0;
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ Message::getTSIGRecord() const {
|
||||
|
||||
unsigned int
|
||||
Message::getRRCount(const Section section) const {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
return (impl_->counts_[section]);
|
||||
@ -507,7 +507,7 @@ Message::addRRset(const Section section, RRsetPtr rrset) {
|
||||
isc_throw(InvalidMessageOperation,
|
||||
"addRRset performed in non-render mode");
|
||||
}
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ Message::addRRset(const Section section, RRsetPtr rrset) {
|
||||
bool
|
||||
Message::hasRRset(const Section section, const Name& name,
|
||||
const RRClass& rrclass, const RRType& rrtype) const {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
|
||||
@ -542,7 +542,7 @@ Message::hasRRset(const Section section, const RRsetPtr& rrset) const {
|
||||
|
||||
bool
|
||||
Message::removeRRset(const Section section, RRsetIterator& iterator) {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
|
||||
@ -570,7 +570,7 @@ Message::clearSection(const Section section) {
|
||||
isc_throw(InvalidMessageOperation,
|
||||
"clearSection performed in non-render mode");
|
||||
}
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
if (section == Message::SECTION_QUESTION) {
|
||||
@ -658,7 +658,7 @@ MessageImpl::parseQuestion(InputBuffer& buffer) {
|
||||
unsigned int added = 0;
|
||||
|
||||
for (unsigned int count = 0;
|
||||
count < counts_[Message::SECTION_QUESTION];
|
||||
static_cast<int>(count) < counts_[Message::SECTION_QUESTION];
|
||||
++count) {
|
||||
const Name name(buffer);
|
||||
|
||||
@ -732,13 +732,15 @@ struct MatchRR {
|
||||
int
|
||||
MessageImpl::parseSection(const Message::Section section,
|
||||
InputBuffer& buffer, Message::ParseOptions options) {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
|
||||
unsigned int added = 0;
|
||||
|
||||
for (unsigned int count = 0; count < counts_[section]; ++count) {
|
||||
for (unsigned int count = 0;
|
||||
static_cast<int>(count) < counts_[section];
|
||||
++count) {
|
||||
// We need to remember the start position for TSIG processing
|
||||
const size_t start_position = buffer.getPosition();
|
||||
|
||||
@ -847,7 +849,7 @@ MessageImpl::addTSIG(Message::Section section, unsigned int count,
|
||||
isc_throw(DNSMessageFORMERR,
|
||||
"TSIG RR found in an invalid section");
|
||||
}
|
||||
if (count != counts_[section] - 1) {
|
||||
if (static_cast<int>(count) != counts_[section] - 1) {
|
||||
isc_throw(DNSMessageFORMERR, "TSIG RR is not the last record");
|
||||
}
|
||||
// This check will never fail as the multiple TSIG RR case is
|
||||
@ -991,7 +993,7 @@ Message::clear(Mode mode) {
|
||||
|
||||
void
|
||||
Message::appendSection(const Section section, const Message& source) {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
|
||||
@ -1135,7 +1137,7 @@ Message::endQuestion() const {
|
||||
///
|
||||
const SectionIterator<RRsetPtr>
|
||||
Message::beginSection(const Section section) const {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
if (section == SECTION_QUESTION) {
|
||||
@ -1148,7 +1150,7 @@ Message::beginSection(const Section section) const {
|
||||
|
||||
const SectionIterator<RRsetPtr>
|
||||
Message::endSection(const Section section) const {
|
||||
if (static_cast<int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
if (static_cast<unsigned int>(section) >= MessageImpl::NUM_SECTIONS) {
|
||||
isc_throw(OutOfRange, "Invalid message section: " << static_cast<int>(section));
|
||||
}
|
||||
if (section == SECTION_QUESTION) {
|
||||
|
@ -932,7 +932,7 @@ TokenSplit::evaluate(Pkt& pkt, ValueStack& values) {
|
||||
boost::algorithm::token_compress_off);
|
||||
|
||||
// Range check the field.
|
||||
if (field < 1 || field > fields.size()) {
|
||||
if (field < 1 || static_cast<size_t>(field) > fields.size()) {
|
||||
// Push an empty string if field is out of range.
|
||||
values.push("");
|
||||
|
||||
@ -1367,7 +1367,7 @@ TokenVendorClass::evaluate(Pkt& pkt, ValueStack& values) {
|
||||
case DATA:
|
||||
{
|
||||
size_t max = vendor->getTuplesNum();
|
||||
if (index_ + 1 > max) {
|
||||
if (static_cast<size_t>(index_ + 1) > max) {
|
||||
// The index specified is out of bounds, e.g. there are only
|
||||
// 2 tuples and index specified is 5.
|
||||
LOG_DEBUG(eval_logger, EVAL_DBG_STACK, EVAL_DEBUG_VENDOR_CLASS_DATA_NOT_FOUND)
|
||||
|
@ -95,7 +95,8 @@ CalloutManager::registerCallout(const std::string& name,
|
||||
bool
|
||||
CalloutManager::calloutsPresent(int hook_index) const {
|
||||
// Validate the hook index.
|
||||
if ((hook_index < 0) || (hook_index >= hook_vector_.size())) {
|
||||
if ((hook_index < 0) ||
|
||||
(static_cast<size_t>(hook_index) >= hook_vector_.size())) {
|
||||
isc_throw(NoSuchHook, "hook index " << hook_index <<
|
||||
" is not valid for the list of registered hooks");
|
||||
}
|
||||
@ -242,7 +243,7 @@ CalloutManager::deregisterCallout(const std::string& name, CalloutPtr callout,
|
||||
int hook_index = server_hooks_.getIndex(name);
|
||||
|
||||
// New hooks can have been registered since the manager was constructed.
|
||||
if (hook_index >= hook_vector_.size()) {
|
||||
if (static_cast<size_t>(hook_index) >= hook_vector_.size()) {
|
||||
return (false);
|
||||
}
|
||||
|
||||
@ -340,7 +341,7 @@ CalloutManager::registerCommandHook(const std::string& command_name) {
|
||||
void
|
||||
CalloutManager::ensureHookLibsVectorSize() {
|
||||
ServerHooks& hooks = ServerHooks::getServerHooks();
|
||||
if (hooks.getCount() > hook_vector_.size()) {
|
||||
if (static_cast<size_t>(hooks.getCount()) > hook_vector_.size()) {
|
||||
// Uh oh, there are more hook points that our vector allows.
|
||||
hook_vector_.resize(hooks.getCount());
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ LibraryHandle::getParameters() {
|
||||
index = callout_manager_.getLibraryIndex();
|
||||
}
|
||||
|
||||
if ((index > libinfo.size()) || (index <= 0)) {
|
||||
if ((index > static_cast<int>(libinfo.size())) || (index <= 0)) {
|
||||
// Something is very wrong here. The library index is out of bounds.
|
||||
// However, this is user facing interface, so we should not throw here.
|
||||
return (isc::data::ConstElementPtr());
|
||||
|
@ -604,7 +604,7 @@ PgSqlConnection::executePreparedStatement(PgSqlTaggedStatement& statement,
|
||||
const PsqlBindArray& in_bindings) {
|
||||
checkUnusable();
|
||||
|
||||
if (statement.nbparams != in_bindings.size()) {
|
||||
if (static_cast<size_t>(statement.nbparams) != in_bindings.size()) {
|
||||
isc_throw (InvalidOperation, "executePreparedStatement:"
|
||||
<< " expected: " << statement.nbparams
|
||||
<< " parameters, given: " << in_bindings.size()
|
||||
|
@ -295,7 +295,7 @@ PsqlBindArray::toText() const {
|
||||
return ("bindarray is empty");
|
||||
}
|
||||
|
||||
for (int i = 0; i < values_.size(); ++i) {
|
||||
for (size_t i = 0; i < values_.size(); ++i) {
|
||||
stream << i << " : ";
|
||||
|
||||
if (lengths_[i] == 0) {
|
||||
|
@ -49,7 +49,7 @@ bool LogContentTest::checkFile() {
|
||||
ifstream file(LOG_FILE);
|
||||
EXPECT_TRUE(file.is_open());
|
||||
string line, exp_line;
|
||||
int i = 0;
|
||||
unsigned i = 0;
|
||||
bool found = true;
|
||||
|
||||
using namespace std;
|
||||
|
@ -91,7 +91,7 @@ bool UnixControlClient::sendCommand(const std::string& command) {
|
||||
}
|
||||
// Send command
|
||||
int bytes_sent = send(socket_fd_, command.c_str(), command.length(), 0);
|
||||
if (bytes_sent < command.length()) {
|
||||
if (bytes_sent < static_cast<int>(command.length())) {
|
||||
const char* errmsg = strerror(errno);
|
||||
ADD_FAILURE() << "Failed to send " << command.length()
|
||||
<< " bytes, send() returned " << bytes_sent
|
||||
|
@ -153,7 +153,7 @@ void applyDelete(ConstElementPtr key, ElementPtr scope) {
|
||||
return;
|
||||
} else if (key->getType() == Element::integer) {
|
||||
int index = key->intValue();
|
||||
if ((index >= 0) && (index < scope->size())) {
|
||||
if ((index >= 0) && (static_cast<size_t>(index) < scope->size())) {
|
||||
scope->remove(index);
|
||||
}
|
||||
} else if (key->getType() == Element::map) {
|
||||
@ -166,7 +166,7 @@ void applyDelete(ConstElementPtr key, ElementPtr scope) {
|
||||
if (name.empty()) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < scope->size(); ++i) {
|
||||
for (unsigned i = 0; i < scope->size(); ++i) {
|
||||
ElementPtr item = scope->getNonConst(i);
|
||||
if (!item || (item->getType() != Element::map)) {
|
||||
continue;
|
||||
@ -283,7 +283,7 @@ void applyDown(ConstElementPtr path, ConstElementPtr actions, ElementPtr scope,
|
||||
for (ElementPtr& down : downs) {
|
||||
applyDown(path, actions, down, next);
|
||||
}
|
||||
} else if ((index >= 0) && (index < scope->size())) {
|
||||
} else if ((index >= 0) && (static_cast<size_t>(index) < scope->size())) {
|
||||
applyDown(path, actions, scope->getNonConst(index), next);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user