From 3cab5cc7a72ec216d463cfd7735e11b808a221c7 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Wed, 17 Dec 2014 19:25:04 +0000 Subject: mTextControl: changed warning lavel to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11489 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/mTextControl/src/ImageDataObjectHlp.cpp | 142 ++++++++++++------------ 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'plugins/mTextControl/src/ImageDataObjectHlp.cpp') diff --git a/plugins/mTextControl/src/ImageDataObjectHlp.cpp b/plugins/mTextControl/src/ImageDataObjectHlp.cpp index 7e2747eb44..0ff5b9c479 100644 --- a/plugins/mTextControl/src/ImageDataObjectHlp.cpp +++ b/plugins/mTextControl/src/ImageDataObjectHlp.cpp @@ -114,102 +114,102 @@ HRESULT CreateDataObject(const FORMATETC *fmtetc, const STGMEDIUM *stgmed, UINT //bool InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap, HGLOBAL hGlobal) bool InsertBitmap(IRichEditOle* pRichEditOle, HENHMETAFILE hEmf) { - SCODE sc; + SCODE sc; - // Get the image data object - // + // Get the image data object + // static const FORMATETC lc_format[] = - { + { { CF_ENHMETAFILE, 0, DVASPECT_CONTENT, -1, TYMED_ENHMF }//, -// { CF_BITMAP, 0, DVASPECT_CONTENT, -1, TYMED_GDI }, -// { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL } + // { CF_BITMAP, 0, DVASPECT_CONTENT, -1, TYMED_GDI }, + // { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL } }; STGMEDIUM lc_stgmed[] = { { TYMED_ENHMF, { (HBITMAP)hEmf }, 0 }//, -// { TYMED_GDI, { hBitmap }, 0 }, -// { TYMED_HGLOBAL, { (HBITMAP)hGlobal }, 0 } + // { TYMED_GDI, { hBitmap }, 0 }, + // { TYMED_HGLOBAL, { (HBITMAP)hGlobal }, 0 } }; IDataObject *pods; CreateDataObject(lc_format, lc_stgmed, 1, &pods); - // Get the RichEdit container site - // - IOleClientSite *pOleClientSite; - pRichEditOle->GetClientSite(&pOleClientSite); + // Get the RichEdit container site + // + IOleClientSite *pOleClientSite; + pRichEditOle->GetClientSite(&pOleClientSite); - // Initialize a Storage Object - // - LPLOCKBYTES lpLockBytes = NULL; - sc = CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes); - if (sc != S_OK) + // Initialize a Storage Object + // + LPLOCKBYTES lpLockBytes = NULL; + sc = CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes); + if (sc != S_OK) + { + pOleClientSite->Release(); + return false; + } + + IStorage *pStorage; + sc = StgCreateDocfileOnILockBytes(lpLockBytes, + STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE, 0, &pStorage); + if (sc != S_OK) { - pOleClientSite->Release(); - return false; - } - - IStorage *pStorage; - sc = StgCreateDocfileOnILockBytes(lpLockBytes, - STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, &pStorage); - if (sc != S_OK) - { lpLockBytes->Release(); - pOleClientSite->Release(); - return false; - } - - // The final ole object which will be inserted in the richedit control - // - IOleObject *pOleObject; - sc = OleCreateStaticFromData(pods, IID_IOleObject, OLERENDER_FORMAT, - (LPFORMATETC)lc_format, pOleClientSite, pStorage, (void **)&pOleObject); - if (sc != S_OK) - { - pStorage->Release(); + pOleClientSite->Release(); + return false; + } + + // The final ole object which will be inserted in the richedit control + // + IOleObject *pOleObject; + sc = OleCreateStaticFromData(pods, IID_IOleObject, OLERENDER_FORMAT, + (LPFORMATETC)lc_format, pOleClientSite, pStorage, (void **)&pOleObject); + if (sc != S_OK) + { + pStorage->Release(); lpLockBytes->Release(); - pOleClientSite->Release(); - return false; - } + pOleClientSite->Release(); + return false; + } - // all items are "contained" -- this makes our reference to this object - // weak -- which is needed for links to embedding silent update. - OleSetContainedObject(pOleObject, TRUE); + // all items are "contained" -- this makes our reference to this object + // weak -- which is needed for links to embedding silent update. + OleSetContainedObject(pOleObject, TRUE); - // Now Add the object to the RichEdit - // + // Now Add the object to the RichEdit + // REOBJECT reobject = { 0 }; reobject.cbStruct = sizeof(REOBJECT); - reobject.cp = REO_CP_SELECTION ; - reobject.dvaspect = DVASPECT_CONTENT; - reobject.poleobj = pOleObject; - reobject.polesite = pOleClientSite; - reobject.pstg = pStorage; - reobject.dwFlags = REO_BELOWBASELINE; - - sc = pOleObject->GetUserClassID(&reobject.clsid); - if (sc != S_OK) + reobject.cp = REO_CP_SELECTION; + reobject.dvaspect = DVASPECT_CONTENT; + reobject.poleobj = pOleObject; + reobject.polesite = pOleClientSite; + reobject.pstg = pStorage; + reobject.dwFlags = REO_BELOWBASELINE; + + sc = pOleObject->GetUserClassID(&reobject.clsid); + if (sc != S_OK) { - pOleObject->Release(); - pStorage->Release(); + pOleObject->Release(); + pStorage->Release(); lpLockBytes->Release(); pOleClientSite->Release(); - return false; - } - - // Insert the bitmap at the current location in the richedit control - // - sc = pRichEditOle->InsertObject(&reobject); - - // Release all unnecessary interfaces - // - pOleObject->Release(); - pStorage->Release(); - lpLockBytes->Release(); - pOleClientSite->Release(); - pods->Release(); + return false; + } + + // Insert the bitmap at the current location in the richedit control + // + sc = pRichEditOle->InsertObject(&reobject); + + // Release all unnecessary interfaces + // + pOleObject->Release(); + pStorage->Release(); + lpLockBytes->Release(); + pOleClientSite->Release(); + pods->Release(); return sc == S_OK; } -- cgit v1.2.3