diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-10-14 16:55:51 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-10-16 14:19:16 +0000 |
commit | d11ac6045926d4c6e392b3797939fbb7c7d37b27 (patch) | |
tree | b6b99803b11f8f9d84bba39ee2d38430c4f59c69 /extensions/source/activex | |
parent | 099ef29c47970d4b9d20f31d0ccbef93c492226b (diff) |
clang-cl loplugin: extensions
Change-Id: I659d8a3b098c7417235006c86ea60e7fe1e56a44
Reviewed-on: https://gerrit.libreoffice.org/29867
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'extensions/source/activex')
-rw-r--r-- | extensions/source/activex/SOActionsApproval.h | 13 | ||||
-rw-r--r-- | extensions/source/activex/SOActiveX.cxx | 78 | ||||
-rw-r--r-- | extensions/source/activex/SOActiveX.h | 38 | ||||
-rw-r--r-- | extensions/source/activex/SOComWindowPeer.h | 39 | ||||
-rw-r--r-- | extensions/source/activex/SODispatchInterceptor.cxx | 12 | ||||
-rw-r--r-- | extensions/source/activex/SODispatchInterceptor.h | 35 | ||||
-rw-r--r-- | extensions/source/activex/StdAfx2.h | 4 | ||||
-rw-r--r-- | extensions/source/activex/so_activex.cxx | 189 |
8 files changed, 235 insertions, 173 deletions
diff --git a/extensions/source/activex/SOActionsApproval.h b/extensions/source/activex/SOActionsApproval.h index d56ce3de7e05..e61a23357b04 100644 --- a/extensions/source/activex/SOActionsApproval.h +++ b/extensions/source/activex/SOActionsApproval.h @@ -58,7 +58,14 @@ BEGIN_COM_MAP(SOActionsApproval) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISOActionsApproval) COM_INTERFACE_ENTRY(ISupportErrorInfo) +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif END_COM_MAP() +#if defined __clang__ +#pragma clang diagnostic pop +#endif DECLARE_NOT_AGGREGATABLE(SOActionsApproval) // Remove the comment from the line above if you don't want your object to // support aggregation. @@ -66,12 +73,12 @@ DECLARE_NOT_AGGREGATABLE(SOActionsApproval) DECLARE_REGISTRY_RESOURCEID(IDR_SODOCUMENTEVENTLISTENER) // ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) override; // ISOActionsApproval virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE approveAction( /* [in] */ long nActionID, - /* [retval][out] */ boolean *pbApproval) + /* [retval][out] */ boolean *pbApproval) override { // only PreventClose is approved USES_CONVERSION; @@ -81,7 +88,7 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SODOCUMENTEVENTLISTENER) } virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) + /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override { *pVal = SafeArrayCreateVector( VT_BSTR, 0, 1 ); diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx index a758c89a687c..2d63b08f8b61 100644 --- a/extensions/source/activex/SOActiveX.cxx +++ b/extensions/source/activex/SOActiveX.cxx @@ -44,18 +44,18 @@ void OutputError_Impl( HWND hw, HRESULT ErrorCode ) { - void* sMessage; + LPTSTR sMessage; FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &sMessage, + reinterpret_cast<LPTSTR>(&sMessage), 0, - NULL + nullptr ); - ::MessageBoxA( hw, (LPCTSTR)sMessage, NULL, MB_OK | MB_ICONINFORMATION ); + ::MessageBoxA( hw, sMessage, nullptr, MB_OK | MB_ICONINFORMATION ); LocalFree( sMessage ); } @@ -72,12 +72,12 @@ HRESULT ExecuteFunc( IDispatch* idispUnoObject, HRESULT hr = idispUnoObject->GetIDsOfNames( IID_NULL, const_cast<OLECHAR **>(&sFuncName), 1, LOCALE_USER_DEFAULT, &id); if( !SUCCEEDED( hr ) ) return hr; - DISPPARAMS dispparams= { params, 0, count, 0}; + DISPPARAMS dispparams= { params, nullptr, count, 0}; // DEBUG EXCEPINFO myInfo; hr = idispUnoObject->Invoke( id, IID_NULL,LOCALE_USER_DEFAULT, DISPATCH_METHOD, - &dispparams, pResult, &myInfo, 0); + &dispparams, pResult, &myInfo, nullptr); // for debugging purposes // USES_CONVERSION; @@ -100,7 +100,7 @@ HRESULT GetIDispByFunc( IDispatch* idispUnoObject, HRESULT hr = ExecuteFunc( idispUnoObject, sFuncName, params, count, &result ); if( !SUCCEEDED( hr ) ) return hr; - if( result.vt != VT_DISPATCH || result.pdispVal == NULL ) + if( result.vt != VT_DISPATCH || result.pdispVal == nullptr ) return E_FAIL; pdispResult = CComPtr<IDispatch>( result.pdispVal ); @@ -151,27 +151,27 @@ CSOActiveX::CSOActiveX() , mCurFileUrl( L"private:factory/swriter" ) , mbLoad( FALSE ) , mbViewOnly( TRUE ) -, mParentWin( NULL ) -, mOffWin( NULL ) -, mpDispatchInterceptor( NULL ) +, mParentWin( nullptr ) +, mOffWin( nullptr ) +, mpDispatchInterceptor( nullptr ) , mnVersion( SO_NOT_DETECTED ) , mbReadyForActivation( FALSE ) , mbDrawLocked( FALSE ) { CLSID clsFactory = {0x82154420,0x0FBF,0x11d4,{0x83, 0x13,0x00,0x50,0x04,0x52,0x6A,0xB4}}; - HRESULT hr = CoCreateInstance( clsFactory, NULL, CLSCTX_ALL, __uuidof(IDispatch), (void**)&mpDispFactory); + HRESULT hr = CoCreateInstance( clsFactory, nullptr, CLSCTX_ALL, __uuidof(IDispatch), reinterpret_cast<void**>(&mpDispFactory)); if( !SUCCEEDED( hr ) ) - OutputError_Impl( NULL, hr ); + OutputError_Impl( nullptr, hr ); mPWinClass.style = CS_HREDRAW|CS_VREDRAW; mPWinClass.lpfnWndProc = ::DefWindowProc; mPWinClass.cbClsExtra = 0; mPWinClass.cbWndExtra = 0; - mPWinClass.hInstance = (HINSTANCE) GetModuleHandle(NULL); //myInstance; - mPWinClass.hIcon = NULL; - mPWinClass.hCursor = NULL; - mPWinClass.hbrBackground = (HBRUSH) COLOR_BACKGROUND; - mPWinClass.lpszMenuName = NULL; + mPWinClass.hInstance = GetModuleHandle(nullptr); //myInstance; + mPWinClass.hIcon = nullptr; + mPWinClass.hCursor = nullptr; + mPWinClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_BACKGROUND); + mPWinClass.lpszMenuName = nullptr; mPWinClass.lpszClassName = STAROFFICE_WINDOWCLASS; RegisterClass(&mPWinClass); @@ -203,7 +203,7 @@ HRESULT CSOActiveX::Cleanup() mpDispatchInterceptor->ClearParent(); mpDispatchInterceptor->Release(); - mpDispatchInterceptor = NULL; + mpDispatchInterceptor = nullptr; } mpDispTempFile = CComPtr< IDispatch >(); @@ -211,7 +211,7 @@ HRESULT CSOActiveX::Cleanup() if( mpInstanceLocker ) { - ExecuteFunc( mpInstanceLocker, L"dispose", NULL, 0, &dummyResult ); + ExecuteFunc( mpInstanceLocker, L"dispose", nullptr, 0, &dummyResult ); mpInstanceLocker = CComPtr< IDispatch >(); } @@ -238,7 +238,7 @@ HRESULT CSOActiveX::Cleanup() if( SUCCEEDED( hr ) ) { // the following call will let the closing happen - hr = ExecuteFunc( pDispDocumentCloser, L"dispose", NULL, 0, &dummyResult ); + hr = ExecuteFunc( pDispDocumentCloser, L"dispose", nullptr, 0, &dummyResult ); bCloserActivated = SUCCEEDED( hr ); } } @@ -248,7 +248,7 @@ HRESULT CSOActiveX::Cleanup() CComVariant aPropVar; aPropVar.vt = VT_BOOL; aPropVar.boolVal = VARIANT_TRUE; if ( !SUCCEEDED( ExecuteFunc( mpDispFrame, L"close", &aPropVar, 1, &dummyResult ) ) ) - ExecuteFunc( mpDispFrame, L"dispose", NULL, 0, &dummyResult ); + ExecuteFunc( mpDispFrame, L"dispose", nullptr, 0, &dummyResult ); } mpDispFrame = CComPtr< IDispatch >(); @@ -273,7 +273,7 @@ HRESULT CSOActiveX::TerminateOffice() // create tree of frames CComPtr<IDispatch> pdispChildren; - hr = GetIDispByFunc( pdispDesktop, L"getFrames", NULL, 0, pdispChildren ); + hr = GetIDispByFunc( pdispDesktop, L"getFrames", nullptr, 0, pdispChildren ); if( !pdispChildren || !SUCCEEDED( hr ) ) return hr; CComVariant aFrames; @@ -287,7 +287,7 @@ HRESULT CSOActiveX::TerminateOffice() // there is no frames open // TODO: check whether the frames are hidden if they are open? CComVariant dummyResult; - hr = ExecuteFunc( pdispDesktop, L"terminate", NULL, 0, &dummyResult ); + hr = ExecuteFunc( pdispDesktop, L"terminate", nullptr, 0, &dummyResult ); } } @@ -317,7 +317,7 @@ STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG /*pErrorLog*/ mnVersion = GetVersionConnected(); IPropertyBag2* pPropBag2; - HRESULT hr = pPropBag->QueryInterface( IID_IPropertyBag2, (void**)&pPropBag2 ); + HRESULT hr = pPropBag->QueryInterface( IID_IPropertyBag2, reinterpret_cast<void**>(&pPropBag2) ); //ATLASSERT( hr >= 0 ); if( !SUCCEEDED( hr ) ) @@ -347,7 +347,7 @@ STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPERRORLOG /*pErrorLog*/ HRESULT* hvs = new HRESULT[aNum]; hr = pPropBag2->Read( aNum, aPropNames, - NULL, + nullptr, aVal, hvs ); //ATLASSERT( hr >= 0 ); @@ -454,7 +454,7 @@ HRESULT CSOActiveX::SetLayoutManagerProps() CComVariant pVarLayoutMgr; OLECHAR const * sLMPropName = L"LayoutManager"; HRESULT hr = GetPropertiesFromIDisp( mpDispFrame, &sLMPropName, &pVarLayoutMgr, 1 ); - if( pVarLayoutMgr.vt != VT_DISPATCH || pVarLayoutMgr.pdispVal == NULL ) + if( pVarLayoutMgr.vt != VT_DISPATCH || pVarLayoutMgr.pdispVal == nullptr ) return E_FAIL; CComPtr<IDispatch> pdispLM( pVarLayoutMgr.pdispVal ); @@ -558,7 +558,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height ) // create tree of frames CComPtr<IDispatch> pdispChildren; - hr = GetIDispByFunc( pdispDesktop, L"getFrames", NULL, 0, pdispChildren ); + hr = GetIDispByFunc( pdispDesktop, L"getFrames", nullptr, 0, pdispChildren ); if( !SUCCEEDED( hr ) ) return hr; // insert new frame into desctop hierarchy @@ -604,7 +604,7 @@ HRESULT CSOActiveX::CreateFrameOldWay( HWND hwnd, int width, int height ) // the third sequence element nInitInd = 2; CComPtr<IDispatch> pdispValueObj; - hr = GetIDispByFunc( mpDispFactory, L"Bridge_GetValueObject", NULL, 0, pdispValueObj ); + hr = GetIDispByFunc( mpDispFactory, L"Bridge_GetValueObject", nullptr, 0, pdispValueObj ); if( !SUCCEEDED( hr ) || !pdispValueObj ) return hr; CComVariant aValueArgs[2]; @@ -747,7 +747,7 @@ void CSOActiveX::CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* /* if ( SUCCEEDED( hr ) ) { for( DWORD ix = 0; ix < dwSize; ix++ ) - ((BYTE*)(pDataArray->pvData))[ix] = pBytes[ix]; + static_cast<BYTE*>(pDataArray->pvData)[ix] = pBytes[ix]; hr = SafeArrayUnlock( pDataArray ); if ( SUCCEEDED( hr ) ) { @@ -809,15 +809,15 @@ HRESULT CSOActiveX::LoadURLToFrame( ) // try to get the model and set the presetation specific property, the setting will fail for other document formats CComPtr<IDispatch> pdispController; - hr = GetIDispByFunc( mpDispFrame, L"getController", NULL, 0, pdispController ); + hr = GetIDispByFunc( mpDispFrame, L"getController", nullptr, 0, pdispController ); if ( SUCCEEDED( hr ) && pdispController ) { CComPtr<IDispatch> pdispModel; - hr = GetIDispByFunc( pdispController, L"getModel", NULL, 0, pdispModel ); + hr = GetIDispByFunc( pdispController, L"getModel", nullptr, 0, pdispModel ); if ( SUCCEEDED( hr ) && pdispModel ) { CComPtr<IDispatch> pdispPres; - hr = GetIDispByFunc( pdispModel, L"getPresentation", NULL, 0, pdispPres ); + hr = GetIDispByFunc( pdispModel, L"getPresentation", nullptr, 0, pdispPres ); if ( SUCCEEDED( hr ) && pdispPres ) { // this is a presentation @@ -831,7 +831,7 @@ HRESULT CSOActiveX::LoadURLToFrame( ) if ( SUCCEEDED( hr ) ) { CComVariant dummyResult; - ExecuteFunc( pdispPres, L"Start", NULL, 0, &dummyResult ); + ExecuteFunc( pdispPres, L"Start", nullptr, 0, &dummyResult ); } } } @@ -1001,9 +1001,9 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di ) di.prcBounds->right - di.prcBounds->left, di.prcBounds->bottom - di.prcBounds->top, mParentWin, - NULL, - NULL, - NULL ); + nullptr, + nullptr, + nullptr ); ::ShowWindow( mOffWin, SW_SHOW ); } @@ -1086,7 +1086,7 @@ HRESULT CSOActiveX::OnDraw( ATL_DRAWINFO& di ) { // fallback that is activated by the parent class if ( di.hdcDraw ) - FillRect( di.hdcDraw, (RECT*)di.prcBounds, (HBRUSH)COLOR_BACKGROUND ); + FillRect( di.hdcDraw, reinterpret_cast<RECT const *>(di.prcBounds), reinterpret_cast<HBRUSH>(COLOR_BACKGROUND) ); return S_OK; } @@ -1116,7 +1116,7 @@ STDMETHODIMP CSOActiveX::SetClientSite( IOleClientSite* aClientSite ) { aServiceProvider->QueryService( SID_SInternetExplorer, IID_IWebBrowser, - (void**)&mWebBrowser2 ); + reinterpret_cast<void**>(&mWebBrowser2) ); // ATLASSERT( mWebBrowser2 ); if( mWebBrowser2 ) AtlAdvise( mWebBrowser2, GetUnknown(), DIID_DWebBrowserEvents2, &mCookie ); diff --git a/extensions/source/activex/SOActiveX.h b/extensions/source/activex/SOActiveX.h index 570b37ee253b..04055eaf74df 100644 --- a/extensions/source/activex/SOActiveX.h +++ b/extensions/source/activex/SOActiveX.h @@ -19,8 +19,8 @@ // SOActiveX.h : Declaration of the CSOActiveX -#ifndef __SOACTIVEX_H_ -#define __SOACTIVEX_H_ +#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIVEX_H +#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOACTIVEX_H #include "resource.h" @@ -104,7 +104,7 @@ protected: public: CSOActiveX(); - ~CSOActiveX(); + ~CSOActiveX() override; DECLARE_REGISTRY_RESOURCEID(IDR_SOACTIVEX) @@ -129,7 +129,14 @@ BEGIN_COM_MAP(CSOActiveX) COM_INTERFACE_ENTRY(IProvideClassInfo2) COM_INTERFACE_ENTRY(IPersistPropertyBag) COM_INTERFACE_ENTRY(IObjectSafety) +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif END_COM_MAP() +#if defined __clang__ +#pragma clang diagnostic pop +#endif #if defined __clang__ #pragma clang diagnostic push @@ -151,7 +158,14 @@ END_PROP_MAP() BEGIN_CONNECTION_POINT_MAP(CSOActiveX) END_CONNECTION_POINT_MAP() +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif BEGIN_MSG_MAP(CSOActiveX) +#if defined __clang__ +#pragma clang diagnostic pop +#endif CHAIN_MSG_MAP(CComControl<CSOActiveX>) DEFAULT_REFLECTION_HANDLER() END_MSG_MAP() @@ -163,12 +177,12 @@ END_MSG_MAP() // IViewObjectEx - DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE) + static DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE) // ISOActiveX public: - STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ); + STDMETHOD(SetClientSite)( IOleClientSite* aClientSite ) override; STDMETHOD(Invoke)( DISPID dispidMember, REFIID riid, LCID lcid, @@ -176,12 +190,12 @@ public: DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo, - UINT* puArgErr); - STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ); - STDMETHOD(Load) ( LPSTREAM pStm ); - STDMETHOD(InitNew) (); - HRESULT OnDrawAdvanced(ATL_DRAWINFO& di); - HRESULT OnDraw(ATL_DRAWINFO& di); + UINT* puArgErr) override; + STDMETHOD(Load) ( LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog ) override; + STDMETHOD(Load) ( LPSTREAM pStm ) override; + STDMETHOD(InitNew) () override; + HRESULT OnDrawAdvanced(ATL_DRAWINFO& di) override; + HRESULT OnDraw(ATL_DRAWINFO& di) override; HRESULT SetLayoutManagerProps(); HRESULT CreateFrameOldWay( HWND hwnd, int width, int height ); @@ -201,6 +215,6 @@ public: SOVersion GetVersionConnected(); }; -#endif //__SOACTIVEX_H_ +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/SOComWindowPeer.h b/extensions/source/activex/SOComWindowPeer.h index b1c6f86801a8..0ff68e8250e6 100644 --- a/extensions/source/activex/SOComWindowPeer.h +++ b/extensions/source/activex/SOComWindowPeer.h @@ -19,8 +19,8 @@ // SOComWindowPeer.h: Definition of the SOComWindowPeer class -#ifndef __SOCOMWINDOWPEER_H_ -#define __SOCOMWINDOWPEER_H_ +#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOCOMWINDOWPEER_H +#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SOCOMWINDOWPEER_H #ifdef _MSC_VER #pragma once @@ -52,14 +52,21 @@ class SOComWindowPeer : { HWND m_hwnd; public: - SOComWindowPeer() : m_hwnd( NULL ) {} + SOComWindowPeer() : m_hwnd( nullptr ) {} virtual ~SOComWindowPeer() { } BEGIN_COM_MAP(SOComWindowPeer) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISOComWindowPeer) COM_INTERFACE_ENTRY(ISupportErrorInfo) +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif END_COM_MAP() +#if defined __clang__ +#pragma clang diagnostic pop +#endif DECLARE_NOT_AGGREGATABLE(SOComWindowPeer) // Remove the comment from the line above if you don't want your object to // support aggregation. @@ -67,69 +74,69 @@ DECLARE_NOT_AGGREGATABLE(SOComWindowPeer) DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER) // ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) override; // ISOComWindowPeer virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getWindowHandle( /* [in] */ SAFEARRAY __RPC_FAR * /*procId*/, /* [in] */ short /*s*/, - /* [retval][out] */ long __RPC_FAR *ret) + /* [retval][out] */ long __RPC_FAR *ret) override { *ret = HandleToLong( m_hwnd ); return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit( - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) override { - *retVal = NULL; + *retVal = nullptr; return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer( - /* [in] */ IDispatch __RPC_FAR* /*xPointer*/) + /* [in] */ IDispatch __RPC_FAR* /*xPointer*/) override { return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground( - /* [in] */ int /*nColor*/) + /* [in] */ int /*nColor*/) override { return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate( - /* [in] */ short /*__MIDL_0015*/) + /* [in] */ short /*__MIDL_0015*/) override { return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect( /* [in] */ IDispatch __RPC_FAR* /*aRect*/, - /* [in] */ short /*nFlags*/) + /* [in] */ short /*nFlags*/) override { return S_OK; } - virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void) + virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void) override { return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener( - /* [in] */ IDispatch __RPC_FAR* /*xListener*/) + /* [in] */ IDispatch __RPC_FAR* /*xListener*/) override { return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener( - /* [in] */ IDispatch __RPC_FAR* /*xListener*/) + /* [in] */ IDispatch __RPC_FAR* /*xListener*/) override { return S_OK; } virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) + /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override { *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 ); @@ -150,6 +157,6 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER) void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; } }; -#endif // __SOCOMWINDOWPEER_H_ +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/activex/SODispatchInterceptor.cxx b/extensions/source/activex/SODispatchInterceptor.cxx index fda4d06d3850..8f90d4fb7f91 100644 --- a/extensions/source/activex/SODispatchInterceptor.cxx +++ b/extensions/source/activex/SODispatchInterceptor.cxx @@ -90,7 +90,7 @@ STDMETHODIMP SODispatchInterceptor::queryDispatch( IDispatch FAR* aURL, { if( !m_xSlave ) { - *retVal = NULL; + *retVal = nullptr; return S_OK; } @@ -101,9 +101,9 @@ STDMETHODIMP SODispatchInterceptor::queryDispatch( IDispatch FAR* aURL, aArgs[2] = CComVariant( aURL ); hr = ExecuteFunc( m_xSlave, L"queryDispatch", aArgs, 3, &aResult ); - if( !SUCCEEDED( hr ) || aResult.vt != VT_DISPATCH || aResult.pdispVal == NULL ) + if( !SUCCEEDED( hr ) || aResult.vt != VT_DISPATCH || aResult.pdispVal == nullptr ) { - *retVal = NULL; + *retVal = nullptr; return S_OK; } @@ -143,7 +143,7 @@ STDMETHODIMP SODispatchInterceptor::queryDispatches( SAFEARRAY FAR* aDescripts, CComVariant pValues[3]; hr = GetPropertiesFromIDisp( pElem, pMemberNames, pValues, 3 ); if( !SUCCEEDED( hr ) ) return hr; - if( pValues[0].vt != VT_DISPATCH || pValues[0].pdispVal == NULL + if( pValues[0].vt != VT_DISPATCH || pValues[0].pdispVal == nullptr || pValues[1].vt != VT_BSTR || pValues[2].vt != VT_I4 ) return E_FAIL; @@ -164,7 +164,7 @@ STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR CComVariant pValue; HRESULT hr = GetPropertiesFromIDisp( aURL, &pUrlName, &pValue, 1 ); if( !SUCCEEDED( hr ) ) return hr; - if( pValue.vt != VT_BSTR || pValue.bstrVal == NULL ) + if( pValue.vt != VT_BSTR || pValue.bstrVal == nullptr ) return E_FAIL; USES_CONVERSION; @@ -184,7 +184,7 @@ STDMETHODIMP SODispatchInterceptor::dispatch( IDispatch FAR* aURL, SAFEARRAY FAR { CComVariant pVarElem; SafeArrayGetElement( aArgs, &ind, &pVarElem ); - if( pVarElem.vt == VT_DISPATCH && pVarElem.pdispVal != NULL ) + if( pVarElem.vt == VT_DISPATCH && pVarElem.pdispVal != nullptr ) { OLECHAR const * pMemberNames[2] = { L"Name", L"Value" }; CComVariant pValues[2]; diff --git a/extensions/source/activex/SODispatchInterceptor.h b/extensions/source/activex/SODispatchInterceptor.h index f0ec8c47b64d..8705cbfac3c6 100644 --- a/extensions/source/activex/SODispatchInterceptor.h +++ b/extensions/source/activex/SODispatchInterceptor.h @@ -51,14 +51,21 @@ class SODispatchInterceptor : CSOActiveX* m_xParentControl; CRITICAL_SECTION mMutex; public: - SODispatchInterceptor() : m_xParentControl( NULL ) { InitializeCriticalSection(&mMutex); } + SODispatchInterceptor() : m_xParentControl( nullptr ) { InitializeCriticalSection(&mMutex); } virtual ~SODispatchInterceptor() { ATLASSERT( !m_xParentControl ); DeleteCriticalSection(&mMutex); } BEGIN_COM_MAP(SODispatchInterceptor) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY(ISODispatchInterceptor) COM_INTERFACE_ENTRY(ISupportErrorInfo) +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif END_COM_MAP() +#if defined __clang__ +#pragma clang diagnostic pop +#endif DECLARE_NOT_AGGREGATABLE(SODispatchInterceptor) // Remove the comment from the line above if you don't want your object to // support aggregation. @@ -76,38 +83,38 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR) void ClearParent() { EnterCriticalSection( &mMutex ); - m_xParentControl = NULL; + m_xParentControl = nullptr; LeaveCriticalSection( &mMutex ); } // ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); + STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) override; // ISODispatchInterceptor virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getSlaveDispatchProvider( - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) override { *retVal = m_xSlave; return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setSlaveDispatchProvider( - /* [in] */ IDispatch __RPC_FAR *xNewDispatchProvider) + /* [in] */ IDispatch __RPC_FAR *xNewDispatchProvider) override { m_xSlave = xNewDispatchProvider; return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getMasterDispatchProvider( - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) override { *retVal = m_xMaster; return S_OK; } virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setMasterDispatchProvider( - /* [in] */ IDispatch __RPC_FAR *xNewSupplier) + /* [in] */ IDispatch __RPC_FAR *xNewSupplier) override { m_xMaster = xNewSupplier; return S_OK; @@ -117,29 +124,29 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR) /* [in] */ IDispatch __RPC_FAR *aURL, /* [in] */ BSTR aTargetFrameName, /* [in] */ long nSearchFlags, - /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal); + /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) override; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE queryDispatches( /* [in] */ SAFEARRAY __RPC_FAR * aDescripts, - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *retVal); + /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *retVal) override; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispatch( /* [in] */ IDispatch __RPC_FAR *aURL, - /* [in] */ SAFEARRAY __RPC_FAR * aArgs); + /* [in] */ SAFEARRAY __RPC_FAR * aArgs) override; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addStatusListener( /* [in] */ IDispatch __RPC_FAR *xControl, - /* [in] */ IDispatch __RPC_FAR *aURL); + /* [in] */ IDispatch __RPC_FAR *aURL) override; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeStatusListener( /* [in] */ IDispatch __RPC_FAR *xControl, - /* [in] */ IDispatch __RPC_FAR *aURL); + /* [in] */ IDispatch __RPC_FAR *aURL) override; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getInterceptedURLs( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal); + /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( - /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) + /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override { *pVal = SafeArrayCreateVector( VT_BSTR, 0, 4 ); diff --git a/extensions/source/activex/StdAfx2.h b/extensions/source/activex/StdAfx2.h index 10a15b5979bb..2d121dab1df2 100644 --- a/extensions/source/activex/StdAfx2.h +++ b/extensions/source/activex/StdAfx2.h @@ -21,8 +21,8 @@ // or project specific include files that are used frequently, // but are changed infrequently -#if !defined(AFX_STDAFX_H__C1799EA0_62CC_44DE_A2DD_C9F0410FF7F1__INCLUDED_) -#define AFX_STDAFX_H__C1799EA0_62CC_44DE_A2DD_C9F0410FF7F1__INCLUDED_ +#ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_STDAFX2_H +#define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_STDAFX2_H #ifdef _MSC_VER #pragma once diff --git a/extensions/source/activex/so_activex.cxx b/extensions/source/activex/so_activex.cxx index c69f8b272d2c..e40ae8693658 100644 --- a/extensions/source/activex/so_activex.cxx +++ b/extensions/source/activex/so_activex.cxx @@ -82,19 +82,13 @@ const REGSAM n64KeyAccess = KEY_ALL_ACCESS | KEY_WOW64_64KEY; const REGSAM n32KeyAccess = KEY_ALL_ACCESS; #ifdef _AMD64_ -const BOOL bX64 = TRUE; +const bool bX64 = true; #define REG_DELETE_KEY_A( key, aPath, nKeyAccess ) RegDeleteKeyExA( key, aPath, nKeyAccess, 0 ) #else -const BOOL bX64 = FALSE; +const bool bX64 = false; #define REG_DELETE_KEY_A( key, aPath, nKeyAccess ) RegDeleteKeyA( key, aPath ) #endif -// MinGW doesn't know anything about RegDeleteKeyExA if WINVER < 0x0502. -extern "C" { -WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY,LPCSTR,REGSAM,DWORD); -} - - // DLL Entry Point extern "C" @@ -203,13 +197,13 @@ const char* aLocalPrefix = "Software\\Classes\\"; BOOL createKey( HKEY hkey, const char* aKeyToCreate, REGSAM nKeyAccess, - const char* aValue = NULL, - const char* aChildName = NULL, - const char* aChildValue = NULL ) + const char* aValue = nullptr, + const char* aChildName = nullptr, + const char* aChildValue = nullptr ) { HKEY hkey1; - return ( ERROR_SUCCESS == RegCreateKeyExA( hkey, aKeyToCreate, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + return ( ERROR_SUCCESS == RegCreateKeyExA( hkey, aKeyToCreate, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) && ( !aValue || ERROR_SUCCESS == RegSetValueExA( hkey1, "", 0, @@ -231,11 +225,11 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc { BOOL aResult = FALSE; - HKEY hkey = NULL; - HKEY hkey1 = NULL; - HKEY hkey2 = NULL; - HKEY hkey3 = NULL; - HKEY hkey4 = NULL; + HKEY hkey = nullptr; + HKEY hkey1 = nullptr; + HKEY hkey2 = nullptr; + HKEY hkey3 = nullptr; + HKEY hkey4 = nullptr; char aSubKey[513]; int ind; const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; @@ -245,7 +239,7 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. // Unfortunately it can be done only for the user who installs the office. if ( bForAllUsers ) - DllUnregisterServerNative( nMode, sal_False, sal_False ); + DllUnregisterServerNative( nMode, false, false ); if ( pProgramPath && strlen( pProgramPath ) < 1024 ) { @@ -258,8 +252,8 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc { wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); aResult = - ( ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) - && ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, (const BYTE*)"SOActiveX Class", 17 ) + ( ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey , nullptr ) + && ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, reinterpret_cast<const BYTE*>("SOActiveX Class"), 17 ) && createKey( hkey, "Control", nKeyAccess ) && createKey( hkey, "EnableFullPage", nKeyAccess ) && createKey( hkey, "InprocServer32", nKeyAccess, pActiveXPath, "ThreadingModel", "Apartment" ) @@ -272,21 +266,21 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc && createKey( hkey, "Version", nKeyAccess, "1.0" ) && createKey( hkey, "VersionIndependentProgID", nKeyAccess, "so_activex.SOActiveX" ) && ERROR_SUCCESS == RegCloseKey( hkey ) - && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aPrefix, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aPrefix, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey , nullptr ) && createKey( hkey, "so_activex.SOActiveX", nKeyAccess, "SOActiveX Class" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) && createKey( hkey1, "CLSID", nKeyAccess, aClassID ) && createKey( hkey1, "CurVer", nKeyAccess, "so_activex.SOActiveX.1" ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) && createKey( hkey, "so_activex.SOActiveX.1", nKeyAccess, "SOActiveX Class" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX.1", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX.1", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) && createKey( hkey1, "CLSID", nKeyAccess, aClassID ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "TypeLib", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aTypeLib, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "TypeLib", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aTypeLib, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey2 , nullptr ) && createKey( hkey2, "1.0", nKeyAccess, "wrap_activex 1.0 Type Library" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey3 , NULL ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey4 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey3 , nullptr ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey4 , nullptr ) && createKey( hkey4, "win32", nKeyAccess, pActiveXPath ) && ERROR_SUCCESS == RegCloseKey( hkey4 ) && createKey( hkey3, "FLAGS", nKeyAccess, "0" ) @@ -294,21 +288,21 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc && ERROR_SUCCESS == RegCloseKey( hkey3 ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey, "Interface", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "Interface", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) && createKey( hkey1, aInterIDWinPeer, nKeyAccess, "ISOComWindowPeer" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDWinPeer, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDWinPeer, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey2 , nullptr ) && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubWinPeer ) && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubWinPeer ) && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) && createKey( hkey1, aInterIDActApprove, nKeyAccess, "ISOActionsApproval" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDActApprove, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDActApprove, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey2 , nullptr ) && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubActApprove ) && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubActApprove ) && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) && createKey( hkey1, aInterIDDispInt, nKeyAccess, "ISODispatchInterceptor" ) - && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDDispInt, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDDispInt, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey2 , nullptr ) && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubDispInt ) && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubDispInt ) && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) @@ -316,7 +310,7 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc && ERROR_SUCCESS == RegCloseKey( hkey1 ) && ERROR_SUCCESS == RegCloseKey( hkey ) ); - hkey = hkey1 = hkey2 = hkey3 = hkey4 = NULL; + hkey = hkey1 = hkey2 = hkey3 = hkey4 = nullptr; } } @@ -325,7 +319,7 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc if( nForModes[ind] & nMode ) { wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) || ERROR_SUCCESS != RegSetValueExA(hkey, "CLSID", 0, REG_SZ, reinterpret_cast<const BYTE *>(aClassID), sal::static_int_cast<DWORD>(strlen(aClassID))) ) @@ -334,7 +328,10 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc } if( hkey ) - RegCloseKey(hkey),hkey= NULL; + { + RegCloseKey(hkey); + hkey= nullptr; + } } } @@ -344,20 +341,26 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc for( ind = 0; ind < SUPPORTED_EXT_NUM; ind++ ) { wsprintfA( aSubKey, "EnableFullPage\\%s", aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) ) + if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) ) aResult = FALSE; if ( hkey1 ) - RegCloseKey(hkey1),hkey1= NULL; + { + RegCloseKey(hkey1); + hkey1= nullptr; + } } } else aResult = FALSE; if ( hkey ) - RegCloseKey(hkey),hkey= NULL; + { + RegCloseKey(hkey); + hkey= nullptr; + } - return aResult; + return HRESULT(aResult); } STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit, const char* pProgramPath ) @@ -376,7 +379,7 @@ STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit, co // DllUnregisterServer - Removes entries from the system registry HRESULT DeleteKeyTree( HKEY hkey, const char* pPath, REGSAM nKeyAccess ) { - HKEY hkey1 = NULL; + HKEY hkey1 = nullptr; char pSubKeyName[256]; // first delete the subkeys @@ -384,11 +387,15 @@ HRESULT DeleteKeyTree( HKEY hkey, const char* pPath, REGSAM nKeyAccess ) && ERROR_SUCCESS == RegEnumKeyA( hkey1, 0, pSubKeyName, 256 ) && ERROR_SUCCESS == DeleteKeyTree( hkey1, pSubKeyName, nKeyAccess ) ) { - RegCloseKey( hkey1 ),hkey1= NULL; + RegCloseKey( hkey1 ); + hkey1= nullptr; } if ( hkey1 ) - RegCloseKey( hkey1 ),hkey1= NULL; + { + RegCloseKey( hkey1 ); + hkey1= nullptr; + } // delete the key itself return REG_DELETE_KEY_A( hkey, pPath, nKeyAccess & ( KEY_WOW64_64KEY | KEY_WOW64_32KEY ) ); @@ -396,7 +403,7 @@ HRESULT DeleteKeyTree( HKEY hkey, const char* pPath, REGSAM nKeyAccess ) STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) { - HKEY hkey = NULL; + HKEY hkey = nullptr; BOOL fErr = FALSE; char aSubKey[513]; const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; @@ -407,43 +414,47 @@ STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKey { DWORD nSubKeys = 0, nValues = 0; wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) ) fErr = TRUE; else { if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) ) fErr = TRUE; - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) + if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr, + &nSubKeys, nullptr, nullptr, + &nValues, nullptr, nullptr, nullptr, nullptr ) ) { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; fErr = TRUE; } else { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; if ( !nSubKeys && !nValues ) DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } } wsprintfA( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) ) fErr = TRUE; else { - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) + if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr, + &nSubKeys, nullptr, nullptr, + &nValues, nullptr, nullptr, nullptr, nullptr ) ) { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; fErr = TRUE; } else { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; if ( !nSubKeys && !nValues ) DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } @@ -479,7 +490,7 @@ STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKey if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - return !fErr; + return HRESULT(!fErr); } STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) @@ -510,8 +521,8 @@ STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcces { BOOL aResult = TRUE; - HKEY hkey = NULL; - HKEY hkey1 = NULL; + HKEY hkey = nullptr; + HKEY hkey1 = nullptr; char aSubKey[513]; int ind; const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; @@ -520,14 +531,14 @@ STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcces // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. // Unfortunately it can be done only for the user who installs the office. if ( bForAllUsers ) - DllUnregisterServerDoc( nMode, sal_False, sal_False ); + DllUnregisterServerDoc( nMode, false, false ); for( ind = 0; ind < SUPPORTED_MSEXT_NUM && aResult; ind++ ) { if( nForMSModes[ind] & nMode ) { wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) || ERROR_SUCCESS != RegSetValueExA(hkey, "Extension", 0, REG_SZ, reinterpret_cast<const BYTE *>(aMSFileExt[ind]), sal::static_int_cast<DWORD>(strlen(aMSFileExt[ind]))) @@ -539,10 +550,13 @@ STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcces } if( hkey ) - RegCloseKey(hkey),hkey= NULL; + { + RegCloseKey(hkey); + hkey= nullptr; + } wsprintfA( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) || ERROR_SUCCESS != RegSetValueExA(hkey, "Content Type", 0, REG_SZ, reinterpret_cast<const BYTE *>(aMSMimeType[ind]), sal::static_int_cast<DWORD>(strlen(aMSMimeType[ind])))) @@ -551,12 +565,15 @@ STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcces } if( hkey ) - RegCloseKey(hkey),hkey= NULL; + { + RegCloseKey(hkey); + hkey= nullptr; + } } } wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if ( aResult && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) + if ( aResult && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey , nullptr ) && createKey( hkey, "EnableFullPage", nKeyAccess ) ) { for( ind = 0; ind < SUPPORTED_MSEXT_NUM; ind++ ) @@ -564,11 +581,14 @@ STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcces if( nForMSModes[ind] & nMode ) { wsprintfA( aSubKey, "EnableFullPage\\%s", aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) ) + if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr ) ) aResult = FALSE; if ( hkey1 ) - RegCloseKey(hkey1),hkey1= NULL; + { + RegCloseKey(hkey1); + hkey1= nullptr; + } } } } @@ -576,9 +596,12 @@ STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcces aResult = FALSE; if ( hkey ) - RegCloseKey(hkey),hkey= NULL; + { + RegCloseKey(hkey); + hkey= nullptr; + } - return aResult; + return HRESULT(aResult); } STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) @@ -598,7 +621,7 @@ STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) { - HKEY hkey = NULL; + HKEY hkey = nullptr; BOOL fErr = FALSE; char aSubKey[513]; const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; @@ -610,7 +633,7 @@ STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcc DWORD nSubKeys = 0, nValues = 0; wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) ) fErr = TRUE; else { @@ -620,39 +643,43 @@ STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcc if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) ) fErr = TRUE; - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) + if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr, + &nSubKeys, nullptr, nullptr, + &nValues, nullptr, nullptr, nullptr, nullptr ) ) { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; fErr = TRUE; } else { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; if ( !nSubKeys && !nValues ) DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } } wsprintfA( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey, nullptr ) ) fErr = TRUE; else { if ( ERROR_SUCCESS != RegDeleteValue( hkey, "Content Type" ) ) fErr = TRUE; - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, - &nSubKeys, NULL, NULL, - &nValues, NULL, NULL, NULL, NULL ) ) + if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr, + &nSubKeys, nullptr, nullptr, + &nValues, nullptr, nullptr, nullptr, nullptr ) ) { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; fErr = TRUE; } else { - RegCloseKey( hkey ), hkey = NULL; + RegCloseKey( hkey ); + hkey = nullptr; if ( !nSubKeys && !nValues ) DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } @@ -660,7 +687,7 @@ STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcc } } - return !fErr; + return HRESULT(!fErr); } STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) |