summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory/src/ImageDataObject.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-08-31 12:19:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-08-31 12:19:31 +0000
commitca942b88c295830544e03804666229e0e955f64b (patch)
treee19134219dae9befdf0b5cb1764873830058d5ad /plugins/BasicHistory/src/ImageDataObject.cpp
parent75a38acd5c2a1e0abd08d3458d36a452dfd0879a (diff)
- memory leak fixed;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@17226 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory/src/ImageDataObject.cpp')
-rw-r--r--plugins/BasicHistory/src/ImageDataObject.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/plugins/BasicHistory/src/ImageDataObject.cpp b/plugins/BasicHistory/src/ImageDataObject.cpp
index 8e6c1b9b55..d0cbc85843 100644
--- a/plugins/BasicHistory/src/ImageDataObject.cpp
+++ b/plugins/BasicHistory/src/ImageDataObject.cpp
@@ -55,7 +55,6 @@ bool ImageDataObject::InsertIcon(IRichEditOle* pRichEditOle, HICON hIcon,
// returns true on success, false on failure
bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
{
- SCODE sc;
BITMAP bminfo;
// Get the image data object
@@ -72,16 +71,16 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
// Initialize a Storage Object
//
- IStorage *pStorage;
LPLOCKBYTES lpLockBytes = NULL;
- sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
+ SCODE sc = ::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
if (sc != S_OK) {
pOleClientSite->Release();
return false;
}
- sc = ::StgCreateDocfileOnILockBytes(lpLockBytes,
- STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
+
+ IStorage *pStorage;
+ sc = ::StgCreateDocfileOnILockBytes(lpLockBytes, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage);
if (sc != S_OK) {
lpLockBytes = NULL;
pOleClientSite->Release();
@@ -117,7 +116,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
}
reobject.clsid = clsid;
- reobject.cp = REO_CP_SELECTION ;
+ reobject.cp = REO_CP_SELECTION;
reobject.dvaspect = DVASPECT_CONTENT;
reobject.poleobj = pOleObject;
reobject.polesite = pOleClientSite;
@@ -134,10 +133,7 @@ bool ImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap)
pOleClientSite->Release();
lpLockBytes->Release();
pStorage->Release();
- if (sc != S_OK)
- return false;
- else
- return true;
+ return sc == S_OK;
}
@@ -161,10 +157,8 @@ void ImageDataObject::SetBitmap(HBITMAP hBitmap)
IOleObject *ImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStorage *pStorage)
{
- SCODE sc;
IOleObject *pOleObject;
- sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT,
- &m_format, pOleClientSite, pStorage, (void **) & pOleObject);
+ SCODE sc = ::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, &m_format, pOleClientSite, pStorage, (void **)& pOleObject);
if (sc != S_OK)
pOleObject = NULL;
return pOleObject;