diff options
author | Noel Grandin <noel@peralex.com> | 2014-09-29 13:33:02 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-01 13:08:41 +0200 |
commit | fa537124ac2ead40c4cba7f4ce298a1982db7d84 (patch) | |
tree | 9f17602f29c9179648ba5117af394c5ed0f8efb1 /basic | |
parent | 99bb7d664ef6c809ff6478fe2335c8a4a00e141b (diff) |
loplugin: cstylecast
Change-Id: Ie3d13eccdf444d569cbe40befb45eb86941160b6
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 24 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 18 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 36 |
3 files changed, 39 insertions, 39 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 9563b5761f48..15056527baca 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -677,7 +677,7 @@ void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInf sal_uInt16 nModCount = pBasic->GetModules()->Count(); for ( sal_uInt16 nMod = 0 ; nMod < nModCount ; nMod++ ) { - SbModule* pModule = (SbModule*)pBasic->GetModules()->Get( nMod ); + SbModule* pModule = static_cast<SbModule*>(pBasic->GetModules()->Get( nMod )); DBG_ASSERT( pModule, "Module not received!" ); OUString aModName = pModule->GetName(); @@ -1010,7 +1010,7 @@ bool BasicManager::HasExeCode( const OUString& sLib ) sal_uInt16 nMods = pMods ? pMods->Count() : 0; for( sal_uInt16 i = 0; i < nMods; i++ ) { - SbModule* p = (SbModule*) pMods->Get( i ); + SbModule* p = static_cast<SbModule*>( pMods->Get( i ) ); if ( p ) if ( p->HasExeCode() ) return true; @@ -1169,7 +1169,7 @@ bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con { if( xNew->IsA( TYPE(StarBASIC) ) ) { - StarBASIC* pNew = (StarBASIC*)(SbxBase*) xNew; + StarBASIC* pNew = static_cast<StarBASIC*>((SbxBase*) xNew); // Use the Parent of the old BASICs if( rOldBasic.Is() ) { @@ -1206,7 +1206,7 @@ void BasicManager::CheckModules( StarBASIC* pLib, bool bReference ) const for ( sal_uInt16 nMod = 0; nMod < pLib->GetModules()->Count(); nMod++ ) { - SbModule* pModule = (SbModule*)pLib->GetModules()->Get( nMod ); + SbModule* pModule = static_cast<SbModule*>(pLib->GetModules()->Get( nMod )); DBG_ASSERT( pModule, "Module not received!" ); if ( !pModule->IsCompiled() && !StarBASIC::GetErrorCode() ) { @@ -1724,10 +1724,10 @@ namespace sal_uInt16 nModCount = pLib->GetModules()->Count(); for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod ) { - SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod ); + SbModule* pMod = static_cast<SbModule*>(pLib->GetModules()->Get( nMod )); if ( pMod && rTransliteration.isEqual( pMod->GetName(), sModule ) ) { - SbMethod* pMethod = (SbMethod*)pMod->Find( sMacro, SbxCLASS_METHOD ); + SbMethod* pMethod = static_cast<SbMethod*>(pMod->Find( sMacro, SbxCLASS_METHOD )); if( pMethod ) { return pMethod; @@ -2103,7 +2103,7 @@ sal_Bool DialogContainer_Impl::hasElements() for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ ) { SbxVariable* pVar = mpLib->GetObjects()->Get( nObj ); - if ( pVar->ISA( SbxObject ) && ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) + if ( pVar->ISA( SbxObject ) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) { bRet = true; break; @@ -2118,14 +2118,14 @@ uno::Any DialogContainer_Impl::getByName( const OUString& aName ) { SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE ); if( !( pVar && pVar->ISA( SbxObject ) && - ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) ) + ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) ) { throw container::NoSuchElementException(); } uno::Reference< script::XStarBasicDialogInfo > xDialog = (XStarBasicDialogInfo*)new DialogInfo_Impl - ( aName, implGetDialogData( (SbxObject*)pVar ) ); + ( aName, implGetDialogData( static_cast<SbxObject*>(pVar) ) ); uno::Any aRetAny; aRetAny <<= xDialog; @@ -2144,7 +2144,7 @@ uno::Sequence< OUString > DialogContainer_Impl::getElementNames() for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ ) { SbxVariable* pVar = mpLib->GetObjects()->Get( nObj ); - if ( pVar->ISA( SbxObject ) && ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) + if ( pVar->ISA( SbxObject ) && ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) { pRetSeq[ nDialogCounter ] = OUString( pVar->GetName() ); nDialogCounter++; @@ -2160,7 +2160,7 @@ sal_Bool DialogContainer_Impl::hasByName( const OUString& aName ) bool bRet = false; SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE ); if( pVar && pVar->ISA( SbxObject ) && - ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) + ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) { bRet = true; } @@ -2200,7 +2200,7 @@ void DialogContainer_Impl::removeByName( const OUString& Name ) (void)Name; SbxVariable* pVar = mpLib->GetObjects()->Find( Name, SbxCLASS_DONTCARE ); if( !( pVar && pVar->ISA( SbxObject ) && - ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) ) + ( static_cast<SbxObject*>(pVar)->GetSbxId() == SBXID_DIALOG ) ) ) { throw container::NoSuchElementException(); } diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 53880946bde8..4c6c87779967 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -4410,16 +4410,16 @@ RTLFUNC(Load) } - SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); + SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject()); if ( pObj ) { if( pObj->IsA( TYPE( SbUserFormModule ) ) ) { - ((SbUserFormModule*)pObj)->Load(); + static_cast<SbUserFormModule*>(pObj)->Load(); } else if( pObj->IsA( TYPE( SbxObject ) ) ) { - SbxVariable* pVar = ((SbxObject*)pObj)->Find( OUString("Load"), SbxCLASS_METHOD ); + SbxVariable* pVar = static_cast<SbxObject*>(pObj)->Find( OUString("Load"), SbxCLASS_METHOD ); if( pVar ) { pVar->GetInteger(); @@ -4441,17 +4441,17 @@ RTLFUNC(Unload) } - SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); + SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject()); if ( pObj ) { if( pObj->IsA( TYPE( SbUserFormModule ) ) ) { - SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj; + SbUserFormModule* pFormModule = static_cast<SbUserFormModule*>(pObj); pFormModule->Unload(); } else if( pObj->IsA( TYPE( SbxObject ) ) ) { - SbxVariable* pVar = ((SbxObject*)pObj)->Find( OUString("Unload"), SbxCLASS_METHOD ); + SbxVariable* pVar = static_cast<SbxObject*>(pObj)->Find( OUString("Unload"), SbxCLASS_METHOD ); if( pVar ) { pVar->GetInteger(); @@ -4480,7 +4480,7 @@ RTLFUNC(LoadPicture) Graphic aGraphic(aBmp); SbxObjectRef xRef = new SbStdPicture; - ((SbStdPicture*)(SbxObject*)xRef)->SetGraphic( aGraphic ); + static_cast<SbStdPicture*>((SbxObject*)xRef)->SetGraphic( aGraphic ); rPar.Get(0)->PutObject( xRef ); } } @@ -4497,11 +4497,11 @@ RTLFUNC(SavePicture) return; } - SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject(); + SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject()); if( pObj->IsA( TYPE( SbStdPicture ) ) ) { SvFileStream aOStream( rPar.Get(2)->GetOUString(), STREAM_WRITE | STREAM_TRUNC ); - Graphic aGraphic = ((SbStdPicture*)pObj)->GetGraphic(); + Graphic aGraphic = static_cast<SbStdPicture*>(pObj)->GetGraphic(); WriteGraphic( aOStream, aGraphic ); } } diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index c7de8abfea60..e8354d69ddf5 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -537,7 +537,7 @@ StarBASIC* GetCurrentBasic( StarBASIC* pRTBasic ) SbxObject* pParent = pActiveModule->GetParent(); if( pParent && pParent->ISA(StarBASIC) ) { - pCurBasic = (StarBASIC*)pParent; + pCurBasic = static_cast<StarBASIC*>(pParent); } } return pCurBasic; @@ -570,7 +570,7 @@ SbMethod* SbiInstance::GetCaller( sal_uInt16 nLevel ) // Attention: pMeth can also be NULL (on a call of the init-code) SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, sal_uInt32 nStart ) - : rBasic( *(StarBASIC*)pm->pParent ), pInst( GetSbData()->pInst ), + : rBasic( *static_cast<StarBASIC*>(pm->pParent) ), pInst( GetSbData()->pInst ), pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0) { nFlags = pe ? pe->GetDebugFlags() : 0; @@ -1653,7 +1653,7 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe else if( refVar->ISA(SbProcedureProperty) ) return false; - SbxObjectRef xValObj = (SbxObject*)refVal->GetObject(); + SbxObjectRef xValObj = static_cast<SbxObject*>(refVal->GetObject()); if( !xValObj.Is() || xValObj->ISA(SbUnoAnyObject) ) return false; @@ -1674,7 +1674,7 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe // will trigger an error, we need to squash those here. // Alternatively it is possible that the same scenario // could overwrite and existing error. Lets prevent that - SbxObjectRef xVarObj = (SbxObject*)refVar->GetObject(); + SbxObjectRef xVarObj = static_cast<SbxObject*>(refVar->GetObject()); if ( eOldErr != SbxERR_OK ) SbxBase::SetError( eOldErr ); else @@ -1788,7 +1788,7 @@ struct DimAsNewRecoverItem struct SbxVariablePtrHash { size_t operator()( SbxVariable* pVar ) const - { return (size_t)pVar; } + { return reinterpret_cast<size_t>(pVar); } }; typedef boost::unordered_map< SbxVariable*, DimAsNewRecoverItem, @@ -2258,7 +2258,7 @@ void SbiRuntime::StepREDIMP() { SbxBase* pElemObj = refVar->GetObject(); SbxDimArray* pNewArray = PTR_CAST(SbxDimArray,pElemObj); - SbxDimArray* pOldArray = (SbxDimArray*)(SbxArray*)refRedimpArray; + SbxDimArray* pOldArray = static_cast<SbxDimArray*>((SbxArray*)refRedimpArray); if( pNewArray ) { short nDimsNew = pNewArray->GetDims(); @@ -3080,7 +3080,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 ) } case FOR_EACH_COLLECTION: { - BasicCollection* pCollection = (BasicCollection*)(SbxVariable*)pForStk->refEnd; + BasicCollection* pCollection = static_cast<BasicCollection*>((SbxVariable*)pForStk->refEnd); SbxArrayRef xItemArray = pCollection->xItemArray; sal_Int32 nCount = xItemArray->Count32(); if( pForStk->nCurCollectionIndex < nCount ) @@ -3242,17 +3242,17 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal, // we don't know the type of uno properties that are (maybevoid) if ( t == SbxEMPTY && refVal->ISA(SbUnoProperty) ) { - SbUnoProperty* pProp = (SbUnoProperty*)pVal; + SbUnoProperty* pProp = static_cast<SbUnoProperty*>(pVal); t = pProp->getRealType(); } if( t == SbxOBJECT ) { SbxObject* pObj; if( pVal->IsA( TYPE(SbxObject) ) ) - pObj = (SbxObject*) pVal; + pObj = static_cast<SbxObject*>( pVal ); else { - pObj = (SbxObject*) refVal->GetObject(); + pObj = static_cast<SbxObject*>( refVal->GetObject() ); if( pObj && !pObj->IsA( TYPE(SbxObject) ) ) pObj = NULL; } @@ -3575,7 +3575,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt // has to know the difference between Left$() and Left() // because the methods' parameters are cut away in PopVar() - SbxVariable* pNew = new SbxMethod( *((SbxMethod*)pElem) ); + SbxVariable* pNew = new SbxMethod( *(static_cast<SbxMethod*>(pElem)) ); //OLD: SbxVariable* pNew = new SbxVariable( *pElem ); pElem->SetParameters(0); @@ -3734,7 +3734,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 ) SbxBaseRef pObj = (SbxBase*)p->GetObject(); if( pObj && pObj->ISA(SbUnoObject) ) { - SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj; + SbUnoObject* pUnoObj = static_cast<SbUnoObject*>((SbxBase*)pObj); Any aAny = pUnoObj->getUnoAny(); if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) @@ -3862,7 +3862,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) { if( pObj->ISA(SbUnoObject) ) { - SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj; + SbUnoObject* pUnoObj = static_cast<SbUnoObject*>((SbxBase*)pObj); Any aAny = pUnoObj->getUnoAny(); if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) @@ -3933,7 +3933,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) { if( pDfltObj->ISA(SbUnoObject) ) { - pUnoObj = (SbUnoObject*)(SbxBase*)pDfltObj; + pUnoObj = static_cast<SbUnoObject*>((SbxBase*)pDfltObj); Any aUnoAny = pUnoObj->getUnoAny(); if( aUnoAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) @@ -3961,7 +3961,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) if ( refTemp ) { meth->SetParameters( pPar ); - SbxVariable* pNew = new SbxMethod( *(SbxMethod*)meth ); + SbxVariable* pNew = new SbxMethod( *static_cast<SbxMethod*>(meth) ); pElem = pNew; } } @@ -3973,7 +3973,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) } else if( pObj->ISA(BasicCollection) ) { - BasicCollection* pCol = (BasicCollection*)(SbxBase*)pObj; + BasicCollection* pCol = static_cast<BasicCollection*>((SbxBase*)pObj); pElem = new SbxVariable( SbxVARIANT ); pPar->Put( pElem, 0 ); pCol->CollItem( pPar ); @@ -4393,7 +4393,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) if( xObj->ISA(SbxDimArray) ) { SbxBase* pObj = (SbxBase*)xObj; - pArray = (SbxDimArray*)pObj; + pArray = static_cast<SbxDimArray*>(pObj); short nDims = pArray->GetDims(); sal_Int32 nTotalSize = 0; @@ -4436,7 +4436,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 ) } } - SbxDimArray* pOldArray = (SbxDimArray*)(SbxArray*)refRedimpArray; + SbxDimArray* pOldArray = static_cast<SbxDimArray*>((SbxArray*)refRedimpArray); if( pArray && pOldArray ) { short nDimsNew = pArray->GetDims(); |