summaryrefslogtreecommitdiff
path: root/basic/source/classes
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-01-12 20:29:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-01-12 20:29:14 +0100
commit6070aaa47d6cede11f8cc0b54ed726fc45cb4a74 (patch)
treefe9c64b200eb663fd2fd82cb7d66d17ea199b53e /basic/source/classes
parent9bd84cfb52eac91ee4bd1376f1a4b053afc24ab5 (diff)
More loplugin:cstylecast: basic
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I20b38196ee1b6a34384dc46d9de1b6e1b44947ae
Diffstat (limited to 'basic/source/classes')
-rw-r--r--basic/source/classes/eventatt.cxx2
-rw-r--r--basic/source/classes/image.cxx12
-rw-r--r--basic/source/classes/sb.cxx4
-rw-r--r--basic/source/classes/sbunoobj.cxx34
-rw-r--r--basic/source/classes/sbxmod.cxx10
5 files changed, 31 insertions, 31 deletions
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index e7003e7eb550..97e3f78b4329 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -184,7 +184,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
if( comphelper::string::getTokenCount(aMacro, '.') == 3 )
{
sal_Int32 nLast = 0;
- OUString aFullLibName = aMacro.getToken( (sal_Int32)0, '.', nLast );
+ OUString aFullLibName = aMacro.getToken( sal_Int32(0), '.', nLast );
sal_Int32 nIndex = aFullLibName.indexOf( ':' );
if (nIndex >= 0)
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 6fc7a50b17d7..9a26496db45b 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -119,7 +119,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
eCharSet = nCharSet;
eCharSet = GetSOLoadTextEncoding( eCharSet );
bBadVer = ( nVersion > B_CURVERSION );
- nDimBase = (sal_uInt16) lDimBase;
+ nDimBase = static_cast<sal_uInt16>(lDimBase);
}
bool bLegacy = ( nVersion < B_EXT_IMG_VERSION );
@@ -170,7 +170,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
if ( bLegacy )
{
ReleaseLegacyBuffer(); // release any previously held buffer
- nLegacyCodeSize = (sal_uInt16) nCodeSize;
+ nLegacyCodeSize = static_cast<sal_uInt16>(nCodeSize);
pLegacyPCode = pCode;
PCodeBuffConvertor< sal_uInt16, sal_uInt32 > aLegacyToNew( reinterpret_cast<sal_uInt8*>(pLegacyPCode), nLegacyCodeSize );
@@ -209,20 +209,20 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
for( i = 0; i < nStrings && SbiGood( r ); i++ )
{
r.ReadUInt32( nOff );
- pStringOff[ i ] = (sal_uInt16) nOff;
+ pStringOff[ i ] = static_cast<sal_uInt16>(nOff);
}
r.ReadUInt32( nLen );
if( SbiGood( r ) )
{
delete [] pStrings;
pStrings = new sal_Unicode[ nLen ];
- nStringSize = (sal_uInt16) nLen;
+ nStringSize = static_cast<sal_uInt16>(nLen);
std::unique_ptr<char[]> pByteStrings(new char[ nLen ]);
r.ReadBytes(pByteStrings.get(), nStringSize);
for( short j = 0; j < nStrings; j++ )
{
- sal_uInt16 nOff2 = (sal_uInt16) pStringOff[ j ];
+ sal_uInt16 nOff2 = static_cast<sal_uInt16>(pStringOff[ j ]);
OUString aStr( pByteStrings.get() + nOff2, strlen(pByteStrings.get() + nOff2), eCharSet );
memcpy( pStrings + nOff2, aStr.getStr(), (aStr.getLength() + 1) * sizeof( sal_Unicode ) );
}
@@ -439,7 +439,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
std::unique_ptr<char[]> pByteStrings(new char[ nStringSize ]);
for( i = 0; i < nStrings; i++ )
{
- sal_uInt16 nOff = (sal_uInt16) pStringOff[ i ];
+ sal_uInt16 nOff = static_cast<sal_uInt16>(pStringOff[ i ]);
OString aStr(OUStringToOString(OUString(pStrings + nOff), eCharSet));
memcpy( pByteStrings.get() + nOff, aStr.getStr(), (aStr.getLength() + 1) * sizeof( char ) );
}
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 79e40d298660..85ea6d902ec1 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -2187,7 +2187,7 @@ void BasicCollection::CollItem( SbxArray* pPar_ )
SbxVariable* pRes = nullptr;
SbxVariable* p = pPar_->Get( 1 );
sal_Int32 nIndex = implGetIndex( p );
- if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() )
+ if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(xItemArray->Count32()) )
{
pRes = xItemArray->Get32( nIndex );
}
@@ -2211,7 +2211,7 @@ void BasicCollection::CollRemove( SbxArray* pPar_ )
SbxVariable* p = pPar_->Get( 1 );
sal_Int32 nIndex = implGetIndex( p );
- if( nIndex >= 0 && nIndex < (sal_Int32)xItemArray->Count32() )
+ if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(xItemArray->Count32()) )
{
xItemArray->Remove( nIndex );
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 8a67a697e5f0..d622d887ce21 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -364,7 +364,7 @@ OUString implGetExceptionMsg( const EXCEPTION& e )
void implHandleBasicErrorException( BasicErrorException const & e )
{
- ErrCode nError = StarBASIC::GetSfxFromVBError( (sal_uInt16)e.ErrorCode );
+ ErrCode nError = StarBASIC::GetSfxFromVBError( static_cast<sal_uInt16>(e.ErrorCode) );
StarBASIC::Error( nError, e.ErrorMessageArgument );
}
@@ -391,7 +391,7 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
// special handling for BasicErrorException errors
if ( aWrapped.TargetException >>= aBasicError )
{
- nError = StarBASIC::GetSfxFromVBError( (sal_uInt16)aBasicError.ErrorCode );
+ nError = StarBASIC::GetSfxFromVBError( static_cast<sal_uInt16>(aBasicError.ErrorCode) );
aMessageBuf.append( aBasicError.ErrorMessageArgument );
aExamine.clear();
break;
@@ -540,7 +540,7 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int
sal_Int32 nLen = xIdlArray->getLen( aValue );
for ( sal_Int32 index = 0; index < nLen; ++index )
{
- Any aElementAny = xIdlArray->get( aValue, (sal_uInt32)index );
+ Any aElementAny = xIdlArray->get( aValue, static_cast<sal_uInt32>(index) );
// This detects the dimension were currently processing
if ( dimCopy == dimension )
{
@@ -767,7 +767,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
for( i = 0 ; i < nLen ; i++ )
{
// convert elements
- Any aElementAny = xIdlArray->get( aValue, (sal_uInt32)i );
+ Any aElementAny = xIdlArray->get( aValue, static_cast<sal_uInt32>(i) );
auto xVar = tools::make_ref<SbxVariable>( eSbxElementType );
unoToSbxValue( xVar.get(), aElementAny );
@@ -1432,7 +1432,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property const * pUn
if( bOverflow )
StarBASIC::Error( ERRCODE_BASIC_MATH_OVERFLOW );
- sal_Int8 nByteVal = (sal_Int8)nVal;
+ sal_Int8 nByteVal = static_cast<sal_Int8>(nVal);
aRetVal <<= nByteVal;
break;
}
@@ -1463,7 +1463,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, sal_uInt
Any aValAny;
for( i = 0 ; i < nParamCount ; i++ )
{
- sal_uInt16 iSbx = (sal_uInt16)(i+1);
+ sal_uInt16 iSbx = static_cast<sal_uInt16>(i+1);
aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
bBlockConversionToSmallestType );
@@ -1486,7 +1486,7 @@ void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, sal_uInt
{
for( i = 0 ; i < nParamCount ; i++ )
{
- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (sal_uInt16)(i+1) ),
+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( static_cast<sal_uInt16>(i+1) ),
bBlockConversionToSmallestType );
}
}
@@ -1526,9 +1526,9 @@ Any invokeAutomationMethod( const OUString& Name, Sequence< Any > const & args,
for( sal_uInt32 j = 0 ; j < nLen ; j++ )
{
sal_Int16 iTarget = pIndices[ j ];
- if( iTarget >= (sal_Int16)nParamCount )
+ if( iTarget >= static_cast<sal_Int16>(nParamCount) )
break;
- unoToSbxValue( pParams->Get( (sal_uInt16)(j+1) ), pNewValues[ j ] );
+ unoToSbxValue( pParams->Get( static_cast<sal_uInt16>(j+1) ), pNewValues[ j ] );
}
}
return aRetAny;
@@ -2061,7 +2061,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
try
{
- sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
+ sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
Any aRetAny;
if ( bCanBeConsideredAMethod && nParamCount )
@@ -2147,7 +2147,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if( pHint->GetId() == SfxHintId::BasicDataWanted )
{
// number of Parameter -1 because of Param0 == this
- sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
+ sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
Sequence<Any> args;
bool bOutParams = false;
sal_uInt32 i;
@@ -2200,7 +2200,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
css::uno::Type aType( rxClass->getTypeClass(), rxClass->getName() );
// ATTENTION: Don't forget for Sbx-Parameter the offset!
- pAnyArgs[i] = sbxToUnoValue( pParams->Get( (sal_uInt16)(i+1) ), aType );
+ pAnyArgs[i] = sbxToUnoValue( pParams->Get( static_cast<sal_uInt16>(i+1) ), aType );
// If it is not certain check whether the out-parameter are available.
if( !bOutParams )
@@ -2243,7 +2243,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
const ParamInfo& rInfo = pParamInfos[j];
ParamMode aParamMode = rInfo.aMode;
if( aParamMode != ParamMode_IN )
- unoToSbxValue( pParams->Get( (sal_uInt16)(j+1) ), pAnyArgs[ j ] );
+ unoToSbxValue( pParams->Get( static_cast<sal_uInt16>(j+1) ), pAnyArgs[ j ] );
}
}
}
@@ -3518,7 +3518,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
if( pUnoCtor && pHint->GetId() == SfxHintId::BasicDataWanted )
{
// Parameter count -1 because of Param0 == this
- sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
+ sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
Sequence<Any> args;
Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc();
@@ -3585,7 +3585,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
Any* pAnyArgs = args.getArray();
for( sal_uInt32 i = 0 ; i < nEffectiveParamCount ; i++ )
{
- sal_uInt16 iSbx = (sal_uInt16)(i + nSbxParameterOffset + nParameterOffsetByContext);
+ sal_uInt16 iSbx = static_cast<sal_uInt16>(i + nSbxParameterOffset + nParameterOffsetByContext);
// bRestParameterMode allows nEffectiveParamCount > nUnoParamCount
Reference< XParameter > xParam;
@@ -3650,7 +3650,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
continue;
if( xParam->isOut() )
- unoToSbxValue( pParams->Get( (sal_uInt16)(j+1) ), pAnyArgs[ j ] );
+ unoToSbxValue( pParams->Get( static_cast<sal_uInt16>(j+1) ), pAnyArgs[ j ] );
}
}
}
@@ -3727,7 +3727,7 @@ void SbUnoSingleton::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
SbxVariable* pVar = pHint->GetVar();
SbxArray* pParams = pVar->GetParameters();
- sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0;
+ sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
sal_uInt32 nAllowedParamCount = 1;
Reference < XComponentContext > xContextToUse;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 85b5a2412653..3c28f7a5b765 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1448,7 +1448,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine,
const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine, sal_uInt16& nCol,
bool bFollowJumps, const SbiImage* pImg ) const
{
- sal_uInt32 nPC = (sal_uInt32) ( p - reinterpret_cast<const sal_uInt8*>(pImage->GetCode()) );
+ sal_uInt32 nPC = static_cast<sal_uInt32>( p - reinterpret_cast<const sal_uInt8*>(pImage->GetCode()) );
while( nPC < pImage->GetCodeSize() )
{
SbiOpcode eOp = (SbiOpcode ) ( *p++ );
@@ -1472,7 +1472,7 @@ const sal_uInt8* SbModule::FindNextStmnt( const sal_uInt8* p, sal_uInt16& nLine,
nl |= *p++ << 16 ; nl |= *p++ << 24;
nc = *p++; nc |= *p++ << 8;
nc |= *p++ << 16 ; nc |= *p++ << 24;
- nLine = (sal_uInt16)nl; nCol = (sal_uInt16)nc;
+ nLine = static_cast<sal_uInt16>(nl); nCol = static_cast<sal_uInt16>(nc);
return p;
}
else if( eOp >= SbiOpcode::SbOP2_START && eOp <= SbiOpcode::SbOP2_END )
@@ -1582,14 +1582,14 @@ SbModule::fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg ) const
pImg = pImage;
for( sal_uInt32 i = 0; i < pMethods->Count(); i++ )
{
- SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get( (sal_uInt16)i ) );
+ SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get( static_cast<sal_uInt16>(i) ) );
if( pMeth )
{
//fixup method start positions
if ( bCvtToLegacy )
pMeth->nStart = pImg->CalcLegacyOffset( pMeth->nStart );
else
- pMeth->nStart = pImg->CalcNewOffset( (sal_uInt16)pMeth->nStart );
+ pMeth->nStart = pImg->CalcNewOffset( static_cast<sal_uInt16>(pMeth->nStart) );
}
}
@@ -1986,7 +1986,7 @@ bool SbMethod::LoadData( SvStream& rStrm, sal_uInt16 nVer )
sal_uInt16 nFlag;
rStrm.ReadUInt16( nFlag );
- sal_Int16 nTempStart = (sal_Int16)nStart;
+ sal_Int16 nTempStart = static_cast<sal_Int16>(nStart);
if( nVer == 2 )
{