From deb05176bf259030db8d5f8ff7c68b5feb325770 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Fri, 26 Jun 2015 07:37:59 +0000 Subject: VKontakte: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@14391 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'protocols/VKontakte/src/misc.cpp') 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, "
"); - 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; -- cgit v1.2.3