Kaydet (Commit) 3b9e0676 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

const_cast: convert some C-style casts and remove some redundant ones

Change-Id: Iefbf64608dba0c0ae01e79e5b679a9b42748b73a
üst 23ab1493
......@@ -99,7 +99,7 @@ SfxItemSet::SfxItemSet
(void) bTotalRanges; // avoid warnings
#endif
_pWhichRanges = (sal_uInt16*) _pPool->GetFrozenIdRanges();
_pWhichRanges = const_cast<sal_uInt16*>(_pPool->GetFrozenIdRanges());
assert( _pWhichRanges && "don't create ItemSets with full range before FreezeIdRanges()" );
if ( !_pWhichRanges )
_pPool->FillItemIdRanges_Impl( _pWhichRanges );
......@@ -232,7 +232,7 @@ SfxItemSet::SfxItemSet( const SfxItemSet& rASet ):
{
// Just copy the pointer and increase RefCount
*ppDst = *ppSrc;
( (SfxPoolItem*) (*ppDst) )->AddRef();
(*ppDst)->AddRef();
}
else if ( !(*ppSrc)->Which() )
*ppDst = (*ppSrc)->Clone();
......@@ -258,7 +258,7 @@ SfxItemSet::~SfxItemSet()
if( *ppFnd && !IsInvalidItem(*ppFnd) )
{
if( !(*ppFnd)->Which() )
delete (SfxPoolItem*) *ppFnd;
delete *ppFnd;
else {
// Still multiple references present, so just alter the RefCount
if ( 1 < (*ppFnd)->GetRefCount() && !IsDefaultItem(*ppFnd) )
......@@ -770,7 +770,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
if( pNewRanges == GetPool()->GetFrozenIdRanges() )
{
delete[] _pWhichRanges;
_pWhichRanges = ( sal_uInt16* ) pNewRanges;
_pWhichRanges = const_cast<sal_uInt16*>(pNewRanges);
}
else
{
......
......@@ -104,7 +104,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, bool b
// Add the transformation to the cache
SfxItemModifyImpl aModify;
aModify.pOrigItem = &rOrigItem;
aModify.pPoolItem = (SfxSetItem*) pNewPoolItem;
aModify.pPoolItem = const_cast<SfxSetItem*>(pNewPoolItem);
pCache->push_back( aModify );
DBG_ASSERT( !pItemToPut ||
......
......@@ -1815,9 +1815,9 @@ OUString SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const
else
{
LanguageTag aSaveLocale( xLocaleData->getLanguageTag() );
((SvNumberFormatter*)this)->xLocaleData.changeLocale( LanguageTag( pFormat->GetLanguage()) );
const_cast<SvNumberFormatter*>(this)->xLocaleData.changeLocale( LanguageTag( pFormat->GetLanguage()) );
aRet = xLocaleData->getNumDecimalSep();
((SvNumberFormatter*)this)->xLocaleData.changeLocale( aSaveLocale );
const_cast<SvNumberFormatter*>(this)->xLocaleData.changeLocale( aSaveLocale );
}
return aRet;
}
......
......@@ -131,21 +131,21 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
switch ( eIdx )
{
case NF_KEY_TRUE :
((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE] =
const_cast<ImpSvNumberformatScan*>(this)->sKeyword[NF_KEY_TRUE] =
pFormatter->GetCharClass()->uppercase( pFormatter->GetLocaleData()->getTrueWord() );
if ( sKeyword[NF_KEY_TRUE].isEmpty() )
{
SAL_WARN( "svl.numbers", "InitSpecialKeyword: TRUE_WORD?" );
((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE] = "TRUE";
const_cast<ImpSvNumberformatScan*>(this)->sKeyword[NF_KEY_TRUE] = "TRUE";
}
break;
case NF_KEY_FALSE :
((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE] =
const_cast<ImpSvNumberformatScan*>(this)->sKeyword[NF_KEY_FALSE] =
pFormatter->GetCharClass()->uppercase( pFormatter->GetLocaleData()->getFalseWord() );
if ( sKeyword[NF_KEY_FALSE].isEmpty() )
{
SAL_WARN( "svl.numbers", "InitSpecialKeyword: FALSE_WORD?" );
((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE] = "FALSE";
const_cast<ImpSvNumberformatScan*>(this)->sKeyword[NF_KEY_FALSE] = "FALSE";
}
break;
default:
......@@ -155,7 +155,7 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
void ImpSvNumberformatScan::InitCompatCur() const
{
ImpSvNumberformatScan* pThis = (ImpSvNumberformatScan*)this;
ImpSvNumberformatScan* pThis = const_cast<ImpSvNumberformatScan*>(this);
// currency symbol for old style ("automatic") compatibility format codes
pFormatter->GetCompatibilityCurrency( pThis->sCurSymbol, pThis->sCurAbbrev );
// currency symbol upper case
......@@ -167,7 +167,7 @@ void ImpSvNumberformatScan::InitKeywords() const
{
if ( !bKeywordsNeedInit )
return ;
((ImpSvNumberformatScan*)this)->SetDependentKeywords();
const_cast<ImpSvNumberformatScan*>(this)->SetDependentKeywords();
bKeywordsNeedInit = false;
}
......
......@@ -159,7 +159,7 @@ void DdeTopic::InsertItem( SAL_UNUSED_PARAMETER DdeItem* )
DdeItem* DdeTopic::AddItem( const DdeItem& rDdeItem )
{
return (DdeItem*) &rDdeItem;
return const_cast<DdeItem*>(&rDdeItem);
}
void DdeTopic::RemoveItem( SAL_UNUSED_PARAMETER const DdeItem& )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment