From 039cedaf8e2884d136b70aae1f3a2b80640b2583 Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Wed, 17 Aug 2016 23:14:28 +0200
Subject: [PATCH] changes to address #295

---
 src/json.hpp      | 6 ++++--
 src/json.hpp.re2c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/json.hpp b/src/json.hpp
index ddf37eb2..a8289a49 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -8892,7 +8892,8 @@ basic_json_parser_63:
             {
                 case lexer::token_type::begin_object:
                 {
-                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
+                    if (keep and (not callback
+                                  or ((keep = callback(depth++, parse_event_t::object_start, result)) != 0)))
                     {
                         // explicitly set result to object to cope with {}
                         result.m_type = value_t::object;
@@ -8970,7 +8971,8 @@ basic_json_parser_63:
 
                 case lexer::token_type::begin_array:
                 {
-                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
+                    if (keep and (not callback
+                                  or ((keep = callback(depth++, parse_event_t::array_start, result)) != 0)))
                     {
                         // explicitly set result to object to cope with []
                         result.m_type = value_t::array;
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index 740c768c..ffa20f39 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -8189,7 +8189,8 @@ class basic_json
             {
                 case lexer::token_type::begin_object:
                 {
-                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::object_start, result))))
+                    if (keep and (not callback
+                                  or ((keep = callback(depth++, parse_event_t::object_start, result)) != 0)))
                     {
                         // explicitly set result to object to cope with {}
                         result.m_type = value_t::object;
@@ -8267,7 +8268,8 @@ class basic_json
 
                 case lexer::token_type::begin_array:
                 {
-                    if (keep and (not callback or (keep = callback(depth++, parse_event_t::array_start, result))))
+                    if (keep and (not callback
+                                  or ((keep = callback(depth++, parse_event_t::array_start, result)) != 0)))
                     {
                         // explicitly set result to object to cope with []
                         result.m_type = value_t::array;