From a9fbe9a81a6777b4b358d93116ee15f9f07dfb6e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 Feb 2019 12:53:15 +0300 Subject: custom UrlDecode removed --- plugins/SmileyAdd/src/customsmiley.cpp | 8 +++----- plugins/SmileyAdd/src/general.cpp | 34 ---------------------------------- plugins/SmileyAdd/src/stdafx.h | 2 -- 3 files changed, 3 insertions(+), 41 deletions(-) (limited to 'plugins/SmileyAdd/src') diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index 686560a9d0..624b016a7c 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -67,13 +67,11 @@ SmileyCType::SmileyCType(const CMStringW &fullpath, const wchar_t *filepath) bool SmileyCType::CreateTriggerText(char *text) { - UrlDecode(text); - - int len = (int)mir_strlen(text); - if (len == 0) return false; + if (mir_strlen(text) == 0) + return false; size_t reslen; - ptrA res((char*)mir_base64_decode(text, &reslen)); + ptrA res((char*)mir_base64_decode(mir_urlDecode(text), &reslen)); if (res == NULL) return false; diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index af943b4c4e..06547da24a 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -148,40 +148,6 @@ void pathToAbsolute(const CMStringW &pSrc, CMStringW &pOut) pOut = szOutPath; } -///////////////////////////////////////////////////////////////////////////////////////// -// UrlDecode - converts URL chars like %20 into printable characters - -static int __fastcall SingleHexToDecimal(char c) -{ - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - if (c >= 'A' && c <= 'F') return c - 'A' + 10; - return -1; -} - -void UrlDecode(char *str) -{ - char *s = str, *d = str; - - while (*s) { - if (*s == '%') { - int digit1 = SingleHexToDecimal(s[1]); - if (digit1 != -1) { - int digit2 = SingleHexToDecimal(s[2]); - if (digit2 != -1) { - s += 3; - *d++ = (char)((digit1 << 4) | digit2); - continue; - } - } - } - *d++ = *s++; - } - - *d = 0; -} - - bool InitGdiPlus(void) { Gdiplus::GdiplusStartupInput gdiplusStartupInput; diff --git a/plugins/SmileyAdd/src/stdafx.h b/plugins/SmileyAdd/src/stdafx.h index 6817dfcbc9..35949d1e36 100644 --- a/plugins/SmileyAdd/src/stdafx.h +++ b/plugins/SmileyAdd/src/stdafx.h @@ -148,6 +148,4 @@ void RichEditData_Destroy(void); void CloseSmileys(void); int CheckForTip(int x, int y, HWND hwnd, wchar_t **smltxt); -void UrlDecode(char *str); - #endif -- cgit v1.2.3