Kaydet (Commit) 3b658759 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

clang-cl loplugin: embedserv

Change-Id: I9901dac882a74453015881ded2355ff0a51b50d5
Reviewed-on: https://gerrit.libreoffice.org/29868Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst d11ac604
......@@ -35,7 +35,7 @@ using namespace ::com::sun::star;
// EmbedDocument_Impl
sal_uInt64 EmbedDocument_Impl::getMetaFileHandle_Impl( sal_Bool isEnhMeta )
sal_uInt64 EmbedDocument_Impl::getMetaFileHandle_Impl( bool isEnhMeta )
{
sal_uInt64 pResult = NULL;
......@@ -85,13 +85,13 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
if ( !( pFormatetc->tymed & TYMED_ENHMF ) )
return DV_E_TYMED;
HENHMETAFILE hMeta = reinterpret_cast<HENHMETAFILE>( getMetaFileHandle_Impl( sal_True ) );
HENHMETAFILE hMeta = reinterpret_cast<HENHMETAFILE>( getMetaFileHandle_Impl( true ) );
if ( hMeta )
{
pMedium->tymed = TYMED_ENHMF;
pMedium->hEnhMetaFile = hMeta;
pMedium->pUnkForRelease = NULL;
pMedium->pUnkForRelease = nullptr;
return S_OK;
}
......@@ -103,13 +103,13 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
if ( !( pFormatetc->tymed & TYMED_MFPICT ) )
return DV_E_TYMED;
HGLOBAL hMeta = reinterpret_cast<HGLOBAL>( getMetaFileHandle_Impl( sal_False ) );
HGLOBAL hMeta = reinterpret_cast<HGLOBAL>( getMetaFileHandle_Impl( false ) );
if ( hMeta )
{
pMedium->tymed = TYMED_MFPICT;
pMedium->hMetaFilePict = hMeta;
pMedium->pUnkForRelease = NULL;
pMedium->pUnkForRelease = nullptr;
return S_OK;
}
......@@ -126,7 +126,7 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
return DV_E_TYMED;
CComPtr< IStorage > pNewStg;
HRESULT hr = StgCreateDocfile( NULL, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, 0, &pNewStg );
HRESULT hr = StgCreateDocfile( nullptr, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, 0, &pNewStg );
if ( FAILED( hr ) || !pNewStg ) return STG_E_MEDIUMFULL;
hr = SaveTo_Impl( pNewStg );
......@@ -135,7 +135,7 @@ STDMETHODIMP EmbedDocument_Impl::GetData( FORMATETC * pFormatetc, STGMEDIUM * pM
pMedium->tymed = TYMED_ISTORAGE;
pMedium->pstg = pNewStg;
pMedium->pstg->AddRef();
pMedium->pUnkForRelease = ( IUnknown* )pNewStg;
pMedium->pUnkForRelease = static_cast<IUnknown*>(pNewStg);
return S_OK;
}
......@@ -171,7 +171,7 @@ STDMETHODIMP EmbedDocument_Impl::GetDataHere( FORMATETC * pFormatetc, STGMEDIUM
if ( FAILED( hr ) ) return STG_E_MEDIUMFULL;
pMedium->tymed = TYMED_ISTORAGE;
pMedium->pUnkForRelease = NULL;
pMedium->pUnkForRelease = nullptr;
return S_OK;
}
......@@ -225,7 +225,7 @@ STDMETHODIMP EmbedDocument_Impl::GetCanonicalFormatEtc( FORMATETC * pFormatetcIn
if ( !pFormatetcIn || !pFormatetcOut )
return DV_E_FORMATETC;
pFormatetcOut->ptd = NULL;
pFormatetcOut->ptd = nullptr;
pFormatetcOut->cfFormat = pFormatetcIn->cfFormat;
pFormatetcOut->dwAspect = DVASPECT_CONTENT;
......@@ -272,7 +272,7 @@ STDMETHODIMP EmbedDocument_Impl::DAdvise( FORMATETC * pFormatetc, DWORD advf, IA
if ( !SUCCEEDED( CreateDataAdviseHolder( &m_pDAdviseHolder ) ) || !m_pDAdviseHolder )
return E_OUTOFMEMORY;
return m_pDAdviseHolder->Advise( (IDataObject*)this, pFormatetc, advf, pAdvSink, pdwConnection );
return m_pDAdviseHolder->Advise( static_cast<IDataObject*>(this), pFormatetc, advf, pAdvSink, pdwConnection );
}
STDMETHODIMP EmbedDocument_Impl::DUnadvise( DWORD dwConnection )
......
......@@ -26,7 +26,7 @@ STDMETHODIMP EmbedDocument_Impl::GetWindow(HWND *hWnd)
OSL_ENSURE(m_pDocHolder,"no document for inplace activation");
*hWnd = m_pDocHolder->GetTopMostWinHandle();
if(*hWnd != NULL)
if(*hWnd != nullptr)
return NOERROR;
else
return ERROR;
......
......@@ -25,10 +25,6 @@
using namespace ::com::sun::star;
extern OUString getFilterNameFromGUID_Impl( GUID* );
// IOleObject
......@@ -51,10 +47,10 @@ STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLES
{
m_pDocHolder->setTitle(
OUString(
(sal_Unicode*)szContainerObj));
szContainerObj));
m_pDocHolder->setContainerName(
OUString(
(sal_Unicode*)szContainerApp));
szContainerApp));
}
return S_OK;
......@@ -149,7 +145,7 @@ STDMETHODIMP EmbedDocument_Impl::DoVerb(
return OLEOBJ_S_CANNOT_DOVERB_NOW;
// an object can not handle any Verbs in Hands off mode
if ( m_pMasterStorage == NULL || m_pOwnStream == NULL )
if ( m_pMasterStorage == nullptr || m_pOwnStream == nullptr )
return OLE_E_CANT_BINDTOSOURCE;
......@@ -427,8 +423,8 @@ HRESULT EmbedDocument_Impl::SaveObject()
OUString aPreservFileName = m_aFileName;
// in case of links the containers does not provide client site sometimes
hr = Save( (LPCOLESTR)NULL, FALSE ); // triggers saving to the link location
SaveCompleted( (LPCOLESTR)aPreservFileName.getStr() );
hr = Save( static_cast<LPCOLESTR>(nullptr), FALSE ); // triggers saving to the link location
SaveCompleted( aPreservFileName.getStr() );
}
notify( false );
......@@ -458,7 +454,7 @@ void EmbedDocument_Impl::notify( bool bDataChanged )
iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 );
if ( m_pDAdviseHolder && bDataChanged )
m_pDAdviseHolder->SendOnDataChange( (IDataObject*)this, 0, 0 );
m_pDAdviseHolder->SendOnDataChange( static_cast<IDataObject*>(this), 0, 0 );
}
void EmbedDocument_Impl::Deactivate()
......
......@@ -67,7 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, NULL);
_Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
......
......@@ -24,6 +24,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <guid.hxx>
OUString getStorageTypeFromGUID_Impl( GUID* guid )
{
if ( *guid == OID_WriterTextServer )
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_EMBEDSERV_SOURCE_EMBED_GUID_HXX
#define INCLUDED_EMBEDSERV_SOURCE_EMBED_GUID_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <common.h>
OUString getFilterNameFromGUID_Impl( GUID* );
OUString getServiceNameFromGUID_Impl( GUID* );
OUString getStorageTypeFromGUID_Impl( GUID* guid );
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -37,7 +37,7 @@ CIIAObj::~CIIAObj()
STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
{
*ppv=NULL;
*ppv=nullptr;
if(IID_IUnknown==riid ||
IID_IOleWindow==riid ||
......@@ -45,9 +45,9 @@ STDMETHODIMP CIIAObj::QueryInterface(REFIID riid, LPVOID FAR *ppv)
*ppv=this;
//AddRef any interface we'll return.
if (NULL!=*ppv)
if (nullptr!=*ppv)
{
((LPUNKNOWN)*ppv)->AddRef();
static_cast<LPUNKNOWN>(*ppv)->AddRef();
return NOERROR;
}
......
......@@ -83,20 +83,20 @@ void SAL_CALL Interceptor::dispose()
if(m_pStatCL)
m_pStatCL->disposeAndClear( aEvt );
m_xSlaveDispatchProvider = 0;
m_xMasterDispatchProvider = 0;
m_xSlaveDispatchProvider = nullptr;
m_xMasterDispatchProvider = nullptr;
}
Interceptor::Interceptor(
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess,
DocumentHolder* pDocH,
sal_Bool bLink )
bool bLink )
: m_xOleAccess( xOleAccess ),
m_xDocHLocker( static_cast< ::cppu::OWeakObject* >( pDocH ) ),
m_pDocH(pDocH),
m_pDisposeEventListeners(0),
m_pStatCL(0),
m_pDisposeEventListeners(nullptr),
m_pStatCL(nullptr),
m_bLink( bLink )
{
m_aInterceptedURL[0] = ".uno:Save";
......@@ -113,7 +113,7 @@ Interceptor::~Interceptor()
delete m_pDisposeEventListeners;
delete m_pStatCL;
DocumentHolder* pTmpDocH = NULL;
DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock;
{
osl::MutexGuard aGuard(m_aMutex);
......@@ -130,8 +130,8 @@ void Interceptor::DisconnectDocHolder()
{
osl::MutexGuard aGuard(m_aMutex);
m_xDocHLocker.clear();
m_pDocH = NULL;
m_xOleAccess = NULL;
m_pDocH = nullptr;
m_xOleAccess = nullptr;
}
//XDispatch
......@@ -169,7 +169,7 @@ Interceptor::dispatch(
{
if ( aNewArgs[nInd].Name == "SaveTo" )
{
aNewArgs[nInd].Value <<= sal_True;
aNewArgs[nInd].Value <<= true;
break;
}
nInd++;
......@@ -179,11 +179,11 @@ Interceptor::dispatch(
{
aNewArgs.realloc( nInd + 1 );
aNewArgs[nInd].Name = "SaveTo";
aNewArgs[nInd].Value <<= sal_True;
aNewArgs[nInd].Value <<= true;
}
uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(
URL, OUString( "_self" ), 0 );
URL, "_self", 0 );
if ( xDispatch.is() )
xDispatch->dispatch( URL, aNewArgs );
}
......@@ -196,7 +196,7 @@ void Interceptor::generateFeatureStateEvent()
{
if( m_pStatCL )
{
DocumentHolder* pTmpDocH = NULL;
DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock;
{
osl::MutexGuard aGuard(m_aMutex);
......@@ -223,14 +223,14 @@ void Interceptor::generateFeatureStateEvent()
continue;
frame::FeatureStateEvent aStateEvent;
aStateEvent.IsEnabled = sal_True;
aStateEvent.Requery = sal_False;
aStateEvent.IsEnabled = true;
aStateEvent.Requery = false;
if(i == 0)
{
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0];
aStateEvent.FeatureDescriptor = "Update";
aStateEvent.State <<= (OUString("($1) ") + aTitle);
aStateEvent.State <<= ("($1) " + aTitle);
}
else if ( i == 5 )
......@@ -243,7 +243,7 @@ void Interceptor::generateFeatureStateEvent()
{
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i];
aStateEvent.FeatureDescriptor = "Close and Return";
aStateEvent.State <<= (OUString("($2) ") + aTitle);
aStateEvent.State <<= ("($2) " + aTitle);
}
......@@ -274,7 +274,7 @@ Interceptor::addStatusListener(
if( !m_bLink && URL.Complete == m_aInterceptedURL[0] )
{ // Save
DocumentHolder* pTmpDocH = NULL;
DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock;
{
osl::MutexGuard aGuard(m_aMutex);
......@@ -290,9 +290,9 @@ Interceptor::addStatusListener(
frame::FeatureStateEvent aStateEvent;
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0];
aStateEvent.FeatureDescriptor = "Update";
aStateEvent.IsEnabled = sal_True;
aStateEvent.Requery = sal_False;
aStateEvent.State <<= (OUString("($1) ") + aTitle );
aStateEvent.IsEnabled = true;
aStateEvent.Requery = false;
aStateEvent.State <<= ("($1) " + aTitle );
Control->statusChanged(aStateEvent);
{
......@@ -312,7 +312,7 @@ Interceptor::addStatusListener(
URL.Complete == m_aInterceptedURL[++i] ||
URL.Complete == m_aInterceptedURL[++i] ) )
{ // Close and return
DocumentHolder* pTmpDocH = NULL;
DocumentHolder* pTmpDocH = nullptr;
uno::Reference< uno::XInterface > xLock;
{
osl::MutexGuard aGuard(m_aMutex);
......@@ -328,9 +328,9 @@ Interceptor::addStatusListener(
frame::FeatureStateEvent aStateEvent;
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i];
aStateEvent.FeatureDescriptor = "Close and Return";
aStateEvent.IsEnabled = sal_True;
aStateEvent.Requery = sal_False;
aStateEvent.State <<= (OUString("($2) ") + aTitle );
aStateEvent.IsEnabled = true;
aStateEvent.Requery = false;
aStateEvent.State <<= ("($2) " + aTitle );
Control->statusChanged(aStateEvent);
......@@ -350,8 +350,8 @@ Interceptor::addStatusListener(
frame::FeatureStateEvent aStateEvent;
aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5];
aStateEvent.FeatureDescriptor = "SaveCopyTo";
aStateEvent.IsEnabled = sal_True;
aStateEvent.Requery = sal_False;
aStateEvent.IsEnabled = true;
aStateEvent.Requery = false;
aStateEvent.State <<= (OUString("($3)"));
Control->statusChanged(aStateEvent);
......@@ -422,23 +422,23 @@ Interceptor::queryDispatch(
{
osl::MutexGuard aGuard(m_aMutex);
if( !m_bLink && URL.Complete == m_aInterceptedURL[0] )
return (frame::XDispatch*)this;
return static_cast<frame::XDispatch*>(this);
else if(URL.Complete == m_aInterceptedURL[1])
return (frame::XDispatch*)0 ;
return nullptr;
else if( !m_bLink && URL.Complete == m_aInterceptedURL[2] )
return (frame::XDispatch*)this;
return static_cast<frame::XDispatch*>(this);
else if( !m_bLink && URL.Complete == m_aInterceptedURL[3] )
return (frame::XDispatch*)this;
return static_cast<frame::XDispatch*>(this);
else if( !m_bLink && URL.Complete == m_aInterceptedURL[4] )
return (frame::XDispatch*)this;
return static_cast<frame::XDispatch*>(this);
else if(URL.Complete == m_aInterceptedURL[5])
return (frame::XDispatch*)this;
return static_cast<frame::XDispatch*>(this);
else {
if(m_xSlaveDispatchProvider.is())
return m_xSlaveDispatchProvider->queryDispatch(
URL,TargetFrameName,SearchFlags);
else
return uno::Reference<frame::XDispatch>(0);
return uno::Reference<frame::XDispatch>(nullptr);
}
}
......@@ -458,17 +458,17 @@ Interceptor::queryDispatches(
for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
if ( !m_bLink && m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this;
aRet[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete)
aRet[i] = (frame::XDispatch*) 0;
aRet[i] = nullptr;
else if( !m_bLink && m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this;
aRet[i] = static_cast<frame::XDispatch*>(this);
else if( !m_bLink && m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this;
aRet[i] = static_cast<frame::XDispatch*>(this);
else if( !m_bLink && m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete )
aRet[i] = (frame::XDispatch*) this;
aRet[i] = static_cast<frame::XDispatch*>(this);
else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete)
aRet[i] = (frame::XDispatch*) this;
aRet[i] = static_cast<frame::XDispatch*>(this);
return aRet;
}
......
......@@ -59,14 +59,14 @@ extern "C" {
SAL_DLLPUBLIC_EXPORT void * SAL_CALL emser_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
{
void * pRet = 0;
void * pRet = nullptr;
OUString aImplName( OUString::createFromAscii( pImplName ) );
uno::Reference< lang::XSingleServiceFactory > xFactory;
if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) )
{
xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager),
xFactory= ::cppu::createOneInstanceFactory( static_cast< lang::XMultiServiceFactory*>(pServiceManager),
EmbedServer_getImplementationName(),
EmbedServer_createInstance,
EmbedServer_getSupportedServiceNames() );
......
......@@ -50,7 +50,7 @@ class CurThreadData
CurThreadData();
virtual ~CurThreadData();
sal_Bool SAL_CALL setData(void *pData);
bool SAL_CALL setData(void *pData);
void* SAL_CALL getData();
......@@ -60,7 +60,7 @@ class CurThreadData
CurThreadData::CurThreadData()
{
m_hKey = osl_createThreadKey( (oslThreadKeyCallbackFunction)NULL );
m_hKey = osl_createThreadKey( nullptr );
}
CurThreadData::~CurThreadData()
......@@ -68,7 +68,7 @@ CurThreadData::~CurThreadData()
osl_destroyThreadKey(m_hKey);
}
sal_Bool CurThreadData::setData(void *pData)
bool CurThreadData::setData(void *pData)
{
OSL_ENSURE( m_hKey, "No thread key!\n" );
return (osl_setThreadKeyData(m_hKey, pData));
......@@ -84,16 +84,16 @@ void o2u_attachCurrentThread()
{
static CurThreadData oleThreadData;
if ( oleThreadData.getData() != 0 )
if ( oleThreadData.getData() != nullptr )
{
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
if (!SUCCEEDED(hr))
{ // FIXME: is it a problem that this ends up in STA currently?
assert(RPC_E_CHANGED_MODE == hr);
SAL_INFO("embedserv.ole",
"CoInitializeEx fail: probably thread is in STA already?");
}
oleThreadData.setData((void*)sal_True);
oleThreadData.setData(reinterpret_cast<void*>(true));
}
}
......@@ -151,7 +151,7 @@ EmbedProviderFactory_Impl::~EmbedProviderFactory_Impl()
{
}
sal_Bool EmbedProviderFactory_Impl::registerClass()
bool EmbedProviderFactory_Impl::registerClass()
{
HRESULT hresult;
......@@ -167,7 +167,7 @@ sal_Bool EmbedProviderFactory_Impl::registerClass()
return (hresult == NOERROR);
}
sal_Bool EmbedProviderFactory_Impl::deregisterClass()
bool EmbedProviderFactory_Impl::deregisterClass()
{
HRESULT hresult = CoRevokeClassObject( m_factoryHandle );
......@@ -179,17 +179,17 @@ STDMETHODIMP EmbedProviderFactory_Impl::QueryInterface(REFIID riid, void FAR* FA
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) (IClassFactory*) this;
*ppv = static_cast<IUnknown*>(static_cast<IClassFactory*>(this));
return NOERROR;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
*ppv = static_cast<IClassFactory*>(this);
return NOERROR;
}
*ppv = NULL;
*ppv = nullptr;
return ResultFromScode(E_NOINTERFACE);
}
......@@ -214,9 +214,9 @@ STDMETHODIMP EmbedProviderFactory_Impl::CreateInstance(IUnknown FAR* punkOuter,
REFIID riid,
void FAR* FAR* ppv)
{
punkOuter = NULL;
punkOuter = nullptr;
IUnknown* pEmbedDocument = (IUnknown*)(IPersistStorage*)( new EmbedDocument_Impl( m_xFactory, &m_guid ) );
IUnknown* pEmbedDocument = static_cast<IUnknown*>(static_cast<IPersistStorage*>( new EmbedDocument_Impl( m_xFactory, &m_guid ) ));
return pEmbedDocument->QueryInterface( riid, ppv );
}
......
......@@ -44,14 +44,10 @@ using namespace winwrap;
typedef CHatchWin *PCHatchWin;
void DrawShading(LPRECT prc, HDC hDC, UINT cWidth);
winwrap::CWindow::CWindow(HINSTANCE hInst)
{
m_hInst=hInst;
m_hWnd=NULL;
m_hWnd=nullptr;
return;
}
......@@ -118,10 +114,10 @@ BOOL winwrap::HatchWindowRegister(HINSTANCE hInst)
wc.cbClsExtra = 0;
wc.lpfnWndProc = HatchWndProc;
wc.cbWndExtra = CBHATCHWNDEXTRA;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.hIcon = nullptr;
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
wc.lpszMenuName = nullptr;
wc.lpszClassName = SZCLASSHATCHWIN;
return RegisterClass(&wc);
......@@ -140,9 +136,9 @@ CHatchWin::CHatchWin(HINSTANCE hInst,const DocumentHolder* pDocHolder)
: CWindow(hInst),
m_aTracker()
{
m_hWnd=NULL;
m_hWndKid=NULL;
m_hWndAssociate=NULL;
m_hWnd=nullptr;
m_hWndKid=nullptr;
m_hWndAssociate=nullptr;
m_uID=0;
m_dBorderOrg=GetProfileInt(TEXT("windows")
......@@ -164,7 +160,7 @@ CHatchWin::~CHatchWin()
* Chances are this was already destroyed when a document
* was destroyed.
*/
if (NULL!=m_hWnd && IsWindow(m_hWnd))
if (nullptr!=m_hWnd && IsWindow(m_hWnd))
DestroyWindow(m_hWnd);
return;
......@@ -200,7 +196,7 @@ BOOL CHatchWin::Init(HWND hWndParent, WORD uID, HWND hWndAssoc)
m_uID=uID;
m_hWndAssociate=hWndAssoc;
return (NULL!=m_hWnd);
return (nullptr!=m_hWnd);
}
......@@ -274,7 +270,7 @@ void CHatchWin::RectsSet(LPRECT prcPos, LPRECT prcClip)
InflateRect(&rcPos, m_dBorder, m_dBorder);
IntersectRect(&rc, &rcPos, prcClip);
SetWindowPos(m_hWnd, NULL, rc.left, rc.top, rc.right-rc.left
SetWindowPos(m_hWnd, nullptr, rc.left, rc.top, rc.right-rc.left
, rc.bottom-rc.top, SWP_NOZORDER | SWP_NOACTIVATE);
/*
......@@ -316,7 +312,7 @@ void CHatchWin::ChildSet(HWND hWndKid)
{
m_hWndKid=hWndKid;
if (NULL!=hWndKid)
if (nullptr!=hWndKid)
{
SetParent(hWndKid, m_hWnd);
......@@ -374,14 +370,14 @@ LRESULT APIENTRY winwrap::HatchWndProc(
HDC hDC;
PAINTSTRUCT ps;
phw=(PCHatchWin)GetWindowLongPtr(hWnd, HWWL_STRUCTURE);
phw=reinterpret_cast<PCHatchWin>(GetWindowLongPtr(hWnd, HWWL_STRUCTURE));
POINT ptMouse;
switch (iMsg)
{
case WM_CREATE:
phw=(PCHatchWin)((LPCREATESTRUCT)lParam)->lpCreateParams;
SetWindowLongPtr(hWnd, HWWL_STRUCTURE, (LONG_PTR)phw);
phw=static_cast<PCHatchWin>(reinterpret_cast<LPCREATESTRUCT>(lParam)->lpCreateParams);
SetWindowLongPtr(hWnd, HWWL_STRUCTURE, reinterpret_cast<LONG_PTR>(phw));
break;
case WM_PAINT:
hDC=BeginPaint(hWnd,&ps);
......@@ -409,7 +405,7 @@ LRESULT APIENTRY winwrap::HatchWndProc(
break;
case WM_SETFOCUS:
//We need this since the container will SetFocus to us.
if (NULL!=phw->m_hWndKid)
if (nullptr!=phw->m_hWndKid)
SetFocus(phw->m_hWndKid);
break;
......@@ -423,12 +419,12 @@ LRESULT APIENTRY winwrap::HatchWndProc(
* message when the mouse is on the border. So we can
* just send the notification.
*/
if (NULL!=phw->m_hWndAssociate)
if (nullptr!=phw->m_hWndAssociate)
{
SendMessage(
phw->m_hWndAssociate, WM_COMMAND,
MAKEWPARAM(phw->m_uID, HWN_BORDERDOUBLECLICKED),
(LPARAM) hWnd);
reinterpret_cast<LPARAM>(hWnd));
}
break;
......
......@@ -90,7 +90,7 @@ private:
CComPtr< IDispatch > m_pIDispatch;
sal_Bool m_bLink;
bool m_bLink;
css::uno::Reference< css::frame::XFrame2 > DocumentFrame();
......@@ -101,7 +101,7 @@ private:
void ClearInterceptorInternally();
void LoadDocInFrame( sal_Bool bPluginMode );
void LoadDocInFrame( bool bPluginMode );
public:
......@@ -122,7 +122,7 @@ public:
const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess );
~DocumentHolder();
~DocumentHolder() override;
// Methods for inplace activation
......@@ -136,19 +136,19 @@ public:
BOOL InPlaceMenuCreate();
BOOL InPlaceMenuDestroy();
void OpenIntoWindow();
BOOL Undo();
static void OpenIntoWindow();
static BOOL Undo();
// further methods
void SetDocument(
const css::uno::Reference< css::frame::XModel >& xDoc,
sal_Bool bLink = sal_False
bool bLink = false
);
sal_Bool ExecuteSuspendCloseFrame();
bool ExecuteSuspendCloseFrame();
void DisconnectFrameDocument( sal_Bool bComplete = sal_False );
void DisconnectFrameDocument( bool bComplete = false );
void CloseDocument();
void CloseFrame();
void ClearInterceptor();
......@@ -164,8 +164,8 @@ public:
void OnPosRectChanged(LPRECT lpRect) const;
void show();
sal_Bool HasFrame() { return m_xFrame.is(); }
sal_Bool IsLink() { return m_bLink; }
bool HasFrame() { return m_xFrame.is(); }
bool IsLink() { return m_bLink; }
/** hides the document window, even in case of an external container
* side managed window.
......@@ -198,7 +198,7 @@ public:
// XEventListener
virtual void SAL_CALL
disposing( const css::lang::EventObject& aSource )
throw( css::uno::RuntimeException );
throw( css::uno::RuntimeException ) override;
// XCloseListener
virtual void SAL_CALL
......@@ -208,13 +208,13 @@ public:
)
throw(
css::util::CloseVetoException
);
) override;
virtual void SAL_CALL
notifyClosing(
const css::lang::EventObject& aSource
)
throw( css::uno::RuntimeException );
throw( css::uno::RuntimeException ) override;
// XTerminateListener
virtual void SAL_CALL
......@@ -223,13 +223,13 @@ public:
)
throw(
css::frame::TerminationVetoException
);
) override;
virtual void SAL_CALL
notifyTermination(
const css::lang::EventObject& aSource
)
throw( css::uno::RuntimeException );
throw( css::uno::RuntimeException ) override;
// XModifyListener
......@@ -239,7 +239,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
// XDockingAreaAcceptor
......@@ -249,7 +249,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual sal_Bool SAL_CALL
requestDockingAreaSpace(
......@@ -257,7 +257,7 @@ public:
)
throw(
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
setDockingAreaSpace(
......@@ -265,7 +265,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
};
#endif
......
......@@ -41,19 +41,19 @@ public:
virtual ~CIIAObj();
/* IUnknown methods */
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR * ppvObj);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR * ppvObj) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
/* IOleInPlaceActiveObject methods */
STDMETHODIMP GetWindow(HWND *);
STDMETHODIMP ContextSensitiveHelp(BOOL);
STDMETHODIMP GetWindow(HWND *) override;
STDMETHODIMP ContextSensitiveHelp(BOOL) override;
STDMETHODIMP TranslateAccelerator(LPMSG);
STDMETHODIMP OnFrameWindowActivate(BOOL);
STDMETHODIMP OnDocWindowActivate(BOOL);
STDMETHODIMP OnFrameWindowActivate(BOOL) override;
STDMETHODIMP OnDocWindowActivate(BOOL) override;
STDMETHODIMP ResizeBorder(LPCRECT, LPOLEINPLACEUIWINDOW
, BOOL);
STDMETHODIMP EnableModeless(BOOL);
, BOOL) override;
STDMETHODIMP EnableModeless(BOOL) override;
private:
......
......@@ -46,9 +46,9 @@ public:
Interceptor(
const ::rtl::Reference< EmbeddedDocumentInstanceAccess_Impl >& xOleAccess,
DocumentHolder* pDocH,
sal_Bool bLink );
bool bLink );
~Interceptor();
~Interceptor() override;
void DisconnectDocHolder();
......@@ -76,7 +76,7 @@ public:
dispatch(
const css::util::URL& URL,
const css::uno::Sequence< css::beans::PropertyValue >& Arguments )
throw (css::uno::RuntimeException);
throw (css::uno::RuntimeException) override;
virtual void SAL_CALL
addStatusListener(
......@@ -84,7 +84,7 @@ public:
const css::util::URL& URL )
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeStatusListener(
......@@ -92,14 +92,14 @@ public:
const css::util::URL& URL )
throw (
css::uno::RuntimeException
);
) override;
//XInterceptorInfo
virtual css::uno::Sequence< OUString >
SAL_CALL getInterceptedURLs( )
throw (
css::uno::RuntimeException
);
) override;
//XDispatchProvider ( inherited by XDispatchProviderInterceptor )
......@@ -111,7 +111,7 @@ public:
sal_Int32 SearchFlags )
throw (
css::uno::RuntimeException
);
) override;
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
queryDispatches(
......@@ -119,7 +119,7 @@ public:
css::frame::DispatchDescriptor >& Requests )
throw (
css::uno::RuntimeException
);
) override;
//XDispatchProviderInterceptor
......@@ -127,27 +127,27 @@ public:
getSlaveDispatchProvider( )
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
setSlaveDispatchProvider(
const css::uno::Reference< css::frame::XDispatchProvider >& NewDispatchProvider )
throw (
css::uno::RuntimeException
);
) override;
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL
getMasterDispatchProvider( )
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
setMasterDispatchProvider(
const css::uno::Reference< css::frame::XDispatchProvider >& NewSupplier )
throw (
css::uno::RuntimeException
);
) override;
private:
......@@ -168,7 +168,7 @@ private:
comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners;
StatusChangeListenerContainer* m_pStatCL;
sal_Bool m_bLink;
bool m_bLink;
};
#endif
......
......@@ -35,7 +35,7 @@ class EmbedServer_Impl: public cppu::WeakImplHelper<css::lang::XServiceInfo>
{
public:
EmbedServer_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > &xFactory );
virtual ~EmbedServer_Impl();
virtual ~EmbedServer_Impl() override;
OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException, std::exception) override;
......@@ -59,17 +59,17 @@ public:
EmbedProviderFactory_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid);
virtual ~EmbedProviderFactory_Impl();
sal_Bool registerClass();
sal_Bool deregisterClass();
bool registerClass();
bool deregisterClass();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)() override;
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
STDMETHOD(LockServer)(int fLock);
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override;
STDMETHOD(LockServer)(int fLock) override;
protected:
......
......@@ -94,7 +94,7 @@ namespace winwrap {
void GetTrueRect(LPRECT lpTrueRect) const;
BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
HWND hWndClipTo = NULL);
HWND hWndClipTo = nullptr);
// BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
int HitTest(POINT point) const;
int NormalizeHit(int nHandle) const;
......@@ -123,7 +123,7 @@ protected:
void GetHandleRect(int nHandle,RECT* pHandleRect) const;
void GetModifyPointers(
int nHandle,int**ppx, int**ppy, int* px, int*py);
virtual int GetHandleSize(LPRECT lpRect = NULL) const;
virtual int GetHandleSize(LPRECT lpRect = nullptr) const;
BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo);
void Construct();
};
......
......@@ -38,7 +38,7 @@ public:
ContainerWindowWrapper(HWND aHwnd);
~ ContainerWindowWrapper();
~ ContainerWindowWrapper() override;
// XComponent
......@@ -48,7 +48,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addEventListener(
......@@ -56,7 +56,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeEventListener(
......@@ -64,7 +64,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
// XSystemDependentWindowPeer
......@@ -76,7 +76,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
// XWindow
......@@ -89,14 +89,14 @@ public:
sal_Int16 Flags
)
throw (
css::uno::RuntimeException);
css::uno::RuntimeException) override;
virtual css::awt::Rectangle SAL_CALL
getPosSize(
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
setVisible(
......@@ -104,7 +104,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
setEnable(
......@@ -112,14 +112,14 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
setFocus(
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addWindowListener(
......@@ -127,7 +127,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeWindowListener(
......@@ -135,7 +135,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addFocusListener(
......@@ -143,7 +143,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeFocusListener(
......@@ -151,7 +151,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addKeyListener(
......@@ -160,7 +160,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeKeyListener(
......@@ -168,7 +168,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addMouseListener(
......@@ -176,7 +176,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeMouseListener(
......@@ -185,7 +185,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addMouseMotionListener(
......@@ -194,7 +194,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removeMouseMotionListener(
......@@ -202,7 +202,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
addPaintListener(
......@@ -210,7 +210,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
virtual void SAL_CALL
removePaintListener(
......@@ -218,7 +218,7 @@ public:
)
throw (
css::uno::RuntimeException
);
) override;
private:
......
......@@ -28,7 +28,7 @@ namespace inprocserv
OleWrapperAdviseSink::OleWrapperAdviseSink()
: m_nRefCount( 0 )
, m_pFormatEtc( NULL )
, m_pFormatEtc( nullptr )
, m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 )
, m_bObjectAdvise( TRUE )
......@@ -42,7 +42,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink()
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener )
: m_nRefCount( 0 )
, m_pListener( pListener )
, m_pFormatEtc( NULL )
, m_pFormatEtc( nullptr )
, m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 )
, m_bObjectAdvise( TRUE )
......@@ -56,7 +56,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag )
: m_nRefCount( 0 )
, m_pListener( pListener )
, m_pFormatEtc( NULL )
, m_pFormatEtc( nullptr )
, m_nAspect( DVASPECT_CONTENT )
, m_nRegID( 0 )
, m_bObjectAdvise( FALSE )
......@@ -69,7 +69,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList
{
m_pFormatEtc = new FORMATETC;
m_pFormatEtc->cfFormat = pFormatEtc->cfFormat;
m_pFormatEtc->ptd = NULL;
m_pFormatEtc->ptd = nullptr;
m_pFormatEtc->dwAspect = pFormatEtc->dwAspect;
m_pFormatEtc->lindex = pFormatEtc->lindex;
m_pFormatEtc->tymed = pFormatEtc->tymed;
......@@ -79,7 +79,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList
OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag )
: m_nRefCount( 0 )
, m_pListener( pListener )
, m_pFormatEtc( NULL )
, m_pFormatEtc( nullptr )
, m_nAspect( nAspect )
, m_nRegID( 0 )
, m_bObjectAdvise( TRUE )
......@@ -97,17 +97,17 @@ OleWrapperAdviseSink::~OleWrapperAdviseSink()
STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv )
{
*ppv=NULL;
*ppv=nullptr;
if ( riid == IID_IUnknown )
*ppv = (IUnknown*)this;
*ppv = static_cast<IUnknown*>(this);
if ( riid == IID_IAdviseSink )
*ppv = (IAdviseSink*)this;
*ppv = static_cast<IAdviseSink*>(this);
if ( *ppv != NULL )
if ( *ppv != nullptr )
{
((IUnknown*)*ppv)->AddRef();
static_cast<IUnknown*>(*ppv)->AddRef();
return S_OK;
}
......
......@@ -69,21 +69,21 @@ public:
FORMATETC* GetFormatEtc() { return m_pFormatEtc; }
DWORD GetAspect() { return m_nAspect; }
ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; }
void DisconnectOrigAdvise() { m_pListener = NULL; }
void DisconnectOrigAdvise() { m_pListener = nullptr; }
void SetClosed() { m_bClosed = TRUE; }
void UnsetClosed() { m_bClosed = FALSE; }
BOOL IsClosed() { return m_bClosed; }
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
STDMETHODIMP QueryInterface(REFIID, void**) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
STDMETHODIMP_(void) OnRename(LPMONIKER);
STDMETHODIMP_(void) OnSave();
STDMETHODIMP_(void) OnClose();
STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM) override;
STDMETHODIMP_(void) OnViewChange(DWORD, LONG) override;
STDMETHODIMP_(void) OnRename(LPMONIKER) override;
STDMETHODIMP_(void) OnSave() override;
STDMETHODIMP_(void) OnClose() override;
};
}; // namespace advisesink
......
......@@ -42,7 +42,7 @@ static const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = {
&OID_MathOASISServer
};
static HINSTANCE g_hInstance = NULL;
static HINSTANCE g_hInstance = nullptr;
static ULONG g_nObj = 0;
static ULONG g_nLock = 0;
......@@ -93,7 +93,7 @@ namespace {
HRESULT hRes = E_FAIL;
if ( pLibrary && nLen )
{
HKEY hKey = NULL;
HKEY hKey = nullptr;
hRes = S_OK;
for ( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
......@@ -109,14 +109,14 @@ namespace {
{
if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, pSubKey, &hKey ) )
{
if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, (const BYTE*)pLibrary, nLen ) )
if ( ERROR_SUCCESS == RegSetValueEx( hKey, "", 0, REG_SZ, reinterpret_cast<const BYTE*>(pLibrary), nLen ) )
bLocalSuccess = TRUE;
}
if ( hKey )
{
RegCloseKey( hKey );
hKey = NULL;
hKey = nullptr;
}
}
......@@ -144,13 +144,13 @@ public:
virtual ~InprocEmbedProvider_Impl();
/* IUnknown methods */
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override;
STDMETHOD_(ULONG, AddRef)() override;
STDMETHOD_(ULONG, Release)() override;
/* IClassFactory methods */
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
STDMETHOD(LockServer)(int fLock);
STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override;
STDMETHOD(LockServer)(int fLock) override;
protected:
......@@ -186,7 +186,7 @@ STDAPI INPROC_DLLPUBLIC DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID*
return E_NOINTERFACE;
*ppv = new inprocserv::InprocEmbedProvider_Impl( rclsid );
((LPUNKNOWN)*ppv)->AddRef();
static_cast<LPUNKNOWN>(*ppv)->AddRef();
return S_OK;
}
......@@ -270,17 +270,17 @@ STDMETHODIMP InprocEmbedProvider_Impl::QueryInterface( REFIID riid, void FAR* FA
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
*ppv = (IUnknown*) this;
*ppv = static_cast<IUnknown*>(this);
return S_OK;
}
else if (IsEqualIID(riid, IID_IClassFactory))
{
AddRef();
*ppv = (IClassFactory*) this;
*ppv = static_cast<IClassFactory*>(this);
return S_OK;
}
*ppv = NULL;
*ppv = nullptr;
return E_NOINTERFACE;
}
......@@ -307,18 +307,16 @@ STDMETHODIMP InprocEmbedProvider_Impl::CreateInstance(IUnknown FAR* punkOuter,
// TODO/LATER: should the aggregation be supported?
// if ( punkOuter != NULL && riid != IID_IUnknown )
// return E_NOINTERFACE;
if ( punkOuter != NULL )
if ( punkOuter != nullptr )
return CLASS_E_NOAGGREGATION;
InprocEmbedDocument_Impl* pEmbedDocument = new InprocEmbedDocument_Impl( m_guid );
pEmbedDocument->AddRef();
HRESULT hr = pEmbedDocument->Init();
if ( SUCCEEDED( hr ) )
hr = pEmbedDocument->QueryInterface( riid, ppv );
HRESULT hr = pEmbedDocument->QueryInterface( riid, ppv );
pEmbedDocument->Release();
if ( !SUCCEEDED( hr ) )
*ppv = NULL;
*ppv = nullptr;
return hr;
}
......
......@@ -33,27 +33,27 @@ template< class T > class ComSmart
if ( m_pInterface )
{
T* pInterface = m_pInterface;
m_pInterface = NULL;
m_pInterface = nullptr;
pInterface->Release();
}
}
public:
ComSmart()
: m_pInterface( NULL )
: m_pInterface( nullptr )
{}
ComSmart( const ComSmart<T>& rObj )
: m_pInterface( rObj.m_pInterface )
{
if ( m_pInterface != NULL )
if ( m_pInterface != nullptr )
m_pInterface->AddRef();
}
explicit ComSmart( T* pInterface )
: m_pInterface( pInterface )
{
if ( m_pInterface != NULL )
if ( m_pInterface != nullptr )
m_pInterface->AddRef();
}
......@@ -68,7 +68,7 @@ public:
m_pInterface = rObj.m_pInterface;
if ( m_pInterface != NULL )
if ( m_pInterface != nullptr )
m_pInterface->AddRef();
return *this;
......@@ -80,7 +80,7 @@ public:
m_pInterface = pInterface;
if ( m_pInterface != NULL )
if ( m_pInterface != nullptr )
m_pInterface->AddRef();
return *this;
......@@ -100,7 +100,7 @@ public:
{
OwnRelease();
m_pInterface = NULL;
m_pInterface = nullptr;
return &m_pInterface;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment