summaryrefslogtreecommitdiffstats
path: root/svl
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-27 14:50:50 +0100
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-27 15:58:28 +0000
commit70dee11c2e15e90fbd41bf331e67c1d28e094e35 (patch)
tree9bf3a9c17495788b9b1d7ef23da1b96799e81e6a /svl
parentmove these into the member init list (diff)
downloadcore-70dee11c2e15e90fbd41bf331e67c1d28e094e35.tar.gz
core-70dee11c2e15e90fbd41bf331e67c1d28e094e35.zip
use a define for invalid SfxPoolItem
and use helper function IsInvalidItem() more Change-Id: Ifd651a336a7bd4ef4f945219d765afb827465438 Reviewed-on: https://gerrit.libreoffice.org/33611 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 9e44a8ba1889..a4ed73c52f33 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -436,7 +436,7 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich,
break; // Keep searching in the parents!
}
- if ( reinterpret_cast<SfxPoolItem*>(-1) == *ppFnd )
+ if ( IsInvalidItem(*ppFnd) )
// Different ones are present
return SfxItemState::DONTCARE;
@@ -779,7 +779,7 @@ void SfxItemSet::SetRanges( const sal_uInt16 *pNewRanges )
else if ( SfxItemState::DONTCARE == eState )
{
++nNewCount;
- aNewItems[n] = reinterpret_cast<SfxPoolItem*>(-1);
+ aNewItems[n] = INVALID_POOL_ITEM;
}
else
{
@@ -908,7 +908,7 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const
ppFnd += nWhich - *pPtr;
if( *ppFnd )
{
- if( reinterpret_cast<SfxPoolItem*>(-1) == *ppFnd ) {
+ if( IsInvalidItem(*ppFnd) ) {
//FIXME: The following code is duplicated further down
SAL_WARN_IF(!m_pPool, "svl.items", "no Pool, but status is ambiguous, with ID/pos " << nWhich);
//!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich);
@@ -1192,12 +1192,12 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
{
if ( IsInvalidItem(pFnd2) )
// Decision table: default, dontcare, doesn't matter, doesn't matter
- *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd1 = INVALID_POOL_ITEM;
else if ( pFnd2 && !bIgnoreDefaults &&
_pPool->GetDefaultItem(pFnd2->Which()) != *pFnd2 )
// Decision table: default, set, !=, sal_False
- *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd1 = INVALID_POOL_ITEM;
else if ( pFnd2 && bIgnoreDefaults )
// Decision table: default, set, doesn't matter, sal_True
@@ -1218,7 +1218,7 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
{
// Decision table: set, default, !=, sal_False
_pPool->Remove( **ppFnd1 );
- *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd1 = INVALID_POOL_ITEM;
}
}
else if ( IsInvalidItem(pFnd2) )
@@ -1230,7 +1230,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 = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd1 = INVALID_POOL_ITEM;
}
}
else
@@ -1240,7 +1240,7 @@ static void MergeItem_Impl( SfxItemPool *_pPool, sal_uInt16 &rCount,
{
// Decision table: set, set, !=, doesn't matter
_pPool->Remove( **ppFnd1 );
- *ppFnd1 = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd1 = INVALID_POOL_ITEM;
}
}
}
@@ -1330,15 +1330,15 @@ void SfxItemSet::InvalidateItem( sal_uInt16 nWhich )
if( *ppFnd ) // Set for me
{
- if( reinterpret_cast<SfxPoolItem*>(-1) != *ppFnd ) // Not yet dontcare!
+ if( !IsInvalidItem(*ppFnd) )
{
m_pPool->Remove( **ppFnd );
- *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd = INVALID_POOL_ITEM;
}
}
else
{
- *ppFnd = reinterpret_cast<SfxPoolItem*>(-1);
+ *ppFnd = INVALID_POOL_ITEM;
++m_nCount;
}
break;
@@ -1825,7 +1825,7 @@ const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, sal_uInt16 nWhi
// Remember old Item
bool bIncrementCount = false;
const SfxPoolItem* pOld = *( m_pItems + nPos );
- if ( reinterpret_cast< SfxPoolItem* >( -1 ) == pOld ) // state "dontcare"
+ if ( IsInvalidItem(pOld) ) // state "dontcare"
pOld = nullptr;
if ( !pOld )
{