From 6de4c29e763613e818d347006d46a638b039b41f Mon Sep 17 00:00:00 2001 From: Jacob Potter Date: Mon, 22 Sep 2014 11:59:58 -0700 Subject: [PATCH] fix int->double->int conversion in JsonInt --- json11.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json11.cpp b/json11.cpp index 1ef01db..6424554 100644 --- a/json11.cpp +++ b/json11.cpp @@ -158,7 +158,7 @@ protected: class JsonDouble final : public Value { double number_value() const override { return m_value; } - int int_value() const override { return m_value; } + int int_value() const override { return static_cast(m_value); } bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } bool less(const JsonValue * other) const override { return m_value < other->number_value(); } public: @@ -171,7 +171,7 @@ class JsonInt final : public Value { bool equals(const JsonValue * other) const override { return m_value == other->number_value(); } bool less(const JsonValue * other) const override { return m_value < other->number_value(); } public: - explicit JsonInt(double value) : Value(value) {} + explicit JsonInt(int value) : Value(value) {} }; class JsonBoolean final : public Value {