diff --git a/include/nlohmann/detail/output/output_adapters.hpp b/include/nlohmann/detail/output/output_adapters.hpp index 6755878cc..231cf53ce 100644 --- a/include/nlohmann/detail/output/output_adapters.hpp +++ b/include/nlohmann/detail/output/output_adapters.hpp @@ -29,6 +29,10 @@ namespace detail template struct output_adapter_protocol { virtual void write_character(CharType c) = 0; + /// @param[in] s pointer to the characters to write; binary_writer legitimately + /// passes a null pointer together with length 0 for an empty + /// string or binary value, so implementations must tolerate that + /// @param[in] length number of characters at @a s virtual void write_characters(const CharType* s, std::size_t length) = 0; virtual ~output_adapter_protocol() = default; @@ -95,7 +99,6 @@ class output_vector_adapter : public output_adapter_protocol sink.write_character(c); } - JSON_HEDLEY_NON_NULL(2) void write_characters(const CharType* s, std::size_t length) override { sink.write_characters(s, length); @@ -120,7 +123,6 @@ class output_stream_adapter : public output_adapter_protocol stream.put(c); } - JSON_HEDLEY_NON_NULL(2) void write_characters(const CharType* s, std::size_t length) override { stream.write(s, static_cast(length)); @@ -145,7 +147,6 @@ class output_string_adapter : public output_adapter_protocol str.push_back(c); } - JSON_HEDLEY_NON_NULL(2) void write_characters(const CharType* s, std::size_t length) override { str.append(s, length); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 18994919c..6515ee4c4 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20168,6 +20168,10 @@ namespace detail template struct output_adapter_protocol { virtual void write_character(CharType c) = 0; + /// @param[in] s pointer to the characters to write; binary_writer legitimately + /// passes a null pointer together with length 0 for an empty + /// string or binary value, so implementations must tolerate that + /// @param[in] length number of characters at @a s virtual void write_characters(const CharType* s, std::size_t length) = 0; virtual ~output_adapter_protocol() = default; @@ -20234,7 +20238,6 @@ class output_vector_adapter : public output_adapter_protocol sink.write_character(c); } - JSON_HEDLEY_NON_NULL(2) void write_characters(const CharType* s, std::size_t length) override { sink.write_characters(s, length); @@ -20259,7 +20262,6 @@ class output_stream_adapter : public output_adapter_protocol stream.put(c); } - JSON_HEDLEY_NON_NULL(2) void write_characters(const CharType* s, std::size_t length) override { stream.write(s, static_cast(length)); @@ -20284,7 +20286,6 @@ class output_string_adapter : public output_adapter_protocol str.push_back(c); } - JSON_HEDLEY_NON_NULL(2) void write_characters(const CharType* s, std::size_t length) override { str.append(s, length);