summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-25 15:11:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-25 15:11:34 +0300
commit496b8d54f05de925f7827785544acbaec35fa356 (patch)
treeefddde401d7b52ed2ee54737a700045730e1a71e /libs
parent27d82200ded3da7e718bfef2cd50ab7ef18050dc (diff)
fixes #3454 (Telegram: crash fix)
Diffstat (limited to 'libs')
-rw-r--r--libs/libjson/src/JSONNode.cpp15
-rw-r--r--libs/libjson/src/JSONNode.h5
-rw-r--r--libs/libjson/src/JSONNode.inl8
-rw-r--r--libs/win32/libjson.libbin68786 -> 69346 bytes
-rw-r--r--libs/win64/libjson.libbin69494 -> 70070 bytes
5 files changed, 19 insertions, 9 deletions
diff --git a/libs/libjson/src/JSONNode.cpp b/libs/libjson/src/JSONNode.cpp
index 1340254b02..daf6e80e2c 100644
--- a/libs/libjson/src/JSONNode.cpp
+++ b/libs/libjson/src/JSONNode.cpp
@@ -53,9 +53,18 @@ JSONNode nullNode(JSON_NULL);
IMPLEMENT_FOR_ALL_TYPES(IMPLEMENT_CTOR)
#ifndef JSON_LIBRARY
- JSONNode::JSONNode(const json_string & name_t, const json_char * value_t) : internal(internalJSONNode::newInternal()) {
- internal -> Set(json_string(value_t));
- internal -> setname(name_t);
+ JSONNode::JSONNode(const json_string &name_t, const json_char *value_t) : internal(internalJSONNode::newInternal())
+ {
+ internal->Set(json_string(value_t ? value_t : ""));
+ internal->setname(name_t);
+ incAllocCount();
+ }
+
+ JSONNode::JSONNode(const json_string &name_t, const wchar_t *value_t) : internal(internalJSONNode::newInternal())
+ {
+ T2Utf val(value_t);
+ internal->Set(json_string(val ? val : ""));
+ internal->setname(name_t);
incAllocCount();
}
#endif
diff --git a/libs/libjson/src/JSONNode.h b/libs/libjson/src/JSONNode.h
index dc69e965ab..a145810854 100644
--- a/libs/libjson/src/JSONNode.h
+++ b/libs/libjson/src/JSONNode.h
@@ -89,10 +89,11 @@ class LIBJSON_EXPORT JSONNode
public:
explicit JSONNode(char mytype = JSON_NODE);
- #define DECLARE_CTOR(type) JSONNode(const json_string & name_t, type value_t)
+ #define DECLARE_CTOR(type) JSONNode(const json_string &name_t, type value_t)
DECLARE_FOR_ALL_TYPES(DECLARE_CTOR)
+ JSONNode(const json_string &name_t, const wchar_t *value_t);
- JSONNode(const JSONNode & orig);
+ JSONNode(const JSONNode &orig);
~JSONNode(void);
static JSONNode parse(const json_char *str);
diff --git a/libs/libjson/src/JSONNode.inl b/libs/libjson/src/JSONNode.inl
index 48c1b9ec4f..56dc0b3074 100644
--- a/libs/libjson/src/JSONNode.inl
+++ b/libs/libjson/src/JSONNode.inl
@@ -17,22 +17,22 @@ inline JSONNode::JSONNode(char mytype) : internal(internalJSONNode::newInternal(
(mytype == JSON_NODE), JSON_TEXT("Not a proper JSON type"));
incAllocCount();
}
-inline JSONNode::JSONNode(const json_string & unparsed) :
+inline JSONNode::JSONNode(const json_string &unparsed) :
internal(internalJSONNode::newInternal(unparsed))
{ //root, specialized because it can only be array or node
incAllocCount();
}
-inline JSONNode::JSONNode(internalJSONNode * internal_t) :
+inline JSONNode::JSONNode(internalJSONNode *internal_t) :
internal(internal_t)
{ //do not increment anything, this is only used in one case and it's already taken care of
incAllocCount();
}
-inline JSONNode::JSONNode(const JSONNode & orig): internal(orig.internal -> incRef())
+inline JSONNode::JSONNode(const JSONNode &orig) : internal(orig.internal -> incRef())
{
incAllocCount();
}
//this allows a temp node to simply transfer its contents, even with ref counting off
-inline JSONNode::JSONNode(bool, JSONNode & orig): internal(orig.internal)
+inline JSONNode::JSONNode(bool, JSONNode &orig) : internal(orig.internal)
{
orig.internal = 0;
incAllocCount();
diff --git a/libs/win32/libjson.lib b/libs/win32/libjson.lib
index d49c059aff..efd01d2f85 100644
--- a/libs/win32/libjson.lib
+++ b/libs/win32/libjson.lib
Binary files differ
diff --git a/libs/win64/libjson.lib b/libs/win64/libjson.lib
index ca2d79bc25..e8c0651a29 100644
--- a/libs/win64/libjson.lib
+++ b/libs/win64/libjson.lib
Binary files differ