diff options
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 23 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 32 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 2 |
5 files changed, 35 insertions, 32 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index b49d4424e2..d079ef7e41 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -80,42 +80,45 @@ HANDLE GetIconHandle(int iCommand) /////////////////////////////////////////////////////////////////////////////////////////
-static const char szHexDigits[] = "0123456789ABCDEF";
-
char* ExpUrlEncode(const char *szUrl, bool strict)
{
+ const char szHexDigits[] = "0123456789ABCDEF";
+
if (szUrl == NULL)
return NULL;
const BYTE *s;
int outputLen;
- for (outputLen = 0, s = (const BYTE*)szUrl; *s; s++) {
+ for (outputLen = 0, s = (const BYTE*)szUrl; *s; s++)
if ((*s & 0x80 && !strict) || // UTF-8 multibyte
('0' <= *s && *s <= '9') || //0-9
('A' <= *s && *s <= 'Z') || //ABC...XYZ
('a' <= *s && *s <= 'z') || //abc...xyz
- *s == '~' || *s == '-' || *s == '_' || *s == '.' || *s == ' ') outputLen++;
- else outputLen += 3;
- }
+ *s == '~' || *s == '-' || *s == '_' || *s == '.' || *s == ' ')
+ outputLen++;
+ else
+ outputLen += 3;
char *szOutput = (char*)mir_alloc(outputLen + 1);
if (szOutput == NULL)
return NULL;
char *d = szOutput;
- for (s = (const BYTE*)szUrl; *s; s++) {
+ for (s = (const BYTE*)szUrl; *s; s++)
if ((*s & 0x80 && !strict) || // UTF-8 multibyte
('0' <= *s && *s <= '9') || //0-9
('A' <= *s && *s <= 'Z') || //ABC...XYZ
('a' <= *s && *s <= 'z') || //abc...xyz
- *s == '~' || *s == '-' || *s == '_' || *s == '.') *d++ = *s;
- else if (*s == ' ') *d++ = '+';
+ *s == '~' || *s == '-' || *s == '_' || *s == '.')
+ *d++ = *s;
+ else if (*s == ' ')
+ *d++ = '+';
else {
*d++ = '%';
*d++ = szHexDigits[*s >> 4];
*d++ = szHexDigits[*s & 0xF];
}
- }
+
*d = '\0';
return szOutput;
}
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 18a8286a16..e6c0d1a4ca 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -358,13 +358,13 @@ CVKNewsItem* CVkProto::GetVkParent(JSONNODE *pParent, VKObjType vkParentType, TC ClearFormatNick(tszText);
JSONNODE *pNode = json_get(pParent, "photo");
- if (pNode){
+ if (pNode) {
delete vkNotificationItem;
return GetVkParent(pNode, vkPhoto, tszText.IsEmpty() ? NULL : tszText.GetBuffer());
}
pNode = json_get(pParent, "video");
- if (pNode){
+ if (pNode) {
delete vkNotificationItem;
return GetVkParent(pNode, vkVideo, tszText.IsEmpty() ? NULL : tszText.GetBuffer());
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 9bfe354b60..11b87229fd 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -511,7 +511,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg) void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
{
int iResult = ACKRESULT_FAILED;
- if (pReq->pUserInfo == NULL){
+ if (pReq->pUserInfo == NULL) {
debugLogA("CVkProto::OnSendMessage failed! (pUserInfo == NULL)");
return;
}
@@ -542,7 +542,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) }
else if (m_bServerDelivery)
ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, iResult, HANDLE(param->iMsgID), 0);
- if (!pReq->bNeedsRestart){
+ if (!pReq->bNeedsRestart) {
delete param;
pReq->pUserInfo = NULL;
}
@@ -576,7 +576,7 @@ int CVkProto::SetStatus(int iNewStatus) debugLogA("CVkProto::SetStatus (2) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
m_hWorkerThread = ForkThreadEx(&CVkProto::WorkerThread, 0, NULL);
}
- else if (IsOnline()){
+ else if (IsOnline()) {
debugLogA("CVkProto::SetStatus (3) iNewStatus = %d, m_iStatus = %d, m_iDesiredStatus = %d oldStatus = %d", iNewStatus, m_iStatus, m_iDesiredStatus, oldStatus);
SetServerStatus(iNewStatus);
}
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index b55bc4f68a..0d1e7f4ce3 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -59,7 +59,8 @@ struct AsyncHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject struct PARAM
{
LPCSTR szName;
- __forceinline PARAM(LPCSTR _name) : szName(_name) {}
+ __forceinline PARAM(LPCSTR _name) : szName(_name)
+ {}
};
struct INT_PARAM : public PARAM
@@ -67,8 +68,7 @@ struct INT_PARAM : public PARAM int iValue;
__forceinline INT_PARAM(LPCSTR _name, int _value) :
PARAM(_name), iValue(_value)
- {
- }
+ {}
};
AsyncHttpRequest* operator<<(AsyncHttpRequest*, const INT_PARAM&);
@@ -77,8 +77,7 @@ struct CHAR_PARAM : public PARAM LPCSTR szValue;
__forceinline CHAR_PARAM(LPCSTR _name, LPCSTR _value) :
PARAM(_name), szValue(_value)
- {
- }
+ {}
};
AsyncHttpRequest* operator<<(AsyncHttpRequest*, const CHAR_PARAM&);
@@ -87,8 +86,7 @@ struct TCHAR_PARAM : public PARAM LPCTSTR tszValue;
__forceinline TCHAR_PARAM(LPCSTR _name, LPCTSTR _value) :
PARAM(_name), tszValue(_value)
- {
- }
+ {}
};
AsyncHttpRequest* operator<<(AsyncHttpRequest*, const TCHAR_PARAM&);
@@ -111,7 +109,8 @@ struct CVkChatMessage : public MZeroedObject m_mid(_id),
m_uid(0),
m_date(0),
- m_bHistory(false){}
+ m_bHistory(false)
+ {}
int m_mid, m_uid, m_date;
bool m_bHistory;
@@ -140,7 +139,7 @@ struct CVkChatInfo : public MZeroedObject m_admin_id(0),
m_bHistoryRead(0),
m_hContact(INVALID_CONTACT_ID)
- {}
+ {}
int m_chatid, m_admin_id;
bool m_bHistoryRead;
@@ -201,13 +200,14 @@ struct CVKNotification { struct CVKNewsItem : public MZeroedObject {
- CVKNewsItem()
- {
- tDate = NULL;
- vkUser = NULL;
- bIsGroup = bIsRepost = false;
- vkFeedbackType = vkParentType = vkNull;
- };
+ CVKNewsItem() :
+ tDate(NULL),
+ vkUser(NULL),
+ bIsGroup(false),
+ bIsRepost(false),
+ vkFeedbackType(vkNull),
+ vkParentType(vkNull)
+ {}
CMString tszId;
time_t tDate;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 436d552f0f..0517840911 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -628,7 +628,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe for (int i = 0; i < numMessages; i++) {
JSONNODE *pMsg = json_at(pMsgs, i);
- if (pMsg == NULL){
+ if (pMsg == NULL) {
debugLogA("CVkProto::OnReceiveMessages pMsg == NULL");
break;
}
|