diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:31:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:33:37 +0100 |
commit | 3b9e0676b0a193dbf802a6b703827c9cc0689900 (patch) | |
tree | f923afc6c47ceb5e3bb930025f27a8eaeb1758ff /svl | |
parent | 23ab1493b64dff46e5f66941240c9972e99d6f1f (diff) |
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: Iefbf64608dba0c0ae01e79e5b679a9b42748b73a
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/itemset.cxx | 8 | ||||
-rw-r--r-- | svl/source/items/poolcach.cxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 4 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 12 | ||||
-rw-r--r-- | svl/unx/source/svdde/ddedummy.cxx | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index c69cbb48baca..f0a42745a4bd 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -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 { diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 09f2d531f632..eb1f955dbece 100644 --- a/svl/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -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 || diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 218fdb16e458..c941c6798e0c 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -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; } diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 04c8d177c5df..c8835b30fc38 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -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; } diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx index d80752c7f899..4813dc36b5da 100644 --- a/svl/unx/source/svdde/ddedummy.cxx +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -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& ) |