diff options
author | Juan Picca <jumapico@gmail.com> | 2015-02-01 00:49:08 -0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-02-05 07:24:30 +0000 |
commit | 6e1d28efb3d314d553e970f197f19636ce4e0ded (patch) | |
tree | eb7d4a61f4072eca56994c6be04d04ac7c5fc8ab /basic | |
parent | e98b6027458dd9410e27c5f273f4db5cc1443b01 (diff) |
fdo#39440: replace C-style cast's
* Add get() method to tools::SvRef
Change-Id: I3825852176c9c37f3ee21f4fd57328b1c7451951
Reviewed-on: https://gerrit.libreoffice.org/14268
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/methods1.cxx | 2 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 26 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 28 |
3 files changed, 28 insertions, 28 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 11c8bd6d0b7e..a4376de7eea1 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1832,7 +1832,7 @@ RTLFUNC(Split) { SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); xVar->PutString( vRet[i] ); - pArray->Put( (SbxVariable*)xVar, &i ); + pArray->Put( xVar.get(), &i ); } // return array diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 0dea79052318..e87a109efe0e 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1278,7 +1278,7 @@ SbiForStack* SbiRuntime::FindForStackItemForCollection( class BasicCollection* p { for (SbiForStack *p = pForStk; p; p = p->pNext) { - SbxVariable* pVar = p->refEnd.Is() ? (SbxVariable*)p->refEnd : NULL; + SbxVariable* pVar = p->refEnd.Is() ? p->refEnd.get() : NULL; if( p->eForType == FOR_EACH_COLLECTION && pVar != NULL && PTR_CAST(BasicCollection,pVar) == pCollection ) { @@ -1713,7 +1713,7 @@ void SbiRuntime::StepPUT() // store on its own method (inside a function)? bool bFlagsChanged = false; SbxFlagBits n = SBX_NONE; - if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + if( refVar.get() == static_cast<SbxVariable*>(pMeth) ) { bFlagsChanged = true; n = refVar->GetFlags(); @@ -1865,13 +1865,13 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b { bool bFlagsChanged = false; SbxFlagBits n = SBX_NONE; - if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + if( refVar.get() == static_cast<SbxVariable*>(pMeth) ) { bFlagsChanged = true; n = refVar->GetFlags(); refVar->SetFlag( SBX_WRITE ); } - SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar); + SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty, refVar.get()); if( pProcProperty ) { pProcProperty->setSet( true ); @@ -1907,7 +1907,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b SbxObject* pObj = NULL; - pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar); + pObj = PTR_CAST(SbxObject,refVar.get()); // calling GetObject on a SbxEMPTY variable raises // object not set errors, make sure its an Object @@ -2066,7 +2066,7 @@ void SbiRuntime::StepLSET() else { SbxFlagBits n = refVar->GetFlags(); - if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + if( refVar.get() == static_cast<SbxVariable*>(pMeth) ) { refVar->SetFlag( SBX_WRITE ); } @@ -2102,7 +2102,7 @@ void SbiRuntime::StepRSET() else { SbxFlagBits n = refVar->GetFlags(); - if( (SbxVariable*) refVar == (SbxVariable*) pMeth ) + if( refVar.get() == static_cast<SbxVariable*>(pMeth) ) { refVar->SetFlag( SBX_WRITE ); } @@ -3103,7 +3103,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 ) { Any aElem = p->xEnumeration->nextElement(); SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( (SbxVariable*)xVar, aElem ); + unoToSbxValue( xVar.get(), aElem ); (*pForStk->refVar) = *xVar; } else @@ -3239,7 +3239,7 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal, bool bOk = bDefault; SbxDataType t = refVal->GetType(); - SbxVariable* pVal = (SbxVariable*)refVal; + SbxVariable* pVal = refVal.get(); // we don't know the type of uno properties that are (maybevoid) if ( t == SbxEMPTY && refVal->ISA(SbUnoProperty) ) { @@ -3597,7 +3597,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt SbxVariableRef refTemp = pElem; // dissolve the notify while copying variable - SbxVariable* pNew = new SbxVariable( *((SbxVariable*)pElem) ); + SbxVariable* pNew = new SbxVariable( *pElem ); pElem->SetParameters( NULL ); pElem = pNew; } @@ -3816,7 +3816,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 ) SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) { SbxArray* pPar; - if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem ) + if( ( pElem->GetType() & SbxARRAY ) && refRedim.get() != pElem ) { SbxBase* pElemObj = pElem->GetObject(); SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj); @@ -4046,7 +4046,7 @@ void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) { SbxVariableRef pObjVar = PopVar(); - SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pObjVar); + SbxObject* pObj = PTR_CAST(SbxObject, pObjVar.get()); if( !pObj ) { SbxBase* pObjVarObj = pObjVar->GetObject(); @@ -4059,7 +4059,7 @@ void SbiRuntime::StepELEM( sal_uInt32 nOp1, sal_uInt32 nOp2 ) // #74254 now per list if( pObj ) { - SaveRef( (SbxVariable*)pObj ); + SaveRef( static_cast<SbxVariable*>(pObj) ); } PushVar( FindElement( pObj, nOp1, nOp2, SbERR_NO_METHOD, false ) ); } diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 278000254646..81a1001ca996 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -50,29 +50,29 @@ SbxValue::SbxValue( SbxDataType t, void* p ) : SbxBase() { switch( t & 0x0FFF ) { - case SbxINTEGER: n |= SbxBYREF; aData.pInteger = (sal_Int16*) p; break; - case SbxSALUINT64: n |= SbxBYREF; aData.puInt64 = (sal_uInt64*) p; break; + case SbxINTEGER: n |= SbxBYREF; aData.pInteger = static_cast<sal_Int16*>(p); break; + case SbxSALUINT64: n |= SbxBYREF; aData.puInt64 = static_cast<sal_uInt64*>(p); break; case SbxSALINT64: - case SbxCURRENCY: n |= SbxBYREF; aData.pnInt64 = (sal_Int64*) p; break; - case SbxLONG: n |= SbxBYREF; aData.pLong = (sal_Int32*) p; break; - case SbxSINGLE: n |= SbxBYREF; aData.pSingle = (float*) p; break; + case SbxCURRENCY: n |= SbxBYREF; aData.pnInt64 = static_cast<sal_Int64*>(p); break; + case SbxLONG: n |= SbxBYREF; aData.pLong = static_cast<sal_Int32*>(p); break; + case SbxSINGLE: n |= SbxBYREF; aData.pSingle = static_cast<float*>(p); break; case SbxDATE: - case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = (double*) p; break; - case SbxSTRING: n |= SbxBYREF; aData.pOUString = (OUString*) p; break; + case SbxDOUBLE: n |= SbxBYREF; aData.pDouble = static_cast<double*>(p); break; + case SbxSTRING: n |= SbxBYREF; aData.pOUString = static_cast<OUString*>(p); break; case SbxERROR: case SbxUSHORT: - case SbxBOOL: n |= SbxBYREF; aData.pUShort = (sal_uInt16*) p; break; - case SbxULONG: n |= SbxBYREF; aData.pULong = (sal_uInt32*) p; break; - case SbxCHAR: n |= SbxBYREF; aData.pChar = (sal_Unicode*) p; break; - case SbxBYTE: n |= SbxBYREF; aData.pByte = (sal_uInt8*) p; break; - case SbxINT: n |= SbxBYREF; aData.pInt = (int*) p; break; + case SbxBOOL: n |= SbxBYREF; aData.pUShort = static_cast<sal_uInt16*>(p); break; + case SbxULONG: n |= SbxBYREF; aData.pULong = static_cast<sal_uInt32*>(p); break; + case SbxCHAR: n |= SbxBYREF; aData.pChar = static_cast<sal_Unicode*>(p); break; + case SbxBYTE: n |= SbxBYREF; aData.pByte = static_cast<sal_uInt8*>(p); break; + case SbxINT: n |= SbxBYREF; aData.pInt = static_cast<int*>(p); break; case SbxOBJECT: - aData.pObj = (SbxBase*) p; + aData.pObj = static_cast<SbxBase*>(p); if( p ) aData.pObj->AddFirstRef(); break; case SbxDECIMAL: - aData.pDecimal = (SbxDecimal*) p; + aData.pDecimal = static_cast<SbxDecimal*>(p); if( p ) aData.pDecimal->addRef(); break; |