From 19c49a459da6dff5c5cbe8e5cbff1926ee01fb33 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Wed, 4 Mar 2015 14:59:16 -0600 Subject: [PATCH] fix Builders::validate() (cherry picked from commit 626cfcdbb83bdc93243d7b64144e88f08c510085) --- src/lib_json/json_reader.cpp | 3 +-- src/lib_json/json_writer.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib_json/json_reader.cpp b/src/lib_json/json_reader.cpp index 4311853..90b4fdb 100644 --- a/src/lib_json/json_reader.cpp +++ b/src/lib_json/json_reader.cpp @@ -1915,7 +1915,6 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const Json::Value my_invalid; if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL Json::Value& inv = *invalid; - bool valid = true; std::set valid_keys; getValidReaderKeys(&valid_keys); Value::Members keys = settings_.getMemberNames(); @@ -1926,7 +1925,7 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const inv[key] = settings_[key]; } } - return valid; + return 0u == inv.size(); } // static void CharReaderBuilder::strictMode(Json::Value* settings) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index f7c630d..9dbe53e 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -1110,7 +1110,6 @@ bool StreamWriterBuilder::validate(Json::Value* invalid) const Json::Value my_invalid; if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL Json::Value& inv = *invalid; - bool valid = true; std::set valid_keys; getValidWriterKeys(&valid_keys); Value::Members keys = settings_.getMemberNames(); @@ -1121,7 +1120,7 @@ bool StreamWriterBuilder::validate(Json::Value* invalid) const inv[key] = settings_[key]; } } - return valid; + return 0u == inv.size(); } // static void StreamWriterBuilder::setDefaults(Json::Value* settings)