summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-11-28 12:58:45 +0000
committerRobert Pösel <robyer@seznam.cz>2014-11-28 12:58:45 +0000
commit2de6603f69b343c3245043ab4c05292a617bd9ba (patch)
treea0930902daee55144d130a6bc77f8a22fedca4cc /plugins
parent8817909629b3e0881672a7b7324fc7c583c331ad (diff)
Use JSONROOT everywhere to simplify code and fix memleaks (in Dropbox and Steam)
git-svn-id: http://svn.miranda-ng.org/main/trunk@11130 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dropbox/src/dropbox.cpp14
-rw-r--r--plugins/Dropbox/src/dropbox_commands.cpp6
-rw-r--r--plugins/Dropbox/src/dropbox_transfers.cpp8
3 files changed, 14 insertions, 14 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp
index f998a6d935..827b42a45e 100644
--- a/plugins/Dropbox/src/dropbox.cpp
+++ b/plugins/Dropbox/src/dropbox.cpp
@@ -77,7 +77,7 @@ void CDropbox::RequestAccountInfo()
if (response && response->resultCode == HTTP_STATUS_OK)
{
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
JSONNODE *node = json_get(root, "referral_link");
@@ -121,16 +121,16 @@ void CDropbox::RequestAccountInfo()
}
node = json_get(root, "quota_info");
- root = json_as_node(node);
- if (root)
+ JSONNODE *nroot = json_as_node(node);
+ if (nroot)
{
- node = json_get(root, "shared");
+ node = json_get(nroot, "shared");
if (node)
db_set_dw(hContact, MODULE, "SharedQuota", json_as_int(node));
- node = json_get(root, "normal");
+ node = json_get(nroot, "normal");
if (node)
db_set_dw(hContact, MODULE, "NormalQuota", json_as_int(node));
- node = json_get(root, "quota");
+ node = json_get(nroot, "quota");
if (node)
db_set_dw(hContact, MODULE, "TotalQuota", json_as_int(node));
}
@@ -192,7 +192,7 @@ UINT CDropbox::RequestAcceessTokenAsync(void *owner, void* param)
if (response)
{
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
if (response->resultCode == HTTP_STATUS_OK)
diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp
index ef0a84b370..e83988ff0c 100644
--- a/plugins/Dropbox/src/dropbox_commands.cpp
+++ b/plugins/Dropbox/src/dropbox_commands.cpp
@@ -34,7 +34,7 @@ void CDropbox::CommandContent(void *arg)
{
CMStringA message;
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
JSONNODE *node = json_get(root, "is_dir");
@@ -91,7 +91,7 @@ void CDropbox::CommandShare(void *arg)
{
CMStringA link;
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
JSONNODE *node = json_get(root, "url");
@@ -136,7 +136,7 @@ void CDropbox::CommandDelete(void *arg)
if (response && response->resultCode == HTTP_STATUS_OK)
{
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
JSONNODE *node = json_get(root, "is_deleted");
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp
index e645f059fa..e1a538c664 100644
--- a/plugins/Dropbox/src/dropbox_transfers.cpp
+++ b/plugins/Dropbox/src/dropbox_transfers.cpp
@@ -40,7 +40,7 @@ int CDropbox::SendFileChunkedFirst(const char *data, int length, char *uploadId,
if (response && response->resultCode == HTTP_STATUS_OK)
{
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
JSONNODE *node = json_get(root, "upload_id");
@@ -72,7 +72,7 @@ int CDropbox::SendFileChunkedNext(const char *data, int length, const char *uplo
if (response && response->resultCode == HTTP_STATUS_OK)
{
- JSONNODE *root = json_parse(response->pData);
+ JSONROOT root(response->pData);
if (root)
{
JSONNODE *node = json_get(root, "offset");
@@ -154,8 +154,8 @@ int CDropbox::CreateDownloadUrl(const char *path, wchar_t *url)
if (response && response->resultCode == HTTP_STATUS_OK)
{
- JSONNODE *root = json_parse(response->pData);
- if (root != NULL)
+ JSONROOT root(response->pData);
+ if (root)
{
JSONNODE *node = json_get(root, "url");
wcscpy(url, json_as_string(node));