summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-10-14 16:55:51 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-16 14:19:16 +0000
commitd11ac6045926d4c6e392b3797939fbb7c7d37b27 (patch)
treeb6b99803b11f8f9d84bba39ee2d38430c4f59c69 /extensions
parent099ef29c47970d4b9d20f31d0ccbef93c492226b (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')
-rw-r--r--extensions/source/activex/SOActionsApproval.h13
-rw-r--r--extensions/source/activex/SOActiveX.cxx78
-rw-r--r--extensions/source/activex/SOActiveX.h38
-rw-r--r--extensions/source/activex/SOComWindowPeer.h39
-rw-r--r--extensions/source/activex/SODispatchInterceptor.cxx12
-rw-r--r--extensions/source/activex/SODispatchInterceptor.h35
-rw-r--r--extensions/source/activex/StdAfx2.h4
-rw-r--r--extensions/source/activex/so_activex.cxx189
-rw-r--r--extensions/source/config/ldap/ldapaccess.cxx16
-rw-r--r--extensions/source/ole/jscriptclasses.cxx2
-rw-r--r--extensions/source/ole/jscriptclasses.hxx48
-rw-r--r--extensions/source/ole/oledll.cxx2
-rw-r--r--extensions/source/ole/oleobjw.cxx180
-rw-r--r--extensions/source/ole/oleobjw.hxx40
-rw-r--r--extensions/source/ole/olethread.cxx6
-rw-r--r--extensions/source/ole/servprov.cxx66
-rw-r--r--extensions/source/ole/servprov.hxx42
-rw-r--r--extensions/source/ole/servreg.cxx18
-rw-r--r--extensions/source/ole/unoconversionutilities.hxx185
-rw-r--r--extensions/source/ole/unoobjw.cxx160
-rw-r--r--extensions/source/ole/unoobjw.hxx68
-rw-r--r--extensions/source/ole/unotypewrapper.cxx4
-rw-r--r--extensions/source/ole/unotypewrapper.hxx19
-rw-r--r--extensions/source/ole/windata.hxx22
-rw-r--r--extensions/source/scanner/scanwin.cxx223
-rw-r--r--extensions/source/update/check/onlinecheck.cxx4
-rw-r--r--extensions/source/update/check/onlinecheck.hxx33
-rw-r--r--extensions/source/update/check/updatecheck.cxx7
28 files changed, 836 insertions, 717 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 )
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index a1f28f0fb326..65ecc4e33dd5 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -134,8 +134,8 @@ void LdapConnection::connectSimple()
// Do the bind
#ifdef _WIN32
LdapErrCode retCode = ldap_simple_bind_sW(mConnection,
- (PWCHAR) mLdapDefinition.mAnonUser.getStr(),
- (PWCHAR) mLdapDefinition.mAnonCredentials.getStr() );
+ const_cast<sal_Unicode *>(mLdapDefinition.mAnonUser.getStr()),
+ const_cast<sal_Unicode *>(mLdapDefinition.mAnonCredentials.getStr()) );
#else
LdapErrCode retCode = ldap_simple_bind_s(mConnection,
OUStringToOString( mLdapDefinition.mAnonUser, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -160,7 +160,7 @@ void LdapConnection::initConnection()
if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
#ifdef _WIN32
- mConnection = ldap_initW((PWCHAR) mLdapDefinition.mServer.getStr(),
+ mConnection = ldap_initW(const_cast<sal_Unicode *>(mLdapDefinition.mServer.getStr()),
mLdapDefinition.mPort) ;
#else
mConnection = ldap_init(OUStringToOString( mLdapDefinition.mServer, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -191,10 +191,10 @@ void LdapConnection::initConnection()
LdapMessageHolder result;
#ifdef _WIN32
LdapErrCode retCode = ldap_search_sW(mConnection,
- (PWCHAR) aUserDn.getStr(),
+ const_cast<sal_Unicode *>(aUserDn.getStr()),
LDAP_SCOPE_BASE,
const_cast<PWCHAR>( L"(objectclass=*)" ),
- 0,
+ nullptr,
0, // Attributes + values
&result.msg) ;
#else
@@ -258,11 +258,11 @@ void LdapConnection::initConnection()
LdapMessageHolder result;
#ifdef _WIN32
- PWCHAR attributes [2] = { const_cast<PWCHAR>( L"1.1" ), NULL };
+ PWCHAR attributes [2] = { const_cast<PWCHAR>( L"1.1" ), nullptr };
LdapErrCode retCode = ldap_search_sW(mConnection,
- (PWCHAR) mLdapDefinition.mBaseDN.getStr(),
+ const_cast<sal_Unicode *>(mLdapDefinition.mBaseDN.getStr()),
LDAP_SCOPE_SUBTREE,
- (PWCHAR) filter.makeStringAndClear().getStr(), attributes, 0, &result.msg) ;
+ const_cast<sal_Unicode *>(filter.makeStringAndClear().getStr()), attributes, 0, &result.msg) ;
#else
sal_Char * attributes [2] = { const_cast<sal_Char *>(LDAP_NO_ATTRS), nullptr };
LdapErrCode retCode = ldap_search_s(mConnection,
diff --git a/extensions/source/ole/jscriptclasses.cxx b/extensions/source/ole/jscriptclasses.cxx
index b323996404e0..718e7066d3b6 100644
--- a/extensions/source/ole/jscriptclasses.cxx
+++ b/extensions/source/ole/jscriptclasses.cxx
@@ -22,7 +22,7 @@
// JScriptValue
-JScriptValue::JScriptValue(): m_bOutParam(0), m_bInOutParam(0)
+JScriptValue::JScriptValue(): m_bOutParam(false), m_bInOutParam(false)
{
}
diff --git a/extensions/source/ole/jscriptclasses.hxx b/extensions/source/ole/jscriptclasses.hxx
index c483d8ac7b29..55278d8982b4 100644
--- a/extensions/source/ole/jscriptclasses.hxx
+++ b/extensions/source/ole/jscriptclasses.hxx
@@ -50,20 +50,27 @@ public:
BEGIN_COM_MAP(JScriptValue)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IJScriptValueObject)
+#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
// IDispatch -------------------------------------------
- STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
+ STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
STDMETHOD( GetTypeInfo)( UINT iTInfo,
LCID lcid,
- ITypeInfo **ppTInfo);
+ ITypeInfo **ppTInfo) override;
STDMETHOD( GetIDsOfNames)( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
- DISPID *rgDispId);
+ DISPID *rgDispId) override;
STDMETHOD( Invoke)( DISPID dispIdMember,
REFIID riid,
@@ -72,22 +79,22 @@ public:
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
- UINT *puArgErr);
+ UINT *puArgErr) override;
// IJScriptOutParam --------------------------------------
- STDMETHOD( Set)( VARIANT type, VARIANT value);
- STDMETHOD( Get)( VARIANT *val);
- STDMETHOD( InitOutParam)();
- STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value);
- STDMETHOD( IsOutParam)( VARIANT_BOOL * flag);
- STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag);
- STDMETHOD( GetValue)( BSTR* type, VARIANT *value);
+ STDMETHOD( Set)( VARIANT type, VARIANT value) override;
+ STDMETHOD( Get)( VARIANT *val) override;
+ STDMETHOD( InitOutParam)() override;
+ STDMETHOD( InitInOutParam)( VARIANT type, VARIANT value) override;
+ STDMETHOD( IsOutParam)( VARIANT_BOOL * flag) override;
+ STDMETHOD( IsInOutParam)( VARIANT_BOOL * flag) override;
+ STDMETHOD( GetValue)( BSTR* type, VARIANT *value) override;
CComVariant m_varValue;
CComBSTR m_bstrType;
- unsigned m_bOutParam: 1;
- unsigned m_bInOutParam: 1;
+ bool m_bOutParam: 1;
+ bool m_bInOutParam: 1;
};
@@ -102,20 +109,27 @@ public:
BEGIN_COM_MAP(JScriptOutParam)
COM_INTERFACE_ENTRY(IDispatch)
+#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
// IDispatch -------------------------------------------
- STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
+ STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
STDMETHOD( GetTypeInfo)( UINT iTInfo,
LCID lcid,
- ITypeInfo **ppTInfo);
+ ITypeInfo **ppTInfo) override;
STDMETHOD( GetIDsOfNames)( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
- DISPID *rgDispId);
+ DISPID *rgDispId) override;
STDMETHOD( Invoke)( DISPID dispIdMember,
REFIID riid,
@@ -124,7 +138,7 @@ public:
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
- UINT *puArgErr);
+ UINT *puArgErr) override;
private:
diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx
index 5e425016fce4..941c151e783d 100644
--- a/extensions/source/ole/oledll.cxx
+++ b/extensions/source/ole/oledll.cxx
@@ -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)
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 2a2b7eb256f1..25112dd5195b 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -97,7 +97,7 @@ std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > ComPtrToWrapperMap;
IUnknownWrapper_Impl::IUnknownWrapper_Impl( Reference<XMultiServiceFactory>& xFactory,
sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass):
UnoConversionUtilities<IUnknownWrapper_Impl>( xFactory, unoWrapperClass, comWrapperClass),
- m_pxIdlClass( NULL), m_eJScript( JScriptUndefined),
+ m_pxIdlClass( nullptr), m_eJScript( JScriptUndefined),
m_bComTlbIndexInit(false), m_bHasDfltMethod(false), m_bHasDfltProperty(false)
{
}
@@ -107,15 +107,15 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
{
o2u_attachCurrentThread();
MutexGuard guard(getBridgeMutex());
- XInterface * xIntRoot = (OWeakObject *)this;
+ XInterface * xIntRoot = static_cast<OWeakObject *>(this);
#if OSL_DEBUG_LEVEL > 0
acquire(); // make sure we don't delete us twice because of Reference
OSL_ASSERT( Reference<XInterface>( static_cast<XWeak*>(this), UNO_QUERY).get() == xIntRoot );
#endif
// remove entries in global maps
- typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator _IT;
- _IT it= WrapperToAdapterMap.find( (sal_uIntPtr) xIntRoot);
+ typedef std::unordered_map<sal_uIntPtr, sal_uIntPtr>::iterator IT;
+ IT it= WrapperToAdapterMap.find( reinterpret_cast<sal_uIntPtr>(xIntRoot));
if( it != WrapperToAdapterMap.end())
{
sal_uIntPtr adapter= it->second;
@@ -124,7 +124,7 @@ IUnknownWrapper_Impl::~IUnknownWrapper_Impl()
WrapperToAdapterMap.erase( it);
}
- IT_Com it_c= ComPtrToWrapperMap.find( (sal_uIntPtr) m_spUnknown.p);
+ IT_Com it_c= ComPtrToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_spUnknown.p));
if(it_c != ComPtrToWrapperMap.end())
ComPtrToWrapperMap.erase(it_c);
}
@@ -476,7 +476,7 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
m_sTypeName = "IDispatch";
CComBSTR sName;
- if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) )
+ if ( SUCCEEDED( pInfo->GetDocumentation( -1, &sName, nullptr, nullptr, nullptr ) ) )
{
OUString sTmp( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
if ( sTmp.startsWith("_") )
@@ -487,10 +487,10 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
unsigned int index;
if ( SUCCEEDED( pInfo->GetContainingTypeLib( &pTypeLib.p, &index )) )
{
- if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, NULL, NULL, NULL ) ) )
+ if ( SUCCEEDED( pTypeLib->GetDocumentation( -1, &sName, nullptr, nullptr, nullptr ) ) )
{
OUString sLibName( reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName)));
- m_sTypeName = sLibName.concat( OUString(".") ).concat( sTmp );
+ m_sTypeName = sLibName.concat( "." ).concat( sTmp );
}
}
@@ -515,7 +515,7 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
OSL_ASSERT( aDescGet || ! aDescPut);
HRESULT hr;
- DISPPARAMS dispparams = {0, 0, 0, 0};
+ DISPPARAMS dispparams = {nullptr, nullptr, 0, 0};
CComVariant varResult;
ExcepInfo excepinfo;
unsigned int uArgErr;
@@ -598,7 +598,7 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
throw RuntimeException(
"[automation bridge] The object does not have an IDispatch interface");
}
- sal_Bool ret = sal_False;
+ bool ret = false;
try
{
@@ -616,10 +616,10 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
getPropDesc( aName, & aDescGet, & aDescPut, & aVarDesc);
if ((aDescGet && aDescGet->cParams > 0)
|| (aDescPut && aDescPut->cParams > 0))
- ret = sal_True;
+ ret = true;
}
else
- ret = sal_True;
+ ret = true;
}
catch (const BridgeRuntimeError& e)
{
@@ -647,7 +647,7 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
throw RuntimeException("[automation bridge] The object does not have an "
"IDispatch interface");
}
- sal_Bool ret = sal_False;
+ bool ret = false;
try
{
o2u_attachCurrentThread();
@@ -668,7 +668,7 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
|| aDescPut
|| aDescGet )
{
- ret = sal_True;
+ ret = true;
}
}
catch (const BridgeRuntimeError& e)
@@ -704,15 +704,15 @@ Any SAL_CALL IUnknownWrapper_Impl::createBridge( const Any& modelDepObject,
(modelDepObject.getValueTypeClass() == TypeClass_INTERFACE)
)
{
- Reference<XInterface> xInt( *(XInterface**) modelDepObject.getValue());
- Reference<XInterface> xSelf( (OWeakObject*)this);
+ Reference<XInterface> xInt( *static_cast<XInterface* const *>(modelDepObject.getValue()));
+ Reference<XInterface> xSelf( static_cast<OWeakObject*>(this));
if (xInt == xSelf)
{
- VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
+ VARIANT* pVariant = static_cast<VARIANT*>(CoTaskMemAlloc(sizeof(VARIANT)));
VariantInit(pVariant);
- if (m_bOriginalDispatch == sal_True)
+ if (m_bOriginalDispatch)
{
pVariant->vt = VT_DISPATCH;
pVariant->pdispVal = m_spDispatch;
@@ -747,23 +747,23 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
sal_Int32 parameterCount= Params.getLength();
sal_Int32 outParameterCount= 0;
- typelib_InterfaceMethodTypeDescription* pMethod= NULL;
+ typelib_InterfaceMethodTypeDescription* pMethod= nullptr;
TypeDescription methodDesc;
getMethodInfo(sFunctionName, methodDesc);
// We need to know whether the IDispatch is from a JScript object.
// Then out and in/out parameters have to be treated differently than
// with common COM objects.
- sal_Bool bJScriptObject= isJScriptObject();
+ bool bJScriptObject= isJScriptObject();
std::unique_ptr<CComVariant[]> sarParams;
std::unique_ptr<CComVariant[]> sarParamsRef;
- CComVariant *pVarParams= NULL;
- CComVariant *pVarParamsRef= NULL;
- sal_Bool bConvRet= sal_True;
+ CComVariant *pVarParams= nullptr;
+ CComVariant *pVarParamsRef= nullptr;
+ bool bConvRet= true;
if( methodDesc.is())
{
- pMethod = (typelib_InterfaceMethodTypeDescription* )methodDesc.get();
+ pMethod = reinterpret_cast<typelib_InterfaceMethodTypeDescription*>(methodDesc.get());
parameterCount = pMethod->nParams;
// Create the Array for the array being passed in DISPPARAMS
// the array also contains the outparameter (but not the values)
@@ -794,12 +794,12 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
for( i= 0; i < parameterCount; i++)
{
// In parameter
- if( pMethod->pParams[i].bIn == sal_True && ! pMethod->pParams[i].bOut)
+ if( pMethod->pParams[i].bIn && ! pMethod->pParams[i].bOut)
{
anyToVariant( &pVarParams[parameterCount - i -1], Params.getConstArray()[i]);
}
// Out parameter + in/out parameter
- else if( pMethod->pParams[i].bOut == sal_True)
+ else if( pMethod->pParams[i].bOut )
{
CComVariant var;
if(pMethod->pParams[i].bIn)
@@ -815,7 +815,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
if( ! pMethod->pParams[i].bIn)
{
pVarParamsRef[ outParamIndex].vt= VT_DISPATCH;
- pVarParamsRef[ outParamIndex].pdispVal= 0;
+ pVarParamsRef[ outParamIndex].pdispVal= nullptr;
}
pVarParams[parameterCount - i -1].vt = VT_DISPATCH | VT_BYREF;
pVarParams[parameterCount - i -1].ppdispVal= &pVarParamsRef[outParamIndex].pdispVal;
@@ -835,7 +835,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
if( ! pMethod->pParams[i].bIn)
{
pVarParamsRef[ outParamIndex].vt = VT_ARRAY| VT_VARIANT;
- pVarParamsRef[ outParamIndex].parray= NULL;
+ pVarParamsRef[ outParamIndex].parray= nullptr;
}
pVarParams[parameterCount - i -1].vt = VT_ARRAY| VT_BYREF | VT_VARIANT;
pVarParams[parameterCount - i -1].pparray= &pVarParamsRef[outParamIndex].parray;
@@ -864,7 +864,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
if( ! pMethod->pParams[i].bIn)
{
pVarParamsRef[ outParamIndex].vt = VT_BSTR;
- pVarParamsRef[ outParamIndex].bstrVal= 0;
+ pVarParamsRef[ outParamIndex].bstrVal= nullptr;
}
pVarParams[parameterCount - i -1].vt = VT_BSTR| VT_BYREF;
pVarParams[parameterCount - i -1].pbstrVal=
@@ -947,12 +947,12 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
for( ; i< parameterCount; i++)
{
// In parameter
- if( pMethod->pParams[i].bIn == sal_True && ! pMethod->pParams[i].bOut)
+ if( pMethod->pParams[i].bIn && ! pMethod->pParams[i].bOut)
{
anyToVariant( &pVarParams[parameterCount - i -1], Params.getConstArray()[i]);
}
// Out parameter + in/out parameter
- else if( pMethod->pParams[i].bOut == sal_True)
+ else if( pMethod->pParams[i].bOut )
{
CComObject<JScriptOutParam>* pParamObject;
if( SUCCEEDED( CComObject<JScriptOutParam>::CreateInstance( &pParamObject)))
@@ -968,7 +968,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
pVarParams[ parameterCount - i -1].pdispVal= pDisp;
pVarParams[ parameterCount - i -1].pdispVal->AddRef();
// if the param is in/out then put the parameter on index 0
- if( pMethod->pParams[i].bIn == sal_True ) // in / out
+ if( pMethod->pParams[i].bIn ) // in / out
{
CComVariant varParam;
anyToVariant( &varParam, Params.getConstArray()[i]);
@@ -1012,14 +1012,14 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
{
//We should not run into this block, because invokeWithDispIdComTlb should
//have been called instead.
- OSL_ASSERT(0);
+ OSL_ASSERT(false);
}
CComVariant varResult;
ExcepInfo excepinfo;
unsigned int uArgErr;
- DISPPARAMS dispparams= { pVarParams, NULL, static_cast<UINT>(parameterCount), 0};
+ DISPPARAMS dispparams= { pVarParams, nullptr, static_cast<UINT>(parameterCount), 0};
// Get the DISPID
FuncDesc aDesc(getTypeInfo());
@@ -1054,7 +1054,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
if( !bJScriptObject)
{
variantToAny( &pVarParamsRef[outIndex], outAny,
- Type(pMethod->pParams[i].pTypeRef), sal_False);
+ Type(pMethod->pParams[i].pTypeRef), false);
OutParam[outIndex++]= outAny;
}
else //JScriptObject
@@ -1068,17 +1068,17 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
if( SUCCEEDED( pDisp.GetPropertyByName( L"0", &varOut)))
{
variantToAny( &varOut, outAny,
- Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), sal_False);
+ Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), false);
OutParam[outParameterCount - 1 - outIndex++]= outAny;
}
else
- bConvRet= sal_False;
+ bConvRet= false;
}
else
- bConvRet= sal_False;
+ bConvRet= false;
}
else
- bConvRet= sal_False;
+ bConvRet= false;
}
}
if( !bConvRet) break;
@@ -1101,9 +1101,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
try
{
if( pMethod )
- variantToAny(&varResult, ret, Type( pMethod->pReturnTypeRef), sal_False);
+ variantToAny(&varResult, ret, Type( pMethod->pReturnTypeRef), false);
else
- variantToAny(&varResult, ret, sal_False);
+ variantToAny(&varResult, ret, false);
}
catch (IllegalArgumentException & e)
{
@@ -1186,7 +1186,7 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
o2u_attachCurrentThread();
OSL_ASSERT(aArguments.getLength() == 3);
- m_spUnknown= *(IUnknown**) aArguments[0].getValue();
+ m_spUnknown= *static_cast<IUnknown* const *>(aArguments[0].getValue());
#ifdef __MINGW32__
m_spUnknown->QueryInterface(IID_IDispatch, reinterpret_cast<LPVOID*>( & m_spDispatch.p));
#else
@@ -1196,7 +1196,7 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
aArguments[1] >>= m_bOriginalDispatch;
aArguments[2] >>= m_seqTypes;
- ITypeInfo* pType = NULL;
+ ITypeInfo* pType = nullptr;
try
{
// a COM object implementation that has no TypeInfo is still a legal COM object;
@@ -1215,7 +1215,7 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
{
// Get Default member
CComBSTR defaultMemberName;
- if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, 0, 0, 0 ) ) )
+ if ( SUCCEEDED( pType->GetDocumentation(0, &defaultMemberName, nullptr, nullptr, nullptr ) ) )
{
OUString usName(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(defaultMemberName)));
FuncDesc aDescGet(pType);
@@ -1289,13 +1289,13 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
// try Invoke first, if it does not work, try put/get property
for ( sal_Int32 nStep = 0; FAILED( hInvRes ) && nStep < 2; nStep++ )
{
- DISPPARAMS dispparams = {NULL, NULL, 0, 0};
+ DISPPARAMS dispparams = {nullptr, nullptr, 0, 0};
std::unique_ptr<DISPID[]> arDispidNamedArgs;
std::unique_ptr<CComVariant[]> ptrArgs;
std::unique_ptr<CComVariant[]> ptrRefArgs; // referenced arguments
- CComVariant * arArgs = NULL;
- CComVariant * arRefArgs = NULL;
+ CComVariant * arArgs = nullptr;
+ CComVariant * arRefArgs = nullptr;
dispparams.cArgs = aParams.getLength();
@@ -1319,9 +1319,9 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
int cNamedArg = 0;
for ( size_t nInd = 0; nInd < dispparams.cArgs; nInd++ )
{
- if ( aParams[nInd].getValueType() == cppu::UnoType<NamedArgument>::get())
+ if (auto v = o3tl::tryAccess<NamedArgument>(aParams[nInd]))
{
- const NamedArgument& arg = *(NamedArgument const*)aParams[nInd].getValue();
+ const NamedArgument& arg = *v;
//We put the parameter names in reverse order into the array,
//so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs
@@ -1376,7 +1376,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
for ( nInd = 0; nInd < sal_Int32(dispparams.cArgs); nInd++)
{
revIndex = dispparams.cArgs - nInd - 1;
- arRefArgs[revIndex].byref = 0;
+ arRefArgs[revIndex].byref = nullptr;
Any anyArg;
if ( nInd < aParams.getLength() )
anyArg = aParams.getConstArray()[nInd];
@@ -1433,7 +1433,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
// converting return value and out parameter back to UNO
if ( SUCCEEDED( hInvRes ) )
- variantToAny( &varResult, aResult, sal_False );
+ variantToAny( &varResult, aResult, false );
else
{
// map error codes to exceptions
@@ -1445,12 +1445,12 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
case DISP_E_BADPARAMCOUNT:
throw IllegalArgumentException("[automation bridge] Wrong "
"number of arguments. Object returned DISP_E_BADPARAMCOUNT.",
- 0, 0);
+ nullptr, 0);
break;
case DISP_E_BADVARTYPE:
throw RuntimeException("[automation bridge] One or more "
"arguments have the wrong type. Object returned "
- "DISP_E_BADVARTYPE.", 0);
+ "DISP_E_BADVARTYPE.", nullptr);
break;
case DISP_E_EXCEPTION:
message = "[automation bridge]: ";
@@ -1462,11 +1462,11 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
message = "[automation bridge]: A function with the name \""
+ aName + "\" is not supported. Object returned "
"DISP_E_MEMBERNOTFOUND.";
- throw IllegalArgumentException(message, 0, 0);
+ throw IllegalArgumentException(message, nullptr, 0);
break;
case DISP_E_NONAMEDARGS:
throw IllegalArgumentException("[automation bridge] Object "
- "returned DISP_E_NONAMEDARGS",0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
+ "returned DISP_E_NONAMEDARGS",nullptr, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
break;
case DISP_E_OVERFLOW:
throw CannotConvertException("[automation bridge] Call failed.",
@@ -1476,7 +1476,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
case DISP_E_PARAMNOTFOUND:
throw IllegalArgumentException("[automation bridge]Call failed."
"Object returned DISP_E_PARAMNOTFOUND.",
- 0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
+ nullptr, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
break;
case DISP_E_TYPEMISMATCH:
throw CannotConvertException("[automation bridge] Call failed. "
@@ -1486,11 +1486,11 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
break;
case DISP_E_UNKNOWNINTERFACE:
throw RuntimeException("[automation bridge] Call failed. "
- "Object returned DISP_E_UNKNOWNINTERFACE.",0);
+ "Object returned DISP_E_UNKNOWNINTERFACE.",nullptr);
break;
case DISP_E_UNKNOWNLCID:
throw RuntimeException("[automation bridge] Call failed. "
- "Object returned DISP_E_UNKNOWNLCID.",0);
+ "Object returned DISP_E_UNKNOWNLCID.",nullptr);
break;
case DISP_E_PARAMNOTOPTIONAL:
throw CannotConvertException("[automation bridge] Call failed."
@@ -1567,7 +1567,7 @@ void IUnknownWrapper_Impl::getAttributeInfo(const OUString& sName, TypeDescripti
typelib_TypeDescription* pMember= desc.get();
if( pMember->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE )
{
- attributeInfo= ((typelib_InterfaceAttributeTypeDescription*)pMember)->pAttributeTypeRef;
+ attributeInfo= reinterpret_cast<typelib_InterfaceAttributeTypeDescription*>(pMember)->pAttributeTypeRef;
}
}
}
@@ -1579,19 +1579,19 @@ TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall(const
{
TypeDescription _curDesc( m_seqTypes[i]);
_curDesc.makeComplete();
- typelib_InterfaceTypeDescription * pInterface= (typelib_InterfaceTypeDescription*) _curDesc.get();
+ typelib_InterfaceTypeDescription * pInterface= reinterpret_cast<typelib_InterfaceTypeDescription*>(_curDesc.get());
if( pInterface)
{
- typelib_InterfaceMemberTypeDescription* pMember= NULL;
+ typelib_InterfaceMemberTypeDescription* pMember= nullptr;
//find the member description of the current call
for( int j=0; j < pInterface->nAllMembers; j++)
{
typelib_TypeDescriptionReference* pTypeRefMember = pInterface->ppAllMembers[j];
- typelib_TypeDescription* pDescMember= NULL;
+ typelib_TypeDescription* pDescMember= nullptr;
TYPELIB_DANGER_GET( &pDescMember, pTypeRefMember);
typelib_InterfaceMemberTypeDescription* pInterfaceMember=
- (typelib_InterfaceMemberTypeDescription*) pDescMember;
+ reinterpret_cast<typelib_InterfaceMemberTypeDescription*>(pDescMember);
if( OUString( pInterfaceMember->pMemberName) == sName)
{
pMember= pInterfaceMember;
@@ -1602,8 +1602,8 @@ TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall(const
if( pMember)
{
- ret= (typelib_TypeDescription*)pMember;
- TYPELIB_DANGER_RELEASE( (typelib_TypeDescription*)pMember);
+ ret= &pMember->aBase;
+ TYPELIB_DANGER_RELEASE( &pMember->aBase);
}
}
if( ret.is())
@@ -1612,7 +1612,7 @@ TypeDescription IUnknownWrapper_Impl::getInterfaceMemberDescOfCurrentCall(const
return ret;
}
-sal_Bool IUnknownWrapper_Impl::isJScriptObject()
+bool IUnknownWrapper_Impl::isJScriptObject()
{
if( m_eJScript == JScriptUndefined)
{
@@ -1635,7 +1635,7 @@ sal_Bool IUnknownWrapper_Impl::isJScriptObject()
m_eJScript= NoJScript;
}
- return m_eJScript == NoJScript ? sal_False : sal_True;
+ return m_eJScript != NoJScript;
}
@@ -1671,7 +1671,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
Any ret;
HRESULT result;
- DISPPARAMS dispparams = {NULL, NULL, 0, 0};
+ DISPPARAMS dispparams = {nullptr, nullptr, 0, 0};
CComVariant varResult;
ExcepInfo excepinfo;
unsigned int uArgErr;
@@ -1681,8 +1681,8 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
std::unique_ptr<DISPID[]> arDispidNamedArgs;
std::unique_ptr<CComVariant[]> ptrArgs;
std::unique_ptr<CComVariant[]> ptrRefArgs; // referenced arguments
- CComVariant * arArgs = NULL;
- CComVariant * arRefArgs = NULL;
+ CComVariant * arArgs = nullptr;
+ CComVariant * arRefArgs = nullptr;
sal_Int32 revIndex = 0;
//Set the array of DISPIDs for named args if it is a property put operation.
@@ -1727,7 +1727,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
if (::sal::static_int_cast< sal_uInt32, int >( nUnoArgs ) > dispparams.cArgs)
{
OUStringBuffer buf(256);
- buf.appendAscii("[automation bridge] There are too many arguments for this method");
+ buf.append("[automation bridge] There are too many arguments for this method");
throw IllegalArgumentException( buf.makeStringAndClear(),
Reference<XInterface>(), (sal_Int16) dispparams.cArgs);
}
@@ -1761,9 +1761,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
for (size_t iParams = 0; iParams < dispparams.cArgs; iParams ++)
{
const Any & curArg = Params[iParams];
- if (curArg.getValueType() == cppu::UnoType<NamedArgument>::get())
+ if (auto v = o3tl::tryAccess<NamedArgument>(curArg))
{
- const NamedArgument& arg = *(NamedArgument const*) curArg.getValue();
+ const NamedArgument& arg = *v;
//We put the parameter names in reverse order into the array,
//so we can use the DISPID array for DISPPARAMS::rgdispidNamedArgs
//The first name in the array is the method name
@@ -1825,7 +1825,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
for (i = 0; i < (sal_Int32) dispparams.cArgs; i++)
{
revIndex= dispparams.cArgs - i -1;
- arRefArgs[revIndex].byref=0;
+ arRefArgs[revIndex].byref=nullptr;
Any anyArg;
if ( i < nUnoArgs)
anyArg= Params.getConstArray()[i];
@@ -1845,10 +1845,10 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
if (i >= nUnoArgs && !(paramFlags & PARAMFLAG_FOPT))
{
OUStringBuffer buf(256);
- buf.appendAscii("ole automation bridge: The called function expects an argument at"
+ buf.append("ole automation bridge: The called function expects an argument at"
"position: "); //a different number of arguments")),
buf.append(OUString::number((sal_Int32) i));
- buf.appendAscii(" (index starting at 0).");
+ buf.append(" (index starting at 0).");
throw IllegalArgumentException( buf.makeStringAndClear(),
Reference<XInterface>(), (sal_Int16) i);
}
@@ -2041,7 +2041,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
// feature exist for JScript only because it only uses VT_I4 for integer types.
try
{
- variantToAny( & arRefArgs[revParamIndex], outAny, sal_False );
+ variantToAny( & arRefArgs[revParamIndex], outAny, false );
}
catch (IllegalArgumentException & e)
{
@@ -2061,7 +2061,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
OutParamIndex.realloc(outParamIndex);
}
// Return value
- variantToAny(&varResult, ret, sal_False);
+ variantToAny(&varResult, ret, false);
}
// map error codes to exceptions
@@ -2073,12 +2073,12 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
case DISP_E_BADPARAMCOUNT:
throw IllegalArgumentException("[automation bridge] Wrong "
"number of arguments. Object returned DISP_E_BADPARAMCOUNT.",
- 0, 0);
+ nullptr, 0);
break;
case DISP_E_BADVARTYPE:
throw RuntimeException("[automation bridge] One or more "
"arguments have the wrong type. Object returned "
- "DISP_E_BADVARTYPE.", 0);
+ "DISP_E_BADVARTYPE.", nullptr);
break;
case DISP_E_EXCEPTION:
message = "[automation bridge]: ";
@@ -2091,11 +2091,11 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
message = "[automation bridge]: A function with the name \""
+ sFuncName + "\" is not supported. Object returned "
"DISP_E_MEMBERNOTFOUND.";
- throw IllegalArgumentException(message, 0, 0);
+ throw IllegalArgumentException(message, nullptr, 0);
break;
case DISP_E_NONAMEDARGS:
throw IllegalArgumentException("[automation bridge] Object "
- "returned DISP_E_NONAMEDARGS",0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
+ "returned DISP_E_NONAMEDARGS",nullptr, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
break;
case DISP_E_OVERFLOW:
throw CannotConvertException("[automation bridge] Call failed.",
@@ -2105,7 +2105,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
case DISP_E_PARAMNOTFOUND:
throw IllegalArgumentException("[automation bridge]Call failed."
"Object returned DISP_E_PARAMNOTFOUND.",
- 0, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
+ nullptr, ::sal::static_int_cast< sal_Int16, unsigned int >( uArgErr ));
break;
case DISP_E_TYPEMISMATCH:
throw CannotConvertException("[automation bridge] Call failed. "
@@ -2115,11 +2115,11 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
break;
case DISP_E_UNKNOWNINTERFACE:
throw RuntimeException("[automation bridge] Call failed. "
- "Object returned DISP_E_UNKNOWNINTERFACE.",0);
+ "Object returned DISP_E_UNKNOWNINTERFACE.",nullptr);
break;
case DISP_E_UNKNOWNLCID:
throw RuntimeException("[automation bridge] Call failed. "
- "Object returned DISP_E_UNKNOWNLCID.",0);
+ "Object returned DISP_E_UNKNOWNLCID.",nullptr);
break;
case DISP_E_PARAMNOTOPTIONAL:
throw CannotConvertException("[automation bridge] Call failed."
@@ -2198,7 +2198,7 @@ bool IUnknownWrapper_Impl::getDispid(const OUString& sFuncName, DISPID * id)
void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** pFuncDesc)
{
- OSL_ASSERT( * pFuncDesc == 0);
+ OSL_ASSERT( * pFuncDesc == nullptr);
buildComTlbIndex();
typedef TLBFuncIndexMap::const_iterator cit;
//We assume there is only one entry with the function name. A property
@@ -2244,7 +2244,7 @@ void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** p
if( itIndex != m_mapComFunc.end())
{
ITypeInfo* pType= getTypeInfo();
- FUNCDESC * pDesc = NULL;
+ FUNCDESC * pDesc = nullptr;
if (SUCCEEDED(pType->GetFuncDesc(itIndex->second, & pDesc)))
{
if (pDesc->invkind == INVOKE_FUNC)
@@ -2268,7 +2268,7 @@ void IUnknownWrapper_Impl::getFuncDesc(const OUString & sFuncName, FUNCDESC ** p
void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** pFuncDescGet,
FUNCDESC** pFuncDescPut, VARDESC** pVarDesc)
{
- OSL_ASSERT( * pFuncDescGet == 0 && * pFuncDescPut == 0);
+ OSL_ASSERT( * pFuncDescGet == nullptr && * pFuncDescPut == nullptr);
buildComTlbIndex();
typedef TLBFuncIndexMap::const_iterator cit;
pair<cit, cit> p = m_mapComFunc.equal_range(sFuncName);
@@ -2296,7 +2296,7 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
// There are a maximum of two entries, property put and property get
OSL_ASSERT( ! (i > 2) );
ITypeInfo* pType= getTypeInfo();
- FUNCDESC * pFuncDesc = NULL;
+ FUNCDESC * pFuncDesc = nullptr;
if (SUCCEEDED( pType->GetFuncDesc(p.first->second, & pFuncDesc)))
{
if (pFuncDesc->invkind == INVOKE_PROPERTYGET)
@@ -2328,7 +2328,7 @@ void IUnknownWrapper_Impl::getPropDesc(const OUString & sFuncName, FUNCDESC ** p
// with invkind = INVOKE_FUNC. Since this function should only return
//a value for a real property (XInvokation::hasMethod, ..::hasProperty
//we need to make sure that sFuncName represents a real property.
- VARDESC * pVD = NULL;
+ VARDESC * pVD = nullptr;
if (SUCCEEDED(pType->GetVarDesc(p.first->second, & pVD)))
(*pVarDesc) = pVD;
}
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index 0879df3103c3..dfafa4471b24 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -66,31 +66,31 @@ public:
IUnknownWrapper_Impl(Reference<XMultiServiceFactory> &xFactory,
sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
- ~IUnknownWrapper_Impl();
+ ~IUnknownWrapper_Impl() override;
//XInterface
Any SAL_CALL queryInterface(const Type& t)
- throw (RuntimeException);
+ throw (RuntimeException) override;
// XInvokation
virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( )
- throw(RuntimeException);
+ throw(RuntimeException) override;
virtual Any SAL_CALL invoke( const OUString& aFunctionName,
const Sequence< Any >& aParams,
Sequence< sal_Int16 >& aOutParamIndex,
Sequence< Any >& aOutParam )
throw(IllegalArgumentException, CannotConvertException,
- InvocationTargetException, RuntimeException);
+ InvocationTargetException, RuntimeException) override;
virtual void SAL_CALL setValue( const OUString& aPropertyName,
const Any& aValue )
throw(UnknownPropertyException, CannotConvertException,
- InvocationTargetException, RuntimeException);
+ InvocationTargetException, RuntimeException) override;
virtual Any SAL_CALL getValue( const OUString& aPropertyName )
- throw(UnknownPropertyException, RuntimeException);
+ throw(UnknownPropertyException, RuntimeException) override;
virtual sal_Bool SAL_CALL hasMethod( const OUString& aName )
- throw(RuntimeException);
+ throw(RuntimeException) override;
virtual sal_Bool SAL_CALL hasProperty( const OUString& aName )
- throw(RuntimeException);
+ throw(RuntimeException) override;
// XBridgeSupplier2
// This interface is implemented to provide a safe way to obtain the original
@@ -101,24 +101,24 @@ public:
const Sequence< sal_Int8 >& aProcessId,
sal_Int16 sourceModelType,
sal_Int16 destModelType )
- throw(IllegalArgumentException, RuntimeException);
+ throw(IllegalArgumentException, RuntimeException) override;
// XInitialization
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException);
+ throw(Exception, RuntimeException) override;
// XDefaultProperty
- virtual OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return m_sDefaultMember; }
+ virtual OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) override { return m_sDefaultMember; }
// XDefaultMethod
- virtual OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException) { return m_sDefaultMember; }
+ virtual OUString SAL_CALL getDefaultMethodName( ) throw (css::uno::RuntimeException) override { return m_sDefaultMember; }
- virtual css::uno::Any SAL_CALL invokeGetProperty( const OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL invokePutProperty( const OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL invokeGetProperty( const OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException) override;
+ virtual css::uno::Any SAL_CALL invokePutProperty( const OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException) override;
// XDirectInvocation
- virtual css::uno::Any SAL_CALL directInvoke( const OUString& aName, const css::uno::Sequence< css::uno::Any >& aParams ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasMember( const OUString& aName ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL directInvoke( const OUString& aName, const css::uno::Sequence< css::uno::Any >& aParams ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL hasMember( const OUString& aName ) throw (css::uno::RuntimeException) override;
Any invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
@@ -141,8 +141,8 @@ protected:
Sequence< Any >& OutParam);
// UnoConversionUtilities -------------------------------------------------------------------------------
- virtual Reference<XInterface> createUnoWrapperInstance();
- virtual Reference<XInterface> createComWrapperInstance();
+ virtual Reference<XInterface> createUnoWrapperInstance() override;
+ virtual Reference<XInterface> createComWrapperInstance() override;
/**Obtains a FUNCDESC structure for a function.
Fills the FUNCDESC structure if ITypeInfo provides information for
@@ -218,7 +218,7 @@ protected:
// done by
// asking for the property "_environment". If it has the value "JScript"
// (case insensitive) then the IDispatch is considered a JScript object.
- sal_Bool isJScriptObject();
+ bool isJScriptObject();
// If UNO interfaces are implemented in JScript objects, VB or C++ COM objects
@@ -237,7 +237,7 @@ protected:
/** This value is set during XInitialization::initialize. It indicates that the COM interface
was transported as VT_DISPATCH in a VARIANT rather then a VT_UNKNOWN
*/
- sal_Bool m_bOriginalDispatch;
+ bool m_bOriginalDispatch;
DispIdMap m_dispIdMap;
Reference<XIdlClass>* m_pxIdlClass;
diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx
index 99d3a331df31..72434b89febb 100644
--- a/extensions/source/ole/olethread.cxx
+++ b/extensions/source/ole/olethread.cxx
@@ -31,16 +31,16 @@ void o2u_attachCurrentThread()
{
static osl::ThreadData oleThreadData;
- if ((sal_Bool)(sal_IntPtr)oleThreadData.getData() != sal_True)
+ if (!bool(reinterpret_cast<sal_IntPtr>(oleThreadData.getData())))
{
- 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("extensions.olebridge",
"CoInitializeEx fail: probably thread is in STA already?");
}
- oleThreadData.setData((void*)sal_True);
+ oleThreadData.setData(reinterpret_cast<void*>(true));
}
}
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx
index 95b3badf5ae2..71ce5dc21c3d 100644
--- a/extensions/source/ole/servprov.cxx
+++ b/extensions/source/ole/servprov.cxx
@@ -31,6 +31,7 @@
#include "oleobjw.hxx"
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/any.hxx>
using namespace cppu;
using namespace osl;
@@ -76,7 +77,7 @@ ProviderOleWrapper_Impl::~ProviderOleWrapper_Impl()
{
}
-sal_Bool ProviderOleWrapper_Impl::registerClass()
+bool ProviderOleWrapper_Impl::registerClass()
{
HRESULT hresult;
@@ -92,7 +93,7 @@ sal_Bool ProviderOleWrapper_Impl::registerClass()
return (hresult == NOERROR);
}
-sal_Bool ProviderOleWrapper_Impl::deregisterClass()
+bool ProviderOleWrapper_Impl::deregisterClass()
{
HRESULT hresult = CoRevokeClassObject(m_factoryHandle);
@@ -104,17 +105,17 @@ STDMETHODIMP ProviderOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* FAR*
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);
}
@@ -140,7 +141,7 @@ STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
void FAR* FAR* ppv)
{
HRESULT ret = ResultFromScode(E_UNEXPECTED);
- punkOuter = NULL;
+ punkOuter = nullptr;
Reference<XInterface> xInstance;
@@ -155,14 +156,14 @@ STDMETHODIMP ProviderOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
sal_uInt8 arId[16];
rtl_getGlobalProcessId( arId );
Any oleAny = m_bridgeSupplier->createBridge(usrAny,
- Sequence<sal_Int8>((sal_Int8*)arId, 16),
+ Sequence<sal_Int8>(reinterpret_cast<sal_Int8*>(arId), 16),
UNO,
OLE);
- if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
+ if (auto v = o3tl::tryAccess<sal_uIntPtr>(oleAny))
{
- VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
+ VARIANT* pVariant = reinterpret_cast<VARIANT*>(*v);
if (pVariant->vt == VT_DISPATCH)
{
@@ -212,7 +213,7 @@ OneInstanceOleWrapper_Impl::~OneInstanceOleWrapper_Impl()
{
}
-sal_Bool OneInstanceOleWrapper_Impl::registerClass()
+bool OneInstanceOleWrapper_Impl::registerClass()
{
HRESULT hresult;
@@ -228,7 +229,7 @@ sal_Bool OneInstanceOleWrapper_Impl::registerClass()
return (hresult == NOERROR);
}
-sal_Bool OneInstanceOleWrapper_Impl::deregisterClass()
+bool OneInstanceOleWrapper_Impl::deregisterClass()
{
HRESULT hresult1 = NOERROR;
@@ -242,17 +243,17 @@ STDMETHODIMP OneInstanceOleWrapper_Impl::QueryInterface(REFIID riid, void FAR* F
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);
}
@@ -278,7 +279,7 @@ STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
void FAR* FAR* ppv)
{
HRESULT ret = ResultFromScode(E_UNEXPECTED);
- punkOuter = NULL;
+ punkOuter = nullptr;
if (m_xInst.is())
{
@@ -286,14 +287,14 @@ STDMETHODIMP OneInstanceOleWrapper_Impl::CreateInstance(IUnknown FAR* punkOuter,
sal_uInt8 arId[16];
rtl_getGlobalProcessId( arId);
Any oleAny = m_bridgeSupplier->createBridge(usrAny,
- Sequence<sal_Int8>( (sal_Int8*)arId, 16),
+ Sequence<sal_Int8>( reinterpret_cast<sal_Int8*>(arId), 16),
UNO,
OLE);
- if (oleAny.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
+ if (auto v = o3tl::tryAccess<sal_uIntPtr>(oleAny))
{
- VARIANT* pVariant = *(VARIANT**)oleAny.getValue();
+ VARIANT* pVariant = reinterpret_cast<VARIANT*>(*v);
if ((pVariant->vt == VT_UNKNOWN) || (pVariant->vt == VT_DISPATCH))
{
@@ -349,7 +350,7 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
sal_uInt8 arId[16];
rtl_getGlobalProcessId( arId );
- Sequence< sal_Int8 > seqProcessId( (sal_Int8*)arId, 16);
+ Sequence< sal_Int8 > seqProcessId( reinterpret_cast<sal_Int8*>(arId), 16);
if ( seqProcessId == ProcessId)
{
@@ -363,7 +364,7 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
else if (destModelType == OLE)
{
// convert UNO any into variant
- VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
+ VARIANT* pVariant = static_cast<VARIANT*>(CoTaskMemAlloc(sizeof(VARIANT)));
VariantInit( pVariant);
try
{
@@ -381,16 +382,17 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
}
else if (sourceModelType == OLE)
{
- if (modelDepObject.getValueType() != cppu::UnoType<sal_uIntPtr>::get())
+ auto v = o3tl::tryAccess<sal_uIntPtr>(modelDepObject);
+ if (!v)
{
throw IllegalArgumentException();
}
else if (destModelType == OLE)
{
// same model -> copy value only
- VARIANT* pVariant = (VARIANT*) CoTaskMemAlloc(sizeof(VARIANT));
+ VARIANT* pVariant = static_cast<VARIANT*>(CoTaskMemAlloc(sizeof(VARIANT)));
- if (NOERROR != VariantCopy(pVariant, *(VARIANT**)modelDepObject.getValue()))
+ if (NOERROR != VariantCopy(pVariant, reinterpret_cast<VARIANT*>(*v)))
{
CoTaskMemFree(pVariant);
throw(IllegalArgumentException());
@@ -403,7 +405,7 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
else if (destModelType == UNO)
{
// convert variant into UNO any
- VARIANT* pVariant = *(VARIANT**)modelDepObject.getValue();
+ VARIANT* pVariant = reinterpret_cast<VARIANT*>(*v);
try
{
variantToAny(pVariant, ret);
@@ -411,7 +413,7 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject,
catch (const CannotConvertException & e)
{
throw IllegalArgumentException(
- e.Message, 0, -1);
+ e.Message, nullptr, -1);
}
}
else
@@ -546,7 +548,7 @@ Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& Se
{
Reference<XInterface> ret;
HRESULT result;
- IUnknown* pUnknown = NULL;
+ IUnknown* pUnknown = nullptr;
CLSID classId;
o2u_attachCurrentThread();
@@ -560,14 +562,14 @@ Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& Se
{
result = CoCreateInstance(
classId, //Class identifier (CLSID) of the object
- NULL, //Pointer to whether object is or isn't part of an aggregate
+ nullptr, //Pointer to whether object is or isn't part of an aggregate
CLSCTX_SERVER, //Context for running executable code
IID_IUnknown, //Reference to the identifier of the interface
- (void**)&pUnknown); //Address of output variable that receives
+ reinterpret_cast<void**>(&pUnknown)); //Address of output variable that receives
// the interface pointer requested in riid
}
- if (pUnknown != NULL)
+ if (pUnknown != nullptr)
{
Any any;
CComVariant variant;
@@ -638,7 +640,7 @@ OleServer_Impl::OleServer_Impl( const Reference<XMultiServiceFactory>& smgr):
a >>= m_bridgeSupplier;
}
- sal_Bool ret = provideInstance( m_smgr, (GUID*)&OID_ServiceManager );
+ bool ret = provideInstance( m_smgr, const_cast<GUID*>(&OID_ServiceManager) );
(void)ret;
}
@@ -672,7 +674,7 @@ css::uno::Sequence<OUString> OleServer_Impl::getSupportedServiceNames()
"com.sun.star.bridge.oleautomation.ApplicationRegistration"};
}
-sal_Bool OleServer_Impl::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID* guid)
+bool OleServer_Impl::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID* guid)
{
IClassFactoryWrapper* pFac = new ProviderOleWrapper_Impl( m_smgr, xSFact, guid);
@@ -683,7 +685,7 @@ sal_Bool OleServer_Impl::provideService(const Reference<XSingleServiceFactory>&
return pFac->registerClass();
}
-sal_Bool OleServer_Impl::provideInstance(const Reference<XInterface>& xInst, GUID* guid)
+bool OleServer_Impl::provideInstance(const Reference<XInterface>& xInst, GUID* guid)
{
IClassFactoryWrapper* pFac =
new OneInstanceOleWrapper_Impl( m_smgr, xInst, guid );
diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx
index 1673f430a206..adf8f26d8f94 100644
--- a/extensions/source/ole/servprov.hxx
+++ b/extensions/source/ole/servprov.hxx
@@ -57,8 +57,8 @@ class IClassFactoryWrapper : public IClassFactory
{
public:
- virtual sal_Bool registerClass() = 0;
- virtual sal_Bool deregisterClass() = 0;
+ virtual bool registerClass() = 0;
+ virtual bool deregisterClass() = 0;
protected:
~IClassFactoryWrapper() {}
@@ -86,17 +86,17 @@ public:
const Reference<XSingleServiceFactory>& xSFactory, GUID* pGuid);
virtual ~ProviderOleWrapper_Impl();
- sal_Bool registerClass();
- sal_Bool deregisterClass();
+ bool registerClass() override;
+ bool deregisterClass() override;
/* 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:
@@ -128,17 +128,17 @@ public:
OneInstanceOleWrapper_Impl( const Reference<XMultiServiceFactory>& smgr, const Reference<XInterface>& xInst, GUID* pGuid );
virtual ~OneInstanceOleWrapper_Impl();
- sal_Bool registerClass();
- sal_Bool deregisterClass();
+ bool registerClass() override;
+ bool deregisterClass() override;
/* 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:
@@ -174,7 +174,7 @@ class OleConverter_Impl2 : public WeakImplHelper<XBridgeSupplier2, XInitializati
public:
explicit OleConverter_Impl2( const Reference<XMultiServiceFactory>& smgr);
OleConverter_Impl2( const Reference<XMultiServiceFactory>& smgr, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass );
- virtual ~OleConverter_Impl2();
+ virtual ~OleConverter_Impl2() override;
// XBridgeSupplier2 ---------------------------------------------------
@@ -218,7 +218,7 @@ class OleClient_Impl : public WeakImplHelper<XMultiServiceFactory, css::lang::XS
{
public:
explicit OleClient_Impl( const Reference<XMultiServiceFactory>& smgr);
- ~OleClient_Impl();
+ ~OleClient_Impl() override;
// XMultiServiceFactory
Reference<XInterface> SAL_CALL createInstance(const OUString& ServiceSpecifier) throw( Exception, RuntimeException) override;
@@ -257,7 +257,7 @@ class OleServer_Impl : public cppu::WeakImplHelper<css::lang::XServiceInfo>
{
public:
explicit OleServer_Impl( const Reference<XMultiServiceFactory> &smgr);
- ~OleServer_Impl();
+ ~OleServer_Impl() override;
OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException, std::exception) override;
@@ -270,8 +270,8 @@ public:
protected:
- sal_Bool provideService(const Reference<XSingleServiceFactory>& xMulFact, GUID* guid);
- sal_Bool provideInstance(const Reference<XInterface>& xInst, GUID* guid);
+ bool provideService(const Reference<XSingleServiceFactory>& xMulFact, GUID* guid);
+ bool provideInstance(const Reference<XInterface>& xInst, GUID* guid);
list< IClassFactoryWrapper* > m_wrapperList;
Reference< XBridgeSupplier2 > m_bridgeSupplier;
diff --git a/extensions/source/ole/servreg.cxx b/extensions/source/ole/servreg.cxx
index 60e39ae25df0..d37e448fdad9 100644
--- a/extensions/source/ole/servreg.cxx
+++ b/extensions/source/ole/servreg.cxx
@@ -61,33 +61,33 @@ Reference<XInterface> SAL_CALL OleServer_CreateInstance( const Reference<XMultiS
extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL oleautobridge_component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
{
- void * pRet = 0;
+ void * pRet = nullptr;
OUString aImplName( OUString::createFromAscii( pImplName ) );
Reference< XSingleServiceFactory > xFactory;
Sequence<OUString> seqServiceNames;
if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverter2") ))
{
- xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
- OUString("com.sun.star.comp.ole.OleConverter2"),
+ xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
+ "com.sun.star.comp.ole.OleConverter2",
ConverterProvider_CreateInstance2, seqServiceNames );
}
else if (pServiceManager && aImplName.equals( reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleConverterVar1") ))
{
- xFactory= createSingleFactory( reinterpret_cast<XMultiServiceFactory*>(pServiceManager),
- OUString("com.sun.star.comp.ole.OleConverterVar1"),
+ xFactory= createSingleFactory( static_cast<XMultiServiceFactory*>(pServiceManager),
+ "com.sun.star.comp.ole.OleConverterVar1",
ConverterProvider_CreateInstanceVar1, seqServiceNames );
}
else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleClient")))
{
- xFactory= createSingleFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
- OUString("com.sun.star.comp.ole.OleClient"),
+ xFactory= createSingleFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
+ "com.sun.star.comp.ole.OleClient",
OleClient_CreateInstance, seqServiceNames );
}
else if(pServiceManager && aImplName.equals(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleServer")))
{
- xFactory= createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory*>(pServiceManager),
- OUString("com.sun.star.comp.ole.OleServer"),
+ xFactory= createOneInstanceFactory( static_cast< XMultiServiceFactory*>(pServiceManager),
+ "com.sun.star.comp.ole.OleServer",
OleServer_CreateInstance, seqServiceNames );
}
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index e1459b855172..1462997758af 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -29,6 +29,7 @@
#include "com/sun/star/bridge/oleautomation/SCode.hpp"
#include "com/sun/star/bridge/oleautomation/Decimal.hpp"
#include "typelib/typedescription.hxx"
+#include <o3tl/any.hxx>
#include "ole2uno.hxx"
#include <cppuhelper/weakref.hxx>
@@ -141,7 +142,7 @@ public:
@IllegalArgumentException
Thrown if the VARIANT is inappropriate for conversion. ArgumentPosition is -1,
*/
- void variantToAny(const VARIANT* pVariant, Any& rAny, sal_Bool bReduceValueRange = sal_True);
+ void variantToAny(const VARIANT* pVariant, Any& rAny, bool bReduceValueRange = true);
/** This method converts variants arguments in calls from COM -> UNO. Only then
the expected UNO type is known.
@exception CannotConvertException
@@ -150,7 +151,7 @@ public:
@IllegalArgumentException
Thrown if the VARIANT is inappropriate for conversion. ArgumentPosition is -1,
*/
- void variantToAny( const VARIANTARG* pArg, Any& rAny, const Type& ptype, sal_Bool bReduceValueRange = sal_True);
+ void variantToAny( const VARIANTARG* pArg, Any& rAny, const Type& ptype, bool bReduceValueRange = true);
/**
@exception IllegalArgumentException
@@ -178,7 +179,7 @@ public:
virtual Reference< XInterface > createUnoWrapperInstance()=0;
virtual Reference< XInterface > createComWrapperInstance()=0;
- static sal_Bool isJScriptArray(const VARIANT* pvar);
+ static bool isJScriptArray(const VARIANT* pvar);
Sequence<Type> getImplementedInterfaces(IUnknown* pUnk);
@@ -188,12 +189,12 @@ protected:
// helper function for Sequence conversion
void getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim, Sequence< sal_Int32 >& seqElementCounts, TypeDescription& typeDesc);
// helper function for Sequence conversion
- sal_Bool incrementMultidimensionalIndex(sal_Int32 dimensions, const sal_Int32 * parDimensionLength,
+ static bool incrementMultidimensionalIndex(sal_Int32 dimensions, const sal_Int32 * parDimensionLength,
sal_Int32 * parMultidimensionalIndex);
// helper function for Sequence conversion
- size_t getOleElementSize( VARTYPE type);
+ static size_t getOleElementSize( VARTYPE type);
- Type getElementTypeOfSequence( const Type& seqType);
+ static Type getElementTypeOfSequence( const Type& seqType);
//Provides a typeconverter
Reference<XTypeConverter> getTypeConverter();
@@ -240,16 +241,16 @@ bool convertSelfToCom( T& unoInterface, VARIANT * pVar)
if( xSupplier.is())
{
sal_Int8 arId[16];
- rtl_getGlobalProcessId( (sal_uInt8*)arId);
+ rtl_getGlobalProcessId( reinterpret_cast<sal_uInt8*>(arId));
Sequence<sal_Int8> seqId( arId, 16);
Any anySource;
anySource <<= xInt;
Any anyDisp = xSupplier->createBridge(anySource, seqId, UNO, OLE);
// due to global-process-id check this must be in-process pointer
- if (anyDisp.getValueTypeClass() == cppu::UnoType<sal_uIntPtr>::get().getTypeClass())
+ if (auto v = o3tl::tryAccess<sal_uIntPtr>(anyDisp))
{
- VARIANT* pvariant= *(VARIANT**)anyDisp.getValue();
+ VARIANT* pvariant= reinterpret_cast<VARIANT*>(*v);
HRESULT hr;
if (FAILED(hr = VariantCopy(pVar, pvariant)))
throw BridgeRuntimeError(
@@ -295,7 +296,7 @@ Reference< XSingleServiceFactory > UnoConversionUtilities<T>::getInvocationFacto
}
template<class T>
-void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, const Type& ptype, sal_Bool bReduceValueRange /* = sal_True */)
+void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, const Type& ptype, bool bReduceValueRange /* = sal_True */)
{
try
{
@@ -305,7 +306,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny,
CComVariant var;
// There is no need to support indirect values, since they're not supported by UNO
- if( FAILED(hr= VariantCopyInd( &var, const_cast<VARIANTARG*>(pArg)))) // remove VT_BYREF
+ if( FAILED(hr= VariantCopyInd( &var, pArg))) // remove VT_BYREF
throw BridgeRuntimeError(
"[automation bridge] UnoConversionUtilities<T>::variantToAny \n"
"VariantCopyInd failed for reason : " + OUString::number(hr));
@@ -326,7 +327,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny,
if( var.vt == VT_BSTR)
{
if(SUCCEEDED( hr= VariantChangeType( &var, &var, 0, VT_BSTR)))
- rAny.setValue( (void*)V_BSTR( &var), ptype);
+ rAny.setValue( V_BSTR( &var), ptype);
else if (hr == DISP_E_TYPEMISMATCH)
bCannotConvert = true;
else
@@ -335,7 +336,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny,
else
{
if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I2)))
- rAny.setValue((void*) & var.iVal, ptype);
+ rAny.setValue(& var.iVal, ptype);
else if (hr == DISP_E_TYPEMISMATCH)
bCannotConvert = true;
else
@@ -350,7 +351,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny,
}
case TypeClass_ENUM:
if(SUCCEEDED(hr = VariantChangeType( & var, &var, 0, VT_I4)))
- rAny.setValue((void*) & var.lVal, ptype);
+ rAny.setValue(& var.lVal, ptype);
else if (hr == DISP_E_TYPEMISMATCH)
bCannotConvert = true;
else
@@ -563,7 +564,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny,
OUString::number((sal_Int32) var.vt) +
"\" to the expected UNO type of type class: " +
OUString::number((sal_Int32) ptype.getTypeClass()),
- 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
+ nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
if (bFail)
throw IllegalArgumentException(
@@ -637,7 +638,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny,
rAny.getValueTypeName() +
"\" to the expected Automation type of VARTYPE: " +
OUString::number((sal_Int32)type),
- 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
+ nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
throw BridgeRuntimeError(
"[automation bridge]UnoConversionUtilities<T>::anyToVariant \n"
@@ -797,7 +798,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny)
if (rAny >>= value)
{
pVariant->vt = VT_BOOL;
- pVariant->boolVal = value == sal_True? VARIANT_TRUE: VARIANT_FALSE;
+ pVariant->boolVal = value ? VARIANT_TRUE: VARIANT_FALSE;
}
else
{
@@ -808,7 +809,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny)
case TypeClass_CHAR:
{
// Because VT_UI2 does not conform to oleautomation we convert into VT_I2 instead
- sal_uInt16 value = *(sal_Unicode*) rAny.getValue();
+ sal_uInt16 value = *o3tl::forceAccess<sal_Unicode>(rAny);
pVariant->vt = VT_I2;
pVariant->iVal = value;
break;
@@ -887,7 +888,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny)
}
case TypeClass_ENUM:
{
- sal_Int32 value = *(sal_Int32*) rAny.getValue();
+ sal_Int32 value = *static_cast<sal_Int32 const *>(rAny.getValue());
pVariant->vt = VT_I4;
pVariant->lVal= value;
break;
@@ -941,7 +942,7 @@ void UnoConversionUtilities<T>::anyToVariant(VARIANT* pVariant, const Any& rAny)
Type type;
rAny >>= type;
CComVariant var;
- if (createUnoTypeWrapper(type.getTypeName(), & var) == false)
+ if (!createUnoTypeWrapper(type.getTypeName(), & var))
throw BridgeRuntimeError(
"[automation bridge] UnoConversionUtilities<T>::anyToVariant \n"
"Error during conversion of UNO type to Automation object!");
@@ -1016,12 +1017,12 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
if (rSeq.getValueTypeClass() != TypeClass_SEQUENCE)
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createUnoSequenceWrapper \n"
- "The any does not contain a sequence!", 0, 0);
+ "The any does not contain a sequence!", nullptr, 0);
if (elemtype == VT_NULL || elemtype == VT_EMPTY)
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createUnoSequenceWrapper \n"
- "No element type supplied!",0, -1);
- SAFEARRAY* pArray= NULL;
+ "No element type supplied!",nullptr, -1);
+ SAFEARRAY* pArray= nullptr;
// Get the dimensions. This is done by examining the type name string
// The count of brackets determines the dimensions.
OUString sTypeName= rSeq.getValueType().getTypeName();
@@ -1059,7 +1060,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
if( SUCCEEDED( SafeArrayAccessData( pArray, &pSAData)))
{
const sal_Int32* parElementCount= seqElementCounts.getConstArray();
- uno_Sequence * pMultiSeq= *(uno_Sequence* const*) rSeq.getValue();
+ uno_Sequence * pMultiSeq= *static_cast<uno_Sequence* const*>(rSeq.getValue());
sal_Int32 dimsSeq= dims - 1;
// arDimSeqIndices contains the current index of a block of data.
@@ -1068,7 +1069,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
// but the Sequences that contain those elements.
// The indices ar 0 based
std::unique_ptr<sal_Int32[]> sarDimsSeqIndices;
- sal_Int32* arDimsSeqIndices= NULL;
+ sal_Int32* arDimsSeqIndices= nullptr;
if( dimsSeq > 0)
{
sarDimsSeqIndices.reset(new sal_Int32[dimsSeq]);
@@ -1076,14 +1077,14 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
memset( arDimsSeqIndices, 0, sizeof( sal_Int32 ) * dimsSeq);
}
- char* psaCurrentData= (char*)pSAData;
+ char* psaCurrentData= static_cast<char*>(pSAData);
do
{
// Get the Sequence at the current index , see arDimsSeqIndices
uno_Sequence * pCurrentSeq= pMultiSeq;
sal_Int32 curDim=1; // 1 based
- sal_Bool skipSeq= sal_False;
+ bool skipSeq= false;
while( curDim <= dimsSeq )
{
// get the Sequence at the index if valid
@@ -1091,13 +1092,13 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
{
// size of Sequence is 4
sal_Int32 offset= arDimsSeqIndices[ curDim - 1] * 4;
- pCurrentSeq= *(uno_Sequence**) &pCurrentSeq->elements[ offset];
+ pCurrentSeq= *reinterpret_cast<uno_Sequence**>(&pCurrentSeq->elements[ offset]);
curDim++;
}
else
{
// There is no Sequence at this index, so skip this index
- skipSeq= sal_True;
+ skipSeq= true;
break;
}
}
@@ -1109,14 +1110,14 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
// for the next Sequence.
sal_Int32 memOffset= 0;
sal_Int32 dimWeight= parElementCount[ dims - 1]; // size of the rightmost dimension
- for(sal_Int16 idims=0; idims < dimsSeq; idims++ )
+ for(sal_Int32 idims=0; idims < dimsSeq; idims++ )
{
memOffset+= arDimsSeqIndices[dimsSeq - 1 - idims] * dimWeight;
// now determine the weight of the dimension to the left of the current.
if( dims - 2 - idims >=0)
dimWeight*= parElementCount[dims - 2 - idims];
}
- psaCurrentData= (char*)pSAData + memOffset * oleElementSize;
+ psaCurrentData= static_cast<char*>(pSAData) + memOffset * oleElementSize;
// convert the Sequence and put the elements into the Safearray
for( sal_Int32 i= 0; i < pCurrentSeq->nElements; i++)
{
@@ -1134,7 +1135,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
anyToVariant( &var, unoElement);
if( elemtype == VT_VARIANT )
{
- VariantCopy( ( VARIANT*)psaCurrentData, &var);
+ VariantCopy( reinterpret_cast<VARIANT*>(psaCurrentData), &var);
VariantClear( &var);
}
else
@@ -1166,15 +1167,15 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq,
// Param parMultiDimensionalIndex - The array contains the index. Each dimension index is
// 0 based.
template<class T>
-sal_Bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dimensions,
+bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dimensions,
const sal_Int32 * parDimensionLengths,
sal_Int32 * parMultidimensionalIndex)
{
if( dimensions < 1)
- return sal_False;
+ return false;
- sal_Bool ret= sal_True;
- sal_Bool carry= sal_True; // to get into the while loop
+ bool ret= true;
+ bool carry= true; // to get into the while loop
sal_Int32 currentDimension= dimensions; //most significant is 1
while( carry)
@@ -1184,15 +1185,15 @@ sal_Bool UnoConversionUtilities<T>::incrementMultidimensionalIndex(sal_Int32 dim
if( parMultidimensionalIndex[ currentDimension - 1] > (parDimensionLengths[ currentDimension - 1] - 1))
parMultidimensionalIndex[ currentDimension - 1]= 0;
else
- carry= sal_False;
+ carry= false;
currentDimension --;
// if dimensions drops below 1 and carry is set than then all indices are 0 again
// this is signalled by returning sal_False
if( currentDimension < 1 && carry)
{
- carry= sal_False;
- ret= sal_False;
+ carry= false;
+ ret= false;
}
}
return ret;
@@ -1248,21 +1249,21 @@ template<class T>
void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rSeq, sal_Int32 dim,
Sequence< sal_Int32 >& seqElementCounts, TypeDescription& typeDesc)
{
- sal_Int32 dimCount= (*(uno_Sequence* const *) rSeq.getValue())->nElements;
+ sal_Int32 dimCount= (*static_cast<uno_Sequence* const *>(rSeq.getValue()))->nElements;
if( dimCount > seqElementCounts[ dim-1])
seqElementCounts[ dim-1]= dimCount;
// we need the element type to construct the any that is
// passed into getElementCountAndTypeOfSequence again
- typelib_TypeDescription* pSeqDesc= NULL;
+ typelib_TypeDescription* pSeqDesc= nullptr;
rSeq.getValueTypeDescription( &pSeqDesc);
- typelib_TypeDescriptionReference* pElementDescRef= ((typelib_IndirectTypeDescription*)pSeqDesc)->pType;
+ typelib_TypeDescriptionReference* pElementDescRef= reinterpret_cast<typelib_IndirectTypeDescription*>(pSeqDesc)->pType;
// if the elements are Sequences than do recursion
if( dim < seqElementCounts.getLength() )
{
- uno_Sequence* pSeq = *(uno_Sequence* const*) rSeq.getValue();
- uno_Sequence** arSequences= (uno_Sequence**)pSeq->elements;
+ uno_Sequence* pSeq = *static_cast<uno_Sequence* const*>(rSeq.getValue());
+ uno_Sequence** arSequences= reinterpret_cast<uno_Sequence**>(pSeq->elements);
for( sal_Int32 i=0; i < dimCount; i++)
{
uno_Sequence* arElement= arSequences[ i];
@@ -1281,26 +1282,26 @@ void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rS
template<class T>
SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq)
{
- SAFEARRAY* pArray = NULL;
+ SAFEARRAY* pArray = nullptr;
sal_uInt32 n = 0;
if( rSeq.getValueTypeClass() != TypeClass_SEQUENCE )
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createUnoSequenceWrapper\n"
- "The UNO argument is not a sequence", 0, -1);
+ "The UNO argument is not a sequence", nullptr, -1);
- uno_Sequence * punoSeq= *(uno_Sequence**) rSeq.getValue();
+ uno_Sequence * punoSeq= *static_cast<uno_Sequence* const *>(rSeq.getValue());
typelib_TypeDescriptionReference* pSeqTypeRef= rSeq.getValueTypeRef();
- typelib_TypeDescription* pSeqType= NULL;
+ typelib_TypeDescription* pSeqType= nullptr;
TYPELIB_DANGER_GET( &pSeqType, pSeqTypeRef);
- typelib_IndirectTypeDescription * pSeqIndDec= (typelib_IndirectTypeDescription*) pSeqType;
+ typelib_IndirectTypeDescription * pSeqIndDec= reinterpret_cast<typelib_IndirectTypeDescription*>(pSeqType);
typelib_TypeDescriptionReference * pSeqElementTypeRef= pSeqIndDec->pType;
TYPELIB_DANGER_RELEASE( pSeqType);
- typelib_TypeDescription* pSeqElementDesc= NULL;
+ typelib_TypeDescription* pSeqElementDesc= nullptr;
TYPELIB_DANGER_GET( &pSeqElementDesc, pSeqElementTypeRef);
sal_Int32 nElementSize= pSeqElementDesc->nSize;
n= punoSeq->nElements;
@@ -1353,19 +1354,19 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createUnoObjectWrapper \n"
"Cannot create an Automation interface for a UNO type which is not "
- "a struct or interface!", 0, -1);
+ "a struct or interface!", nullptr, -1);
if (rObj.getValueTypeClass() == TypeClass_INTERFACE)
{
if (! (rObj >>= xInt))
throw IllegalArgumentException(
"[automation bridge] UnoConversionUtilities<T>::createUnoObjectWrapper\n "
- "Could not create wrapper object for UNO object!", 0, -1);
+ "Could not create wrapper object for UNO object!", nullptr, -1);
//If XInterface is NULL, which is a valid value, then simply return NULL.
if ( ! xInt.is())
{
pVar->vt = VT_UNKNOWN;
- pVar->punkVal = NULL;
+ pVar->punkVal = nullptr;
return;
}
//make sure we have the main XInterface which is used with a map
@@ -1374,7 +1375,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
Reference<XInterface> xIntWrapper;
// Does a UNO wrapper exist already ?
- IT_Uno it_uno = UnoObjToWrapperMap.find( (sal_uIntPtr) xInt.get());
+ IT_Uno it_uno = UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(xInt.get()));
if(it_uno != UnoObjToWrapperMap.end())
{
xIntWrapper = it_uno->second;
@@ -1389,9 +1390,9 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
else
{
Reference<XInterface> xIntComWrapper = xInt;
- typedef std::unordered_map<sal_uIntPtr,sal_uIntPtr>::iterator _IT;
+ typedef std::unordered_map<sal_uIntPtr,sal_uIntPtr>::iterator IT;
// Adapter? then get the COM wrapper to which the adapter delegates its calls
- _IT it= AdapterToWrapperMap.find( (sal_uIntPtr) xInt.get());
+ IT it= AdapterToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(xInt.get()));
if( it != AdapterToWrapperMap.end() )
xIntComWrapper= reinterpret_cast<XInterface*>(it->second);
@@ -1444,7 +1445,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
// be mapped again and there is already a wrapper then the old wrapper
// will be used.
if(xInt.is()) // only interfaces
- UnoObjToWrapperMap[(sal_uIntPtr) xInt.get()]= xNewWrapper;
+ UnoObjToWrapperMap[reinterpret_cast<sal_uIntPtr>(xInt.get())]= xNewWrapper;
convertSelfToCom(xNewWrapper, pVar);
return;
}
@@ -1453,7 +1454,7 @@ void UnoConversionUtilities<T>::createUnoObjectWrapper(const Any & rObj, VARIANT
template<class T>
void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny,
- sal_Bool bReduceValueRange /* = sal_True */)
+ bool bReduceValueRange /* = sal_True */)
{
HRESULT hr = S_OK;
try
@@ -1461,7 +1462,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny
CComVariant var;
// There is no need to support indirect values, since they're not supported by UNO
- if( FAILED(hr= VariantCopyInd( &var, const_cast<VARIANTARG*>(pVariant)))) // remove VT_BYREF
+ if( FAILED(hr= VariantCopyInd( &var, pVariant))) // remove VT_BYREF
throw BridgeRuntimeError(
"[automation bridge] UnoConversionUtilities<T>::variantToAny \n"
"VariantCopyInd failed for reason : " + OUString::number(hr));
@@ -1525,7 +1526,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny
#ifdef __MINGW32__
CComQIPtr<IUnoTypeWrapper, &__uuidof(IUnoTypeWrapper)> spType((IUnknown*) var.byref);
#else
- CComQIPtr<IUnoTypeWrapper> spType((IUnknown*) var.byref);
+ CComQIPtr<IUnoTypeWrapper> spType(static_cast<IUnknown*>(var.byref));
#endif
if (spType)
{
@@ -1535,13 +1536,13 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny
"[automation bridge]UnoConversionUtilities<T>::variantToAny \n"
"Failed to get the type name from a UnoTypeWrapper!");
Type type;
- if (getType(sName, type) == false)
+ if (!getType(sName, type))
{
throw CannotConvertException(
"[automation bridge]UnoConversionUtilities<T>::variantToAny \n"
"A UNO type with the name: " + OUString(reinterpret_cast<const sal_Unicode*>(LPCOLESTR(sName))) +
"does not exist!",
- 0, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
+ nullptr, TypeClass_UNKNOWN, FailReason::TYPE_NOT_SUPPORTED,0);
}
rAny <<= type;
}
@@ -1657,7 +1658,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
if (pVar->vt != VT_UNKNOWN && pVar->vt != VT_DISPATCH && pVar->vt != VT_EMPTY)
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createOleObjectWrapper \n"
- "The VARIANT does not contain an object type! ", 0, -1);
+ "The VARIANT does not contain an object type! ", nullptr, -1);
MutexGuard guard( getBridgeMutex());
@@ -1674,7 +1675,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
spUnknown.QueryInterface( & spDispatch.p);
#endif
}
- else if (pVar->vt == VT_DISPATCH && pVar->pdispVal != NULL)
+ else if (pVar->vt == VT_DISPATCH && pVar->pdispVal != nullptr)
{
CComPtr<IDispatch> spDispatch2(pVar->pdispVal);
if (spDispatch2)
@@ -1708,7 +1709,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
}
// COM pointer are NULL, no wrapper required
- if (spUnknown == NULL)
+ if (spUnknown == nullptr)
{
Reference<XInterface> xInt;
if( aType.getTypeClass() == TypeClass_INTERFACE)
@@ -1760,7 +1761,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
//find the proper Adapter. The pointer in the WrapperToAdapterMap are valid as long as
//we get a pointer to the wrapper from ComPtrToWrapperMap, because the Adapter hold references
//to the wrapper.
- CIT_Wrap it = WrapperToAdapterMap.find((sal_uIntPtr) xIntWrapper.get());
+ CIT_Wrap it = WrapperToAdapterMap.find(reinterpret_cast<sal_uIntPtr>(xIntWrapper.get()));
if (it == WrapperToAdapterMap.end())
{
// No adapter available.
@@ -1784,18 +1785,18 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createOleObjectWrapper \n"
"The COM object is not suitable for the UNO type: " +
- desiredType.getTypeName(), 0, -1);
+ desiredType.getTypeName(), nullptr, -1);
}
else
{
//There is an adapter available
- Reference<XInterface> xIntAdapter((XInterface*) it->second);
+ Reference<XInterface> xIntAdapter(reinterpret_cast<XInterface*>(it->second));
ret = xIntAdapter->queryInterface( desiredType);
if ( ! ret.hasValue())
throw IllegalArgumentException(
"[automation bridge]UnoConversionUtilities<T>::createOleObjectWrapper \n"
"The COM object is not suitable for the UNO type: " +
- desiredType.getTypeName(), 0, -1);
+ desiredType.getTypeName(), nullptr, -1);
}
return ret;
@@ -1866,8 +1867,8 @@ Reference<XInterface> UnoConversionUtilities<T>::createAdapter(const Sequence<Ty
// object is a wrapped COM object. In that case we extract the original COM object rather than
// creating a wrapper around the UNO object.
typedef std::unordered_map<sal_uInt64,sal_uInt64>::value_type VALUE;
- AdapterToWrapperMap.insert( VALUE( (sal_uInt64) xIntAdapted.get(), (sal_uInt64) receiver.get()));
- WrapperToAdapterMap.insert( VALUE( (sal_uInt64) receiver.get(), (sal_uInt64) xIntAdapted.get()));
+ AdapterToWrapperMap.insert( VALUE( reinterpret_cast<sal_uInt64>(xIntAdapted.get()), reinterpret_cast<sal_uInt64>(receiver.get())));
+ WrapperToAdapterMap.insert( VALUE( reinterpret_cast<sal_uInt64>(receiver.get()), reinterpret_cast<sal_uInt64>(xIntAdapted.get())));
}
else
{
@@ -1970,7 +1971,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
"Conversion of dispatch object to Sequence failed!");
DISPID dispid;
- DISPPARAMS param= {0,0,0,0};
+ DISPPARAMS param= {nullptr,nullptr,0,0};
CComVariant result;
OLECHAR const * sLength= L"length";
@@ -1981,7 +1982,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
throw BridgeRuntimeError("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n"
"Conversion of dispatch object to Sequence failed!");
if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
- &param, &result, NULL, NULL)))
+ &param, &result, nullptr, nullptr)))
throw BridgeRuntimeError("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n"
"Conversion of dispatch object to Sequence failed!");
if( FAILED( VariantChangeType( &result, &result, 0, VT_I4)))
@@ -1994,19 +1995,19 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
// get a few basic facts about the sequence, and reallocate:
// create the Sequences
// get the size of the elements
- typelib_TypeDescription *pDesc= NULL;
+ typelib_TypeDescription *pDesc= nullptr;
type.getDescription( &pDesc);
typelib_IndirectTypeDescription *pSeqDesc= reinterpret_cast<typelib_IndirectTypeDescription*>(pDesc);
typelib_TypeDescriptionReference *pSeqElemDescRef= pSeqDesc->pType; // type of the Sequence' elements
Type elemType( pSeqElemDescRef);
- _typelib_TypeDescription* pSeqElemDesc=NULL;
+ _typelib_TypeDescription* pSeqElemDesc=nullptr;
TYPELIB_DANGER_GET( &pSeqElemDesc, pSeqElemDescRef);
sal_uInt32 nelementSize= pSeqElemDesc->nSize;
TYPELIB_DANGER_RELEASE( pSeqElemDesc);
uno_Sequence *p_uno_Seq;
- uno_sequence_construct( &p_uno_Seq, pDesc, NULL, length, cpp_acquire);
+ uno_sequence_construct( &p_uno_Seq, pDesc, nullptr, length, cpp_acquire);
typelib_TypeClass typeElement= pSeqDesc->pType->eTypeClass;
char *pArray= p_uno_Seq->elements;
@@ -2016,7 +2017,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
for( sal_Int32 i= 0; i< length; i++)
{
OUString ousIndex=OUString::number( i);
- OLECHAR* sindex = (OLECHAR*)ousIndex.getStr();
+ OLECHAR* sindex = const_cast<sal_Unicode *>(ousIndex.getStr());
if( FAILED( hr= pdispEx->GetIDsOfNames(IID_NULL, &sindex , 1, LOCALE_USER_DEFAULT, &dispid)))
{
@@ -2024,7 +2025,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
"Conversion of dispatch object to Sequence failed!");
}
if( FAILED( hr= pdispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
- &param, &result, NULL, NULL)))
+ &param, &result, nullptr, nullptr)))
{
throw BridgeRuntimeError("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n"
"Conversion of dispatch object to Sequence failed!");
@@ -2035,13 +2036,13 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
// That requires a recursiv conversion
Any any;
// Destination address within the out-Sequence "anySeq" where to copy the next converted element
- void* pDest= (void*)(pArray + (i * nelementSize));
+ void* pDest= pArray + (i * nelementSize);
if( result.vt & VT_DISPATCH && typeElement == typelib_TypeClass_SEQUENCE)
{
- variantToAny( &result, any, elemType, sal_False);
+ variantToAny( &result, any, elemType, false);
// copy the converted VARIANT, that is a Sequence to the Sequence
- uno_Sequence * p_unoSeq= *(uno_Sequence**)any.getValue();
+ uno_Sequence * p_unoSeq= *static_cast<uno_Sequence* const *>(any.getValue());
// just copy the pointer of the uno_Sequence
// nelementSize should be 4 !!!!
memcpy( pDest, &p_unoSeq, nelementSize);
@@ -2049,7 +2050,7 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
}
else // Element type is no Sequence -> do one conversion
{
- variantToAny( &result, any, elemType, sal_False);
+ variantToAny( &result, any, elemType, false);
if( typeElement == typelib_TypeClass_ANY)
{
// copy the converted VARIANT to the Sequence
@@ -2187,10 +2188,10 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapperOfDim(SAFEARRAY* p
if( unotype.getTypeClass() == TypeClass_VOID)
// the function was called without specifying the destination type
- variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], sal_False);
+ variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound], false);
else
variantToAny(&variant, pUnoArray[index[actDim - 1] - lBound],
- getElementTypeOfSequence(unotype), sal_False);
+ getElementTypeOfSequence(unotype), false);
VariantClear(&variant);
}
@@ -2205,10 +2206,10 @@ Type UnoConversionUtilities<T>::getElementTypeOfSequence( const Type& seqType)
if( seqType.getTypeClass() != TypeClass_VOID)
{
OSL_ASSERT( seqType.getTypeClass() == TypeClass_SEQUENCE);
- typelib_IndirectTypeDescription* pDescSeq= NULL;
- seqType.getDescription((typelib_TypeDescription** ) & pDescSeq);
- retValue = Type(pDescSeq->pType);
- typelib_typedescription_release( (typelib_TypeDescription*) pDescSeq);
+ typelib_TypeDescription* pDescSeq= nullptr;
+ seqType.getDescription(& pDescSeq);
+ retValue = Type(reinterpret_cast<typelib_IndirectTypeDescription *>(pDescSeq)->pType);
+ typelib_typedescription_release(pDescSeq);
}
return retValue;
}
@@ -2242,7 +2243,7 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapper(SAFEARRAY* pArray
// An JScript has property like "0", "1", "2" etc. which represent the
// value at the corresponding index of the array
template<class T>
-sal_Bool UnoConversionUtilities<T>::isJScriptArray(const VARIANT* rvar)
+bool UnoConversionUtilities<T>::isJScriptArray(const VARIANT* rvar)
{
OSL_ENSURE( rvar->vt == VT_DISPATCH, "param is not a VT_DISPATCH");
HRESULT hr;
@@ -2255,10 +2256,10 @@ sal_Bool UnoConversionUtilities<T>::isJScriptArray(const VARIANT* rvar)
&id);
if( SUCCEEDED ( hr) )
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
template<class T>
@@ -2376,7 +2377,7 @@ inline void reduceRange( Any& any)
{
OSL_ASSERT( any.getValueTypeClass() == TypeClass_LONG);
- sal_Int32 value= *(sal_Int32*)any.getValue();
+ sal_Int32 value= *o3tl::doAccess<sal_Int32>(any);
if( value <= 0x7f && value >= -0x80)
{// -128 bis 127
sal_Int8 charVal= static_cast<sal_Int8>( value);
diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx
index 9855b4554253..192a490cd35c 100644
--- a/extensions/source/ole/unoobjw.cxx
+++ b/extensions/source/ole/unoobjw.cxx
@@ -68,8 +68,8 @@ extern "C" const GUID IID_IDispatchEx;
namespace ole_adapter
{
std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
-static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
-static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
+static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource);
+static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource);
static HRESULT mapCannotConvertException(const CannotConvertException &e, unsigned int * puArgErr);
/* Does not throw any exceptions.
@@ -77,7 +77,7 @@ static HRESULT mapCannotConvertException(const CannotConvertException &e, unsign
*/
static void writeExcepinfo(EXCEPINFO * pInfo, const OUString& message)
{
- if (pInfo != NULL)
+ if (pInfo != nullptr)
{
pInfo->wCode = UNO_2_OLE_EXCEPTIONCODE;
pInfo->bstrSource = SysAllocString(L"[automation bridge] ");
@@ -96,7 +96,7 @@ InterfaceOleWrapper_Impl::~InterfaceOleWrapper_Impl()
{
MutexGuard guard(getBridgeMutex());
// remove entries in global map
- IT_Uno it= UnoObjToWrapperMap.find( (sal_uIntPtr) m_xOrigin.get());
+ IT_Uno it= UnoObjToWrapperMap.find( reinterpret_cast<sal_uIntPtr>(m_xOrigin.get()));
if(it != UnoObjToWrapperMap.end())
UnoObjToWrapperMap.erase(it);
}
@@ -111,17 +111,17 @@ STDMETHODIMP InterfaceOleWrapper_Impl::QueryInterface(REFIID riid, LPVOID FAR *
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
- *ppv = (IUnknown*) (IDispatch*) this;
+ *ppv = static_cast<IUnknown*>(static_cast<IDispatch*>(this));
}
else if (IsEqualIID(riid, IID_IDispatch))
{
AddRef();
- *ppv = (IDispatch*) this;
+ *ppv = static_cast<IDispatch*>(this);
}
else if( IsEqualIID( riid, __uuidof( IUnoObjectWrapper)))
{
AddRef();
- *ppv= (IUnoObjectWrapper*) this;
+ *ppv= static_cast<IUnoObjectWrapper*>(this);
}
else
ret= E_NOINTERFACE;
@@ -271,15 +271,15 @@ STDMETHODIMP InterfaceOleWrapper_Impl::GetIDsOfNames(REFIID /*riid*/,
}
catch(const BridgeRuntimeError&)
{
- OSL_ASSERT(0);
+ OSL_ASSERT(false);
}
catch(const Exception&)
{
- OSL_ASSERT(0);
+ OSL_ASSERT(false);
}
catch(...)
{
- OSL_ASSERT(0);
+ OSL_ASSERT(false);
}
return ret;
@@ -375,10 +375,10 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id,
OLECHAR const * sindex= L"0";
DISPID id2;
- DISPPARAMS noParams= {0,0,0,0};
+ DISPPARAMS noParams= {nullptr,nullptr,0,0};
if(SUCCEEDED( hr= pdisp->GetIDsOfNames( IID_NULL, const_cast<OLECHAR **>(&sindex), 1, LOCALE_USER_DEFAULT, &id2)))
hr= pdisp->Invoke( id2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
- & noParams, & varParam, NULL, NULL);
+ & noParams, & varParam, nullptr, nullptr);
if( FAILED( hr))
{
throw BridgeRuntimeError(
@@ -398,15 +398,15 @@ void InterfaceOleWrapper_Impl::convertDispparamsArgs(DISPID id,
else if(info.eMemberType == MemberType_PROPERTY)
variantToAny( & varParam, anyParam, info.aType);
else
- OSL_ASSERT(0);
+ OSL_ASSERT(false);
pParams[countArgs - (i + 1)]= anyParam;
}// end for / iterating over all parameters
}
-sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, InvocationInfo& info)
+bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, InvocationInfo& info)
{
- sal_Bool bTypesAvailable= sal_False;
+ bool bTypesAvailable= false;
if( !m_xInvocation.is() )return false;
Reference<XInvocation2> inv2( m_xInvocation, UNO_QUERY);
@@ -437,23 +437,23 @@ sal_Bool InterfaceOleWrapper_Impl::getInvocationInfoForCall( DISPID id, Invocat
// of letters. First we assume that the name which was passed into
// GetIDsOfNames is correct. If we won't get information with that
// name then we have the invocation service use the XExactName interface.
- sal_Bool validInfo= sal_True;
+ bool validInfo= true;
InvocationInfo invInfo;
try{
- invInfo= inv2->getInfoForName( sMemberName, sal_False);
+ invInfo= inv2->getInfoForName( sMemberName, false);
}
catch(const IllegalArgumentException&)
{
- validInfo= sal_False;
+ validInfo= false;
}
if( ! validInfo)
{
- invInfo= inv2->getInfoForName( sMemberName, sal_True);
+ invInfo= inv2->getInfoForName( sMemberName, true);
}
if( invInfo.aName.pData)
{
- bTypesAvailable= sal_True;
+ bTypesAvailable= true;
info= invInfo;
}
}
@@ -481,7 +481,7 @@ Any SAL_CALL InterfaceOleWrapper_Impl::createBridge(const Any& modelDepObject,
{
if( xInt == Reference<XInterface>( static_cast<XWeak*>( this), UNO_QUERY))
{
- VARIANT *pVar= (VARIANT*)CoTaskMemAlloc( sizeof( VARIANT));
+ VARIANT *pVar= static_cast<VARIANT*>(CoTaskMemAlloc( sizeof( VARIANT)));
if( pVar)
{
pVar->vt= VT_DISPATCH;
@@ -536,7 +536,7 @@ Reference<XInterface> InterfaceOleWrapper_Impl::createComWrapperInstance()
bool getType( const BSTR name, Type & type)
{
bool ret = false;
- typelib_TypeDescription * pDesc= NULL;
+ typelib_TypeDescription * pDesc= nullptr;
OUString str( reinterpret_cast<const sal_Unicode*>(name));
typelib_typedescription_getByName( &pDesc, str.pData );
if( pDesc)
@@ -548,9 +548,9 @@ bool getType( const BSTR name, Type & type)
return ret;
}
-static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
+static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
{
- sal_Bool ret = sal_False;
+ bool ret = false;
HRESULT hr;
// Handle JScriptValue objects and JScript out params ( Array object )
@@ -575,7 +575,7 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
&& varBool == VARIANT_TRUE))
{
if( SUCCEEDED( spValueDest->Set( CComVariant(), *pSource)))
- ret= sal_True;
+ ret= true;
}
}
else if (pDest->vt == VT_DISPATCH)// VT_DISPATCH -> JScript out param
@@ -595,7 +595,7 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
DISPID dwDispID;
if( SUCCEEDED( spDispEx->GetDispID( nullProp, fdexNameEnsure, &dwDispID)))
{
- DISPPARAMS dispparams = {NULL, NULL, 1, 1};
+ DISPPARAMS dispparams = {nullptr, nullptr, 1, 1};
dispparams.rgvarg = pSource;
DISPID dispidPut = DISPID_PROPERTYPUT;
dispparams.rgdispidNamedArgs = &dispidPut;
@@ -603,12 +603,12 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
if (pSource->vt == VT_UNKNOWN || pSource->vt == VT_DISPATCH ||
(pSource->vt & VT_ARRAY) || (pSource->vt & VT_BYREF))
hr = spDispEx->InvokeEx(dwDispID, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUTREF,
- &dispparams, NULL, NULL, NULL);
+ &dispparams, nullptr, nullptr, nullptr);
else
hr= spDispEx->InvokeEx(dwDispID, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT,
- &dispparams, NULL, NULL, NULL);
+ &dispparams, nullptr, nullptr, nullptr);
if( SUCCEEDED(hr))
- ret= sal_True;
+ ret= true;
}
}
}
@@ -626,10 +626,10 @@ static sal_Bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
// Thus we are in charge of freeing an eventual value contained by the inner VARIANT
// Please note: VariantCopy doesn't free a VT_BYREF value
// The out parameters are expected to have always a valid type
-static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
+static bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
{
HRESULT hr;
- sal_Bool ret = FALSE;
+ bool ret = false;
// Out parameter must be VT_BYREF
if ((V_VT(pDest) & VT_BYREF) != 0 )
{
@@ -643,7 +643,7 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
// VT_DISPATCH, VT_UNKNOWN, VT_ARRAY, VT_BSTR in the VARIANT that
// is contained in pDest are released by VariantCopy
VariantCopy(V_VARIANTREF(pDest), pSource);
- ret = sal_True;
+ ret = true;
}
else
{
@@ -653,13 +653,13 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
if ((oleTypeFlags & VT_ARRAY) != 0)
{
// In / Out Param
- if( *V_ARRAYREF(pDest) != NULL)
+ if( *V_ARRAYREF(pDest) != nullptr)
hr= SafeArrayCopyData( V_ARRAY(pSource), *V_ARRAYREF(pDest));
else
// Out Param
- hr= SafeArrayCopy(V_ARRAY(pSource), V_ARRAYREF(pDest)) == NOERROR;
+ hr= SafeArrayCopy(V_ARRAY(pSource), V_ARRAYREF(pDest));
if( SUCCEEDED( hr))
- ret = sal_True;
+ ret = true;
}
else
{
@@ -669,92 +669,92 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
case VT_I2:
{
*V_I2REF(pDest) = V_I2(pSource);
- ret = sal_True;
+ ret = true;
break;
}
case VT_I4:
*V_I4REF(pDest) = V_I4(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_R4:
*V_R4REF(pDest) = V_R4(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_R8:
*V_R8REF(pDest) = V_R8(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_CY:
*V_CYREF(pDest) = V_CY(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_DATE:
*V_DATEREF(pDest) = V_DATE(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_BSTR:
SysFreeString( *pDest->pbstrVal);
*V_BSTRREF(pDest) = SysAllocString(V_BSTR(pSource));
- ret = sal_True;
+ ret = true;
break;
case VT_DISPATCH:
- if (*V_DISPATCHREF(pDest) != NULL)
+ if (*V_DISPATCHREF(pDest) != nullptr)
(*V_DISPATCHREF(pDest))->Release();
*V_DISPATCHREF(pDest) = V_DISPATCH(pSource);
- if (*V_DISPATCHREF(pDest) != NULL)
+ if (*V_DISPATCHREF(pDest) != nullptr)
(*V_DISPATCHREF(pDest))->AddRef();
- ret = sal_True;
+ ret = true;
break;
case VT_ERROR:
*V_ERRORREF(pDest) = V_ERROR(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_BOOL:
*V_BOOLREF(pDest) = V_BOOL(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_UNKNOWN:
- if (*V_UNKNOWNREF(pDest) != NULL)
+ if (*V_UNKNOWNREF(pDest) != nullptr)
(*V_UNKNOWNREF(pDest))->Release();
*V_UNKNOWNREF(pDest) = V_UNKNOWN(pSource);
- if (*V_UNKNOWNREF(pDest) != NULL)
+ if (*V_UNKNOWNREF(pDest) != nullptr)
(*V_UNKNOWNREF(pDest))->AddRef();
- ret = sal_True;
+ ret = true;
break;
case VT_I1:
*V_I1REF(pDest) = V_I1(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_UI1:
*V_UI1REF(pDest) = V_UI1(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_UI2:
*V_UI2REF(pDest) = V_UI2(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_UI4:
*V_UI4REF(pDest) = V_UI4(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_INT:
*V_INTREF(pDest) = V_INT(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_UINT:
*V_UINTREF(pDest) = V_UINT(pSource);
- ret = sal_True;
+ ret = true;
break;
case VT_DECIMAL:
memcpy(pDest->pdecVal, pSource, sizeof(DECIMAL));
- ret = sal_True;
+ ret = true;
break;
default:
break;
@@ -776,7 +776,7 @@ static sal_Bool writeBackOutParameter(VARIANTARG* pDest, VARIANT* pSource)
SysFreeString( *pDest->pbstrVal);
*pDest->pbstrVal= SysAllocString( buff);
- ret = sal_True;
+ ret = true;
}
}
}
@@ -797,7 +797,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember,
try
{
- sal_Bool bHandled= sal_False;
+ bool bHandled= false;
ret= InvokeGeneral( dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo,
puArgErr, bHandled);
if( bHandled)
@@ -829,7 +829,7 @@ STDMETHODIMP InterfaceOleWrapper_Impl::Invoke(DISPID dispidMember,
ret= doGetProperty( pdispparams, pvarResult,
pexcepinfo, d.name);
}
- else if ((flags & DISPATCH_PROPERTYPUT || flags & DISPATCH_PROPERTYPUTREF) != 0)
+ else if ((flags & DISPATCH_PROPERTYPUT) != 0 || (flags & DISPATCH_PROPERTYPUTREF) != 0)
{
if (pdispparams->cArgs != 1)
ret = DISP_E_BADPARAMCOUNT;
@@ -915,7 +915,7 @@ HRESULT InterfaceOleWrapper_Impl::doInvoke( DISPPARAMS * pdispparams, VARIANT *
}
// write back return value
- if (pvarResult != NULL)
+ if (pvarResult != nullptr)
anyToVariant(pvarResult, returnValue);
}
catch(const IllegalArgumentException & e) //XInvocation::invoke
@@ -1004,7 +1004,7 @@ HRESULT InterfaceOleWrapper_Impl::doGetProperty( DISPPARAMS * /*pdispparams*/, V
}
HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/,
- EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence<Any> params)
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString& name, Sequence<Any> const & params)
{
HRESULT ret= S_OK;
@@ -1022,7 +1022,7 @@ HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, V
}
catch(const InvocationTargetException &e)
{
- if (pexcepinfo != NULL)
+ if (pexcepinfo != nullptr)
{
Any org = e.TargetException;
@@ -1042,7 +1042,7 @@ HRESULT InterfaceOleWrapper_Impl::doSetProperty( DISPPARAMS * /*pdispparams*/, V
HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
- unsigned int * /*puArgErr*/, sal_Bool& bHandled)
+ unsigned int * /*puArgErr*/, bool& bHandled)
{
HRESULT ret= S_OK;
try
@@ -1051,9 +1051,9 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
// is that we put an object into an Array object ( out parameter). We have to return
// IDispatch otherwise the object cannot be accessed from the Script.
if( dispidMember == DISPID_VALUE && wFlags == DISPATCH_PROPERTYGET
- && m_defaultValueType != VT_EMPTY && pvarResult != NULL)
+ && m_defaultValueType != VT_EMPTY && pvarResult != nullptr)
{
- bHandled= sal_True;
+ bHandled= true;
if( m_defaultValueType == VT_DISPATCH)
{
pvarResult->vt= VT_DISPATCH;
@@ -1066,7 +1066,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
// function: _GetValueObject
else if( dispidMember == DISPID_JSCRIPT_VALUE_FUNC)
{
- bHandled= sal_True;
+ bHandled= true;
if( !pvarResult)
ret= E_POINTER;
CComObject< JScriptValue>* pValue;
@@ -1086,8 +1086,8 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
}
else if( dispidMember == DISPID_GET_STRUCT_FUNC)
{
- bHandled= sal_True;
- sal_Bool bStruct= sal_False;
+ bHandled= true;
+ bool bStruct= false;
Reference<XIdlReflection> xRefl = theCoreReflection::get(comphelper::getComponentContext(m_smgr));
@@ -1106,15 +1106,15 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
if( var.vt == VT_DISPATCH)
{
VariantCopy( pvarResult, & var);
- bStruct= sal_True;
+ bStruct= true;
}
}
}
- ret= bStruct == sal_True ? S_OK : DISP_E_EXCEPTION;
+ ret= bStruct ? S_OK : DISP_E_EXCEPTION;
}
else if (dispidMember == DISPID_CREATE_TYPE_FUNC)
{
- bHandled= sal_True;
+ bHandled= true;
if( !pvarResult)
ret= E_POINTER;
// the first parameter is in DISPPARAMS rgvargs contains the name of the struct.
@@ -1126,7 +1126,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
//check if the provided name represents a valid type
Type type;
- if (getType(arg.bstrVal, type) == false)
+ if (!getType(arg.bstrVal, type))
{
writeExcepinfo(pexcepinfo,OUString(
"[automation bridge] A UNO type with the name " +
@@ -1134,7 +1134,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
return DISP_E_EXCEPTION;
}
- if (createUnoTypeWrapper(arg.bstrVal, pvarResult) == false)
+ if (!createUnoTypeWrapper(arg.bstrVal, pvarResult))
{
writeExcepinfo(pexcepinfo, "[automation bridge] InterfaceOleWrapper_Impl::InvokeGeneral\n"
"Could not initialize UnoTypeWrapper object!");
@@ -1313,7 +1313,7 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /*
HRESULT ret = S_OK;
try
{
- sal_Bool bHandled= sal_False;
+ bool bHandled= false;
ret= InvokeGeneral( dispidMember, wFlags, pdispparams, pvarResult, pexcepinfo,
puArgErr, bHandled);
if( bHandled)
@@ -1498,7 +1498,7 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /*
{
// Remember the name as not existing
// and remove the MemberInfo
- m_badNameMap[info.name]= sal_False;
+ m_badNameMap[info.name]= false;
m_idToMemberInfoMap.erase( it_MemberInfo);
}
} // if( ! info.flags )
@@ -1556,7 +1556,7 @@ STDMETHODIMP UnoObjectWrapperRemoteOpt::Invoke ( DISPID dispidMember, REFIID /*
}
HRESULT UnoObjectWrapperRemoteOpt::methodInvoke( DISPID /*dispidMember*/, DISPPARAMS * /*pdispparams*/, VARIANT * /*pvarResult*/,
- EXCEPINFO * /*pexcepinfo*/, unsigned int * /*puArgErr*/, Sequence<Any>)
+ EXCEPINFO * /*pexcepinfo*/, unsigned int * /*puArgErr*/, Sequence<Any> const &)
{
return S_OK;
}
@@ -1565,7 +1565,7 @@ HRESULT UnoObjectWrapperRemoteOpt::methodInvoke( DISPID /*dispidMember*/, DISPPA
static HRESULT mapCannotConvertException(const CannotConvertException &e, unsigned int * puArgErr)
{
HRESULT ret;
- sal_Bool bWriteIndex= sal_True;
+ bool bWriteIndex= true;
switch ( e.Reason)
{
@@ -1601,11 +1601,11 @@ static HRESULT mapCannotConvertException(const CannotConvertException &e, unsign
break;
default:
ret = E_UNEXPECTED;
- bWriteIndex= sal_False;
+ bWriteIndex= false;
break;
}
- if( bWriteIndex && puArgErr != NULL)
+ if( bWriteIndex && puArgErr != nullptr)
*puArgErr = e.ArgumentIndex;
return ret;
}
diff --git a/extensions/source/ole/unoobjw.hxx b/extensions/source/ole/unoobjw.hxx
index af067eb66db3..170e2f2f9d3a 100644
--- a/extensions/source/ole/unoobjw.hxx
+++ b/extensions/source/ole/unoobjw.hxx
@@ -53,7 +53,7 @@ struct hash_IUnknown_Impl
{
size_t operator()(const IUnknown* p) const
{
- return (size_t)p;
+ return reinterpret_cast<size_t>(p);
}
};
@@ -85,7 +85,7 @@ typedef std::unordered_map
typedef std::unordered_map
<
OUString,
- sal_Bool,
+ bool,
OUStringHash
> BadNameMap;
@@ -110,28 +110,28 @@ public:
InterfaceOleWrapper_Impl(Reference<XMultiServiceFactory>& xFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
- ~InterfaceOleWrapper_Impl();
+ ~InterfaceOleWrapper_Impl() override;
/* 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;
/* IDispatch methods */
- STDMETHOD( GetTypeInfoCount )( unsigned int * pctinfo );
- STDMETHOD( GetTypeInfo )( unsigned int itinfo, LCID lcid, ITypeInfo ** pptinfo );
+ STDMETHOD( GetTypeInfoCount )( unsigned int * pctinfo ) override;
+ STDMETHOD( GetTypeInfo )( unsigned int itinfo, LCID lcid, ITypeInfo ** pptinfo ) override;
STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
- LCID lcid, DISPID * rgdispid );
+ LCID lcid, DISPID * rgdispid ) override;
STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
- unsigned int * puArgErr );
+ unsigned int * puArgErr ) override;
/* IDispatchEx methods */
virtual HRESULT STDMETHODCALLTYPE GetDispID(
/* [in] */ BSTR bstrName,
/* [in] */ DWORD grfdex,
- /* [out] */ DISPID __RPC_FAR *pid);
+ /* [out] */ DISPID __RPC_FAR *pid) override;
virtual /* [local] */ HRESULT STDMETHODCALLTYPE InvokeEx(
/* [in] */ DISPID id,
@@ -140,50 +140,50 @@ public:
/* [in] */ DISPPARAMS __RPC_FAR *pdp,
/* [out] */ VARIANT __RPC_FAR *pvarRes,
/* [out] */ EXCEPINFO __RPC_FAR *pei,
- /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller);
+ /* [unique][in] */ IServiceProvider __RPC_FAR *pspCaller) override;
virtual HRESULT STDMETHODCALLTYPE DeleteMemberByName(
/* [in] */ BSTR bstr,
- /* [in] */ DWORD grfdex);
+ /* [in] */ DWORD grfdex) override;
virtual HRESULT STDMETHODCALLTYPE DeleteMemberByDispID(
- /* [in] */ DISPID id);
+ /* [in] */ DISPID id) override;
virtual HRESULT STDMETHODCALLTYPE GetMemberProperties(
/* [in] */ DISPID id,
/* [in] */ DWORD grfdexFetch,
- /* [out] */ DWORD __RPC_FAR *pgrfdex);
+ /* [out] */ DWORD __RPC_FAR *pgrfdex) override;
virtual HRESULT STDMETHODCALLTYPE GetMemberName(
/* [in] */ DISPID id,
- /* [out] */ BSTR __RPC_FAR *pbstrName);
+ /* [out] */ BSTR __RPC_FAR *pbstrName) override;
virtual HRESULT STDMETHODCALLTYPE GetNextDispID(
/* [in] */ DWORD grfdex,
/* [in] */ DISPID id,
- /* [out] */ DISPID __RPC_FAR *pid);
+ /* [out] */ DISPID __RPC_FAR *pid) override;
virtual HRESULT STDMETHODCALLTYPE GetNameSpaceParent(
- /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk);
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunk) override;
// XBridgeSupplier2 ---------------------------------------------------
virtual Any SAL_CALL createBridge(const Any& modelDepObject,
const Sequence<sal_Int8>& ProcessId,
sal_Int16 sourceModelType,
sal_Int16 destModelType)
- throw (IllegalArgumentException, RuntimeException);
+ throw (IllegalArgumentException, RuntimeException) override;
//XInitialization -----------------------------------------------------
- virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException);
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException) override;
// IUnoObjectWrapper
- STDMETHOD( getWrapperXInterface)( Reference<XInterface>* pXInt);
- STDMETHOD( getOriginalUnoObject)( Reference<XInterface>* pXInt);
- STDMETHOD( getOriginalUnoStruct)( Any * pStruct);
+ STDMETHOD( getWrapperXInterface)( Reference<XInterface>* pXInt) override;
+ STDMETHOD( getOriginalUnoObject)( Reference<XInterface>* pXInt) override;
+ STDMETHOD( getOriginalUnoStruct)( Any * pStruct) override;
// UnoConversionUtility
- virtual Reference< XInterface > createUnoWrapperInstance();
- virtual Reference< XInterface > createComWrapperInstance();
+ virtual Reference< XInterface > createUnoWrapperInstance() override;
+ virtual Reference< XInterface > createComWrapperInstance() override;
protected:
@@ -194,16 +194,16 @@ protected:
EXCEPINFO * pexcepinfo, OUString & name );
virtual HRESULT doSetProperty( DISPPARAMS * pdispparams, VARIANT * pvarResult,
- EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any> params);
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, OUString & name, Sequence<Any> const & params);
virtual HRESULT InvokeGeneral( DISPID dispidMember, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
- unsigned int * puArgErr, sal_Bool& bHandled);
+ unsigned int * puArgErr, bool& bHandled);
void convertDispparamsArgs( DISPID id, unsigned short wFlags, DISPPARAMS* pdispparams,
Sequence<Any>& rSeq);
- sal_Bool getInvocationInfoForCall(DISPID id, InvocationInfo& info);
+ bool getInvocationInfoForCall(DISPID id, InvocationInfo& info);
Reference<XInvocation> m_xInvocation;
Reference<XExactName> m_xExactName;
@@ -239,23 +239,23 @@ class UnoObjectWrapperRemoteOpt: public InterfaceOleWrapper_Impl
{
public:
UnoObjectWrapperRemoteOpt( Reference<XMultiServiceFactory>& aFactory, sal_uInt8 unoWrapperClass, sal_uInt8 comWrapperClass);
- ~UnoObjectWrapperRemoteOpt();
+ ~UnoObjectWrapperRemoteOpt() override;
STDMETHOD( GetIDsOfNames )( REFIID riid, OLECHAR ** rgszNames, unsigned int cNames,
- LCID lcid, DISPID * rgdispid );
+ LCID lcid, DISPID * rgdispid ) override;
STDMETHOD( Invoke )( DISPID dispidMember, REFIID riid, LCID lcid, unsigned short wFlags,
DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo,
- unsigned int * puArgErr );
+ unsigned int * puArgErr ) override;
// UnoConversionUtility
// If UNO interfaces are converted in methods of this class then
// they are always wrapped with instances of this class
- virtual Reference< XInterface > createUnoWrapperInstance();
+ virtual Reference< XInterface > createUnoWrapperInstance() override;
protected:
- HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult,
- EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence<Any> params);
+ static HRESULT methodInvoke( DISPID dispidMember, DISPPARAMS * pdispparams, VARIANT * pvarResult,
+ EXCEPINFO * pexcepinfo, unsigned int * puArgErr, Sequence<Any> const & params);
// In GetIDsOfNames are blindly passed out, that is without verifying
// the name. If two names are passed in during different calls to
// GetIDsOfNames and the names differ only in their cases then different
diff --git a/extensions/source/ole/unotypewrapper.cxx b/extensions/source/ole/unotypewrapper.cxx
index 6d46ab8991a2..3d10e7675380 100644
--- a/extensions/source/ole/unotypewrapper.cxx
+++ b/extensions/source/ole/unotypewrapper.cxx
@@ -114,7 +114,7 @@ STDMETHODIMP UnoTypeWrapper::Invoke( DISPID dispIdMember,
EXCEPINFO* /*pExcepInfo*/,
UINT* /*puArgErr*/)
{
- if (pDispParams == NULL)
+ if (pDispParams == nullptr)
return DISP_E_EXCEPTION;
if( pDispParams->cNamedArgs)
@@ -127,7 +127,7 @@ STDMETHODIMP UnoTypeWrapper::Invoke( DISPID dispIdMember,
case DISPID_VALUE: // DISPID_VALUE
if (wFlags & DISPATCH_PROPERTYGET)
{
- if (pVarResult == NULL)
+ if (pVarResult == nullptr)
{
ret = E_POINTER;
break;
diff --git a/extensions/source/ole/unotypewrapper.hxx b/extensions/source/ole/unotypewrapper.hxx
index 4b217f2aadba..e5b4c3c20dca 100644
--- a/extensions/source/ole/unotypewrapper.hxx
+++ b/extensions/source/ole/unotypewrapper.hxx
@@ -42,20 +42,27 @@ public:
BEGIN_COM_MAP(UnoTypeWrapper)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IUnoTypeWrapper)
+#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
// IDispatch -------------------------------------------
- STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
+ STDMETHOD( GetTypeInfoCount)(UINT *pctinfo) override;
STDMETHOD( GetTypeInfo)( UINT iTInfo,
LCID lcid,
- ITypeInfo **ppTInfo);
+ ITypeInfo **ppTInfo) override;
STDMETHOD( GetIDsOfNames)( REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
- DISPID *rgDispId);
+ DISPID *rgDispId) override;
STDMETHOD( Invoke)( DISPID dispIdMember,
REFIID riid,
@@ -64,10 +71,10 @@ public:
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
- UINT *puArgErr);
+ UINT *puArgErr) override;
// IUnoTypeWrapper --------------------------------------
- STDMETHOD(put_Name)(BSTR val);
- STDMETHOD(get_Name)(BSTR* pVal);
+ STDMETHOD(put_Name)(BSTR val) override;
+ STDMETHOD(get_Name)(BSTR* pVal) override;
CComBSTR m_sName;
};
diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx
index 71474773e566..11d7ce57827d 100644
--- a/extensions/source/ole/windata.hxx
+++ b/extensions/source/ole/windata.hxx
@@ -61,13 +61,13 @@ public:
explicit VarDesc(ITypeInfo* pTypeInfo) :
m_pTypeInfo(pTypeInfo),
- m_pVarDesc(NULL)
+ m_pVarDesc(nullptr)
{
OSL_ASSERT(pTypeInfo);
}
~VarDesc()
{
- if (m_pVarDesc != NULL)
+ if (m_pVarDesc != nullptr)
{
m_pTypeInfo->ReleaseVarDesc(m_pVarDesc);
}
@@ -101,7 +101,7 @@ public:
explicit FuncDesc(ITypeInfo * pTypeInfo) :
m_pTypeInfo(pTypeInfo),
- m_pFuncDesc(NULL)
+ m_pFuncDesc(nullptr)
{
OSL_ASSERT(pTypeInfo);
}
@@ -134,17 +134,17 @@ public:
FUNCDESC* Detach()
{
FUNCDESC* pDesc = m_pFuncDesc;
- m_pFuncDesc = NULL;
+ m_pFuncDesc = nullptr;
return pDesc;
}
void ReleaseFUNCDESC()
{
- if (m_pFuncDesc != NULL)
+ if (m_pFuncDesc != nullptr)
{
m_pTypeInfo->ReleaseFuncDesc(m_pFuncDesc);
}
- m_pFuncDesc = NULL;
+ m_pFuncDesc = nullptr;
}
};
//Wrapper for EXCEPINFO structure
@@ -159,11 +159,11 @@ public:
}
~ExcepInfo()
{
- if (bstrSource != NULL)
+ if (bstrSource != nullptr)
::SysFreeString(bstrSource);
- if (bstrDescription != NULL)
+ if (bstrDescription != nullptr)
::SysFreeString(bstrDescription);
- if (bstrHelpFile != NULL)
+ if (bstrHelpFile != nullptr)
::SysFreeString(bstrHelpFile);
}
};
@@ -179,13 +179,13 @@ public:
explicit TypeAttr(ITypeInfo* pTypeInfo) :
m_pTypeInfo( pTypeInfo ),
- m_pTypeAttr( NULL )
+ m_pTypeAttr( nullptr )
{
OSL_ASSERT(pTypeInfo);
}
~TypeAttr() throw()
{
- if (m_pTypeAttr != NULL)
+ if (m_pTypeAttr != nullptr)
{
m_pTypeInfo->ReleaseTypeAttr(m_pTypeAttr);
}
diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx
index 558c45e0406b..0653359c8114 100644
--- a/extensions/source/scanner/scanwin.cxx
+++ b/extensions/source/scanner/scanwin.cxx
@@ -93,32 +93,28 @@ class ImpTwain : public ::cppu::WeakImplHelper< util::XCloseListener >
bool mbCloseFrameOnExit;
bool ImplHandleMsg( void* pMsg );
- void ImplCreate();
void ImplOpenSourceManager();
void ImplOpenSource();
bool ImplEnableSource();
void ImplXfer();
void ImplFallback( ULONG_PTR nEvent );
- void ImplSendCloseEvent();
void ImplDeregisterCloseListener();
void ImplRegisterCloseListener();
- uno::Reference< frame::XFrame > ImplGetActiveFrame();
- uno::Reference< util::XCloseBroadcaster > ImplGetActiveFrameCloseBroadcaster();
DECL_LINK( ImplFallbackHdl, void*, void );
DECL_LINK( ImplDestroyHdl, void*, void );
// from util::XCloseListener
- virtual void SAL_CALL queryClosing( const lang::EventObject& Source, sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
- virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException) override;
+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException) override;
// from lang::XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException);
+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException) override;
public:
ImpTwain( ScannerManager& rMgr, const Link<unsigned long,void>& rNotifyLink );
- ~ImpTwain();
+ ~ImpTwain() override;
void Destroy();
@@ -126,7 +122,7 @@ public:
bool InitXfer();
};
-static ImpTwain* pImpTwainInstance = NULL;
+static ImpTwain* pImpTwainInstance = nullptr;
LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
@@ -135,9 +131,9 @@ LRESULT CALLBACK TwainWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
{
- MSG* pMsg = (MSG*) lParam;
+ MSG* pMsg = reinterpret_cast<MSG*>(lParam);
- if( ( nCode < 0 ) || ( pImpTwainInstance->hTwainWnd != pMsg->hwnd ) || !pImpTwainInstance->ImplHandleMsg( (void*) lParam ) )
+ if( ( nCode < 0 ) || ( pImpTwainInstance->hTwainWnd != pMsg->hwnd ) || !pImpTwainInstance->ImplHandleMsg( reinterpret_cast<void*>(lParam) ) )
{
return CallNextHookEx( pImpTwainInstance->hTwainHook, nCode, wParam, lParam );
}
@@ -150,16 +146,72 @@ LRESULT CALLBACK TwainMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
}
}
+namespace {
+
+uno::Reference< frame::XFrame > ImplGetActiveFrame()
+{
+ try
+ {
+ // query desktop instance
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
+
+ uno::Reference< frame::XFrame > xActiveFrame = xDesktop->getActiveFrame();
+
+ if( xActiveFrame.is() )
+ {
+ return xActiveFrame;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ OSL_FAIL("ImpTwain::ImplGetActiveFrame: Could not determine active frame!");
+ return uno::Reference< frame::XFrame >();
+}
+
+uno::Reference< util::XCloseBroadcaster > ImplGetActiveFrameCloseBroadcaster()
+{
+ try
+ {
+ return uno::Reference< util::XCloseBroadcaster >( ImplGetActiveFrame(), uno::UNO_QUERY );
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ OSL_FAIL("ImpTwain::ImplGetActiveFrameCloseBroadcaster: Could determine close broadcaster on active frame!");
+ return uno::Reference< util::XCloseBroadcaster >();
+}
+
+void ImplSendCloseEvent()
+{
+ try
+ {
+ uno::Reference< util::XCloseable > xCloseable( ImplGetActiveFrame(), uno::UNO_QUERY );
+
+ if( xCloseable.is() )
+ xCloseable->close( true );
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ OSL_FAIL("ImpTwain::ImplSendCloseEvent: Could not send required close broadcast!");
+}
+
+}
+
// #107835# hold reference to ScannerManager, to prevent premature death
ImpTwain::ImpTwain( ScannerManager& rMgr, const Link<unsigned long,void>& rNotifyLink ) :
mxMgr( uno::Reference< scanner::XScannerManager >( static_cast< OWeakObject* >( &rMgr ), uno::UNO_QUERY) ),
mrMgr( rMgr ),
aNotifyLink( rNotifyLink ),
- pDSM( NULL ),
- pMod( NULL ),
+ pDSM( nullptr ),
+ pMod( nullptr ),
nCurState( 1 ),
- hTwainWnd( 0 ),
- hTwainHook( 0 ),
+ hTwainWnd( nullptr ),
+ hTwainHook( nullptr ),
mbCloseFrameOnExit( false )
{
// setup TWAIN window
@@ -182,11 +234,11 @@ ImpTwain::ImpTwain( ScannerManager& rMgr, const Link<unsigned long,void>& rNotif
strncpy( aAppIdent.ProductName, "Office", 32 );
aAppIdent.ProductName[32] = aAppIdent.ProductName[33] = 0;
- WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, "TwainClass" };
+ WNDCLASS aWc = { 0, &TwainWndProc, 0, sizeof( WNDCLASS ), GetModuleHandle( nullptr ), nullptr, nullptr, nullptr, nullptr, "TwainClass" };
RegisterClass( &aWc );
- hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, HWND_DESKTOP, NULL, aWc.hInstance, 0 );
- hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, NULL, GetCurrentThreadId() );
+ hTwainWnd = CreateWindowEx( WS_EX_TOPMOST, aWc.lpszClassName, "TWAIN", 0, 0, 0, 0, 0, HWND_DESKTOP, nullptr, aWc.hInstance, nullptr );
+ hTwainHook = SetWindowsHookEx( WH_GETMESSAGE, &TwainMsgProc, nullptr, GetCurrentThreadId() );
// block destruction until ImplDestroyHdl is called
mxSelfRef = static_cast< ::cppu::OWeakObject* >( this );
@@ -202,7 +254,7 @@ ImpTwain::~ImpTwain()
void ImpTwain::Destroy()
{
ImplFallback( TWAIN_EVENT_NONE );
- Application::PostUserEvent( LINK( this, ImpTwain, ImplDestroyHdl ), NULL );
+ Application::PostUserEvent( LINK( this, ImpTwain, ImplDestroyHdl ) );
}
bool ImpTwain::SelectSource()
@@ -215,9 +267,10 @@ bool ImpTwain::SelectSource()
{
TW_IDENTITY aIdent;
- aIdent.Id = 0, aIdent.ProductName[ 0 ] = '\0';
+ aIdent.Id = 0;
+ aIdent.ProductName[ 0 ] = '\0';
aNotifyLink.Call( TWAIN_EVENT_SCANNING );
- nRet = PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &aIdent );
+ nRet = PFUNC( &aAppIdent, nullptr, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &aIdent );
}
ImplFallback( TWAIN_EVENT_QUIT );
@@ -251,13 +304,13 @@ void ImpTwain::ImplOpenSourceManager()
{
pMod = new ::osl::Module( OUString() );
- if( pMod->load( OUString( TWAIN_LIBNAME ) ) )
+ if( pMod->load( TWAIN_LIBNAME ) )
{
nCurState = 2;
- pDSM = (DSMENTRYPROC) pMod->getSymbol(OUString(TWAIN_FUNCNAME));
+ pDSM = reinterpret_cast<DSMENTRYPROC>(pMod->getSymbol(TWAIN_FUNCNAME));
if (pDSM &&
- ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, &hTwainWnd ) == TWRC_SUCCESS ) )
+ ( PFUNC( &aAppIdent, nullptr, DG_CONTROL, DAT_PARENT, MSG_OPENDSM, &hTwainWnd ) == TWRC_SUCCESS ) )
{
nCurState = 3;
}
@@ -265,7 +318,7 @@ void ImpTwain::ImplOpenSourceManager()
else
{
delete pMod;
- pMod = NULL;
+ pMod = nullptr;
}
}
}
@@ -274,13 +327,14 @@ void ImpTwain::ImplOpenSource()
{
if( 3 == nCurState )
{
- if( ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_GETDEFAULT, &aSrcIdent ) == TWRC_SUCCESS ) &&
- ( PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &aSrcIdent ) == TWRC_SUCCESS ) )
+ if( ( PFUNC( &aAppIdent, nullptr, DG_CONTROL, DAT_IDENTITY, MSG_GETDEFAULT, &aSrcIdent ) == TWRC_SUCCESS ) &&
+ ( PFUNC( &aAppIdent, nullptr, DG_CONTROL, DAT_IDENTITY, MSG_OPENDS, &aSrcIdent ) == TWRC_SUCCESS ) )
{
TW_CAPABILITY aCap = { CAP_XFERCOUNT, TWON_ONEVALUE, GlobalAlloc( GHND, sizeof( TW_ONEVALUE ) ) };
- TW_ONEVALUE* pVal = (TW_ONEVALUE*) GlobalLock( aCap.hContainer );
+ TW_ONEVALUE* pVal = static_cast<TW_ONEVALUE*>(GlobalLock( aCap.hContainer ));
- pVal->ItemType = TWTY_INT16, pVal->Item = 1;
+ pVal->ItemType = TWTY_INT16;
+ pVal->Item = 1;
GlobalUnlock( aCap.hContainer );
PFUNC( &aAppIdent, &aSrcIdent, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &aCap );
GlobalFree( aCap.hContainer );
@@ -322,7 +376,7 @@ bool ImpTwain::ImplEnableSource()
bool ImpTwain::ImplHandleMsg( void* pMsg )
{
TW_UINT16 nRet;
- PTWAINMSG pMess = (PTWAINMSG) pMsg;
+ PTWAINMSG pMess = static_cast<PTWAINMSG>(pMsg);
TW_EVENT aEvt = { pMess, MSG_NULL };
if (pDSM)
@@ -396,19 +450,19 @@ void ImpTwain::ImplXfer()
if( ( nXRes != -1 ) && ( nYRes != - 1 ) && ( nWidth != - 1 ) && ( nHeight != - 1 ) )
{
// set resolution of bitmap
- BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( (HGLOBAL) (sal_IntPtr) hDIB );
+ BITMAPINFOHEADER* pBIH = static_cast<BITMAPINFOHEADER*>(GlobalLock( reinterpret_cast<HGLOBAL>((sal_IntPtr) hDIB) ));
static const double fFactor = 100.0 / 2.54;
pBIH->biXPelsPerMeter = FRound( fFactor * nXRes );
pBIH->biYPelsPerMeter = FRound( fFactor * nYRes );
- GlobalUnlock( (HGLOBAL) (sal_IntPtr) hDIB );
+ GlobalUnlock( reinterpret_cast<HGLOBAL>((sal_IntPtr) hDIB) );
}
- mrMgr.SetData( (void*) (sal_IntPtr) hDIB );
+ mrMgr.SetData( reinterpret_cast<void*>((sal_IntPtr) hDIB) );
}
else
- GlobalFree( (HGLOBAL) (sal_IntPtr) hDIB );
+ GlobalFree( reinterpret_cast<HGLOBAL>((sal_IntPtr) hDIB) );
nCurState = 7;
}
@@ -422,12 +476,12 @@ void ImpTwain::ImplXfer()
void ImpTwain::ImplFallback( ULONG_PTR nEvent )
{
- Application::PostUserEvent( LINK( this, ImpTwain, ImplFallbackHdl ), (void*) nEvent );
+ Application::PostUserEvent( LINK( this, ImpTwain, ImplFallbackHdl ), reinterpret_cast<void*>(nEvent) );
}
IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData, void )
{
- const sal_uIntPtr nEvent = (sal_uIntPtr) pData;
+ const sal_uIntPtr nEvent = reinterpret_cast<sal_uIntPtr>(pData);
bool bFallback = true;
switch( nCurState )
@@ -461,14 +515,14 @@ IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData, void )
case 4:
{
- PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &aSrcIdent );
+ PFUNC( &aAppIdent, nullptr, DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &aSrcIdent );
nCurState = 3;
}
break;
case 3:
{
- PFUNC( &aAppIdent, NULL, DG_CONTROL, DAT_PARENT, MSG_CLOSEDSM, &hTwainWnd );
+ PFUNC( &aAppIdent, nullptr, DG_CONTROL, DAT_PARENT, MSG_CLOSEDSM, &hTwainWnd );
nCurState = 2;
}
break;
@@ -476,7 +530,7 @@ IMPL_LINK( ImpTwain, ImplFallbackHdl, void*, pData, void )
case 2:
{
delete pMod;
- pMod = NULL;
+ pMod = nullptr;
nCurState = 1;
}
break;
@@ -505,44 +559,8 @@ IMPL_LINK_NOARG( ImpTwain, ImplDestroyHdl, void*, void )
// permit destruction of ourselves (normally, refcount
// should drop to zero exactly here)
- mxSelfRef = NULL;
- pImpTwainInstance = NULL;
-}
-
-uno::Reference< frame::XFrame > ImpTwain::ImplGetActiveFrame()
-{
- try
- {
- // query desktop instance
- uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
-
- uno::Reference< frame::XFrame > xActiveFrame = xDesktop->getActiveFrame();
-
- if( xActiveFrame.is() )
- {
- return xActiveFrame;
- }
- }
- catch( const uno::Exception& )
- {
- }
-
- OSL_FAIL("ImpTwain::ImplGetActiveFrame: Could not determine active frame!");
- return uno::Reference< frame::XFrame >();
-}
-
-uno::Reference< util::XCloseBroadcaster > ImpTwain::ImplGetActiveFrameCloseBroadcaster()
-{
- try
- {
- return uno::Reference< util::XCloseBroadcaster >( ImplGetActiveFrame(), uno::UNO_QUERY );
- }
- catch( const uno::Exception& )
- {
- }
-
- OSL_FAIL("ImpTwain::ImplGetActiveFrameCloseBroadcaster: Could determine close broadcaster on active frame!");
- return uno::Reference< util::XCloseBroadcaster >();
+ mxSelfRef = nullptr;
+ pImpTwainInstance = nullptr;
}
void ImpTwain::ImplRegisterCloseListener()
@@ -616,23 +634,6 @@ void SAL_CALL ImpTwain::disposing( const lang::EventObject& /*Source*/ ) throw (
// we're not holding any references to the frame, thus noop
}
-void ImpTwain::ImplSendCloseEvent()
-{
- try
- {
- uno::Reference< util::XCloseable > xCloseable( ImplGetActiveFrame(), uno::UNO_QUERY );
-
- if( xCloseable.is() )
- xCloseable->close( true );
- }
- catch( const uno::Exception& )
- {
- }
-
- OSL_FAIL("ImpTwain::ImplSendCloseEvent: Could not send required close broadcast!");
-}
-
-
class Twain
{
uno::Reference< lang::XEventListener > mxListener;
@@ -655,8 +656,8 @@ public:
};
Twain::Twain() :
- mpCurMgr( NULL ),
- mpImpTwain( NULL ),
+ mpCurMgr( nullptr ),
+ mpImpTwain( nullptr ),
meState( TWAIN_STATE_NONE )
{
}
@@ -675,7 +676,7 @@ bool Twain::SelectSource( ScannerManager& rMgr )
{
// hold reference to ScannerManager, to prevent premature death
mxMgr.set( static_cast< OWeakObject* >( const_cast< ScannerManager* >( mpCurMgr = &rMgr ) ),
- uno::UNO_QUERY ),
+ uno::UNO_QUERY );
meState = TWAIN_STATE_NONE;
mpImpTwain = new ImpTwain( rMgr, LINK( this, Twain, ImpNotifyHdl ) );
@@ -695,7 +696,7 @@ bool Twain::PerformTransfer( ScannerManager& rMgr, const uno::Reference< lang::X
{
// hold reference to ScannerManager, to prevent premature death
mxMgr.set( static_cast< OWeakObject* >( const_cast< ScannerManager* >( mpCurMgr = &rMgr ) ),
- uno::UNO_QUERY ),
+ uno::UNO_QUERY );
mxListener = rxListener;
meState = TWAIN_STATE_NONE;
@@ -724,14 +725,14 @@ IMPL_LINK( Twain, ImpNotifyHdl, unsigned long, nEvent, void )
if( mpImpTwain )
{
mpImpTwain->Destroy();
- mpImpTwain = NULL;
- mpCurMgr = NULL;
+ mpImpTwain = nullptr;
+ mpCurMgr = nullptr;
}
if( mxListener.is() )
mxListener->disposing( lang::EventObject( mxMgr ) );
- mxListener = NULL;
+ mxListener = nullptr;
}
break;
@@ -742,14 +743,14 @@ IMPL_LINK( Twain, ImpNotifyHdl, unsigned long, nEvent, void )
meState = ( mpCurMgr->GetData() ? TWAIN_STATE_DONE : TWAIN_STATE_CANCELED );
mpImpTwain->Destroy();
- mpImpTwain = NULL;
- mpCurMgr = NULL;
+ mpImpTwain = nullptr;
+ mpCurMgr = nullptr;
if( mxListener.is() )
mxListener->disposing( lang::EventObject( mxMgr ) );
}
- mxListener = NULL;
+ mxListener = nullptr;
}
break;
@@ -768,19 +769,19 @@ void ScannerManager::ReleaseData()
{
if( mpData )
{
- GlobalFree( (HGLOBAL)(sal_IntPtr) mpData );
- mpData = NULL;
+ GlobalFree( static_cast<HGLOBAL>(mpData) );
+ mpData = nullptr;
}
}
awt::Size ScannerManager::getSize() throw(std::exception)
{
awt::Size aRet;
- HGLOBAL hDIB = (HGLOBAL)(sal_IntPtr) mpData;
+ HGLOBAL hDIB = static_cast<HGLOBAL>(mpData);
if( hDIB )
{
- BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( hDIB );
+ BITMAPINFOHEADER* pBIH = static_cast<BITMAPINFOHEADER*>(GlobalLock( hDIB ));
if( pBIH )
{
@@ -804,9 +805,9 @@ uno::Sequence< sal_Int8 > ScannerManager::getDIB() throw(std::exception)
if( mpData )
{
- HGLOBAL hDIB = (HGLOBAL)(sal_IntPtr) mpData;
+ HGLOBAL hDIB = static_cast<HGLOBAL>(mpData);
const sal_uInt32 nDIBSize = GlobalSize( hDIB );
- BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) GlobalLock( hDIB );
+ BITMAPINFOHEADER* pBIH = static_cast<BITMAPINFOHEADER*>(GlobalLock( hDIB ));
if( pBIH )
{
@@ -842,7 +843,7 @@ uno::Sequence< sal_Int8 > ScannerManager::getDIB() throw(std::exception)
aRet = uno::Sequence< sal_Int8 >( sizeof( BITMAPFILEHEADER ) + nDIBSize );
sal_Int8* pBuf = aRet.getArray();
- SvMemoryStream* pMemStm = new SvMemoryStream( (char*) pBuf, sizeof( BITMAPFILEHEADER ), StreamMode::WRITE );
+ SvMemoryStream* pMemStm = new SvMemoryStream( pBuf, sizeof( BITMAPFILEHEADER ), StreamMode::WRITE );
pMemStm->WriteChar( 'B' ).WriteChar( 'M' ).WriteUInt32( 0 ).WriteUInt32( 0 );
pMemStm->WriteUInt32( sizeof( BITMAPFILEHEADER ) + pBIH->biSize + ( nColEntries * sizeof( RGBQUAD ) ) );
diff --git a/extensions/source/update/check/onlinecheck.cxx b/extensions/source/update/check/onlinecheck.cxx
index 9324ff7699b5..3207647447f0 100644
--- a/extensions/source/update/check/onlinecheck.cxx
+++ b/extensions/source/update/check/onlinecheck.cxx
@@ -24,6 +24,8 @@
#include <sal/types.h>
#include <sal/macros.h>
+#include <onlinecheck.hxx>
+
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <wininet.h>
@@ -48,7 +50,7 @@ extern "C" bool SAL_CALL WNT_hasInternetConnection()
SAL_N_ELEMENTS(szConnectionName),
0 );
- return fIsConnected ? true : false;
+ return fIsConnected;
#ifndef __MINGW32__
} __except( EXCEPTION_EXECUTE_HANDLER ) {
diff --git a/extensions/source/update/check/onlinecheck.hxx b/extensions/source/update/check/onlinecheck.hxx
new file mode 100644
index 000000000000..731d3e6c2cbb
--- /dev/null
+++ b/extensions/source/update/check/onlinecheck.hxx
@@ -0,0 +1,33 @@
+/* -*- 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_EXTENSIONS_SOURCE_UPDATE_CHECK_ONLINECHECK_HXX
+#define INCLUDED_EXTENSIONS_SOURCE_UPDATE_CHECK_ONLINECHECK_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+#if defined(_WIN32)
+extern "C" bool SAL_CALL WNT_hasInternetConnection();
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx
index 7bee406f8b2d..437af2a3d541 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -53,6 +53,7 @@
#endif
#endif
+#include <onlinecheck.hxx>
#include "updateprotocol.hxx"
#include "updatecheckconfig.hxx"
@@ -70,10 +71,6 @@ namespace uno = com::sun::star::uno ;
#define PROPERTY_CLICK_HDL "MenuClickHDL"
#define PROPERTY_SHOW_MENUICON "MenuIconVisible"
-#if defined(_WIN32)
-extern "C" bool SAL_CALL WNT_hasInternetConnection();
-#endif
-
// Returns the URL of the release note for the given position
OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled)
{
@@ -606,7 +603,7 @@ DownloadThread::run()
#ifdef _WIN32
CoUninitialize();
- CoInitialize( NULL );
+ CoInitialize( nullptr );
#endif
while( schedule() )