]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1495] fix non-printable numeric_limits
authorAndrei Pavel <andrei@isc.org>
Mon, 26 Oct 2020 14:07:52 +0000 (16:07 +0200)
committerAndrei Pavel <andrei@isc.org>
Mon, 9 Nov 2020 12:17:16 +0000 (14:17 +0200)
src/hooks/dhcp/high_availability/ha_config_parser.cc
src/lib/dhcp/option_data_types.cc
src/lib/dhcp/option_definition.cc

index 7cba9c10cd9013e3f2fc1f3b8b506bff460a9f00..a0ac78f5b70c5a67d5f73a5310520f86295f8fa2 100644 (file)
@@ -255,7 +255,7 @@ T HAConfigParser::getAndValidateInteger(const ConstElementPtr& config,
 
     } else if (value > std::numeric_limits<T>::max()) {
         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));
index a74ec9e3ac31edac64dd9057c59e328cf921ccd9..6d27c8ce35f0a2a39bc7f8a67d7d5f446c87fe96 100644 (file)
@@ -236,7 +236,7 @@ OptionDataTypeUtil::writeTuple(const std::string& value,
         if (value.size() > std::numeric_limits<uint8_t>::max()) {
             isc_throw(BadDataTypeCast, "invalid tuple value (size "
                       << 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()));
 
@@ -267,7 +267,7 @@ OptionDataTypeUtil::writeTuple(const OpaqueDataTuple& tuple,
         if (tuple.getLength() > std::numeric_limits<uint8_t>::max()) {
             isc_throw(BadDataTypeCast, "invalid tuple value (size "
                       << 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()));
 
index 91bf7db4758f393d983680dc1ad34de640e9e675..2452f598bd4ecce724b7fe50e24a3a0d4e4c33c7 100644 (file)
@@ -603,9 +603,9 @@ OptionDefinition::lexicalCastWithRangeCheck(const std::string& value_str)
             result < numeric_limits<T>::min()) {
             isc_throw(BadDataTypeCast, "unable to convert '"
                       << value_str << "' to numeric type. This value is "
-                      expected to be in the range of "
-                      << numeric_limits<T>::min()
-                      << ".." << numeric_limits<T>::max());
+                         "expected to be in the range of "
+                      << +numeric_limits<T>::min() << ".."
+                      << +numeric_limits<T>::max());
         }
     }
     return (static_cast<T>(result));