diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-03 22:43:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-03 22:43:15 +0300 |
commit | 654aba9d146fa931628790e2b16c5ca0f28907b3 (patch) | |
tree | c0d15a8c186e7ab1a5ec7135ada6e70f7480e17f /libs/libjson | |
parent | a0ad33a285bac4d7f0ad3f29c9edc925e8c1429e (diff) |
libjson:
- fix for printing null fields;
- fix for passing NULL_PARAM & JSON_PARAM
Diffstat (limited to 'libs/libjson')
-rw-r--r-- | libs/libjson/src/JSONWriter.cpp | 3 | ||||
-rw-r--r-- | libs/libjson/src/internalJSONNode.cpp | 3 | ||||
-rw-r--r-- | libs/libjson/src/stdafx.cxx | 8 |
3 files changed, 11 insertions, 3 deletions
diff --git a/libs/libjson/src/JSONWriter.cpp b/libs/libjson/src/JSONWriter.cpp index d5f7e5d380..ce753970c8 100644 --- a/libs/libjson/src/JSONWriter.cpp +++ b/libs/libjson/src/JSONWriter.cpp @@ -158,8 +158,9 @@ json_string internalJSONNode::Write(unsigned int indent, bool arrayChild){ case JSON_ARRAY: //write out the child nodes int he array
Fetch();
return WriteComment(indent) + WriteName(formatted, arrayChild) + JSON_TEXT("[") + WriteChildren(indent) + JSON_TEXT("]");
- case JSON_NUMBER: //write out a literal, without quotes
case JSON_NULL:
+ return WriteComment(indent) + WriteName(formatted, arrayChild) + CONST_NULL;
+ case JSON_NUMBER: //write out a literal, without quotes
case JSON_BOOL:
return WriteComment(indent) + WriteName(formatted, arrayChild) + _string;
}
diff --git a/libs/libjson/src/internalJSONNode.cpp b/libs/libjson/src/internalJSONNode.cpp index 7cee25f27a..1b51582db2 100644 --- a/libs/libjson/src/internalJSONNode.cpp +++ b/libs/libjson/src/internalJSONNode.cpp @@ -36,6 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. lots of copies, but since strings are copy on write, this assignment
is much faster
*/
+
+const json_string CONST_NULL(JSON_TEXT("null"));
+
static const json_string CONST_TRUE(JSON_TEXT("true"));
static const json_string CONST_FALSE(JSON_TEXT("false"));
diff --git a/libs/libjson/src/stdafx.cxx b/libs/libjson/src/stdafx.cxx index 98f83a0b3a..32eb3c894f 100644 --- a/libs/libjson/src/stdafx.cxx +++ b/libs/libjson/src/stdafx.cxx @@ -54,12 +54,16 @@ LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const WCHAR_PARAM ¶m) LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const NULL_PARAM ¶m) { - json.push_back(JSONNode(param.szName, nullptr)); + JSONNode newOne(JSON_NULL); + newOne.set_name(param.szName); + json.push_back(newOne); return json; }
LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const JSON_PARAM ¶m) { - json.push_back(JSONNode(param.szName, param.node)); + JSONNode newOne(param.node); + newOne.set_name(param.szName); + json.push_back(newOne); return json; } |