diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-07 23:38:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-07 23:38:31 +0300 |
commit | 777dc2174f34c2a4d4499c3d63ef8914ed9ecb81 (patch) | |
tree | 6d7c6c4b09287386739ba4cc7accde38ed90da8c /protocols | |
parent | e9e0d8203c36c1d2e2aa4201e01bf4206804f25b (diff) |
old AdvaImg services converted into Image_* functions
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/captcha.cpp | 7 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 11 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/image.cpp | 15 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/token.cpp | 10 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_captcha.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_captcha.cpp | 6 |
6 files changed, 11 insertions, 45 deletions
diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp index bcd952fccc..96f13447d5 100644 --- a/protocols/FacebookRM/src/captcha.cpp +++ b/protocols/FacebookRM/src/captcha.cpp @@ -120,12 +120,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result) } CAPTCHA_FORM_PARAMS param = {}; - - IMGSRVC_MEMIO memio = { 0 }; - memio.iLen = reply->dataLength; - memio.pBuf = reply->pData; - memio.fif = FIF_UNKNOWN; /* detect */ - param.bmp = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio); + param.bmp = Image_LoadFromMem(reply->pData, reply->dataLength, FIF_UNKNOWN); BITMAP bmp = { 0 }; GetObject(param.bmp, sizeof(bmp), &bmp); diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index cbf9715466..29ca4dd2da 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -525,19 +525,14 @@ const char* FacebookProto::ParseIcon(const std::string &url) NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(facy.handle_, &req); if (reply != nullptr && reply->resultCode == HTTP_CODE_OK) { - IMGSRVC_MEMIO memio = { 0 }; - memio.iLen = reply->dataLength; - memio.pBuf = reply->pData; - memio.fif = FIF_UNKNOWN; /* detect */ - - HBITMAP hBmp = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio); + HBITMAP hBmp = Image_LoadFromMem(reply->pData, reply->dataLength, FIF_UNKNOWN); if (hBmp != nullptr) { IMGSRVC_INFO info = { sizeof(info) }; - info.wszName = wszFileName; + info.szName.w = wszFileName; info.fif = FIF_ICO; info.dwMask = IMGI_HBITMAP; info.hbm = hBmp; - CallService(MS_IMG_SAVE, (WPARAM)&info, IMGL_WCHAR); + Image_Save(&info, IMGL_WCHAR); } } } diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 23c485b2ad..38540c4620 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -1054,19 +1054,10 @@ void* GaduProto::img_loadpicture(gg_event* e, wchar_t *szFileName) ////////////////////////////////////////////////////////////////////
// Loading picture using Miranda Image services
- // Load image from memory
- if (!szFileName)
- {
- IMGSRVC_MEMIO memio;
- memio.iLen = dat->nSize;
- memio.pBuf = (void *)dat->lpData;
- memio.fif = FIF_UNKNOWN; /* detect */
- memio.flags = 0;
- dat->hBitmap = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio, 0);
- }
- // Load image from file
+ if (!szFileName) // Load image from memory
+ dat->hBitmap = Image_LoadFromMem(dat->lpData, dat->nSize, FIF_UNKNOWN);
else
- dat->hBitmap = Bitmap_Load(szFileName);
+ dat->hBitmap = Bitmap_Load(szFileName); // Load image from file
// If everything is fine return the handle
if (dat->hBitmap)
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index d38435afa2..ebb9535726 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -137,14 +137,8 @@ int GaduProto::gettoken(GGTOKEN *token) dat.height = t->height;
// Load bitmap
- IMGSRVC_MEMIO memio = { 0 };
- memio.iLen = h->body_size;
- memio.pBuf = h->body;
- memio.fif = FIF_UNKNOWN; /* detect */
- memio.flags = 0;
- dat.hBitmap = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio, 0);
- if (dat.hBitmap == nullptr)
- {
+ dat.hBitmap = Image_LoadFromMem(h->body, h->body_size, FIF_UNKNOWN);
+ if (dat.hBitmap == nullptr) {
MessageBox(nullptr, TranslateT("Could not load token image."), m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index c48aea4c00..f4ea12630f 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -146,12 +146,7 @@ bool CJabberProto::ProcessCaptcha(HXML node, HXML parentNode, ThreadData *info) if (buffer == nullptr)
return false;
- IMGSRVC_MEMIO memio;
- memio.iLen = (long)bufferLen;
- memio.pBuf = (void *)buffer;
- memio.fif = FIF_UNKNOWN; /* detect */
- memio.flags = 0;
- param.bmp = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio, 0);
+ param.bmp = Image_LoadFromMem(buffer, bufferLen, FIF_UNKNOWN);
BITMAP bmp = {0};
GetObject(param.bmp, sizeof(bmp), &bmp);
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index e06be3d052..72b8809e94 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -47,11 +47,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) return false;
}
- IMGSRVC_MEMIO memio = { 0 };
- memio.iLen = reply->dataLength;
- memio.pBuf = reply->pData;
- memio.fif = FIF_UNKNOWN; /* detect */
- param.bmp = (HBITMAP)CallService(MS_IMG_LOADFROMMEM, (WPARAM)&memio);
+ param.bmp = Image_LoadFromMem(reply->pData, reply->dataLength, FIF_UNKNOWN);
BITMAP bmp = { 0 };
GetObject(param.bmp, sizeof(bmp), &bmp);
|