diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-06-26 07:37:59 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-06-26 07:37:59 +0000 |
commit | deb05176bf259030db8d5f8ff7c68b5feb325770 (patch) | |
tree | d00388dd336d7ee56e3d60e45dcc218de489299e /protocols/VKontakte/src/misc.cpp | |
parent | 3a548ab7449b7c6f444eb7e626636914926380fa (diff) |
VKontakte: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14391 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index f68d076c5e..5d1f42288a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -25,20 +25,12 @@ JSONNode nullNode(JSON_NULL); bool IsEmpty(LPCTSTR str)
{
- if (str == NULL)
- return true;
- if (str[0] == 0)
- return true;
- return false;
+ return (str == NULL || str[0] == 0);
}
bool IsEmpty(LPCSTR str)
{
- if (str == NULL)
- return true;
- if (str[0] == 0)
- return true;
- return false;
+ return (str == NULL || str[0] == 0);
}
LPCSTR findHeader(NETLIBHTTPREQUEST *pReq, LPCSTR szField)
@@ -306,11 +298,9 @@ JSONNode& CVkProto::CheckJsonResponse(AsyncHttpRequest *pReq, NETLIBHTTPREQUEST debugLogA("CVkProto::CheckJsonResponse");
root = JSONNode::parse(reply->pData);
- if (!root)
- return nullNode;
if (!CheckJsonResult(pReq, root))
return nullNode;
-
+
return root["response"];
}
@@ -439,10 +429,12 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul szResult.Empty();
char *pFormBeg = strstr(pBody, "<form ");
- if (pFormBeg == NULL) return false;
+ if (pFormBeg == NULL)
+ return false;
char *pFormEnd = strstr(pFormBeg, "</form>");
- if (pFormEnd == NULL) return false;
+ if (pFormEnd == NULL)
+ return false;
*pFormEnd = 0;
@@ -915,10 +907,7 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b { vkbbcColor, bbcAdvanced, _T("[color=%s]%s[/color]") },
};
- if (ptszString == NULL)
- return CMString();
-
- if (ptszString[0] == '\0')
+ if (IsEmpty(ptszString))
return CMString();
TCHAR *ptszFormat = NULL;
|