const_cast: convert some C-style casts and remove some redundant ones
Change-Id: If774a3b4e2e993d26dd9b5777a55665a330b2abe
This commit is contained in:
@@ -1583,14 +1583,14 @@ StarBASIC* BasicManager::CreateLibForLibContainer( const OUString& rLibName,
|
||||
|
||||
BasicLibInfo* BasicManager::FindLibInfo( StarBASIC* pBasic ) const
|
||||
{
|
||||
BasicLibInfo* pInf = ((BasicManager*)this)->pLibs->First();
|
||||
BasicLibInfo* pInf = const_cast<BasicManager*>(this)->pLibs->First();
|
||||
while ( pInf )
|
||||
{
|
||||
if ( pInf->GetLib() == pBasic )
|
||||
{
|
||||
return pInf;
|
||||
}
|
||||
pInf = ((BasicManager*)this)->pLibs->Next();
|
||||
pInf = const_cast<BasicManager*>(this)->pLibs->Next();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -338,7 +338,7 @@ void SbiCodeGen::Save()
|
||||
SbxParamInfo* pParam = NULL;
|
||||
if( nUserData )
|
||||
{
|
||||
pParam = (SbxParamInfo*)pInfo->GetParam( i );
|
||||
pParam = const_cast<SbxParamInfo*>(pInfo->GetParam( i ));
|
||||
}
|
||||
if( pParam )
|
||||
{
|
||||
|
@@ -73,7 +73,7 @@ SbiExprNode::SbiExprNode( SbiParser* p, const SbiSymDef& r, SbxDataType t, SbiEx
|
||||
|
||||
eType = ( t == SbxVARIANT ) ? r.GetType() : t;
|
||||
eNodeType = SbxVARVAL;
|
||||
aVar.pDef = (SbiSymDef*) &r;
|
||||
aVar.pDef = const_cast<SbiSymDef*>(&r);
|
||||
aVar.pPar = l;
|
||||
aVar.pvMorePar = NULL;
|
||||
aVar.pNext= NULL;
|
||||
|
@@ -275,7 +275,7 @@ bool SbiScanner::NextSym()
|
||||
aSym = aSymCopy;
|
||||
|
||||
// HACK: modifying a potentially shared string here!
|
||||
*((sal_Unicode*)(pLine-1)) = ' ';
|
||||
*const_cast<sal_Unicode*>(pLine-1) = ' ';
|
||||
}
|
||||
|
||||
// type recognition?
|
||||
|
@@ -189,7 +189,7 @@ public:
|
||||
SbiDdeControl* GetDdeControl() { return pDdeCtrl; }
|
||||
StarBASIC* GetBasic( void ) { return pBasic; }
|
||||
SbiDllMgr* GetDllMgr();
|
||||
SbiRTLData* GetRTLData() const { return (SbiRTLData*)&aRTLData; }
|
||||
SbiRTLData* GetRTLData() const { return const_cast<SbiRTLData*>(&aRTLData); }
|
||||
|
||||
SvNumberFormatter* GetNumberFormatter();
|
||||
sal_uInt32 GetStdDateIdx() const { return nStdDateIdx; }
|
||||
|
@@ -671,7 +671,7 @@ bool SbxObject::StoreData( SvStream& rStrm ) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
((SbxObject*) this)->SetModified( false );
|
||||
const_cast<SbxObject*>(this)->SetModified( false );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -460,7 +460,7 @@ bool ImpConvStringExt( OUString& rSrc, SbxDataType eTargetType )
|
||||
sal_Int32 nPos = aNewString.indexOf( cDecimalSep );
|
||||
if( nPos != -1 )
|
||||
{
|
||||
sal_Unicode* pStr = (sal_Unicode*)aNewString.getStr();
|
||||
sal_Unicode* pStr = const_cast<sal_Unicode*>(aNewString.getStr());
|
||||
pStr[nPos] = (sal_Unicode)'.';
|
||||
bChanged = true;
|
||||
}
|
||||
|
@@ -165,7 +165,7 @@ void ImpPutString( SbxValues* p, const OUString* n )
|
||||
// as a precaution, if a NULL-Ptr appears
|
||||
if( !n )
|
||||
n = pTmp = new OUString;
|
||||
aTmp.pOUString = (OUString*)n;
|
||||
aTmp.pOUString = const_cast<OUString*>(n);
|
||||
switch( +p->eType )
|
||||
{
|
||||
case SbxCHAR:
|
||||
|
@@ -97,7 +97,7 @@ SbxValue::SbxValue( const SbxValue& r )
|
||||
}
|
||||
else
|
||||
{
|
||||
((SbxValue*) &r)->Broadcast( SBX_HINT_DATAWANTED );
|
||||
const_cast<SbxValue*>(&r)->Broadcast( SBX_HINT_DATAWANTED );
|
||||
aData = r.aData;
|
||||
// Copy pointer, increment references
|
||||
switch( aData.eType )
|
||||
@@ -237,7 +237,7 @@ SbxValue* SbxValue::TheRealValue() const
|
||||
|
||||
SbxValue* SbxValue::TheRealValue( bool bObjInObjError ) const
|
||||
{
|
||||
SbxValue* p = (SbxValue*) this;
|
||||
SbxValue* p = const_cast<SbxValue*>(this);
|
||||
for( ;; )
|
||||
{
|
||||
SbxDataType t = SbxDataType( p->aData.eType & 0x0FFF );
|
||||
@@ -412,11 +412,11 @@ const OUString& SbxValue::GetCoreString() const
|
||||
aRes.eType = SbxCoreSTRING;
|
||||
if( Get( aRes ) )
|
||||
{
|
||||
((SbxValue*) this)->aToolString = *aRes.pOUString;
|
||||
const_cast<SbxValue*>(this)->aToolString = *aRes.pOUString;
|
||||
}
|
||||
else
|
||||
{
|
||||
((SbxValue*) this)->aToolString.clear();
|
||||
const_cast<SbxValue*>(this)->aToolString.clear();
|
||||
}
|
||||
return aToolString;
|
||||
}
|
||||
@@ -598,7 +598,7 @@ bool SbxValue::PutStringExt( const OUString& r )
|
||||
if( ImpConvStringExt( aStr, eTargetType ) )
|
||||
aRes.pOUString = (OUString*)&aStr;
|
||||
else
|
||||
aRes.pOUString = (OUString*)&r;
|
||||
aRes.pOUString = const_cast<OUString*>(&r);
|
||||
|
||||
// #34939: For Strings which contain a number, and if this has a Num-Type,
|
||||
// set a Fixed flag so that the type will not be changed
|
||||
@@ -677,7 +677,7 @@ bool SbxValue::PutString( const OUString& r )
|
||||
{
|
||||
SbxValues aRes;
|
||||
aRes.eType = SbxSTRING;
|
||||
aRes.pOUString = (OUString*) &r;
|
||||
aRes.pOUString = const_cast<OUString*>(&r);
|
||||
Put( aRes );
|
||||
return !IsError();
|
||||
}
|
||||
@@ -1567,9 +1567,9 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
|
||||
r.WriteInt32( aData.nLong ); break;
|
||||
case SbxDATE:
|
||||
// #49935: Save as double, otherwise an error during the read in
|
||||
((SbxValue*)this)->aData.eType = (SbxDataType)( ( nType & 0xF000 ) | SbxDOUBLE );
|
||||
const_cast<SbxValue*>(this)->aData.eType = (SbxDataType)( ( nType & 0xF000 ) | SbxDOUBLE );
|
||||
write_uInt16_lenPrefixed_uInt8s_FromOUString(r, GetCoreString(), RTL_TEXTENCODING_ASCII_US);
|
||||
((SbxValue*)this)->aData.eType = (SbxDataType)nType;
|
||||
const_cast<SbxValue*>(this)->aData.eType = (SbxDataType)nType;
|
||||
break;
|
||||
case SbxSINGLE:
|
||||
case SbxDOUBLE:
|
||||
|
@@ -226,7 +226,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
|
||||
return maName;
|
||||
}
|
||||
// Request parameter-information (not for objects)
|
||||
((SbxVariable*)this)->GetInfo();
|
||||
const_cast<SbxVariable*>(this)->GetInfo();
|
||||
// Append nothing, if it is a simple property (no empty brackets)
|
||||
if( !pInfo || ( pInfo->aParams.empty() && GetClass() == SbxCLASS_PROPERTY ))
|
||||
{
|
||||
@@ -317,7 +317,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
|
||||
aTmp += OUString( SbxRes( STRING_ANY ) );
|
||||
}
|
||||
}
|
||||
((SbxVariable*) this)->aToolString = aTmp;
|
||||
const_cast<SbxVariable*>(this)->aToolString = aTmp;
|
||||
return aToolString;
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ bool SbxVariable::StoreData( SvStream& rStrm ) const
|
||||
{
|
||||
// #50200 Avoid that objects , which during the runtime
|
||||
// as return-value are saved in the method as a value were saved
|
||||
SbxVariable* pThis = (SbxVariable*)this;
|
||||
SbxVariable* pThis = const_cast<SbxVariable*>(this);
|
||||
SbxFlagBits nSaveFlags = GetFlags();
|
||||
pThis->SetFlag( SBX_WRITE );
|
||||
pThis->SbxValue::Clear();
|
||||
|
@@ -80,7 +80,7 @@ struct SbxValues
|
||||
SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
|
||||
SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
|
||||
SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
|
||||
SbxValues( const OUString* _pString ): pOUString( (OUString*)_pString ), eType(SbxSTRING) {}
|
||||
SbxValues( const OUString* _pString ): pOUString( const_cast<OUString*>(_pString) ), eType(SbxSTRING) {}
|
||||
SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
|
||||
SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
|
||||
SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
|
||||
|
Reference in New Issue
Block a user