From 777dc2174f34c2a4d4499c3d63ef8914ed9ecb81 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Wed, 7 Mar 2018 23:38:31 +0300
Subject: old AdvaImg services converted into Image_* functions

---
 protocols/Gadu-Gadu/src/image.cpp | 15 +++------------
 protocols/Gadu-Gadu/src/token.cpp | 10 ++--------
 2 files changed, 5 insertions(+), 20 deletions(-)

(limited to 'protocols/Gadu-Gadu')

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;
-- 
cgit v1.2.3