mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
prefer std::string for setComment()
in case of embedded nulls
This commit is contained in:
parent
24682e37bf
commit
50069d72da
@ -512,6 +512,7 @@ Json::Value obj_value(Json::objectValue); // {}
|
||||
//# 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);
|
||||
|
@ -1542,7 +1542,7 @@ JSONTEST_FIXTURE(ValueTest, StaticString) {
|
||||
|
||||
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";
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user