diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-04 07:55:00 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-04 07:55:00 +0000 |
commit | 8751885ea79df4b666b65bb2b6900617785e0da7 (patch) | |
tree | 676db28129ece760d7ad354b2d39ba371453db8c /plugins/SmileyAdd/src/smileys.cpp | |
parent | 09476981eccbcae37ef4526f3fbcb18fca686ffa (diff) |
end of base64* zoo
git-svn-id: http://svn.miranda-ng.org/main/trunk@4879 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SmileyAdd/src/smileys.cpp')
-rw-r--r-- | plugins/SmileyAdd/src/smileys.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index b63cbf4223..e81bc18c28 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -511,26 +511,24 @@ static void DecodeHTML(bkstring& str) }
-static IStream* DecodeBase64Data(const char* data)
+static IStream* DecodeBase64Data(const char* pData)
{
- NETLIBBASE64 nlb64;
- nlb64.pszEncoded = (char*)data;
- nlb64.cchEncoded = (int)strlen(data);
- nlb64.cbDecoded = Netlib_GetBase64DecodedBufferSize(nlb64.cchEncoded);
-
- IStream* pStream = NULL;
+ unsigned dataLen;
+ ptrA data((char*)mir_base64_decode(pData, &dataLen));
+ if (data == NULL)
+ return NULL;
// Read image list
- HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, nlb64.cbDecoded);
- if (hBuffer)
- {
- nlb64.pbDecoded = (PBYTE)GlobalLock(hBuffer);
- CallService(MS_NETLIB_BASE64DECODE, 0, (LPARAM)&nlb64);
- GlobalUnlock(hBuffer);
+ HGLOBAL hBuffer = GlobalAlloc(GMEM_MOVEABLE, dataLen);
+ if (!hBuffer)
+ return NULL;
- CreateStreamOnHGlobal(hBuffer, TRUE, &pStream);
- }
+ void *dst = GlobalLock(hBuffer);
+ memcpy(dst, data, dataLen);
+ GlobalUnlock(hBuffer);
+ IStream *pStream = NULL;
+ CreateStreamOnHGlobal(hBuffer, TRUE, &pStream);
return pStream;
}
|