[Libreoffice-commits] core.git: include/svl svl/source
Noel Grandin
noel at peralex.com
Thu Sep 25 05:58:16 PDT 2014
include/svl/poolitem.hxx | 2 +-
svl/source/items/cntwall.cxx | 2 +-
svl/source/items/ctypeitm.cxx | 2 +-
svl/source/items/flagitem.cxx | 2 +-
svl/source/items/globalnameitem.cxx | 2 +-
svl/source/items/grabbagitem.cxx | 2 +-
svl/source/items/ilstitem.cxx | 2 +-
svl/source/items/imageitm.cxx | 3 ++-
svl/source/items/itemset.cxx | 26 +++++++++++++-------------
svl/source/items/lckbitem.cxx | 2 +-
svl/source/items/macitem.cxx | 2 +-
svl/source/items/poolcach.cxx | 4 ++--
svl/source/items/poolio.cxx | 2 +-
svl/source/items/ptitem.cxx | 2 +-
svl/source/items/rectitem.cxx | 2 +-
svl/source/items/rngitem.cxx | 8 +++-----
svl/source/items/sitem.cxx | 2 +-
svl/source/items/slstitm.cxx | 4 ++--
svl/source/items/srchitem.cxx | 2 +-
svl/source/items/style.cxx | 4 ++--
svl/source/items/szitem.cxx | 2 +-
svl/source/numbers/zforlist.cxx | 2 +-
22 files changed, 40 insertions(+), 41 deletions(-)
New commits:
commit 52b8b3d3a55d38c49e183ec5d6ed5cc012f6f1d0
Author: Noel Grandin <noel at peralex.com>
Date: Fri Sep 19 08:40:23 2014 +0200
loplugin: cstylecast
Change-Id: I75267bf44d0fd36ff316f59300efd31524da36ef
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx
index 3c5db8f..df4b6fb 100644
--- a/include/svl/poolitem.hxx
+++ b/include/svl/poolitem.hxx
@@ -256,7 +256,7 @@ inline bool IsPooledItem( const SfxPoolItem *pItem )
inline bool IsInvalidItem(const SfxPoolItem *pItem)
{
- return pItem == (SfxPoolItem *)-1;
+ return pItem == reinterpret_cast<SfxPoolItem *>(-1);
}
diff --git a/svl/source/items/cntwall.cxx b/svl/source/items/cntwall.cxx
index ce2fe9d..d0f6202 100644
--- a/svl/source/items/cntwall.cxx
+++ b/svl/source/items/cntwall.cxx
@@ -94,7 +94,7 @@ bool CntWallpaperItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- const CntWallpaperItem& rWallItem = (const CntWallpaperItem&)rItem;
+ const CntWallpaperItem& rWallItem = static_cast<const CntWallpaperItem&>(rItem);
return ( rWallItem._nStyle == _nStyle ) &&
( rWallItem._nColor == _nColor ) &&
diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx
index cbc8d28..b734f07 100644
--- a/svl/source/items/ctypeitm.cxx
+++ b/svl/source/items/ctypeitm.cxx
@@ -96,7 +96,7 @@ SvStream & CntContentTypeItem::Store(SvStream & rStream, sal_uInt16) const
// virtual
bool CntContentTypeItem::operator==( const SfxPoolItem& rOrig ) const
{
- const CntContentTypeItem& rOther = (const CntContentTypeItem&)rOrig;
+ const CntContentTypeItem& rOther = static_cast<const CntContentTypeItem&>(rOrig);
if ( ( _eType != CONTENT_TYPE_NOT_INIT ) &&
( rOther._eType != CONTENT_TYPE_NOT_INIT ) )
diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx
index b7ac574..bd9c5b9 100644
--- a/svl/source/items/flagitem.cxx
+++ b/svl/source/items/flagitem.cxx
@@ -86,7 +86,7 @@ SfxPoolItem* SfxFlagItem::Create(SvStream &, sal_uInt16) const
bool SfxFlagItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return (((SfxFlagItem&)rItem).nVal == nVal);
+ return static_cast<const SfxFlagItem&>(rItem).nVal == nVal;
}
diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx
index faf8f72..7b7dba9 100644
--- a/svl/source/items/globalnameitem.cxx
+++ b/svl/source/items/globalnameitem.cxx
@@ -55,7 +55,7 @@ SfxGlobalNameItem::~SfxGlobalNameItem()
bool SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const
{
- return ((SfxGlobalNameItem&)rItem).m_aName == m_aName;
+ return static_cast<const SfxGlobalNameItem&>(rItem).m_aName == m_aName;
}
diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx
index c1b8078..aa2b3e3 100644
--- a/svl/source/items/grabbagitem.cxx
+++ b/svl/source/items/grabbagitem.cxx
@@ -43,7 +43,7 @@ SfxGrabBagItem::~SfxGrabBagItem()
bool SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const
{
- SfxGrabBagItem* pItem = (SfxGrabBagItem*)&rItem;
+ const SfxGrabBagItem* pItem = static_cast<const SfxGrabBagItem*>(&rItem);
return m_aMap == pItem->m_aMap;
}
diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx
index ab7c3f8..58eb459 100644
--- a/svl/source/items/ilstitem.cxx
+++ b/svl/source/items/ilstitem.cxx
@@ -61,7 +61,7 @@ bool SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const
if ( !rPoolItem.ISA( SfxIntegerListItem ) )
return false;
- const SfxIntegerListItem rItem = (const SfxIntegerListItem&) rPoolItem;
+ const SfxIntegerListItem rItem = static_cast<const SfxIntegerListItem&>(rPoolItem);
return rItem.m_aList == m_aList;
}
diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx
index 99487fa..f81e7bb 100644
--- a/svl/source/items/imageitm.cxx
+++ b/svl/source/items/imageitm.cxx
@@ -61,7 +61,8 @@ SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
bool SfxImageItem::operator==( const SfxPoolItem& rItem ) const
{
- return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) );
+ return (static_cast<const SfxImageItem&>(rItem).GetValue() == GetValue()) &&
+ (*pImp == *static_cast<const SfxImageItem&>(rItem).pImp);
}
bool SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 ) const
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 249082c..eb5ffaa 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -428,10 +428,10 @@ void SfxItemSet::InvalidateDefaultItems()
while( *pPtr )
{
for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
- if ( *ppFnd && *ppFnd != (SfxPoolItem *)-1 && **ppFnd == _pPool->GetDefaultItem( nWhich ) )
+ if ( *ppFnd && *ppFnd != reinterpret_cast<SfxPoolItem *>(-1) && **ppFnd == _pPool->GetDefaultItem( nWhich ) )
{
_pPool->Remove( **ppFnd );
- *ppFnd = (SfxPoolItem*)-1;
+ *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
}
pPtr += 2;
}
@@ -473,7 +473,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
break; // Keep searching in the parents!
}
- if ( (SfxPoolItem*) -1 == *ppFnd )
+ if ( reinterpret_cast<SfxPoolItem*>(-1) == *ppFnd )
// Different ones are present
return SfxItemState::DONTCARE;
@@ -760,7 +760,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
else if ( SfxItemState::DONTCARE == eState )
{
++nNewCount;
- aNewItems[n] = (SfxPoolItem*)-1;
+ aNewItems[n] = reinterpret_cast<SfxPoolItem*>(-1);
}
else
{
@@ -918,7 +918,7 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
ppFnd += nWhich - *pPtr;
if( *ppFnd )
{
- if( (SfxPoolItem*)-1 == *ppFnd ) {
+ if( reinterpret_cast<SfxPoolItem*>(-1) == *ppFnd ) {
//FIXME: The following code is duplicated further down
SFX_ASSERT(_pPool, nWhich, "no Pool, but status is ambiguous");
//!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich);
@@ -1212,12 +1212,12 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
{
if ( IsInvalidItem(pFnd2) )
// Decision table: default, dontcare, doesn't matter, doesn't matter
- *ppFnd1 = (SfxPoolItem*) -1;
+ *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
else if ( pFnd2 && !bIgnoreDefaults &&
_pPool->GetDefaultItem(pFnd2->Which()) != *pFnd2 )
// Decision table: default, set, !=, sal_False
- *ppFnd1 = (SfxPoolItem*) -1;
+ *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
else if ( pFnd2 && bIgnoreDefaults )
// Decision table: default, set, doesn't matter, sal_True
@@ -1238,7 +1238,7 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
{
// Decision table: set, default, !=, sal_False
_pPool->Remove( **ppFnd1 );
- *ppFnd1 = (SfxPoolItem*) -1;
+ *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
}
}
else if ( IsInvalidItem(pFnd2) )
@@ -1250,7 +1250,7 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
// Decision table: set, dontcare, doesn't matter, sal_False
// or: set, dontcare, !=, sal_True
_pPool->Remove( **ppFnd1 );
- *ppFnd1 = (SfxPoolItem*) -1;
+ *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
}
}
else
@@ -1260,7 +1260,7 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
{
// Decision table: set, set, !=, doesn't matter
_pPool->Remove( **ppFnd1 );
- *ppFnd1 = (SfxPoolItem*) -1;
+ *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
}
}
}
@@ -1357,15 +1357,15 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
if( *ppFnd ) // Set for me
{
- if( (SfxPoolItem*)-1 != *ppFnd ) // Not yet dontcare!
+ if( reinterpret_cast<SfxPoolItem*>(-1) != *ppFnd ) // Not yet dontcare!
{
_pPool->Remove( **ppFnd );
- *ppFnd = (SfxPoolItem*)-1;
+ *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
}
}
else
{
- *ppFnd = (SfxPoolItem*)-1;
+ *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
++_nCount;
}
break;
diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx
index d89eb63..a203fdb 100644
--- a/svl/source/items/lckbitem.cxx
+++ b/svl/source/items/lckbitem.cxx
@@ -62,7 +62,7 @@ SfxLockBytesItem::~SfxLockBytesItem()
bool SfxLockBytesItem::operator==( const SfxPoolItem& rItem ) const
{
- return ((SfxLockBytesItem&)rItem)._xVal == _xVal;
+ return static_cast<const SfxLockBytesItem&>(rItem)._xVal == _xVal;
}
diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx
index 3c0ff23..e921093 100644
--- a/svl/source/items/macitem.cxx
+++ b/svl/source/items/macitem.cxx
@@ -192,7 +192,7 @@ bool SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const
DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
const SvxMacroTableDtor& rOwn = aMacroTable;
- const SvxMacroTableDtor& rOther = ( (SvxMacroItem&) rAttr ).aMacroTable;
+ const SvxMacroTableDtor& rOther = static_cast<const SvxMacroItem&>(rAttr).aMacroTable;
return rOwn == rOther;
}
diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx
index 3a383e7..09f2d53 100644
--- a/svl/source/items/poolcach.cxx
+++ b/svl/source/items/poolcach.cxx
@@ -83,7 +83,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, bool b
}
// Insert the new attributes in a new Set
- SfxSetItem *pNewItem = (SfxSetItem *)rOrigItem.Clone();
+ SfxSetItem *pNewItem = static_cast<SfxSetItem *>(rOrigItem.Clone());
if ( pItemToPut )
{
pNewItem->GetItemSet().PutDirect( *pItemToPut );
@@ -92,7 +92,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, bool b
}
else
pNewItem->GetItemSet().Put( *pSetToPut );
- const SfxSetItem* pNewPoolItem = (const SfxSetItem*) &pPool->Put( *pNewItem );
+ const SfxSetItem* pNewPoolItem = static_cast<const SfxSetItem*>(&pPool->Put( *pNewItem ));
DBG_ASSERT( pNewPoolItem != pNewItem, "Pool: same in and out?" );
delete pNewItem;
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 661fd37..e6a82aa 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -1438,7 +1438,7 @@ const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, bool bDirect,
sal_uInt16 nWhich(0), nSlot(0); // nSurrogate;
rStream.ReadUInt16( nWhich ).ReadUInt16( nSlot );
- bool bDontPut = (SfxItemPool*)-1 == pRefPool;
+ bool bDontPut = reinterpret_cast<SfxItemPool*>(-1) == pRefPool;
if ( bDontPut || !pRefPool )
pRefPool = this;
diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx
index 8794044..11d10aa 100644
--- a/svl/source/items/ptitem.cxx
+++ b/svl/source/items/ptitem.cxx
@@ -73,7 +73,7 @@ bool SfxPointItem::GetPresentation
bool SfxPointItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ((SfxPointItem&)rItem).aVal == aVal;
+ return static_cast<const SfxPointItem&>(rItem).aVal == aVal;
}
diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx
index 0441fd9..b44cc94 100644
--- a/svl/source/items/rectitem.cxx
+++ b/svl/source/items/rectitem.cxx
@@ -73,7 +73,7 @@ bool SfxRectangleItem::GetPresentation
bool SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ((SfxRectangleItem&)rItem).aVal == aVal;
+ return static_cast<const SfxRectangleItem&>(rItem).aVal == aVal;
}
diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx
index cfea5b9..3c09331 100644
--- a/svl/source/items/rngitem.cxx
+++ b/svl/source/items/rngitem.cxx
@@ -76,10 +76,8 @@ bool SfxRangeItem::GetPresentation
bool SfxRangeItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- SfxRangeItem* pT = (SfxRangeItem*)&rItem;
- if( nFrom==pT->nFrom && nTo==pT->nTo )
- return true;
- return false;
+ const SfxRangeItem& rT = static_cast<const SfxRangeItem&>(rItem);
+ return nFrom==rT.nFrom && nTo==rT.nTo;
}
@@ -144,7 +142,7 @@ SfxUShortRangesItem::~SfxUShortRangesItem()
bool SfxUShortRangesItem::operator==( const SfxPoolItem &rItem ) const
{
- const SfxUShortRangesItem &rOther = (const SfxUShortRangesItem&) rItem;
+ const SfxUShortRangesItem &rOther = static_cast<const SfxUShortRangesItem&>(rItem);
if ( !_pRanges && !rOther._pRanges )
return true;
if ( _pRanges || rOther._pRanges )
diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx
index 206a2e6..1dda3be 100644
--- a/svl/source/items/sitem.cxx
+++ b/svl/source/items/sitem.cxx
@@ -57,7 +57,7 @@ SfxSetItem::~SfxSetItem()
bool SfxSetItem::operator==( const SfxPoolItem& rCmp) const
{
DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" );
- return *pSet == *(((const SfxSetItem &)rCmp).pSet);
+ return *pSet == *static_cast<const SfxSetItem &>(rCmp).pSet;
}
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 163dd11..9459313 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -130,9 +130,9 @@ bool SfxStringListItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- SfxStringListItem* pItem = (SfxStringListItem*)&rItem;
+ const SfxStringListItem& rSSLItem = static_cast<const SfxStringListItem&>(rItem);
- return pImp == pItem->pImp;
+ return pImp == rSSLItem.pImp;
}
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index e2bc8c6..18e88ee 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -244,7 +244,7 @@ static bool operator == ( const SearchOptions& rItem1, const SearchOptions& rIte
bool SvxSearchItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" );
- const SvxSearchItem &rSItem = (SvxSearchItem &) rItem;
+ const SvxSearchItem &rSItem = static_cast<const SvxSearchItem &>(rItem);
return ( nCommand == rSItem.nCommand ) &&
( bBackward == rSItem.bBackward ) &&
( bPattern == rSItem.bPattern ) &&
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 2f41cf8..c4d77698 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -908,14 +908,14 @@ bool SfxStyleSheet::SetParent( const OUString& rName )
// Remove from notification chain of the old parent if applicable
if(!aOldParent.isEmpty())
{
- SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aOldParent, nFamily, SFXSTYLEBIT_ALL);
+ SfxStyleSheet *pParent = static_cast<SfxStyleSheet *>(pPool->Find(aOldParent, nFamily, SFXSTYLEBIT_ALL));
if(pParent)
EndListening(*pParent);
}
// Add to the notification chain of the new parent
if(!aParent.isEmpty())
{
- SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aParent, nFamily, SFXSTYLEBIT_ALL);
+ SfxStyleSheet *pParent = static_cast<SfxStyleSheet *>(pPool->Find(aParent, nFamily, SFXSTYLEBIT_ALL));
if(pParent)
StartListening(*pParent);
}
diff --git a/svl/source/items/szitem.cxx b/svl/source/items/szitem.cxx
index fa25151..3f0e3b3 100644
--- a/svl/source/items/szitem.cxx
+++ b/svl/source/items/szitem.cxx
@@ -70,7 +70,7 @@ bool SfxSizeItem::GetPresentation
bool SfxSizeItem::operator==( const SfxPoolItem& rItem ) const
{
DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ((SfxSizeItem&)rItem).aVal == aVal;
+ return static_cast<const SfxSizeItem&>(rItem).aVal == aVal;
}
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 883d9a2..4fcd9ef 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -319,7 +319,7 @@ Color* SvNumberFormatter::GetUserDefColor(sal_uInt16 nIndex)
{
if( aColorLink.IsSet() )
{
- return (Color*) ( aColorLink.Call( (void*) &nIndex ));
+ return reinterpret_cast<Color*>( aColorLink.Call( (void*) &nIndex )) ;
}
else
{
More information about the Libreoffice-commits
mailing list