From 4fa3e47a853590100fa1bf8a14e5fea556cf0ef3 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:11:56 +0100 Subject: More loplugin:cstylecast: vbahelper auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I4ab5ca8cc7c3e26b43937ec9edae3d106f11cf56 --- vbahelper/source/msforms/vbacontrol.cxx | 4 ++-- vbahelper/source/msforms/vbatextbox.cxx | 2 +- vbahelper/source/vbahelper/vbaapplicationbase.cxx | 10 +++++----- vbahelper/source/vbahelper/vbahelper.cxx | 2 +- vbahelper/source/vbahelper/vbashape.cxx | 2 +- vbahelper/source/vbahelper/vbatextframe.cxx | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index e45f05f6f896..0db919760dc6 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -722,8 +722,8 @@ sal_Int32 ScVbaControl::getBackColor() void ScVbaControl::setBackColor( sal_Int32 nBackColor ) { - if ( ( (sal_uInt32)nBackColor >= (sal_uInt32)0x80000000 ) && - ( (sal_uInt32)nBackColor <= (sal_uInt32)0x80000000 + SAL_N_ELEMENTS(nSysCols) ) ) + if ( ( static_cast(nBackColor) >= sal_uInt32(0x80000000) ) && + ( static_cast(nBackColor) <= sal_uInt32(0x80000000) + SAL_N_ELEMENTS(nSysCols) ) ) { nBackColor = nSysCols[ nBackColor & 0x0FF]; } diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx index b8ef93550c16..bb6e7e973100 100644 --- a/vbahelper/source/msforms/vbatextbox.cxx +++ b/vbahelper/source/msforms/vbatextbox.cxx @@ -78,7 +78,7 @@ ScVbaTextBox::getMaxLength() aValue = m_xProps->getPropertyValue( "MaxTextLen" ); sal_Int16 nMaxLength = 0; aValue >>= nMaxLength; - return (sal_Int32)nMaxLength; + return static_cast(nMaxLength); } void SAL_CALL diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 60056ef40b6a..753a389e5bb6 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -85,7 +85,7 @@ public: nDiffDays += 2; // Change VisualBasic: 1.Jan.1900 == 2 long nDiffSeconds = aTimeNow.GetHour() * 3600 + aTimeNow.GetMin() * 60 + aTimeNow.GetSec(); - return (double)nDiffDays + ((double)nDiffSeconds)/(double)(24*3600); + return static_cast(nDiffDays) + static_cast(nDiffSeconds)/double(24*3600); } static sal_Int32 GetTimerMiliseconds( double nFrom, double nTo ) @@ -96,7 +96,7 @@ public: else nResult = 50; - return (sal_Int32) nResult; + return static_cast(nResult); } void Start( const ::rtl::Reference< VbaApplicationBase >& xBase, const OUString& aFunction, double nFrom, double nTo ) @@ -140,9 +140,9 @@ struct VbaTimerInfoHash { size_t operator()( const VbaTimerInfo& rTimerInfo ) const { - return (size_t)rTimerInfo.first.hashCode() - + (size_t)rtl_str_hashCode_WithLength( reinterpret_cast(&rTimerInfo.second.first), sizeof( double ) ) - + (size_t)rtl_str_hashCode_WithLength( reinterpret_cast(&rTimerInfo.second.second), sizeof( double ) ); + return static_cast(rTimerInfo.first.hashCode()) + + static_cast(rtl_str_hashCode_WithLength( reinterpret_cast(&rTimerInfo.second.first), sizeof( double ) )) + + static_cast(rtl_str_hashCode_WithLength( reinterpret_cast(&rTimerInfo.second.second), sizeof( double ) )); } }; diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 82cd2bf197c0..8226768fb888 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -401,7 +401,7 @@ void PrintOutHelper( SfxViewShell const * pViewShell, const uno::Any& From, cons } } else - pDispatcher->Execute( (sal_uInt16)SID_PRINTDOC, SfxCallMode::SYNCHRON, aArgs ); + pDispatcher->Execute( sal_uInt16(SID_PRINTDOC), SfxCallMode::SYNCHRON, aArgs ); } diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx index e7aed451efe2..57b76b61d238 100644 --- a/vbahelper/source/vbahelper/vbashape.cxx +++ b/vbahelper/source/vbahelper/vbashape.cxx @@ -421,7 +421,7 @@ ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) m_xPropertySet->setPropertyValue( "ZOrder" , uno::makeAny( SAL_MAX_INT32 ) ); break; case office::MsoZOrderCmd::msoSendToBack: - m_xPropertySet->setPropertyValue( "ZOrder" , uno::makeAny( (sal_Int32)0 ) ); + m_xPropertySet->setPropertyValue( "ZOrder" , uno::makeAny( sal_Int32(0) ) ); break; case office::MsoZOrderCmd::msoBringForward: nOrderPosition += 1; diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx index 865ebeba3fe7..9b4810e04b91 100644 --- a/vbahelper/source/vbahelper/vbatextframe.cxx +++ b/vbahelper/source/vbahelper/vbatextframe.cxx @@ -78,7 +78,7 @@ float SAL_CALL VbaTextFrame::getMarginBottom() { sal_Int32 nMargin = getMargin( "TextLowerDistance" ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); + float fMargin = static_cast(Millimeter::getInPoints( nMargin )); return fMargin; } @@ -92,7 +92,7 @@ float SAL_CALL VbaTextFrame::getMarginTop() { sal_Int32 nMargin = getMargin( "TextUpperDistance" ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); + float fMargin = static_cast(Millimeter::getInPoints( nMargin )); return fMargin; } @@ -106,7 +106,7 @@ float SAL_CALL VbaTextFrame::getMarginLeft() { sal_Int32 nMargin = getMargin( "TextLeftDistance" ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); + float fMargin = static_cast(Millimeter::getInPoints( nMargin )); return fMargin; } @@ -120,7 +120,7 @@ float SAL_CALL VbaTextFrame::getMarginRight() { sal_Int32 nMargin = getMargin( "TextRightDistance" ); - float fMargin = (float)Millimeter::getInPoints( nMargin ); + float fMargin = static_cast(Millimeter::getInPoints( nMargin )); return fMargin; } -- cgit