summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-01-27 10:44:00 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-01-27 10:44:00 +0000
commitb22366cb998d14c61e5e892c5530ade0a5fdfabe (patch)
tree5a252b22b8bda205314bf3ee6948a9f112dcfbb4 /protocols/VKontakte/src/misc.cpp
parentafb3dfdf8ac1944df76db4754b96a50be4e6d4dd (diff)
Vkontakte: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@11925 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp23
1 files changed, 13 insertions, 10 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;
}