summaryrefslogtreecommitdiff
path: root/basic/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:27:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:28 +0100
commit0511c867911695154ea677a89e9f40264e41467a (patch)
treee3d579ed7a691edecd2fa6659134d47a731ea2b5 /basic/source
parent21997319a3d656b2d552b70089f824ead568f09e (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: If774a3b4e2e993d26dd9b5777a55665a330b2abe
Diffstat (limited to 'basic/source')
-rw-r--r--basic/source/basmgr/basmgr.cxx4
-rw-r--r--basic/source/comp/codegen.cxx2
-rw-r--r--basic/source/comp/exprnode.cxx2
-rw-r--r--basic/source/comp/scanner.cxx2
-rw-r--r--basic/source/inc/runtime.hxx2
-rw-r--r--basic/source/sbx/sbxobj.cxx2
-rw-r--r--basic/source/sbx/sbxscan.cxx2
-rw-r--r--basic/source/sbx/sbxstr.cxx2
-rw-r--r--basic/source/sbx/sbxvalue.cxx16
-rw-r--r--basic/source/sbx/sbxvar.cxx6
10 files changed, 20 insertions, 20 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index a1259178af96..dd8c324c0ea9 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -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;
}
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 785a9e0b18f3..8d4abe72b553 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -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 )
{
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 4340848bf66e..d9b1ccaeed32 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -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;
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index bddfcbd4f6a7..13d37c8de65a 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -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?
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index c7d6ba86195e..4c8e99df7458 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -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; }
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index e57c42911a9c..badea10bbdd1 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -671,7 +671,7 @@ bool SbxObject::StoreData( SvStream& rStrm ) const
{
return false;
}
- ((SbxObject*) this)->SetModified( false );
+ const_cast<SbxObject*>(this)->SetModified( false );
return true;
}
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 0ec92eba6d44..f22df239205f 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -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;
}
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index 990d1c724338..d6b9f30e663f 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -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:
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 81a1001ca996..bced40f13147 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -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:
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 410fe4b72c65..56f88c29e7cb 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -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();