[Libreoffice-commits] core.git: 21 commits - avmedia/source basic/qa basic/source bean/native bridges/inc bridges/source canvas/source codemaker/source comphelper/source configmgr/source connectivity/source cppuhelper/source dbaccess/source dbaccess/win32 desktop/source desktop/win32 dtrans/Library_dnd.mk dtrans/source embeddedobj/source embedserv/source extensions/source filter/source fpicker/source helpcompiler/inc hwpfilter/source i18npool/source include/comphelper include/sal
Stephan Bergmann
sbergman at redhat.com
Sun Oct 16 14:19:58 UTC 2016
avmedia/source/win/framegrabber.cxx | 26
avmedia/source/win/framegrabber.hxx | 12
avmedia/source/win/manager.hxx | 10
avmedia/source/win/player.cxx | 68 -
avmedia/source/win/player.hxx | 40
avmedia/source/win/window.cxx | 36
avmedia/source/win/window.hxx | 56 -
avmedia/source/win/winuno.cxx | 6
basic/qa/cppunit/test_vba.cxx | 2
basic/source/runtime/dllmgr-x64.cxx | 130 +-
basic/source/runtime/iosys.cxx | 2
basic/source/runtime/methods.cxx | 2
basic/source/runtime/methods1.cxx | 2
basic/source/sbx/sbxdec.cxx | 16
bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c | 2
bridges/inc/cppinterfaceproxy.hxx | 5
bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx | 55 -
bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx | 5
bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx | 138 +-
bridges/source/cpp_uno/msvc_win32_x86-64/mscx.hxx | 6
bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx | 66 -
bridges/source/cpp_uno/shared/vtablefactory.cxx | 2
canvas/source/directx/dx_9rm.cxx | 109 +-
canvas/source/directx/dx_bitmap.cxx | 5
canvas/source/directx/dx_bitmap.hxx | 16
canvas/source/directx/dx_bitmapcanvashelper.cxx | 2
canvas/source/directx/dx_canvas.cxx | 10
canvas/source/directx/dx_canvasbitmap.cxx | 16
canvas/source/directx/dx_canvasfont.cxx | 4
canvas/source/directx/dx_canvasfont.hxx | 18
canvas/source/directx/dx_canvashelper.cxx | 30
canvas/source/directx/dx_canvashelper.hxx | 2
canvas/source/directx/dx_canvashelper_texturefill.cxx | 4
canvas/source/directx/dx_config.hxx | 4
canvas/source/directx/dx_devicehelper.cxx | 12
canvas/source/directx/dx_gdiplususer.cxx | 2
canvas/source/directx/dx_impltools.cxx | 28
canvas/source/directx/dx_impltools.hxx | 3
canvas/source/directx/dx_spritecanvas.cxx | 8
canvas/source/directx/dx_spritecanvashelper.cxx | 8
canvas/source/directx/dx_spritedevicehelper.cxx | 14
canvas/source/directx/dx_spritedevicehelper.hxx | 4
canvas/source/directx/dx_spritehelper.cxx | 2
canvas/source/directx/dx_spritehelper.hxx | 2
canvas/source/directx/dx_surfacebitmap.cxx | 60 -
canvas/source/directx/dx_surfacebitmap.hxx | 16
canvas/source/directx/dx_textlayout.hxx | 44
canvas/source/directx/dx_textlayout_drawhelper.cxx | 8
canvas/source/directx/dx_vcltools.cxx | 21
canvas/source/directx/dx_winstuff.hxx | 10
codemaker/source/codemaker/global.cxx | 2
comphelper/source/misc/mimeconfighelper.cxx | 2
configmgr/source/components.cxx | 2
configmgr/source/winreg.cxx | 12
configmgr/source/writemodfile.cxx | 2
connectivity/source/drivers/ado/ACallableStatement.cxx | 22
connectivity/source/drivers/ado/ACatalog.cxx | 2
connectivity/source/drivers/ado/AColumn.cxx | 20
connectivity/source/drivers/ado/AColumns.cxx | 8
connectivity/source/drivers/ado/AConnection.cxx | 60 -
connectivity/source/drivers/ado/ADatabaseMetaData.cxx | 192 ++--
connectivity/source/drivers/ado/ADatabaseMetaDataImpl.cxx | 62 -
connectivity/source/drivers/ado/ADatabaseMetaDataResultSet.cxx | 92 -
connectivity/source/drivers/ado/ADatabaseMetaDataResultSetMetaData.cxx | 24
connectivity/source/drivers/ado/ADriver.cxx | 24
connectivity/source/drivers/ado/AGroup.cxx | 14
connectivity/source/drivers/ado/AGroups.cxx | 4
connectivity/source/drivers/ado/AIndex.cxx | 8
connectivity/source/drivers/ado/AIndexes.cxx | 4
connectivity/source/drivers/ado/AKey.cxx | 6
connectivity/source/drivers/ado/AKeys.cxx | 8
connectivity/source/drivers/ado/APreparedStatement.cxx | 28
connectivity/source/drivers/ado/AResultSet.cxx | 96 +-
connectivity/source/drivers/ado/AResultSetMetaData.cxx | 20
connectivity/source/drivers/ado/AStatement.cxx | 44
connectivity/source/drivers/ado/ATable.cxx | 12
connectivity/source/drivers/ado/ATables.cxx | 6
connectivity/source/drivers/ado/AUser.cxx | 16
connectivity/source/drivers/ado/AUsers.cxx | 6
connectivity/source/drivers/ado/AView.cxx | 6
connectivity/source/drivers/ado/AViews.cxx | 8
connectivity/source/drivers/ado/Aolevariant.cxx | 46
connectivity/source/drivers/ado/Aservices.cxx | 20
connectivity/source/drivers/ado/Awrapado.cxx | 320 +++---
connectivity/source/drivers/ado/adoimp.cxx | 12
connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx | 6
connectivity/source/inc/ado/ACallableStatement.hxx | 4
connectivity/source/inc/ado/ACatalog.hxx | 10
connectivity/source/inc/ado/AColumn.hxx | 16
connectivity/source/inc/ado/AColumns.hxx | 12
connectivity/source/inc/ado/AConnection.hxx | 10
connectivity/source/inc/ado/ADatabaseMetaData.hxx | 306 +++---
connectivity/source/inc/ado/ADatabaseMetaDataResultSet.hxx | 128 +-
connectivity/source/inc/ado/ADatabaseMetaDataResultSetMetaData.hxx | 44
connectivity/source/inc/ado/ADriver.hxx | 24
connectivity/source/inc/ado/AGroup.hxx | 30
connectivity/source/inc/ado/AGroups.hxx | 12
connectivity/source/inc/ado/AIndex.hxx | 14
connectivity/source/inc/ado/AIndexes.hxx | 12
connectivity/source/inc/ado/AKey.hxx | 18
connectivity/source/inc/ado/AKeys.hxx | 12
connectivity/source/inc/ado/APreparedStatement.hxx | 6
connectivity/source/inc/ado/AResultSet.hxx | 186 ++--
connectivity/source/inc/ado/AResultSetMetaData.hxx | 44
connectivity/source/inc/ado/AStatement.hxx | 6
connectivity/source/inc/ado/ATable.hxx | 32
connectivity/source/inc/ado/ATables.hxx | 12
connectivity/source/inc/ado/AUser.hxx | 36
connectivity/source/inc/ado/AUsers.hxx | 12
connectivity/source/inc/ado/AView.hxx | 10
connectivity/source/inc/ado/AViews.hxx | 12
connectivity/source/inc/ado/Aolevariant.hxx | 12
connectivity/source/inc/ado/Aolewrap.hxx | 16
connectivity/source/inc/ado/Awrapado.hxx | 132 +-
connectivity/source/inc/ado/Awrapadox.hxx | 12
connectivity/source/inc/ado/WrapCatalog.hxx | 2
connectivity/source/inc/ado/WrapColumn.hxx | 4
connectivity/source/inc/ado/WrapIndex.hxx | 14
connectivity/source/inc/ado/WrapKey.hxx | 2
connectivity/source/inc/ado/WrapTable.hxx | 2
connectivity/source/inc/ado/adoimp.hxx | 2
cppuhelper/source/weak.cxx | 2
dbaccess/source/ui/browser/genericcontroller.cxx | 8
dbaccess/source/ui/dlg/ConnectionHelper.cxx | 14
dbaccess/source/ui/dlg/ConnectionPage.cxx | 8
dbaccess/source/ui/dlg/adodatalinks.cxx | 48 -
dbaccess/source/ui/dlg/dsselect.cxx | 5
dbaccess/source/ui/dlg/odbcconfig.cxx | 6
dbaccess/win32/source/odbcconfig/odbcconfig.cxx | 34
desktop/source/app/app.cxx | 4
desktop/source/app/cmdlinehelp.cxx | 40
desktop/source/app/cmdlinehelp.hxx | 5
desktop/source/app/officeipcthread.cxx | 2
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 2
desktop/source/deployment/misc/dp_misc.cxx | 4
desktop/source/deployment/misc/lockfile.cxx | 4
desktop/win32/source/QuickStart/QuickStart.cxx | 23
desktop/win32/source/QuickStart/StdAfx.h | 59 -
desktop/win32/source/applauncher/launcher.cxx | 20
desktop/win32/source/guiloader/genericloader.cxx | 10
desktop/win32/source/guistdio/guistdio.inc | 52 -
desktop/win32/source/loader.cxx | 10
desktop/win32/source/officeloader/officeloader.cxx | 12
desktop/win32/source/unoinfo.cxx | 4
dtrans/Library_dnd.mk | 4
dtrans/source/generic/clipboardmanager.cxx | 8
dtrans/source/generic/clipboardmanager.hxx | 20
dtrans/source/generic/dtrans.cxx | 6
dtrans/source/generic/generic_clipboard.cxx | 4
dtrans/source/generic/generic_clipboard.hxx | 24
dtrans/source/win32/clipb/MtaOleClipb.cxx | 147 +--
dtrans/source/win32/clipb/MtaOleClipb.hxx | 6
dtrans/source/win32/clipb/WinClipbImpl.cxx | 20
dtrans/source/win32/clipb/WinClipbImpl.hxx | 2
dtrans/source/win32/clipb/WinClipboard.cxx | 12
dtrans/source/win32/clipb/WinClipboard.hxx | 22
dtrans/source/win32/clipb/wcbentry.cxx | 4
dtrans/source/win32/dnd/dndentry.cxx | 6
dtrans/source/win32/dnd/idroptarget.cxx | 2
dtrans/source/win32/dnd/idroptarget.hxx | 14
dtrans/source/win32/dnd/source.cxx | 26
dtrans/source/win32/dnd/source.hxx | 26
dtrans/source/win32/dnd/sourcecontext.cxx | 8
dtrans/source/win32/dnd/sourcecontext.hxx | 12
dtrans/source/win32/dnd/target.cxx | 72 -
dtrans/source/win32/dnd/target.hxx | 30
dtrans/source/win32/dnd/targetdragcontext.hxx | 6
dtrans/source/win32/dnd/targetdropcontext.hxx | 8
dtrans/source/win32/dtobj/APNDataObject.cxx | 24
dtrans/source/win32/dtobj/APNDataObject.hxx | 24
dtrans/source/win32/dtobj/DOTransferable.cxx | 262 ++---
dtrans/source/win32/dtobj/DOTransferable.hxx | 23
dtrans/source/win32/dtobj/DTransHelper.cxx | 22
dtrans/source/win32/dtobj/DTransHelper.hxx | 26
dtrans/source/win32/dtobj/DataFmtTransl.cxx | 22
dtrans/source/win32/dtobj/DataFmtTransl.hxx | 18
dtrans/source/win32/dtobj/Fetc.cxx | 10
dtrans/source/win32/dtobj/Fetc.hxx | 10
dtrans/source/win32/dtobj/FetcList.cxx | 78 -
dtrans/source/win32/dtobj/FetcList.hxx | 29
dtrans/source/win32/dtobj/FmtFilter.cxx | 28
dtrans/source/win32/dtobj/TxtCnvtHlp.cxx | 16
dtrans/source/win32/dtobj/XNotifyingDataObject.cxx | 6
dtrans/source/win32/dtobj/XNotifyingDataObject.hxx | 24
dtrans/source/win32/dtobj/XTDataObject.cxx | 266 ++---
dtrans/source/win32/dtobj/XTDataObject.hxx | 55 -
dtrans/source/win32/ftransl/ftransl.cxx | 464 +++++-----
dtrans/source/win32/ftransl/ftransl.hxx | 23
dtrans/source/win32/ftransl/ftranslentry.cxx | 4
dtrans/source/win32/misc/ImplHelper.cxx | 39
dtrans/source/win32/misc/ImplHelper.hxx | 6
embeddedobj/source/inc/oleembobj.hxx | 24
embeddedobj/source/msole/advisesink.cxx | 12
embeddedobj/source/msole/advisesink.hxx | 18
embeddedobj/source/msole/graphconvert.cxx | 17
embeddedobj/source/msole/graphconvert.hxx | 38
embeddedobj/source/msole/mtnotification.hxx | 4
embeddedobj/source/msole/olecomponent.cxx | 315 +++---
embeddedobj/source/msole/olecomponent.hxx | 52 -
embeddedobj/source/msole/oleembed.cxx | 18
embeddedobj/source/msole/olemisc.cxx | 46
embeddedobj/source/msole/olepersist.cxx | 58 -
embeddedobj/source/msole/olepersist.hxx | 2
embeddedobj/source/msole/oleregister.cxx | 2
embeddedobj/source/msole/olevisual.cxx | 16
embeddedobj/source/msole/olewrapclient.cxx | 20
embeddedobj/source/msole/olewrapclient.hxx | 20
embeddedobj/source/msole/xdialogcreator.cxx | 28
embeddedobj/source/msole/xdialogcreator.hxx | 10
embedserv/source/embed/docholder.cxx | 217 ++--
embedserv/source/embed/ed_idataobj.cxx | 20
embedserv/source/embed/ed_iinplace.cxx | 2
embedserv/source/embed/ed_ioleobject.cxx | 16
embedserv/source/embed/ed_ipersiststr.cxx | 126 +-
embedserv/source/embed/esdll.cxx | 2
embedserv/source/embed/guid.cxx | 2
embedserv/source/embed/guid.hxx | 37
embedserv/source/embed/iipaobj.cxx | 6
embedserv/source/embed/intercept.cxx | 78 -
embedserv/source/embed/register.cxx | 4
embedserv/source/embed/servprov.cxx | 26
embedserv/source/embed/syswinwrapper.cxx | 40
embedserv/source/embed/tracker.cxx | 181 +--
embedserv/source/inc/docholder.hxx | 38
embedserv/source/inc/embeddoc.hxx | 132 +-
embedserv/source/inc/iipaobj.hxx | 18
embedserv/source/inc/intercept.hxx | 26
embedserv/source/inc/servprov.hxx | 16
embedserv/source/inc/syswinwrapper.hxx | 4
embedserv/source/inc/xwin.hxx | 44
embedserv/source/inprocserv/advisesink.cxx | 20
embedserv/source/inprocserv/advisesink.hxx | 18
embedserv/source/inprocserv/dllentry.cxx | 34
embedserv/source/inprocserv/inprocembobj.cxx | 332 +++----
embedserv/source/inprocserv/inprocembobj.h | 159 +--
embedserv/source/inprocserv/smartpointer.hxx | 14
extensions/source/activex/SOActionsApproval.h | 13
extensions/source/activex/SOActiveX.cxx | 78 -
extensions/source/activex/SOActiveX.h | 38
extensions/source/activex/SOComWindowPeer.h | 39
extensions/source/activex/SODispatchInterceptor.cxx | 12
extensions/source/activex/SODispatchInterceptor.h | 35
extensions/source/activex/StdAfx2.h | 4
extensions/source/activex/so_activex.cxx | 189 ++--
extensions/source/config/ldap/ldapaccess.cxx | 16
extensions/source/ole/jscriptclasses.cxx | 2
extensions/source/ole/jscriptclasses.hxx | 48 -
extensions/source/ole/oledll.cxx | 2
extensions/source/ole/oleobjw.cxx | 180 +--
extensions/source/ole/oleobjw.hxx | 40
extensions/source/ole/olethread.cxx | 6
extensions/source/ole/servprov.cxx | 66 -
extensions/source/ole/servprov.hxx | 42
extensions/source/ole/servreg.cxx | 18
extensions/source/ole/unoconversionutilities.hxx | 185 ++-
extensions/source/ole/unoobjw.cxx | 160 +--
extensions/source/ole/unoobjw.hxx | 68 -
extensions/source/ole/unotypewrapper.cxx | 4
extensions/source/ole/unotypewrapper.hxx | 19
extensions/source/ole/windata.hxx | 22
extensions/source/scanner/scanwin.cxx | 223 ++--
extensions/source/update/check/onlinecheck.cxx | 4
extensions/source/update/check/onlinecheck.hxx | 33
extensions/source/update/check/updatecheck.cxx | 7
filter/source/graphicfilter/eps/eps.cxx | 2
filter/source/graphicfilter/ieps/ieps.cxx | 2
fpicker/source/win32/filepicker/FPentry.cxx | 6
fpicker/source/win32/filepicker/FileOpenDlg.cxx | 26
fpicker/source/win32/filepicker/FileOpenDlg.hxx | 24
fpicker/source/win32/filepicker/FilePicker.cxx | 66 -
fpicker/source/win32/filepicker/FilePicker.hxx | 62 -
fpicker/source/win32/filepicker/FilterContainer.cxx | 50 -
fpicker/source/win32/filepicker/FilterContainer.hxx | 14
fpicker/source/win32/filepicker/VistaFilePicker.cxx | 34
fpicker/source/win32/filepicker/VistaFilePicker.hxx | 64 -
fpicker/source/win32/filepicker/VistaFilePickerEventHandler.cxx | 20
fpicker/source/win32/filepicker/VistaFilePickerEventHandler.hxx | 28
fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx | 58 -
fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx | 18
fpicker/source/win32/filepicker/WinFileOpenImpl.cxx | 46
fpicker/source/win32/filepicker/WinFileOpenImpl.hxx | 42
fpicker/source/win32/filepicker/asynceventnotifier.cxx | 22
fpicker/source/win32/filepicker/asyncrequests.cxx | 20
fpicker/source/win32/filepicker/asyncrequests.hxx | 6
fpicker/source/win32/filepicker/comptr.hxx | 14
fpicker/source/win32/filepicker/controlaccess.cxx | 44
fpicker/source/win32/filepicker/controlcommand.cxx | 8
fpicker/source/win32/filepicker/controlcommand.hxx | 14
fpicker/source/win32/filepicker/controlcommandresult.hxx | 10
fpicker/source/win32/filepicker/customcontrolcontainer.hxx | 12
fpicker/source/win32/filepicker/dialogcustomcontrols.cxx | 4
fpicker/source/win32/filepicker/dialogcustomcontrols.hxx | 14
fpicker/source/win32/filepicker/dibpreview.cxx | 40
fpicker/source/win32/filepicker/dibpreview.hxx | 22
fpicker/source/win32/filepicker/filepickereventnotification.hxx | 4
fpicker/source/win32/filepicker/filepickerstate.cxx | 18
fpicker/source/win32/filepicker/filepickerstate.hxx | 40
fpicker/source/win32/filepicker/getfilenamewrapper.cxx | 20
fpicker/source/win32/filepicker/helppopupwindow.cxx | 36
fpicker/source/win32/filepicker/helppopupwindow.hxx | 2
fpicker/source/win32/filepicker/previewadapter.cxx | 38
fpicker/source/win32/filepicker/previewadapter.hxx | 6
fpicker/source/win32/filepicker/previewbase.cxx | 18
fpicker/source/win32/filepicker/previewbase.hxx | 8
fpicker/source/win32/filepicker/shared.hxx | 2
fpicker/source/win32/folderpicker/FolderPicker.hxx | 20
fpicker/source/win32/folderpicker/MtaFop.cxx | 130 +-
fpicker/source/win32/folderpicker/MtaFop.hxx | 14
fpicker/source/win32/folderpicker/WinFOPImpl.hxx | 8
fpicker/source/win32/misc/WinImplHelper.cxx | 8
fpicker/source/win32/misc/WinImplHelper.hxx | 2
fpicker/source/win32/misc/resourceprovider.cxx | 4
helpcompiler/inc/HelpCompiler.hxx | 2
hwpfilter/source/hcode.cxx | 2
hwpfilter/source/htags.cxx | 8
hwpfilter/source/hwpreader.cxx | 14
i18npool/source/localedata/localedata.cxx | 2
include/comphelper/windowserrorstring.hxx | 6
include/sal/log-areas.dox | 1
319 files changed, 5507 insertions(+), 5478 deletions(-)
New commits:
commit 6d4f7734ad63998b067f50b6564639a527bf34e3
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:59:47 2016 +0200
clang-cl loplugin: avmedia
Change-Id: Id9ccbeb100ca9770226d0c8c84dae0a02aa7d2d6
Reviewed-on: https://gerrit.libreoffice.org/29882
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/avmedia/source/win/framegrabber.cxx b/avmedia/source/win/framegrabber.cxx
index 7c4cd56..88408ca 100644
--- a/avmedia/source/win/framegrabber.cxx
+++ b/avmedia/source/win/framegrabber.cxx
@@ -52,7 +52,7 @@ namespace avmedia { namespace win {
FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mxMgr( rxMgr )
{
- ::CoInitialize( NULL );
+ ::CoInitialize( nullptr );
}
@@ -61,12 +61,13 @@ FrameGrabber::~FrameGrabber()
::CoUninitialize();
}
+namespace {
-IMediaDet* FrameGrabber::implCreateMediaDet( const OUString& rURL ) const
+IMediaDet* implCreateMediaDet( const OUString& rURL )
{
- IMediaDet* pDet = NULL;
+ IMediaDet* pDet = nullptr;
- if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**) &pDet ) ) )
+ if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, nullptr, CLSCTX_INPROC_SERVER, IID_IMediaDet, reinterpret_cast<void**>(&pDet) ) ) )
{
OUString aLocalStr;
@@ -76,7 +77,7 @@ IMediaDet* FrameGrabber::implCreateMediaDet( const OUString& rURL ) const
if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( reinterpret_cast<LPCOLESTR>(aLocalStr.getStr()) ) ) ) )
{
pDet->Release();
- pDet = NULL;
+ pDet = nullptr;
}
}
}
@@ -84,6 +85,7 @@ IMediaDet* FrameGrabber::implCreateMediaDet( const OUString& rURL ) const
return pDet;
}
+}
bool FrameGrabber::create( const OUString& rURL )
{
@@ -94,7 +96,7 @@ bool FrameGrabber::create( const OUString& rURL )
{
maURL = rURL;
pDet->Release();
- pDet = NULL;
+ pDet = nullptr;
}
else
maURL.clear();
@@ -153,27 +155,27 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
if( aMediaType.cbFormat != 0 )
{
- ::CoTaskMemFree( (PVOID) aMediaType.pbFormat );
+ ::CoTaskMemFree( aMediaType.pbFormat );
aMediaType.cbFormat = 0;
- aMediaType.pbFormat = NULL;
+ aMediaType.pbFormat = nullptr;
}
- if( aMediaType.pUnk != NULL )
+ if( aMediaType.pUnk != nullptr )
{
aMediaType.pUnk->Release();
- aMediaType.pUnk = NULL;
+ aMediaType.pUnk = nullptr;
}
}
if( ( nWidth > 0 ) && ( nHeight > 0 ) &&
- SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, NULL, nWidth, nHeight ) ) &&
+ SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, nullptr, nWidth, nHeight ) ) &&
( nSize > 0 ) )
{
char* pBuffer = new char[ nSize ];
try
{
- if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, NULL, pBuffer, nWidth, nHeight ) ) )
+ if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, nullptr, pBuffer, nWidth, nHeight ) ) )
{
SvMemoryStream aMemStm( pBuffer, nSize, StreamMode::READ | StreamMode::WRITE );
Bitmap aBmp;
diff --git a/avmedia/source/win/framegrabber.hxx b/avmedia/source/win/framegrabber.hxx
index d9845c0..8b3fd49 100644
--- a/avmedia/source/win/framegrabber.hxx
+++ b/avmedia/source/win/framegrabber.hxx
@@ -34,24 +34,22 @@ class FrameGrabber : public ::cppu::WeakImplHelper< css::media::XFrameGrabber,
public:
explicit FrameGrabber( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr );
- ~FrameGrabber();
+ ~FrameGrabber() override;
bool create( const OUString& rURL );
// XFrameGrabber
- virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (css::uno::RuntimeException) override;
// XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) override;
private:
css::uno::Reference< css::lang::XMultiServiceFactory > mxMgr;
OUString maURL;
-
- IMediaDet* implCreateMediaDet( const OUString& rURL ) const;
};
} // namespace win
diff --git a/avmedia/source/win/manager.hxx b/avmedia/source/win/manager.hxx
index a70861e..fcd0c69 100644
--- a/avmedia/source/win/manager.hxx
+++ b/avmedia/source/win/manager.hxx
@@ -33,15 +33,15 @@ class Manager : public ::cppu::WeakImplHelper< css::media::XManager,
public:
explicit Manager( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr );
- ~Manager();
+ ~Manager() override;
// XManager
- virtual css::uno::Reference< css::media::XPlayer > SAL_CALL createPlayer( const OUString& aURL ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::media::XPlayer > SAL_CALL createPlayer( const OUString& aURL ) throw (css::uno::RuntimeException) override;
// XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) override;
private:
css::uno::Reference< css::lang::XMultiServiceFactory > mxMgr;
diff --git a/avmedia/source/win/player.cxx b/avmedia/source/win/player.cxx
index 76ffc30..a5f9f4e 100644
--- a/avmedia/source/win/player.cxx
+++ b/avmedia/source/win/player.cxx
@@ -47,7 +47,7 @@ namespace avmedia { namespace win {
LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
- Player* pPlayer = (Player*) ::GetWindowLongPtr( hWnd, 0 );
+ Player* pPlayer = reinterpret_cast<Player*>(::GetWindowLongPtr( hWnd, 0 ));
bool bProcessed = true;
if( pPlayer )
@@ -73,7 +73,7 @@ bool isWindowsVistaOrHigher()
{
// the Win32 SDK 8.1 deprecates GetVersionEx()
#ifdef _WIN32_WINNT_WINBLUE
- return IsWindowsVistaOrGreater() ? true : false;
+ return IsWindowsVistaOrGreater();
#else
// POST: return true if we are at least on Windows Vista
OSVERSIONINFO osvi;
@@ -88,23 +88,23 @@ bool isWindowsVistaOrHigher()
Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
Player_BASE(m_aMutex),
mxMgr( rxMgr ),
- mpGB( NULL ),
- mpOMF( NULL ),
- mpMC( NULL ),
- mpME( NULL ),
- mpMS( NULL ),
- mpMP( NULL ),
- mpBA( NULL ),
- mpBV( NULL ),
- mpVW( NULL ),
- mpEV( NULL ),
+ mpGB( nullptr ),
+ mpOMF( nullptr ),
+ mpMC( nullptr ),
+ mpME( nullptr ),
+ mpMS( nullptr ),
+ mpMP( nullptr ),
+ mpBA( nullptr ),
+ mpBV( nullptr ),
+ mpVW( nullptr ),
+ mpEV( nullptr ),
mnUnmutedVolume( 0 ),
- mnFrameWnd( 0 ),
+ mnFrameWnd( nullptr ),
mbMuted( false ),
mbLooping( false ),
mbAddWindow( true )
{
- ::CoInitialize( NULL );
+ ::CoInitialize( nullptr );
}
@@ -161,31 +161,31 @@ bool Player::create( const OUString& rURL )
HRESULT hR;
bool bRet = false;
- if( SUCCEEDED( hR = CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**) &mpGB ) ) )
+ if( SUCCEEDED( hR = CoCreateInstance( CLSID_FilterGraph, nullptr, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, reinterpret_cast<void**>(&mpGB) ) ) )
{
// Don't use the overlay mixer on Windows Vista
// It disables the desktop composition as soon as RenderFile is called
// also causes some other problems: video rendering is not reliable
- if( !isWindowsVistaOrHigher() && SUCCEEDED( CoCreateInstance( CLSID_OverlayMixer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**) &mpOMF ) ) )
+ if( !isWindowsVistaOrHigher() && SUCCEEDED( CoCreateInstance( CLSID_OverlayMixer, nullptr, CLSCTX_INPROC_SERVER, IID_IBaseFilter, reinterpret_cast<void**>(&mpOMF) ) ) )
{
mpGB->AddFilter( mpOMF, L"com_sun_star_media_OverlayMixerFilter" );
- if( !SUCCEEDED( mpOMF->QueryInterface( IID_IDDrawExclModeVideo, (void**) &mpEV ) ) )
- mpEV = NULL;
+ if( !SUCCEEDED( mpOMF->QueryInterface( IID_IDDrawExclModeVideo, reinterpret_cast<void**>(&mpEV) ) ) )
+ mpEV = nullptr;
}
- if( SUCCEEDED( hR = mpGB->RenderFile( reinterpret_cast<LPCWSTR>(rURL.getStr()), NULL ) ) &&
- SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaControl, (void**) &mpMC ) ) &&
- SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaEventEx, (void**) &mpME ) ) &&
- SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaSeeking, (void**) &mpMS ) ) &&
- SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaPosition, (void**) &mpMP ) ) )
+ if( SUCCEEDED( hR = mpGB->RenderFile( reinterpret_cast<LPCWSTR>(rURL.getStr()), nullptr ) ) &&
+ SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaControl, reinterpret_cast<void**>(&mpMC) ) ) &&
+ SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaEventEx, reinterpret_cast<void**>(&mpME) ) ) &&
+ SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaSeeking, reinterpret_cast<void**>(&mpMS) ) ) &&
+ SUCCEEDED( hR = mpGB->QueryInterface( IID_IMediaPosition, reinterpret_cast<void**>(&mpMP) ) ) )
{
// Video interfaces
- mpGB->QueryInterface( IID_IVideoWindow, (void**) &mpVW );
- mpGB->QueryInterface( IID_IBasicVideo, (void**) &mpBV );
+ mpGB->QueryInterface( IID_IVideoWindow, reinterpret_cast<void**>(&mpVW) );
+ mpGB->QueryInterface( IID_IBasicVideo, reinterpret_cast<void**>(&mpBV) );
// Audio interface
- mpGB->QueryInterface( IID_IBasicAudio, (void**) &mpBA );
+ mpGB->QueryInterface( IID_IBasicAudio, reinterpret_cast<void**>(&mpBA) );
if( mpBA )
mpBA->put_Volume( mnUnmutedVolume );
@@ -213,7 +213,7 @@ void Player::setNotifyWnd( HWND nNotifyWnd )
{
mbAddWindow = false;
if( mpME )
- mpME->SetNotifyWindow( (OAHWND) nNotifyWnd, WM_GRAPHNOTIFY, reinterpret_cast< LONG_PTR>( this ) );
+ mpME->SetNotifyWindow( reinterpret_cast<OAHWND>(nNotifyWnd), WM_GRAPHNOTIFY, reinterpret_cast< LONG_PTR>( this ) );
}
@@ -253,31 +253,31 @@ void SAL_CALL Player::start( )
{
if ( mbAddWindow )
{
- static WNDCLASS* mpWndClass = NULL;
+ static WNDCLASS* mpWndClass = nullptr;
if ( !mpWndClass )
{
mpWndClass = new WNDCLASS;
memset( mpWndClass, 0, sizeof( *mpWndClass ) );
- mpWndClass->hInstance = GetModuleHandle( NULL );
+ mpWndClass->hInstance = GetModuleHandle( nullptr );
mpWndClass->cbWndExtra = sizeof( DWORD );
mpWndClass->lpfnWndProc = MediaPlayerWndProc_2;
mpWndClass->lpszClassName = "com_sun_star_media_Sound_Player";
- mpWndClass->hbrBackground = (HBRUSH) ::GetStockObject( BLACK_BRUSH );
- mpWndClass->hCursor = ::LoadCursor( NULL, IDC_ARROW );
+ mpWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
+ mpWndClass->hCursor = ::LoadCursor( nullptr, IDC_ARROW );
::RegisterClass( mpWndClass );
}
if ( !mnFrameWnd )
{
- mnFrameWnd = ::CreateWindow( mpWndClass->lpszClassName, NULL,
+ mnFrameWnd = ::CreateWindow( mpWndClass->lpszClassName, nullptr,
0,
0, 0, 0, 0,
- (HWND) NULL, NULL, mpWndClass->hInstance, 0 );
+ nullptr, nullptr, mpWndClass->hInstance, nullptr );
if ( mnFrameWnd )
{
::ShowWindow(mnFrameWnd, SW_HIDE);
- ::SetWindowLongPtr( mnFrameWnd, 0, (LONG_PTR) this );
+ ::SetWindowLongPtr( mnFrameWnd, 0, reinterpret_cast<LONG_PTR>(this) );
// mpVW->put_Owner( (OAHWND) mnFrameWnd );
setNotifyWnd( mnFrameWnd );
}
diff --git a/avmedia/source/win/player.hxx b/avmedia/source/win/player.hxx
index 2923d0d..425ae00 100644
--- a/avmedia/source/win/player.hxx
+++ b/avmedia/source/win/player.hxx
@@ -56,7 +56,7 @@ class Player : public cppu::BaseMutex,
public:
explicit Player( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr );
- ~Player();
+ ~Player() override;
bool create( const OUString& rURL );
@@ -66,29 +66,29 @@ public:
const IVideoWindow* getVideoWindow() const;
// XPlayer
- virtual void SAL_CALL start( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL stop( ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isPlaying( ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getDuration( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMediaTime( double fTime ) throw (css::uno::RuntimeException);
- virtual double SAL_CALL getMediaTime( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isPlaybackLoop( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMute( sal_Bool bSet ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isMute( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (css::uno::RuntimeException);
- virtual sal_Int16 SAL_CALL getVolumeDB( ) throw (css::uno::RuntimeException);
- virtual css::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::media::XPlayerWindow > SAL_CALL createPlayerWindow( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::RuntimeException);
- virtual css::uno::Reference< css::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL start( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL stop( ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL isPlaying( ) throw (css::uno::RuntimeException) override;
+ virtual double SAL_CALL getDuration( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setMediaTime( double fTime ) throw (css::uno::RuntimeException) override;
+ virtual double SAL_CALL getMediaTime( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL isPlaybackLoop( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setMute( sal_Bool bSet ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL isMute( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (css::uno::RuntimeException) override;
+ virtual sal_Int16 SAL_CALL getVolumeDB( ) throw (css::uno::RuntimeException) override;
+ virtual css::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) throw (css::uno::RuntimeException) override;
+ virtual css::uno::Reference< css::media::XPlayerWindow > SAL_CALL createPlayerWindow( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::RuntimeException) override;
+ virtual css::uno::Reference< css::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) throw (css::uno::RuntimeException) override;
// XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) override;
// ::cppu::OComponentHelper
- virtual void SAL_CALL disposing();
+ virtual void SAL_CALL disposing() override;
private:
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 4819c9f..ba30b07 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -43,13 +43,13 @@ namespace avmedia { namespace win {
static ::osl::Mutex& ImplGetOwnStaticMutex()
{
- static ::osl::Mutex* pMutex = NULL;
+ static ::osl::Mutex* pMutex = nullptr;
- if( pMutex == NULL )
+ if( pMutex == nullptr )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( pMutex == NULL )
+ if( pMutex == nullptr )
{
static ::osl::Mutex aMutex;
pMutex = &aMutex;
@@ -61,7 +61,7 @@ static ::osl::Mutex& ImplGetOwnStaticMutex()
LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM nPar2 )
{
- Window* pWindow = (Window*) ::GetWindowLongPtr( hWnd, 0 );
+ Window* pWindow = reinterpret_cast<Window*>(::GetWindowLongPtr( hWnd, 0 ));
bool bProcessed = true;
if( pWindow )
@@ -159,18 +159,18 @@ LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM n
WNDCLASS* lcl_getWndClass()
{
- static WNDCLASS* s_pWndClass = NULL;
+ static WNDCLASS* s_pWndClass = nullptr;
if ( !s_pWndClass )
{
s_pWndClass = new WNDCLASS;
memset( s_pWndClass, 0, sizeof( *s_pWndClass ) );
- s_pWndClass->hInstance = GetModuleHandle( NULL );
+ s_pWndClass->hInstance = GetModuleHandle( nullptr );
s_pWndClass->cbWndExtra = sizeof( DWORD );
s_pWndClass->lpfnWndProc = MediaPlayerWndProc;
s_pWndClass->lpszClassName = "com_sun_star_media_PlayerWnd";
- s_pWndClass->hbrBackground = (HBRUSH) ::GetStockObject( BLACK_BRUSH );
- s_pWndClass->hCursor = ::LoadCursor( NULL, IDC_ARROW );
+ s_pWndClass->hbrBackground = static_cast<HBRUSH>(::GetStockObject( BLACK_BRUSH ));
+ s_pWndClass->hCursor = ::LoadCursor( nullptr, IDC_ARROW );
::RegisterClass( s_pWndClass );
}
@@ -182,8 +182,8 @@ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Playe
maListeners( maMutex ),
meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
mrPlayer( rPlayer ),
- mnFrameWnd( 0 ),
- mnParentWnd( 0 ),
+ mnFrameWnd( nullptr ),
+ mnParentWnd( nullptr ),
mnPointerType( awt::SystemPointer::ARROW )
{
::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
@@ -297,17 +297,17 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments )
mnParentWnd = reinterpret_cast<HWND>(nWnd);
- mnFrameWnd = ::CreateWindow( mpWndClass->lpszClassName, NULL,
+ mnFrameWnd = ::CreateWindow( mpWndClass->lpszClassName, nullptr,
WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
aRect.X, aRect.Y, aRect.Width, aRect.Height,
- mnParentWnd, NULL, mpWndClass->hInstance, 0 );
+ mnParentWnd, nullptr, mpWndClass->hInstance, nullptr );
if( mnFrameWnd )
{
- ::SetWindowLongPtr( mnFrameWnd, 0, (LONG_PTR) this );
+ ::SetWindowLongPtr( mnFrameWnd, 0, reinterpret_cast<LONG_PTR>(this) );
- pVideoWindow->put_Owner( (OAHWND) mnFrameWnd );
- pVideoWindow->put_MessageDrain( (OAHWND) mnFrameWnd );
+ pVideoWindow->put_Owner( reinterpret_cast<OAHWND>(mnFrameWnd) );
+ pVideoWindow->put_MessageDrain( reinterpret_cast<OAHWND>(mnFrameWnd) );
pVideoWindow->put_WindowStyle( WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN );
mrPlayer.setNotifyWnd( mnFrameWnd );
@@ -317,7 +317,7 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments )
}
}
- return( mnFrameWnd != 0 );
+ return( mnFrameWnd != nullptr );
}
void Window::processGraphEvent()
@@ -340,13 +340,13 @@ void Window::updatePointer()
break;
}
- ::SetCursor( ::LoadCursor( NULL, pCursorName ) );
+ ::SetCursor( ::LoadCursor( nullptr, pCursorName ) );
}
void SAL_CALL Window::update( )
throw (uno::RuntimeException)
{
- ::RedrawWindow( (HWND) mnFrameWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
+ ::RedrawWindow( mnFrameWnd, nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
}
sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
diff --git a/avmedia/source/win/window.hxx b/avmedia/source/win/window.hxx
index ca44d39..c034bd0 100644
--- a/avmedia/source/win/window.hxx
+++ b/avmedia/source/win/window.hxx
@@ -44,46 +44,46 @@ public:
Window( const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMgr,
Player& rPlayer );
- ~Window();
+ ~Window() override;
bool create( const css::uno::Sequence< css::uno::Any >& aArguments );
void processGraphEvent();
void updatePointer();
// XPlayerWindow
- virtual void SAL_CALL update( ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL setZoomLevel( css::media::ZoomLevel ZoomLevel ) throw (css::uno::RuntimeException);
- virtual css::media::ZoomLevel SAL_CALL getZoomLevel( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL update( ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL setZoomLevel( css::media::ZoomLevel ZoomLevel ) throw (css::uno::RuntimeException) override;
+ virtual css::media::ZoomLevel SAL_CALL getZoomLevel( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (css::uno::RuntimeException) override;
// XWindow
- virtual void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (css::uno::RuntimeException);
- virtual css::awt::Rectangle SAL_CALL getPosSize( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL setFocus( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (css::uno::RuntimeException) override;
+ virtual css::awt::Rectangle SAL_CALL getPosSize( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL setFocus( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) throw (css::uno::RuntimeException) override;
// XComponent
- virtual void SAL_CALL dispose( ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL dispose( ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException) override;
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException) override;
// XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException);
- virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException);
+ virtual OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (css::uno::RuntimeException) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException) override;
public:
diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx
index a93fb9a..92d7af1 100644
--- a/avmedia/source/win/winuno.cxx
+++ b/avmedia/source/win/winuno.cxx
@@ -34,15 +34,15 @@ static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno:
extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediawin_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* )
{
uno::Reference< lang::XSingleServiceFactory > xFactory;
- void* pRet = 0;
+ void* pRet = nullptr;
if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 )
{
const OUString aServiceName( "com.sun.star.media.Manager_DirectX" );
xFactory.set( ::cppu::createSingleFactory(
- reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- OUString("com.sun.star.comp.avmedia.Manager_DirectX" ),
+ static_cast< lang::XMultiServiceFactory* >( pServiceManager ),
+ "com.sun.star.comp.avmedia.Manager_DirectX",
create_MediaPlayer, uno::Sequence< OUString >( &aServiceName, 1 ) ) );
}
commit 233e5d5f85b1b0e3ad6f6c90b0348448b0d54bb1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:59:40 2016 +0200
clang-cl loplugin: basic
Change-Id: Ibb324ac81343d56038d18a4ee9b27b486df6e520
Reviewed-on: https://gerrit.libreoffice.org/29881
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 40ed225..fb16951 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -151,7 +151,7 @@ void VBATest::testMiscOLEStuff()
fprintf(stderr, "macro result for %s\n", macroSource[ i ] );
fprintf(stderr, "macro returned:\n%s\n", OUStringToOString( pReturn->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() );
}
- CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.get() != NULL );
+ CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.get() != nullptr );
CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" );
}
#else
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index b78ff5d..5ef5f36 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -62,7 +62,7 @@ using namespace css;
namespace {
char * address(std::vector< char > & blob) {
- return blob.empty() ? 0 : &blob[0];
+ return blob.empty() ? nullptr : &blob[0];
}
SbError convert(OUString const & source, OString * target) {
@@ -143,7 +143,7 @@ template< typename T > void add(
}
std::size_t alignment(SbxVariable * variable) {
- OSL_ASSERT(variable != 0);
+ OSL_ASSERT(variable != nullptr);
if ((variable->GetType() & SbxARRAY) == 0) {
switch (variable->GetType()) {
case SbxINTEGER:
@@ -190,7 +190,7 @@ SbError marshal(
SbError marshalString(
SbxVariable * variable, bool special, MarshalData & data, void ** buffer)
{
- OSL_ASSERT(variable != 0 && buffer != 0);
+ OSL_ASSERT(variable != nullptr && buffer != nullptr);
OString str;
SbError e = convert(variable->GetOUString(), &str);
if (e != ERRCODE_NONE) {
@@ -207,7 +207,7 @@ SbError marshalStruct(
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
MarshalData & data)
{
- OSL_ASSERT(variable != 0);
+ OSL_ASSERT(variable != nullptr);
SbxArray * props = dynamic_cast<SbxObject*>( variable->GetObject() )->
GetProperties();
for (sal_uInt16 i = 0; i < props->Count(); ++i) {
@@ -223,7 +223,7 @@ SbError marshalArray(
SbxVariable * variable, std::vector< char > & blob, std::size_t offset,
MarshalData & data)
{
- OSL_ASSERT(variable != 0);
+ OSL_ASSERT(variable != nullptr);
SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
int dims = arr->GetDims();
std::vector< sal_Int32 > low(dims);
@@ -255,7 +255,7 @@ SbError marshal(
bool outer, SbxVariable * variable, bool special,
std::vector< char > & blob, std::size_t offset, MarshalData & data)
{
- OSL_ASSERT(variable != 0);
+ OSL_ASSERT(variable != nullptr);
if (!(variable->GetFlags() & SbxFlagBits::Reference)) {
if ((variable->GetType() & SbxARRAY) == 0) {
switch (variable->GetType()) {
@@ -370,7 +370,7 @@ template< typename T > T read(void const ** pointer) {
}
void const * unmarshal(SbxVariable * variable, void const * data) {
- OSL_ASSERT(variable != 0);
+ OSL_ASSERT(variable != nullptr);
if ((variable->GetType() & SbxARRAY) == 0) {
switch (variable->GetType()) {
case SbxINTEGER:
@@ -438,7 +438,7 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
SbError unmarshalString(StringData const & data, SbxVariable & result) {
OUString str;
- if (data.buffer != 0) {
+ if (data.buffer != nullptr) {
char const * p = static_cast< char const * >(data.buffer);
sal_Int32 len;
if (data.special) {
@@ -481,7 +481,7 @@ SbError call(
bool special =
dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
(proc.name == OString("GetLogicalDriveStringsA"));
- for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
SbError e = marshal(
true, arguments->Get(i), special && i == 2, stack, stack.size(),
data);
@@ -496,8 +496,8 @@ SbError call(
// We fake all calls as being to a varargs function,
// as this means any floating-point argument among the first four
// ones will end up in a XMM register where the callee expects it.
- sal_Int32 (*proc_i)(double d, ...) = (sal_Int32 (*)(double, ...)) proc.proc;
- double (*proc_d)(double d, ...) = (double (*)(double, ...)) proc.proc;
+ sal_Int32 (*proc_i)(double d, ...) = reinterpret_cast<sal_Int32 (*)(double, ...)>(proc.proc);
+ double (*proc_d)(double d, ...) = reinterpret_cast<double (*)(double, ...)>(proc.proc);
sal_Int64 iRetVal = 0;
double dRetVal = 0.0;
@@ -511,50 +511,50 @@ SbError call(
case SbxBOOL:
case SbxBYTE:
iRetVal =
- proc_i(*(double *)&stack[0*8],
- *(double *)&stack[1*8],
- *(double *)&stack[2*8],
- *(double *)&stack[3*8],
- *(sal_uInt64 *)&stack[4*8],
- *(sal_uInt64 *)&stack[5*8],
- *(sal_uInt64 *)&stack[6*8],
- *(sal_uInt64 *)&stack[7*8],
- *(sal_uInt64 *)&stack[8*8],
- *(sal_uInt64 *)&stack[9*8],
- *(sal_uInt64 *)&stack[10*8],
- *(sal_uInt64 *)&stack[11*8],
- *(sal_uInt64 *)&stack[12*8],
- *(sal_uInt64 *)&stack[13*8],
- *(sal_uInt64 *)&stack[14*8],
- *(sal_uInt64 *)&stack[15*8],
- *(sal_uInt64 *)&stack[16*8],
- *(sal_uInt64 *)&stack[17*8],
- *(sal_uInt64 *)&stack[18*8],
- *(sal_uInt64 *)&stack[19*8]);
+ proc_i(*reinterpret_cast<double *>(&stack[0*8]),
+ *reinterpret_cast<double *>(&stack[1*8]),
+ *reinterpret_cast<double *>(&stack[2*8]),
+ *reinterpret_cast<double *>(&stack[3*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[4*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[5*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[6*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[7*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[8*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[9*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[10*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[11*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[12*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[13*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[14*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[15*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[16*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[17*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[18*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[19*8]));
break;
case SbxSINGLE:
case SbxDOUBLE:
dRetVal =
- proc_d(*(double *)&stack[0*8],
- *(double *)&stack[1*8],
- *(double *)&stack[2*8],
- *(double *)&stack[3*8],
- *(sal_uInt64 *)&stack[4*8],
- *(sal_uInt64 *)&stack[5*8],
- *(sal_uInt64 *)&stack[6*8],
- *(sal_uInt64 *)&stack[7*8],
- *(sal_uInt64 *)&stack[8*8],
- *(sal_uInt64 *)&stack[9*8],
- *(sal_uInt64 *)&stack[10*8],
- *(sal_uInt64 *)&stack[11*8],
- *(sal_uInt64 *)&stack[12*8],
- *(sal_uInt64 *)&stack[13*8],
- *(sal_uInt64 *)&stack[14*8],
- *(sal_uInt64 *)&stack[15*8],
- *(sal_uInt64 *)&stack[16*8],
- *(sal_uInt64 *)&stack[17*8],
- *(sal_uInt64 *)&stack[18*8],
- *(sal_uInt64 *)&stack[19*8]);
+ proc_d(*reinterpret_cast<double *>(&stack[0*8]),
+ *reinterpret_cast<double *>(&stack[1*8]),
+ *reinterpret_cast<double *>(&stack[2*8]),
+ *reinterpret_cast<double *>(&stack[3*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[4*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[5*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[6*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[7*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[8*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[9*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[10*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[11*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[12*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[13*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[14*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[15*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[16*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[17*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[18*8]),
+ *reinterpret_cast<sal_uInt64 *>(&stack[19*8]));
break;
default:
break;
@@ -590,7 +590,7 @@ SbError call(
//TODO
break;
case SbxBOOL:
- result.PutBool(static_cast< sal_Bool >(iRetVal));
+ result.PutBool(iRetVal);
break;
case SbxBYTE:
result.PutByte(static_cast< sal_uInt8 >(iRetVal));
@@ -599,7 +599,7 @@ SbError call(
OSL_ASSERT(false);
break;
}
- for (int i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+ for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
arguments->Get(i)->ResetFlag(SbxFlagBits::Reference);
//TODO: skipped for errors?!?
}
@@ -621,14 +621,14 @@ SbError call(
SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
{
- OSL_ASSERT(proc != 0);
+ OSL_ASSERT(proc != nullptr);
if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
if (n <= 0 || n > 0xFFFF) {
return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
}
FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
- if (p != 0) {
+ if (p != nullptr) {
proc->name = OString("#") + OString::number(n);
proc->proc = p;
return ERRCODE_NONE;
@@ -640,7 +640,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
return e;
}
FARPROC p = GetProcAddress(handle, name8.getStr());
- if (p != 0) {
+ if (p != nullptr) {
proc->name = name8;
proc->proc = p;
return ERRCODE_NONE;
@@ -649,7 +649,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
if (i != -1) {
name8 = name8.copy(0, i);
p = GetProcAddress(handle, name8.getStr());
- if (p != 0) {
+ if (p != nullptr) {
proc->name = name8;
proc->proc = p;
return ERRCODE_NONE;
@@ -657,14 +657,14 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
}
OString real(OString("_") + name8);
p = GetProcAddress(handle, real.getStr());
- if (p != 0) {
+ if (p != nullptr) {
proc->name = real;
proc->proc = p;
return ERRCODE_NONE;
}
real = name8 + OString("A");
p = GetProcAddress(handle, real.getStr());
- if (p != 0) {
+ if (p != nullptr) {
proc->name = real;
proc->proc = p;
return ERRCODE_NONE;
@@ -677,10 +677,10 @@ struct Dll: public salhelper::SimpleReferenceObject {
private:
typedef std::map< OUString, ProcData > Procs;
- virtual ~Dll();
+ virtual ~Dll() override;
public:
- Dll(): handle(0) {}
+ Dll(): handle(nullptr) {}
SbError getProc(OUString const & name, ProcData * proc);
@@ -689,7 +689,7 @@ public:
};
Dll::~Dll() {
- if (handle != 0 && !FreeLibrary(handle)) {
+ if (handle != nullptr && !FreeLibrary(handle)) {
OSL_TRACE("FreeLibrary(%p) failed with %u", handle, GetLastError());
}
}
@@ -736,9 +736,9 @@ Dll * SbiDllMgr::Impl::getDll(OUString const & name) {
if (i == dlls.end()) {
i = dlls.insert(Dlls::value_type(name, new Dll)).first;
HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr()));
- if (h == 0) {
+ if (h == nullptr) {
dlls.erase(i);
- return 0;
+ return nullptr;
}
i->second->handle = h;
}
@@ -754,7 +754,7 @@ SbError SbiDllMgr::Call(
}
OUString dllName(fullDllName(library));
Dll * dll = impl_->getDll(dllName);
- if (dll == 0) {
+ if (dll == nullptr) {
return ERRCODE_BASIC_BAD_DLL_LOAD;
}
ProcData proc;
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index a143257..12b3dbc 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -744,7 +744,7 @@ void SbiIoSystem::Shutdown()
vcl::Window* pParent = Application::GetDefDialogParent();
ScopedVclPtrInstance<MessBox>( pParent, WinBits( WB_OK ), OUString(), aOut )->Execute();
#else
- ScopedVclPtrInstance<MessBox>( GetpApp()->GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOut )->Execute();
+ ScopedVclPtrInstance<MessBox>( Application::GetDefDialogParent(), WinBits( WB_OK ), OUString(), aOut )->Execute();
#endif
}
aOut.clear();
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 335c99a..d93c95a 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -420,7 +420,7 @@ RTLFUNC(CurDir)
}
}
char* pBuffer = new char[ _MAX_PATH ];
- if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != 0 )
+ if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != nullptr )
{
rPar.Get(0)->PutString( OUString::createFromAscii( pBuffer ) );
}
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index ac2b13d..dfd3914 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -285,7 +285,7 @@ RTLFUNC(CDec)
(void)bWrite;
#ifdef _WIN32
- SbxDecimal* pDec = NULL;
+ SbxDecimal* pDec = nullptr;
if ( rPar.Count() == 2 )
{
SbxVariable *pSbxVariable = rPar.Get(1);
diff --git a/basic/source/sbx/sbxdec.cxx b/basic/source/sbx/sbxdec.cxx
index 22d7ba2..8a2df8d 100644
--- a/basic/source/sbx/sbxdec.cxx
+++ b/basic/source/sbx/sbxdec.cxx
@@ -92,28 +92,28 @@ void releaseDecimalPtr( SbxDecimal*& rpDecimal )
bool SbxDecimal::operator -= ( const SbxDecimal &r )
{
- HRESULT hResult = VarDecSub( &maDec, (LPDECIMAL)&r.maDec, &maDec );
+ HRESULT hResult = VarDecSub( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
bool bRet = ( hResult == S_OK );
return bRet;
}
bool SbxDecimal::operator += ( const SbxDecimal &r )
{
- HRESULT hResult = VarDecAdd( &maDec, (LPDECIMAL)&r.maDec, &maDec );
+ HRESULT hResult = VarDecAdd( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
bool bRet = ( hResult == S_OK );
return bRet;
}
bool SbxDecimal::operator /= ( const SbxDecimal &r )
{
- HRESULT hResult = VarDecDiv( &maDec, (LPDECIMAL)&r.maDec, &maDec );
+ HRESULT hResult = VarDecDiv( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
bool bRet = ( hResult == S_OK );
return bRet;
}
bool SbxDecimal::operator *= ( const SbxDecimal &r )
{
- HRESULT hResult = VarDecMul( &maDec, (LPDECIMAL)&r.maDec, &maDec );
+ HRESULT hResult = VarDecMul( &maDec, const_cast<LPDECIMAL>(&r.maDec), &maDec );
bool bRet = ( hResult == S_OK );
return bRet;
}
@@ -135,7 +135,7 @@ bool SbxDecimal::isZero()
SbxDecimal::CmpResult compare( const SbxDecimal &rLeft, const SbxDecimal &rRight )
{
- HRESULT hResult = VarDecCmp( (LPDECIMAL)&rLeft.maDec, (LPDECIMAL)&rRight.maDec );
+ HRESULT hResult = VarDecCmp( const_cast<LPDECIMAL>(&rLeft.maDec), const_cast<LPDECIMAL>(&rRight.maDec) );
SbxDecimal::CmpResult eRes = (SbxDecimal::CmpResult)hResult;
return eRes;
}
@@ -226,11 +226,11 @@ bool SbxDecimal::setString( OUString* pOUString )
pBuffer[i] = ',';
i++;
}
- hResult = VarDecFromStr( (OLECHAR*)pBuffer.get(), nLANGID, 0, &maDec );
+ hResult = VarDecFromStr( pBuffer.get(), nLANGID, 0, &maDec );
}
else
{
- hResult = VarDecFromStr( (OLECHAR*)pOUString->getStr(), nLANGID, 0, &maDec );
+ hResult = VarDecFromStr( pOUString->getStr(), nLANGID, 0, &maDec );
}
bRet = ( hResult == S_OK );
return bRet;
@@ -356,7 +356,7 @@ void SbxDecimal::getString( OUString& rString )
OLECHAR sz[100];
BSTR aBStr = SysAllocString( sz );
- if( aBStr != NULL )
+ if( aBStr != nullptr )
{
HRESULT hResult = VarBstrFromDec( &maDec, nLANGID, 0, &aBStr );
if( hResult == S_OK )
commit 22001778560a08b4097bc30035cd5a494bdd1975
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:59:15 2016 +0200
clang-cl loplugin: bean
Change-Id: Iedaf2fc0c1e2cab446687c6c73cceb3c6b77e6e1
Reviewed-on: https://gerrit.libreoffice.org/29880
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c b/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c
index 300568d..177d276 100644
--- a/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c
+++ b/bean/native/win32/com_sun_star_comp_beans_LocalOfficeWindow.c
@@ -128,7 +128,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindow_getNative
and calls on such construct produce
a stack overflow.
*/
- if (GetProp( hWnd, OLD_PROC_KEY )==0)
+ if (GetProp( hWnd, OLD_PROC_KEY )==NULL)
{
hFuncPtr = SetWindowLongPtr( hWnd, GWLP_WNDPROC, (LONG_PTR)OpenOfficeWndProc );
SetProp( hWnd, OLD_PROC_KEY, (HANDLE)hFuncPtr );
commit fee419ae25f15d8f001a1cba1fc1d1704038c94b
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:59:08 2016 +0200
clang-cl loplugin: bridges
Change-Id: I46bcc6eb1f34184626d2f584d7164d84f54c2cf8
Reviewed-on: https://gerrit.libreoffice.org/29879
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
Tested-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/bridges/inc/cppinterfaceproxy.hxx b/bridges/inc/cppinterfaceproxy.hxx
index 13a2b22..069e252 100644
--- a/bridges/inc/cppinterfaceproxy.hxx
+++ b/bridges/inc/cppinterfaceproxy.hxx
@@ -32,6 +32,11 @@ namespace com { namespace sun { namespace star { namespace uno {
class XInterface;
} } } }
+#if !defined __GNUG__ || defined __MINGW32__
+void dso_init();
+void dso_exit();
+#endif
+
namespace bridges { namespace cpp_uno { namespace shared {
class Bridge;
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
index dfa18c4..fee1483 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx
@@ -43,7 +43,7 @@ static inline typelib_TypeClass cpp2uno_call(
void ** pStack )
{
// Return type
- typelib_TypeDescription * pReturnTD = NULL;
+ typelib_TypeDescription * pReturnTD = nullptr;
if ( pReturnTypeRef )
TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
@@ -51,8 +51,8 @@ static inline typelib_TypeClass cpp2uno_call(
// value, return address and 'this'
// pointer.
- void * pUnoReturn = NULL;
- void * pCppReturn = NULL; // Complex return ptr: if != NULL && != pUnoReturn, reconversion need
+ void * pUnoReturn = nullptr;
+ void * pCppReturn = nullptr; // Complex return ptr: if != NULL && != pUnoReturn, reconversion need
if ( pReturnTD )
{
@@ -76,18 +76,18 @@ static inline typelib_TypeClass cpp2uno_call(
// micro-optimization, and allocate these array separately
// Parameters passed to the UNO function
- void ** pUnoArgs = (void **)alloca( sizeof(void *) * nParams );
+ void ** pUnoArgs = static_cast<void **>(alloca( sizeof(void *) * nParams ));
// Parameters received from C++
- void ** pCppArgs = (void **)alloca( sizeof(void *) * nParams );
+ void ** pCppArgs = static_cast<void **>(alloca( sizeof(void *) * nParams ));
// Indexes of values this have to be converted (interface conversion C++<=>UNO)
int * pTempIndexes =
- (int *)alloca( sizeof(int) * nParams );
+ static_cast<int *>(alloca( sizeof(int) * nParams ));
// Type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTD =
- (typelib_TypeDescription **)alloca( sizeof(void *) * nParams );
+ static_cast<typelib_TypeDescription **>(alloca( sizeof(void *) * nParams ));
int nTempIndexes = 0;
@@ -95,7 +95,7 @@ static inline typelib_TypeClass cpp2uno_call(
{
const typelib_MethodParameter & rParam = pParams[nPos];
- typelib_TypeDescription * pParamTD = NULL;
+ typelib_TypeDescription * pParamTD = nullptr;
TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
if ( !rParam.bOut &&
@@ -156,7 +156,7 @@ static inline typelib_TypeClass cpp2uno_call(
if ( pParams[nIndex].bIn ) // Is in/inout => was constructed
{
- ::uno_destructData( pUnoArgs[nIndex], ppTempParamTD[nTempIndexes], 0 );
+ ::uno_destructData( pUnoArgs[nIndex], ppTempParamTD[nTempIndexes], nullptr );
}
TYPELIB_DANGER_RELEASE( ppTempParamTD[nTempIndexes] );
}
@@ -187,7 +187,7 @@ static inline typelib_TypeClass cpp2uno_call(
pThis->getBridge()->getUno2Cpp() );
}
// Destroy temp UNO param
- ::uno_destructData( pUnoArgs[nIndex], pParamTD, 0 );
+ ::uno_destructData( pUnoArgs[nIndex], pParamTD, nullptr );
TYPELIB_DANGER_RELEASE( pParamTD );
}
@@ -200,7 +200,7 @@ static inline typelib_TypeClass cpp2uno_call(
pCppReturn, pUnoReturn, pReturnTD,
pThis->getBridge()->getUno2Cpp() );
// Destroy temp UNO return
- ::uno_destructData( pUnoReturn, pReturnTD, 0 );
+ ::uno_destructData( pUnoReturn, pReturnTD, nullptr );
}
// Complex return ptr is set to eax
pStack[0] = pCppReturn;
@@ -272,7 +272,7 @@ extern "C" typelib_TypeClass cpp_vtable_call(
{
// is GET method
eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef,
- 0, NULL, // No params
+ 0, nullptr, // No params
pStack );
}
else
@@ -280,11 +280,11 @@ extern "C" typelib_TypeClass cpp_vtable_call(
// is SET method
typelib_MethodParameter aParam;
aParam.pTypeRef = pAttrTypeRef;
- aParam.bIn = sal_True;
- aParam.bOut = sal_False;
+ aParam.bIn = true;
+ aParam.bOut = false;
eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
- NULL, // Indicates void return
+ nullptr, // Indicates void return
1, &aParam,
pStack );
}
@@ -305,28 +305,28 @@ extern "C" typelib_TypeClass cpp_vtable_call(
break;
case 0: // queryInterface() opt
{
- typelib_TypeDescription * pTD2 = NULL;
+ typelib_TypeDescription * pTD2 = nullptr;
// the incoming C++ parameters are: The this
// pointer, the hidden return value pointer, and
// then the actual queryInterface() only
// parameter. Thus pStack[4]..
- TYPELIB_DANGER_GET( &pTD2, reinterpret_cast<Type *>( pStack[4] )->getTypeLibType() );
+ TYPELIB_DANGER_GET( &pTD2, static_cast<Type *>( pStack[4] )->getTypeLibType() );
if ( pTD2 )
{
- XInterface * pInterface = NULL;
+ XInterface * pInterface = nullptr;
(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
( pCppI->getBridge()->getCppEnv(),
- (void **)&pInterface,
+ reinterpret_cast<void **>(&pInterface),
pCppI->getOid().pData,
reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD2 ) );
if ( pInterface )
{
// pStack[3] = hidden return value pointer
- ::uno_any_construct( reinterpret_cast<uno_Any *>( pStack[3] ),
+ ::uno_any_construct( static_cast<uno_Any *>( pStack[3] ),
&pInterface, pTD2, cpp_acquire );
pInterface->release();
@@ -427,11 +427,11 @@ unsigned char * codeSnippet(
// mov rcx, nOffsetAndIndex
*p++ = 0x48; *p++ = 0xB9;
- *((sal_uInt64 *)p) = nOffsetAndIndex; p += 8;
+ *reinterpret_cast<sal_uInt64 *>(p) = nOffsetAndIndex; p += 8;
// mov r11, privateSnippetExecutor
*p++ = 0x49; *p++ = 0xBB;
- *((void **)p) = &privateSnippetExecutor; p += 8;
+ *reinterpret_cast<void **>(p) = &privateSnippetExecutor; p += 8;
// jmp r11
*p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
@@ -468,8 +468,7 @@ bridges::cpp_uno::shared::VtableFactory::initializeBlock(
Rtti():
n0(0), n1(0), n2(0),
rtti(CPPU_CURRENT_NAMESPACE::mscx_getRTTI(
- OUString(
- "com.sun.star.uno.XInterface")))
+ "com.sun.star.uno.XInterface"))
{}
};
static Rtti rtti;
@@ -491,7 +490,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
Slot * s = *slots;
for (int member = 0; member < type->nMembers; ++member) {
- typelib_TypeDescription * pTD = NULL;
+ typelib_TypeDescription * pTD = nullptr;
TYPELIB_DANGER_GET( &pTD, type->ppMembers[ member ] );
assert(pTD);
@@ -516,7 +515,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
if ( ! pIfaceAttrTD->bReadOnly )
{
- typelib_TypeDescription * pAttrTD = NULL;
+ typelib_TypeDescription * pAttrTD = nullptr;
TYPELIB_DANGER_GET( &pAttrTD, pIfaceAttrTD->pAttributeTypeRef );
assert(pAttrTD);
@@ -536,7 +535,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
typelib_InterfaceMethodTypeDescription * pMethodTD =
reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( pTD );
- typelib_TypeDescription * pReturnTD = NULL;
+ typelib_TypeDescription * pReturnTD = nullptr;
TYPELIB_DANGER_GET( &pReturnTD, pMethodTD->pReturnTypeRef );
assert(pReturnTD);
@@ -548,7 +547,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
for (int param = 0; nr < 4 && param < pMethodTD->nParams; ++param, ++nr)
{
- typelib_TypeDescription * pParamTD = NULL;
+ typelib_TypeDescription * pParamTD = nullptr;
TYPELIB_DANGER_GET( &pParamTD, pMethodTD->pParams[param].pTypeRef );
assert(pParamTD);
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx
index 356f360..e71238c 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx
@@ -22,10 +22,7 @@
#include <windows.h>
#pragma warning(pop)
-
-void dso_init();
-void dso_exit();
-
+#include <cppinterfaceproxy.hxx>
extern "C" BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
{
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
index f66e9b1..15a12d5 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx
@@ -252,12 +252,6 @@ void
#include "mscx.hxx"
#include "except.hxx"
-//TOOD: Work around missing __CxxDetectRethrow in clang-cl for now (predefined
-// in cl, <www.geoffchappell.com/studies/msvc/language/predefined/index.html>):
-#if defined __clang__
-extern "C" int __cdecl __CxxDetectRethrow(void *);
-#endif
-
#pragma pack(push, 8)
using namespace ::com::sun::star::uno;
@@ -310,32 +304,33 @@ static inline OUString toRTTIname(
//RTTI simulation
typedef std::unordered_map< OUString, void *, OUStringHash > t_string2PtrMap;
-class __type_info_descriptor;
+class type_info_descriptor;
class RTTInfos
{
Mutex _aMutex;
t_string2PtrMap _allRTTI;
- static OUString toRawName( OUString const & rUNOname ) throw ();
public:
type_info * getRTTI( OUString const & rUNOname ) throw ();
int getRTTI_len(OUString const & rUNOname) throw ();
- __type_info_descriptor * insert_new_type_info_descriptor(OUString const & rUNOname);
+ type_info_descriptor * insert_new_type_info_descriptor(OUString const & rUNOname);
RTTInfos() throw ();
+#if !defined LEAK_STATIC_DATA
~RTTInfos() throw ();
+#endif
};
-class __type_info
+class type_info_
{
friend type_info * RTTInfos::getRTTI( OUString const & ) throw ();
friend int mscx_filterCppException(
LPEXCEPTION_POINTERS, uno_Any *, uno_Mapping * );
public:
- virtual ~__type_info() throw ();
+ virtual ~type_info_() throw ();
- inline __type_info( void * m_data, const char * m_d_name ) throw ()
+ inline type_info_( void * m_data, const char * m_d_name ) throw ()
: _m_data( m_data )
{ ::strcpy( _m_d_name, m_d_name ); } // #100211# - checked
@@ -344,28 +339,28 @@ private:
char _m_d_name[1];
};
-__type_info::~__type_info() throw ()
+type_info_::~type_info_() throw ()
{
(void)_m_data;
}
-class __type_info_descriptor
+class type_info_descriptor
{
private:
int type_info_size;
- __type_info info;
+ type_info_ info;
public:
- inline __type_info_descriptor(void * m_data, const char * m_d_name) throw ()
+ inline type_info_descriptor(void * m_data, const char * m_d_name) throw ()
: info(m_data, m_d_name)
{
- type_info_size = sizeof(__type_info) + strlen(m_d_name);
+ type_info_size = sizeof(type_info_) + strlen(m_d_name);
}
type_info * get_type_info()
{
- return (type_info *)&info;
+ return reinterpret_cast<type_info *>(&info);
}
int get_type_info_size()
{
@@ -373,12 +368,12 @@ public:
}
};
-__type_info_descriptor * RTTInfos::insert_new_type_info_descriptor(OUString const & rUNOname) {
+type_info_descriptor * RTTInfos::insert_new_type_info_descriptor(OUString const & rUNOname) {
// insert new type_info
OString aRawName(OUStringToOString(toRTTIname(rUNOname), RTL_TEXTENCODING_ASCII_US));
- __type_info_descriptor * pRTTI = new(::rtl_allocateMemory(sizeof(__type_info_descriptor) + aRawName.getLength()))
- __type_info_descriptor(NULL, aRawName.getStr());
+ type_info_descriptor * pRTTI = new(::rtl_allocateMemory(sizeof(type_info_descriptor) + aRawName.getLength()))
+ type_info_descriptor(nullptr, aRawName.getStr());
// put into map
pair< t_string2PtrMap::iterator, bool > insertion(
@@ -390,7 +385,7 @@ __type_info_descriptor * RTTInfos::insert_new_type_info_descriptor(OUString cons
type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw ()
{
// a must be
- static_assert(sizeof(__type_info) == sizeof(type_info), "### type info structure size differ!");
+ static_assert(sizeof(type_info_) == sizeof(type_info), "### type info structure size differ!");
MutexGuard aGuard( _aMutex );
t_string2PtrMap::const_iterator const iFind( _allRTTI.find( rUNOname ) );
@@ -398,13 +393,13 @@ type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw ()
// check if type is already available
if (iFind == _allRTTI.end())
{
- // Wrap new __type_info in __type_info_descriptor to preserve length info
- __type_info_descriptor * pRTTI = insert_new_type_info_descriptor(rUNOname);
+ // Wrap new type_info_ in type_info_descriptor to preserve length info
+ type_info_descriptor * pRTTI = insert_new_type_info_descriptor(rUNOname);
return pRTTI->get_type_info();
}
else
{
- return ((__type_info_descriptor *)iFind->second)->get_type_info();
+ return static_cast<type_info_descriptor *>(iFind->second)->get_type_info();
}
}
@@ -413,17 +408,17 @@ int RTTInfos::getRTTI_len(OUString const & rUNOname) throw ()
MutexGuard aGuard(_aMutex);
t_string2PtrMap::const_iterator const iFind(_allRTTI.find(rUNOname));
- // Wrap new __type_info in __type_info_descriptor to preserve length info
+ // Wrap new type_info_ in type_info_descriptor to preserve length info
// check if type is already available
if (iFind == _allRTTI.end())
{
- // Wrap new __type_info in __type_info_descriptor to preserve length info
- __type_info_descriptor * pRTTI = insert_new_type_info_descriptor(rUNOname);
+ // Wrap new type_info_ in type_info_descriptor to preserve length info
+ type_info_descriptor * pRTTI = insert_new_type_info_descriptor(rUNOname);
return pRTTI->get_type_info_size();
}
else
{
- return ((__type_info_descriptor *)iFind->second)->get_type_info_size();
+ return static_cast<type_info_descriptor *>(iFind->second)->get_type_info_size();
}
}
@@ -431,6 +426,7 @@ RTTInfos::RTTInfos() throw ()
{
}
+#if !defined LEAK_STATIC_DATA
RTTInfos::~RTTInfos() throw ()
{
SAL_INFO("bridges", "> freeing generated RTTI infos... <");
@@ -439,11 +435,12 @@ RTTInfos::~RTTInfos() throw ()
for ( t_string2PtrMap::const_iterator iPos( _allRTTI.begin() );
iPos != _allRTTI.end(); ++iPos )
{
- __type_info * pType = (__type_info *)iPos->second;
- pType->~__type_info(); // obsolete, but good style...
+ type_info_ * pType = static_cast<type_info_ *>(iPos->second);
+ pType->~type_info_(); // obsolete, but good style...
::rtl_freeMemory( pType );
}
}
+#endif
void * __cdecl copyConstruct(
void * pExcThis,
@@ -472,11 +469,11 @@ void GenerateConstructorTrampoline(
// mov r8, pTD
*p++ = 0x49; *p++ = 0xB8;
- *((void **)p) = pTD; p += 8;
+ *reinterpret_cast<void **>(p) = pTD; p += 8;
// mov r11, copyConstruct
*p++ = 0x49; *p++ = 0xBB;
- *((void **)p) = reinterpret_cast<void *>(©Construct); p += 8;
+ *reinterpret_cast<void **>(p) = reinterpret_cast<void *>(©Construct); p += 8;
// jmp r11
*p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
@@ -492,11 +489,11 @@ void GenerateDestructorTrampoline(
// mov rdx, pTD
*p++ = 0x48; *p++ = 0xBA;
- *((void **)p) = pTD; p += 8;
+ *reinterpret_cast<void **>(p) = pTD; p += 8;
// mov r11, destruct
*p++ = 0x49; *p++ = 0xBB;
- *((void **)p) = reinterpret_cast<void *>(&destruct); p += 8;
+ *reinterpret_cast<void **>(p) = reinterpret_cast<void *>(&destruct); p += 8;
// jmp r11
*p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
@@ -513,7 +510,7 @@ struct ExceptionType
sal_Int32 _n1, _n2, _n3; // thiscast
sal_Int32 _n4; // object_size
sal_uInt32 _pCopyCtor; // copyctor
- __type_info type_info;
+ type_info_ type_info;
inline ExceptionType(
@@ -525,7 +522,7 @@ struct ExceptionType
, _n2( -1 )
, _n3( 0 )
, _n4( pTD->nSize)
- , type_info(NULL, "")
+ , type_info(nullptr, "")
{
// As _n0 is always initialized to zero, that means the
// hasvirtbase flag (see the ONTL catchabletype struct) is
@@ -541,9 +538,6 @@ struct ExceptionType
_pCopyCtor = static_cast<sal_uInt32>(
reinterpret_cast<sal_uInt64>(pCode) - pCodeBase);
}
- inline ~ExceptionType() throw ()
- {
- }
};
struct RaiseInfo;
@@ -559,7 +553,9 @@ public:
static DWORD allocationGranularity;
ExceptionInfos() throw ();
+#if !defined LEAK_STATIC_DATA
~ExceptionInfos() throw ();
+#endif
};
DWORD ExceptionInfos::allocationGranularity = 0;
@@ -580,7 +576,9 @@ struct RaiseInfo
explicit RaiseInfo(typelib_TypeDescription * pTD) throw ();
+#if !defined LEAK_STATIC_DATA
~RaiseInfo() throw ();
+#endif
};
/* Rewrite of 32-Bit-Code to work under 64 Bit:
@@ -606,7 +604,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
int codeSize = codeSnippetSize;
// Info count
int nLen = 0;
- for (pCompTD = (typelib_CompoundTypeDescription*)pTD;
+ for (pCompTD = reinterpret_cast<typelib_CompoundTypeDescription*>(pTD);
pCompTD; pCompTD = pCompTD->pBaseTypeDescription)
{
++nLen;
@@ -622,7 +620,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
int *exceptionTypeSizeArray = new int[nLen];
nLen = 0;
- for (pCompTD = (typelib_CompoundTypeDescription*)pTD;
+ for (pCompTD = reinterpret_cast<typelib_CompoundTypeDescription*>(pTD);
pCompTD; pCompTD = pCompTD->pBaseTypeDescription)
{
int typeInfoLen = mscx_getRTTI_len(pCompTD->aBase.pTypeName);
@@ -647,11 +645,11 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
// 32 bit offsets
const int totalSize = codeSize + typeInfoArraySize + excTypeAddLen;
unsigned char * pCode = _code =
- (unsigned char *)::rtl_allocateMemory(totalSize);
+ static_cast<unsigned char *>(::rtl_allocateMemory(totalSize));
int pCodeOffset = 0;
// New base of types array, starts after Trampoline D-Tor / C-Tors
- DWORD * types = (DWORD *)(pCode + codeSize);
+ DWORD * types = reinterpret_cast<DWORD *>(pCode + codeSize);
// New base of ExceptionType array, starts after types array
unsigned char *etMem = pCode + codeSize + typeInfoArraySize;
@@ -670,7 +668,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
// Fill pCode with D-Tor code
GenerateDestructorTrampoline(pCode, pTD);
- _pDtor = (sal_Int32)((sal_uInt64)pCode - _codeBase);
+ _pDtor = (sal_Int32)(reinterpret_cast<sal_uInt64>(pCode) - _codeBase);
pCodeOffset += codeSnippetSize;
// Info count accompanied by type info ptrs: type, base type, base base type, ...
@@ -681,12 +679,12 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
types[0] = nLen;
int nPos = 1;
- for (pCompTD = (typelib_CompoundTypeDescription*)pTD;
+ for (pCompTD = reinterpret_cast<typelib_CompoundTypeDescription*>(pTD);
pCompTD; pCompTD = pCompTD->pBaseTypeDescription)
{
// Create instance in mem block with placement new
ExceptionType * et = new(etMem + etMemOffset)ExceptionType(
- pCode + pCodeOffset, _codeBase, (typelib_TypeDescription *)pCompTD);
+ pCode + pCodeOffset, _codeBase, reinterpret_cast<typelib_TypeDescription *>(pCompTD));
// Next trampoline entry offset
pCodeOffset += codeSnippetSize;
@@ -704,25 +702,28 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
delete[] exceptionTypeSizeArray;
}
+#if !defined LEAK_STATIC_DATA
RaiseInfo::~RaiseInfo() throw ()
{
- sal_uInt32 * pTypes = (sal_uInt32 *)(_codeBase + _types) + 1;
+ sal_uInt32 * pTypes = reinterpret_cast<sal_uInt32 *>(_codeBase + _types) + 1;
// Because of placement new we have to call D.-tor, not delete!
- for ( int nTypes = *(sal_uInt32 *)(_codeBase + _types); nTypes--; )
+ for ( int nTypes = *reinterpret_cast<sal_uInt32 *>(_codeBase + _types); nTypes--; )
{
- ExceptionType *et = (ExceptionType *)(_codeBase + pTypes[nTypes]);
+ ExceptionType *et = reinterpret_cast<ExceptionType *>(_codeBase + pTypes[nTypes]);
et->~ExceptionType();
}
// free our single block
::rtl_freeMemory( _code );
::typelib_typedescription_release( _pTD );
}
+#endif
ExceptionInfos::ExceptionInfos() throw ()
{
}
+#if !defined LEAK_STATIC_DATA
ExceptionInfos::~ExceptionInfos() throw ()
{
SAL_INFO("bridges", "> freeing exception infos... <");
@@ -731,13 +732,14 @@ ExceptionInfos::~ExceptionInfos() throw ()
for ( t_string2PtrMap::const_iterator iPos( _allRaiseInfos.begin() );
iPos != _allRaiseInfos.end(); ++iPos )
{
- delete (RaiseInfo *)iPos->second;
+ delete static_cast<RaiseInfo *>(iPos->second);
}
}
+#endif
RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw ()
{
- static ExceptionInfos * s_pInfos = 0;
+ static ExceptionInfos * s_pInfos = nullptr;
if (! s_pInfos)
{
MutexGuard aGuard( Mutex::getGlobalMutex() );
@@ -772,13 +774,13 @@ RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw
// Put into map
pair< t_string2PtrMap::iterator, bool > insertion(
- s_pInfos->_allRaiseInfos.insert( t_string2PtrMap::value_type( rTypeName, (void *)pRaiseInfo ) ) );
+ s_pInfos->_allRaiseInfos.insert( t_string2PtrMap::value_type( rTypeName, static_cast<void *>(pRaiseInfo) ) ) );
assert(insertion.second && "### raise info insertion failed?!");
}
else
{
// Reuse existing info
- pRaiseInfo = (RaiseInfo *)iFind->second;
+ pRaiseInfo = static_cast<RaiseInfo *>(iFind->second);
}
return pRaiseInfo;
@@ -787,7 +789,7 @@ RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw
type_info * mscx_getRTTI(
OUString const & rUNOname )
{
- static RTTInfos * s_pRTTIs = 0;
+ static RTTInfos * s_pRTTIs = nullptr;
if (! s_pRTTIs)
{
MutexGuard aGuard( Mutex::getGlobalMutex() );
@@ -806,7 +808,7 @@ type_info * mscx_getRTTI(
int mscx_getRTTI_len(
OUString const & rUNOname)
{
- static RTTInfos * s_pRTTIs = 0;
+ static RTTInfos * s_pRTTIs = nullptr;
if (!s_pRTTIs)
{
MutexGuard aGuard(Mutex::getGlobalMutex());
@@ -833,7 +835,7 @@ void mscx_raiseException(
// ExceptionInfos::getRaiseInfo()
// construct cpp exception object
- typelib_TypeDescription * pTD = NULL;
+ typelib_TypeDescription * pTD = nullptr;
TYPELIB_DANGER_GET( &pTD, pUnoExc->pType );
void * pCppExc = alloca( pTD->nSize );
@@ -841,12 +843,12 @@ void mscx_raiseException(
ULONG_PTR arFilterArgs[4];
arFilterArgs[0] = MSVC_magic_number;
- arFilterArgs[1] = (ULONG_PTR)pCppExc;
- arFilterArgs[2] = (ULONG_PTR)ExceptionInfos::getRaiseInfo( pTD );
- arFilterArgs[3] = ((RaiseInfo *)arFilterArgs[2])->_codeBase;
+ arFilterArgs[1] = reinterpret_cast<ULONG_PTR>(pCppExc);
+ arFilterArgs[2] = reinterpret_cast<ULONG_PTR>(ExceptionInfos::getRaiseInfo( pTD ));
+ arFilterArgs[3] = reinterpret_cast<RaiseInfo *>(arFilterArgs[2])->_codeBase;
// Destruct uno exception
- ::uno_any_destruct( pUnoExc, 0 );
+ ::uno_any_destruct( pUnoExc, nullptr );
TYPELIB_DANGER_RELEASE( pTD );
// last point to release anything not affected by stack unwinding
@@ -858,13 +860,13 @@ int mscx_filterCppException(
uno_Any * pUnoExc,
uno_Mapping * pCpp2Uno )
{
- if (pPointers == 0)
+ if (pPointers == nullptr)
return EXCEPTION_CONTINUE_SEARCH;
EXCEPTION_RECORD * pRecord = pPointers->ExceptionRecord;
// Handle only C++ exceptions:
- if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
+ if (pRecord == nullptr || pRecord->ExceptionCode != MSVC_ExceptionCode)
return EXCEPTION_CONTINUE_SEARCH;
bool rethrow = __CxxDetectRethrow( &pRecord );
@@ -890,7 +892,7 @@ int mscx_filterCppException(
}
// Rethrow: handle only C++ exceptions:
- if (pRecord == 0 || pRecord->ExceptionCode != MSVC_ExceptionCode)
+ if (pRecord == nullptr || pRecord->ExceptionCode != MSVC_ExceptionCode)
return EXCEPTION_CONTINUE_SEARCH;
if (pRecord->NumberParameters == 4 &&
@@ -921,15 +923,15 @@ int mscx_filterCppException(
{
OUString aRTTIname(
OStringToOUString(
- (reinterpret_cast<__type_info *>(base + et->_pTypeInfo)
+ (reinterpret_cast<type_info_ *>(base + et->_pTypeInfo)
->_m_d_name),
RTL_TEXTENCODING_ASCII_US));
OUString aUNOname( toUNOname( aRTTIname ) );
- typelib_TypeDescription * pExcTD = 0;
+ typelib_TypeDescription * pExcTD = nullptr;
typelib_typedescription_getByName(
&pExcTD, aUNOname.pData );
- if (pExcTD == NULL)
+ if (pExcTD == nullptr)
{
OUStringBuffer buf;
buf.append(
@@ -948,7 +950,7 @@ int mscx_filterCppException(
{
// construct uno exception any
uno_any_constructAndConvert(
- pUnoExc, (void *) pRecord->ExceptionInformation[1],
+ pUnoExc, reinterpret_cast<void *>(pRecord->ExceptionInformation[1]),
pExcTD, pCpp2Uno );
typelib_typedescription_release( pExcTD );
}
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/mscx.hxx b/bridges/source/cpp_uno/msvc_win32_x86-64/mscx.hxx
index 297afba..6bfada3 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/mscx.hxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/mscx.hxx
@@ -48,5 +48,11 @@ void mscx_raiseException(
}
+//TOOD: Work around missing __CxxDetectRethrow in clang-cl for now (predefined
+// in cl, <www.geoffchappell.com/studies/msvc/language/predefined/index.html>):
+#if defined __clang__
+extern "C" int __cdecl __CxxDetectRethrow(void *);
+#endif
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
index 4e455f9..2a6bcb8 100644
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star::uno;
namespace
{
-static bool cpp_call(
+bool cpp_call(
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
bridges::cpp_uno::shared::VtableSlot aVtableSlot,
typelib_TypeDescriptionReference * pReturnTypeRef,
@@ -72,12 +72,12 @@ static bool cpp_call(
int nCppParamIndex = 0;
// Return type
- typelib_TypeDescription * pReturnTD = NULL;
+ typelib_TypeDescription * pReturnTD = nullptr;
TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
assert(pReturnTD);
// 'this'
- void * pAdjustedThisPtr = (void **)( pThis->getCppI() ) + aVtableSlot.offset;
+ void * pAdjustedThisPtr = reinterpret_cast<void **>( pThis->getCppI() ) + aVtableSlot.offset;
aCppParams[nCppParamIndex++].p = pAdjustedThisPtr;
enum class ReturnKind { Void, Simple, Complex, ComplexConvert };
@@ -110,7 +110,7 @@ static bool cpp_call(
{
const typelib_MethodParameter & rParam = pParams[nPos];
- typelib_TypeDescription * pParamTD = NULL;
+ typelib_TypeDescription * pParamTD = nullptr;
TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
if ( !rParam.bOut &&
@@ -186,12 +186,12 @@ static bool cpp_call(
// expects. (The callee is not actually varargs, of course.)
sal_Int64 (*pIMethod)(sal_Int64, ...) =
- (sal_Int64 (*)(sal_Int64, ...))
- (*((sal_uInt64 **)pAdjustedThisPtr))[aVtableSlot.index];
+ reinterpret_cast<sal_Int64 (*)(sal_Int64, ...)>(
+ (*static_cast<sal_uInt64 **>(pAdjustedThisPtr))[aVtableSlot.index]);
double (*pFMethod)(sal_Int64, ...) =
- (double (*)(sal_Int64, ...))
- (*((sal_uInt64 **)pAdjustedThisPtr))[aVtableSlot.index];
+ reinterpret_cast<double (*)(sal_Int64, ...)>(
+ (*static_cast<sal_uInt64 **>(pAdjustedThisPtr))[aVtableSlot.index]);
// Pass parameters 2..4 as if it was a floating-point value so
// that it gets put in both XMM and integer registers per the
@@ -245,7 +245,7 @@ static bool cpp_call(
}
// No exception occurred
- *ppUnoExc = NULL;
+ *ppUnoExc = nullptr;
// Reconvert temporary params
while ( nTempIndexes-- )
@@ -260,7 +260,7 @@ static bool cpp_call(
if ( pParams[nIndex].bOut ) // Inout
{
::uno_destructData(
- pUnoArgs[nIndex], pParamTD, 0 ); // Destroy UNO value
+ pUnoArgs[nIndex], pParamTD, nullptr ); // Destroy UNO value
::uno_copyAndConvertData(
pUnoArgs[nIndex], aCppParams[nCppIndex].p, pParamTD,
pThis->getBridge()->getCpp2Uno() );
@@ -285,7 +285,7 @@ static bool cpp_call(
case ReturnKind::Void:
break;
case ReturnKind::Simple:
- *(sal_Int64*)pUnoReturn = uRetVal.i;
+ *static_cast<sal_Int64*>(pUnoReturn) = uRetVal.i;
break;
case ReturnKind::Complex:
assert(uRetVal.p == pUnoReturn);
@@ -330,7 +330,7 @@ void unoInterfaceProxyDispatch(
{
#if OSL_DEBUG_LEVEL > 0
// determine vtable call index
- sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberTD)->nPosition;
+ sal_Int32 nMemberPos = reinterpret_cast<typelib_InterfaceMemberTypeDescription const *>(pMemberTD)->nPosition;
assert(nMemberPos < pTypeDescr->nAllMembers);
#endif
VtableSlot aVtableSlot(
@@ -343,8 +343,8 @@ void unoInterfaceProxyDispatch(
// Is GET
cpp_call(
pThis, aVtableSlot,
- ((typelib_InterfaceAttributeTypeDescription *)pMemberTD)->pAttributeTypeRef,
- 0, NULL, // no params
+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberTD)->pAttributeTypeRef,
+ 0, nullptr, // no params
pReturn, pArgs, ppException );
}
else
@@ -352,11 +352,11 @@ void unoInterfaceProxyDispatch(
// Is SET
typelib_MethodParameter aParam;
aParam.pTypeRef =
- ((typelib_InterfaceAttributeTypeDescription *)pMemberTD)->pAttributeTypeRef;
- aParam.bIn = sal_True;
- aParam.bOut = sal_False;
+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberTD)->pAttributeTypeRef;
+ aParam.bIn = true;
+ aParam.bOut = false;
- typelib_TypeDescriptionReference * pReturnTypeRef = NULL;
+ typelib_TypeDescriptionReference * pReturnTypeRef = nullptr;
OUString aVoidName("void");
typelib_typedescriptionreference_new(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
@@ -377,7 +377,7 @@ void unoInterfaceProxyDispatch(
{
#if OSL_DEBUG_LEVEL > 0
// determine vtable call index
- sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberTD)->nPosition;
+ sal_Int32 nMemberPos = reinterpret_cast<typelib_InterfaceMemberTypeDescription const *>(pMemberTD)->nPosition;
assert(nMemberPos < pTypeDescr->nAllMembers);
#endif
VtableSlot aVtableSlot(
@@ -391,34 +391,34 @@ void unoInterfaceProxyDispatch(
// Standard calls
case 1: // Acquire UNO interface
(*pUnoI->acquire)( pUnoI );
- *ppException = 0;
+ *ppException = nullptr;
break;
case 2: // Release UNO interface
(*pUnoI->release)( pUnoI );
- *ppException = 0;
+ *ppException = nullptr;
break;
case 0: // queryInterface() opt
{
- typelib_TypeDescription * pTD = NULL;
- TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
+ typelib_TypeDescription * pTD = nullptr;
+ TYPELIB_DANGER_GET( &pTD, static_cast< Type * >( pArgs[0] )->getTypeLibType() );
if ( pTD )
{
- uno_Interface * pInterface = NULL;
+ uno_Interface * pInterface = nullptr;
(*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
pThis->getBridge()->getUnoEnv(),
- (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
+ reinterpret_cast<void **>(&pInterface), pThis->oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) );
if ( pInterface )
{
::uno_any_construct(
- reinterpret_cast< uno_Any * >( pReturn ),
- &pInterface, pTD, 0 );
+ static_cast< uno_Any * >( pReturn ),
+ &pInterface, pTD, nullptr );
(*pInterface->release)( pInterface );
TYPELIB_DANGER_RELEASE( pTD );
- *ppException = 0;
+ *ppException = nullptr;
break;
}
TYPELIB_DANGER_RELEASE( pTD );
@@ -428,15 +428,15 @@ void unoInterfaceProxyDispatch(
default:
if ( ! cpp_call(
pThis, aVtableSlot,
- ((typelib_InterfaceMethodTypeDescription *)pMemberTD)->pReturnTypeRef,
- ((typelib_InterfaceMethodTypeDescription *)pMemberTD)->nParams,
- ((typelib_InterfaceMethodTypeDescription *)pMemberTD)->pParams,
+ reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD)->pReturnTypeRef,
+ reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD)->nParams,
+ reinterpret_cast<typelib_InterfaceMethodTypeDescription const *>(pMemberTD)->pParams,
pReturn, pArgs, ppException ) )
{
RuntimeException aExc( "Too many parameters!" );
Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
- ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
+ ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), nullptr );
}
}
break;
@@ -447,7 +447,7 @@ void unoInterfaceProxyDispatch(
Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
// Binary identical null reference (whatever that comment means...)
- ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
+ ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), nullptr );
}
}
}
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 15e24178..eecedbb 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -96,7 +96,7 @@ extern "C" void * SAL_CALL allocExec(
p = nullptr;
}
#elif defined SAL_W32
- p = VirtualAlloc(0, n, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ p = VirtualAlloc(nullptr, n, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#endif
if (p != nullptr) {
*size = n;
commit 29eb4f122bab9ba7280945d0c8a15588b1d46895
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Oct 14 16:59:02 2016 +0200
clang-cl loplugin: canvas
Change-Id: I3e4f9ccbe608a98759f2a9e312839eb909e6b575
Reviewed-on: https://gerrit.libreoffice.org/29878
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index 2dcebf3..1f58f2b 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -74,7 +74,7 @@ namespace dxcanvas
monitorSupport() :
mhLibrary(LoadLibrary("user32.dll")),
- mpMonitorFromWindow(NULL)
+ mpMonitorFromWindow(nullptr)
{
if(mhLibrary)
mpMonitorFromWindow = reinterpret_cast<fMonitorFromWindow>(
@@ -86,14 +86,14 @@ namespace dxcanvas
{
if(mhLibrary)
FreeLibrary(mhLibrary);
- mhLibrary=0;
+ mhLibrary=nullptr;
}
HMONITOR MonitorFromWindow( HWND hwnd )
{
// return adapter_default in case something went wrong...
if(!(mpMonitorFromWindow))
- return HMONITOR(0);
+ return HMONITOR(nullptr);
// MONITOR_DEFAULTTONEAREST
const DWORD dwFlags(0x00000002);
return mpMonitorFromWindow(hwnd,dwFlags);
@@ -127,15 +127,14 @@ namespace dxcanvas
public:
DXSurface( DXRenderModule& rRenderModule,
const ::basegfx::B2ISize& rSize );
- ~DXSurface();
+ ~DXSurface() override;
- virtual bool selectTexture();
- virtual bool isValid();
+ virtual bool selectTexture() override;
+ virtual bool isValid() override;
virtual bool update( const ::basegfx::B2IPoint& rDestPos,
const ::basegfx::B2IRange& rSourceRect,
- ::canvas::IColorBuffer& rSource );
+ ::canvas::IColorBuffer& rSource ) override;
virtual ::basegfx::B2IVector getSize();
- COMReference<IDirect3DTexture9> getTexture() const;
private:
/// Guard local methods against concurrent access to RenderModule
@@ -168,27 +167,27 @@ namespace dxcanvas
{
public:
explicit DXRenderModule( const vcl::Window& rWindow );
- ~DXRenderModule();
+ ~DXRenderModule() override;
- virtual void lock() const { maMutex.acquire(); }
- virtual void unlock() const { maMutex.release(); }
+ virtual void lock() const override { maMutex.acquire(); }
+ virtual void unlock() const override { maMutex.release(); }
virtual COMReference<IDirect3DSurface9>
- createSystemMemorySurface( const ::basegfx::B2IVector& rSize );
- virtual void disposing();
- virtual HWND getHWND() const { return mhWnd; }
- virtual void screenShot();
+ createSystemMemorySurface( const ::basegfx::B2IVector& rSize ) override;
+ virtual void disposing() override;
+ virtual HWND getHWND() const override { return mhWnd; }
+ virtual void screenShot() override;
virtual bool flip( const ::basegfx::B2IRectangle& rUpdateArea,
- const ::basegfx::B2IRectangle& rCurrWindowArea );
+ const ::basegfx::B2IRectangle& rCurrWindowArea ) override;
- virtual void resize( const ::basegfx::B2IRange& rect );
- virtual ::basegfx::B2IVector getPageSize();
- virtual ::std::shared_ptr<canvas::ISurface> createSurface( const ::basegfx::B2IVector& surfaceSize );
- virtual void beginPrimitive( PrimitiveType eType );
- virtual void endPrimitive();
- virtual void pushVertex( const ::canvas::Vertex& vertex );
- virtual bool isError();
+ virtual void resize( const ::basegfx::B2IRange& rect ) override;
+ virtual ::basegfx::B2IVector getPageSize() override;
+ virtual ::std::shared_ptr<canvas::ISurface> createSurface( const ::basegfx::B2IVector& surfaceSize ) override;
+ virtual void beginPrimitive( PrimitiveType eType ) override;
+ virtual void endPrimitive() override;
+ virtual void pushVertex( const ::canvas::Vertex& vertex ) override;
+ virtual bool isError() override;
COMReference<IDirect3DDevice9> getDevice() { return mpDevice; }
@@ -226,7 +225,7 @@ namespace dxcanvas
::basegfx::B2IVector maPageSize;
D3DPRESENT_PARAMETERS mad3dpp;
- inline bool isDisposed() const { return (mhWnd==NULL); }
+ inline bool isDisposed() const { return (mhWnd==nullptr); }
struct dxvertex
{
@@ -268,7 +267,7 @@ namespace dxcanvas
DXSurface::DXSurface( DXRenderModule& rRenderModule,
const ::basegfx::B2ISize& rSize ) :
mrRenderModule(rRenderModule),
- mpTexture(NULL),
+ mpTexture(nullptr),
maSize()
{
ImplRenderModuleGuard aGuard( mrRenderModule );
@@ -291,13 +290,13 @@ namespace dxcanvas
COMReference<IDirect3DDevice9> pDevice(rRenderModule.getDevice());
- IDirect3DTexture9 *pTexture(NULL);
+ IDirect3DTexture9 *pTexture(nullptr);
if(FAILED(pDevice->CreateTexture(
rSize.getX(),
rSize.getY(),
1,0,D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED,
- &pTexture,NULL)))
+ &pTexture,nullptr)))
return;
mpTexture=COMReference<IDirect3DTexture9>(pTexture);
@@ -389,7 +388,7 @@ namespace dxcanvas
pImage += rSourceRect.getMinX()*nSourceBytesPerPixel;
// calculate the destination memory address
- sal_uInt8 *pDst = (sal_uInt8*)aLockedRect.pBits;
+ sal_uInt8 *pDst = static_cast<sal_uInt8*>(aLockedRect.pBits);
const sal_uInt32 nNumBytesToCopy(
static_cast<sal_uInt32>(
@@ -397,7 +396,7 @@ namespace dxcanvas
nSourceBytesPerPixel);
const sal_uInt64 nNumLines(rSourceRect.getHeight());
- for(sal_uInt32 i=0; i<nNumLines; ++i)
+ for(sal_uInt64 i=0; i<nNumLines; ++i)
{
memcpy(pDst,pImage,nNumBytesToCopy);
@@ -430,7 +429,7 @@ namespace dxcanvas
pImage += rSourceRect.getMinX()*nSourceBytesPerPixel;
// calculate the destination memory address
- sal_uInt8 *pDst = (sal_uInt8*)aLockedRect.pBits;
+ sal_uInt8 *pDst = static_cast<sal_uInt8*>(aLockedRect.pBits);
const sal_Int32 nNumLines(
sal::static_int_cast<sal_Int32>(rSourceRect.getHeight()));
@@ -479,17 +478,11 @@ namespace dxcanvas
return maSize;
}
- COMReference<IDirect3DTexture9> DXSurface::getTexture() const
- {
- return mpTexture;
- }
-
-
// DXRenderModule::DXRenderModule
DXRenderModule::DXRenderModule( const vcl::Window& rWindow ) :
- mhWnd(0),
+ mhWnd(nullptr),
mpDevice(),
mpDirect3D9(),
mpSwapChain(),
@@ -537,14 +530,14 @@ namespace dxcanvas
}
maPageSize=aPageSize;
- IDirect3DVertexBuffer9 *pVB(NULL);
+ IDirect3DVertexBuffer9 *pVB(nullptr);
DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
aFVF,
D3DPOOL_DEFAULT,
&pVB,
- NULL)) )
+ nullptr)) )
{
throw lang::NoSupportException(
"Could not create DirectX device - out of memory!" );
@@ -573,7 +566,7 @@ namespace dxcanvas
mpTexture.reset();
mpWindow.disposeAndClear();
- mhWnd=NULL;
+ mhWnd=nullptr;
// refrain from releasing the DX9 objects. We're the only
// ones holding references to them, and it might be
@@ -603,14 +596,14 @@ namespace dxcanvas
mpWindow->SetParentClipMode(ParentClipMode::NoClip);
// the system child window must not clear its background
- mpWindow->EnableEraseBackground( sal_False );
+ mpWindow->EnableEraseBackground( false );
mpWindow->SetControlForeground();
mpWindow->SetControlBackground();
const SystemEnvData *pData = mpWindow->GetSystemData();
const HWND hwnd(reinterpret_cast<HWND>(pData->hWnd));
- mhWnd = const_cast<HWND>(hwnd);
+ mhWnd = hwnd;
ENSURE_OR_THROW( IsWindow( reinterpret_cast<HWND>(mhWnd) ),
"DXRenderModule::create() No valid HWND given." );
@@ -760,7 +753,7 @@ namespace dxcanvas
// now create the device, first try hardware vertex processing,
// then software vertex processing. if both queries fail, we give up
// and indicate failure.
- IDirect3DDevice9 *pDevice(NULL);
+ IDirect3DDevice9 *pDevice(nullptr);
if(FAILED(mpDirect3D9->CreateDevice(aAdapter,
D3DDEVTYPE_HAL,
mhWnd,
@@ -781,7 +774,7 @@ namespace dxcanvas
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list