]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[429-Updated-StampedValue-to-support-reals] Fixed the 7.0 issue 429-Updated-StampedValue-to-support-reals
authorFrancis Dupont <fdupont@isc.org>
Sun, 3 Feb 2019 10:38:12 +0000 (11:38 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sun, 3 Feb 2019 10:38:12 +0000 (11:38 +0100)
src/lib/cc/stamped_value.cc

index 437162443068ecc0eb47b12bc26481197c69c44d..1ce5a0bfdf2f9c2f4d82bddbf19f1826e0101310 100644 (file)
@@ -114,7 +114,14 @@ StampedValue::getValue() const {
         case Element::boolean:
             return (value_->boolValue() ? "1" : "0");
         case Element::real:
-            return (boost::lexical_cast<std::string>(value_->doubleValue()));
+            {
+                std::string repr =
+                    boost::lexical_cast<std::string>(value_->doubleValue());
+                if (repr.find_first_of('.') == std::string::npos) {
+                    repr += ".0";
+                }
+                return (repr);
+            }
         default:
             // Impossible condition.
             isc_throw(TypeError, "StampedValue: invalid type of the '"
@@ -125,6 +132,7 @@ StampedValue::getValue() const {
         isc_throw(BadValue, "StampedValue: unable to convert the value of "
                   "the parameter '" << name_ << "' to string");
     }
+    // unreachable
     return (value_->stringValue());
 }