2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 06:25:34 +00:00

[#1495] fix non-printable numeric_limits

This commit is contained in:
Andrei Pavel
2020-10-26 16:07:52 +02:00
parent 04961564d0
commit db6e5359dd
3 changed files with 6 additions and 6 deletions

View File

@@ -255,7 +255,7 @@ T HAConfigParser::getAndValidateInteger(const ConstElementPtr& config,
} else if (value > std::numeric_limits<T>::max()) { } else if (value > std::numeric_limits<T>::max()) {
isc_throw(ConfigError, "'" << parameter_name << "' must not be greater than " isc_throw(ConfigError, "'" << parameter_name << "' must not be greater than "
<< std::numeric_limits<T>::max()); << +std::numeric_limits<T>::max());
} }
return (static_cast<T>(value)); return (static_cast<T>(value));

View File

@@ -236,7 +236,7 @@ OptionDataTypeUtil::writeTuple(const std::string& value,
if (value.size() > std::numeric_limits<uint8_t>::max()) { if (value.size() > std::numeric_limits<uint8_t>::max()) {
isc_throw(BadDataTypeCast, "invalid tuple value (size " isc_throw(BadDataTypeCast, "invalid tuple value (size "
<< value.size() << " larger than " << value.size() << " larger than "
<< std::numeric_limits<uint8_t>::max() << ")"); << +std::numeric_limits<uint8_t>::max() << ")");
} }
buf.push_back(static_cast<uint8_t>(value.size())); buf.push_back(static_cast<uint8_t>(value.size()));
@@ -267,7 +267,7 @@ OptionDataTypeUtil::writeTuple(const OpaqueDataTuple& tuple,
if (tuple.getLength() > std::numeric_limits<uint8_t>::max()) { if (tuple.getLength() > std::numeric_limits<uint8_t>::max()) {
isc_throw(BadDataTypeCast, "invalid tuple value (size " isc_throw(BadDataTypeCast, "invalid tuple value (size "
<< tuple.getLength() << " larger than " << tuple.getLength() << " larger than "
<< std::numeric_limits<uint8_t>::max() << ")"); << +std::numeric_limits<uint8_t>::max() << ")");
} }
buf.push_back(static_cast<uint8_t>(tuple.getLength())); buf.push_back(static_cast<uint8_t>(tuple.getLength()));

View File

@@ -603,9 +603,9 @@ OptionDefinition::lexicalCastWithRangeCheck(const std::string& value_str)
result < numeric_limits<T>::min()) { result < numeric_limits<T>::min()) {
isc_throw(BadDataTypeCast, "unable to convert '" isc_throw(BadDataTypeCast, "unable to convert '"
<< value_str << "' to numeric type. This value is " << value_str << "' to numeric type. This value is "
" expected to be in the range of " "expected to be in the range of "
<< numeric_limits<T>::min() << +numeric_limits<T>::min() << ".."
<< ".." << numeric_limits<T>::max()); << +numeric_limits<T>::max());
} }
} }
return (static_cast<T>(result)); return (static_cast<T>(result));