diff options
Diffstat (limited to 'libs/libjson/src')
-rw-r--r-- | libs/libjson/src/JSONChildren.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONDebug.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONIterators.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONMemory.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONNode.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONNode_Mutex.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONWorker.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/JSONWriter.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/internalJSONNode.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/internalJSONNode.h | 4 | ||||
-rw-r--r-- | libs/libjson/src/libJSON.cpp | 2 | ||||
-rw-r--r-- | libs/libjson/src/stdafx.cxx | 25 | ||||
-rw-r--r-- | libs/libjson/src/stdafx.h | 2 |
13 files changed, 16 insertions, 35 deletions
diff --git a/libs/libjson/src/JSONChildren.cpp b/libs/libjson/src/JSONChildren.cpp index 9d11dc0f66..5d2374d6b0 100644 --- a/libs/libjson/src/JSONChildren.cpp +++ b/libs/libjson/src/JSONChildren.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONDebug.cpp b/libs/libjson/src/JSONDebug.cpp index 69a9aa0482..80da1b3460 100644 --- a/libs/libjson/src/JSONDebug.cpp +++ b/libs/libjson/src/JSONDebug.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONIterators.cpp b/libs/libjson/src/JSONIterators.cpp index 108a2d6721..6d6d793ffb 100644 --- a/libs/libjson/src/JSONIterators.cpp +++ b/libs/libjson/src/JSONIterators.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONMemory.cpp b/libs/libjson/src/JSONMemory.cpp index 5b3d686416..f593183ec4 100644 --- a/libs/libjson/src/JSONMemory.cpp +++ b/libs/libjson/src/JSONMemory.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONNode.cpp b/libs/libjson/src/JSONNode.cpp index ded274c68c..ccaf95f5f6 100644 --- a/libs/libjson/src/JSONNode.cpp +++ b/libs/libjson/src/JSONNode.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONNode_Mutex.cpp b/libs/libjson/src/JSONNode_Mutex.cpp index d5fb746347..10ac17c59c 100644 --- a/libs/libjson/src/JSONNode_Mutex.cpp +++ b/libs/libjson/src/JSONNode_Mutex.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONWorker.cpp b/libs/libjson/src/JSONWorker.cpp index 353b032b4e..278acca532 100644 --- a/libs/libjson/src/JSONWorker.cpp +++ b/libs/libjson/src/JSONWorker.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/JSONWriter.cpp b/libs/libjson/src/JSONWriter.cpp index ca8e2419be..27f2c9fa85 100644 --- a/libs/libjson/src/JSONWriter.cpp +++ b/libs/libjson/src/JSONWriter.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/internalJSONNode.cpp b/libs/libjson/src/internalJSONNode.cpp index 7ab90d43d3..1ae15db03e 100644 --- a/libs/libjson/src/internalJSONNode.cpp +++ b/libs/libjson/src/internalJSONNode.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/internalJSONNode.h b/libs/libjson/src/internalJSONNode.h index 2ad616fbcd..133c0f4d0c 100644 --- a/libs/libjson/src/internalJSONNode.h +++ b/libs/libjson/src/internalJSONNode.h @@ -302,6 +302,8 @@ inline long internalJSONNode::as_int(void) const { switch(type()) {
case JSON_NULL:
return 0;
+ case JSON_STRING:
+ return atoi(_string.c_str());
case JSON_BOOL:
return _value._bool ? 1 : 0;
}
@@ -317,6 +319,8 @@ inline json_number internalJSONNode::as_float(void) const { switch(type()) {
case JSON_NULL:
return (json_number)0.0;
+ case JSON_STRING:
+ return atof(_string.c_str());
case JSON_BOOL:
return (json_number)(_value._bool ? 1.0 : 0.0);
}
diff --git a/libs/libjson/src/libJSON.cpp b/libs/libjson/src/libJSON.cpp index bd654fa70d..a5218c560b 100644 --- a/libs/libjson/src/libJSON.cpp +++ b/libs/libjson/src/libJSON.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/libs/libjson/src/stdafx.cxx b/libs/libjson/src/stdafx.cxx index 58c1046959..eac064fe7b 100644 --- a/libs/libjson/src/stdafx.cxx +++ b/libs/libjson/src/stdafx.cxx @@ -1,6 +1,6 @@ /*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -18,35 +18,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-static void eraseOldValue(JSONNode &json, const char *pszName)
-{
- if (pszName && *pszName != 0) {
- auto n = json.find(pszName);
- if (n != json.end())
- json.erase(n);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const INT_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
json.push_back(JSONNode(param.szName, param.iValue));
return json;
}
LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const INT64_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
json.push_back(JSONNode(param.szName, param.iValue));
return json;
}
LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const SINT64_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
-
char str[40];
_i64toa(param.iValue, str, 10);
return json << CHAR_PARAM(param.szName, str);
@@ -54,15 +39,12 @@ LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const SINT64_PARAM ¶m) LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const BOOL_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
json.push_back(JSONNode(param.szName, param.bValue));
return json;
}
LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const CHAR_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
-
if (param.szValue == nullptr) {
JSONNode tmp(JSON_NULL); tmp.set_name(param.szName);
json.push_back(tmp);
@@ -78,15 +60,12 @@ LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const CHAR_PARAM ¶m) LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const WCHAR_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
json.push_back(JSONNode(param.szName, ptrA(mir_utf8encodeW(param.wszValue)).get()));
return json;
}
LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const NULL_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
-
JSONNode newOne(JSON_NULL);
newOne.set_name(param.szName);
json.push_back(newOne);
@@ -95,8 +74,6 @@ LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const NULL_PARAM ¶m) LIBJSON_DLL(JSONNode&) operator<<(JSONNode &json, const JSON_PARAM ¶m)
{
- eraseOldValue(json, param.szName);
-
JSONNode newOne(param.node);
newOne.set_name(param.szName);
json.push_back(newOne);
diff --git a/libs/libjson/src/stdafx.h b/libs/libjson/src/stdafx.h index 5e22df85fd..f49f09f14e 100644 --- a/libs/libjson/src/stdafx.h +++ b/libs/libjson/src/stdafx.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
|