prefer std::string for setComment()
in case of embedded nulls
diff --git a/include/json/value.h b/include/json/value.h
index d91ccc4..26bb38b 100644
--- a/include/json/value.h
+++ b/include/json/value.h
@@ -512,6 +512,7 @@
//# endif
/// \deprecated Always pass len.
+ JSONCPP_DEPRECATED("Use setComment(std::string const&) instead.")
void setComment(const char* comment, CommentPlacement placement);
/// Comments must be //... or /* ... */
void setComment(const char* comment, size_t len, CommentPlacement placement);
diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp
index 71e9491..f0e3436 100644
--- a/src/test_lib_json/main.cpp
+++ b/src/test_lib_json/main.cpp
@@ -1542,7 +1542,7 @@
JSONTEST_FIXTURE(ValueTest, CommentBefore) {
Json::Value val; // fill val
- val.setComment("// this comment should appear before", Json::commentBefore);
+ val.setComment(std::string("// this comment should appear before"), Json::commentBefore);
Json::StreamWriterBuilder wbuilder;
wbuilder.settings_["commentStyle"] = "All";
{