From 8a4af820c767bda5aae714c1ff1f86e55bff1a20 Mon Sep 17 00:00:00 2001 From: Jamie Seward Date: Mon, 16 Oct 2017 00:41:58 -0700 Subject: [PATCH] Fix warning C4706 --- src/json.hpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 3f0b6e3e9..d4dfd5382 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -3034,12 +3034,20 @@ class parser { case token_type::begin_object: { - if (keep and (not callback or ((keep = callback(depth++, parse_event_t::object_start, result))))) - { - // explicitly set result to object to cope with {} - result.m_type = value_t::object; - result.m_value = value_t::object; - } + if (keep) + { + if (callback) + { + keep = callback(depth++, parse_event_t::object_start, result); + } + + if (not callback or keep) + { + // explicitly set result to object to cope with {} + result.m_type = value_t::object; + result.m_value = value_t::object; + } + } // read next token get_token(); @@ -3130,11 +3138,19 @@ class parser case token_type::begin_array: { - if (keep and (not callback or ((keep = callback(depth++, parse_event_t::array_start, result))))) + if (keep) { - // explicitly set result to object to cope with [] - result.m_type = value_t::array; - result.m_value = value_t::array; + if (callback) + { + keep = callback(depth++, parse_event_t::array_start, result); + } + + if (not callback or keep) + { + // explicitly set result to object to cope with [] + result.m_type = value_t::array; + result.m_value = value_t::array; + } } // read next token