diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index ce2bc0aa..f8c31661 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -247,7 +247,7 @@ void to_json(BasicJsonType& j, const CompatibleArrayType& arr) template::value, int> = 0> -void to_json(BasicJsonType& j, std::valarray arr) +void to_json(BasicJsonType& j, const std::valarray& arr) { external_constructor::construct(j, std::move(arr)); } diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 5970afd5..563eac31 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -405,11 +405,9 @@ class json_sax_dom_callback_parser : public json_sax bool end_object() override { - bool keep = true; if (ref_stack.back()) { - keep = callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()); - if (not keep) + if (not callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back())) { // discard object *ref_stack.back() = discarded; diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index facd6871..9b7c8de1 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -1173,7 +1173,7 @@ scan_number_done: { // escape control characters char cs[9]; - snprintf(cs, 9, "", c); + snprintf(cs, 9, "", static_cast(c)); result += cs; } else diff --git a/include/nlohmann/detail/iterators/primitive_iterator.hpp b/include/nlohmann/detail/iterators/primitive_iterator.hpp index db0b1e7c..db3f8975 100644 --- a/include/nlohmann/detail/iterators/primitive_iterator.hpp +++ b/include/nlohmann/detail/iterators/primitive_iterator.hpp @@ -87,7 +87,7 @@ class primitive_iterator_t primitive_iterator_t const operator++(int) noexcept { auto result = *this; - m_it++; + ++m_it; return result; } @@ -100,7 +100,7 @@ class primitive_iterator_t primitive_iterator_t const operator--(int) noexcept { auto result = *this; - m_it--; + --m_it; return result; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 4cf28888..21c37d7d 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -1520,7 +1520,7 @@ void to_json(BasicJsonType& j, const CompatibleArrayType& arr) template::value, int> = 0> -void to_json(BasicJsonType& j, std::valarray arr) +void to_json(BasicJsonType& j, const std::valarray& arr) { external_constructor::construct(j, std::move(arr)); } @@ -3165,7 +3165,7 @@ scan_number_done: { // escape control characters char cs[9]; - snprintf(cs, 9, "", c); + snprintf(cs, 9, "", static_cast(c)); result += cs; } else @@ -3746,11 +3746,9 @@ class json_sax_dom_callback_parser : public json_sax bool end_object() override { - bool keep = true; if (ref_stack.back()) { - keep = callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()); - if (not keep) + if (not callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back())) { // discard object *ref_stack.back() = discarded;