summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-09-30 20:22:30 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-10-01 06:33:11 +0200
commit1fc63383ccd8af144d681ba405f5ead863ac24e1 (patch)
tree77d41033131babef8db1dd7ffb6e00b0f0ac3237 /editeng
parent4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (diff)
Avoid redundant IsAtEnd: NextItem returns nullptr iif iterator is at end
To keep the check efficient, split NextItem to inline and Impl parts Change-Id: Id5877a3c5bed73aac9c39c655b106a715cf888ea Reviewed-on: https://gerrit.libreoffice.org/79894 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/rtf/rtfitem.cxx6
-rw-r--r--editeng/source/rtf/svxrtf.cxx28
2 files changed, 14 insertions, 20 deletions
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 78b185fb8ca7..775104700941 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1885,13 +1885,11 @@ void SvxRTFParser::SetDefault( int nToken, int nValue )
{
SfxItemIter aIter( aTmp );
const SfxPoolItem* pItem = aIter.GetCurItem();
- while( true )
+ do
{
pAttrPool->SetPoolDefaultItem( *pItem );
- if( aIter.IsAtEnd() )
- break;
pItem = aIter.NextItem();
- }
+ } while (pItem);
}
}
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index cb50be3cb795..f78fcb891454 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -700,17 +700,15 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack
{
SfxItemIter aIter( pOld->aAttrSet );
const SfxPoolItem* pItem = aIter.GetCurItem(), *pGet;
- while( true )
+ do
{
if( SfxItemState::SET == pCurrent->aAttrSet.GetItemState(
pItem->Which(), false, &pGet ) &&
*pItem == *pGet )
pOld->aAttrSet.ClearItem( pItem->Which() );
- if( aIter.IsAtEnd() )
- break;
pItem = aIter.NextItem();
- }
+ } while (pItem);
if (!pOld->aAttrSet.Count() && !pOld->m_pChildList &&
!pOld->nStyleNo )
@@ -1064,16 +1062,15 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser )
// Search for all which are set over the whole area
SfxItemIter aIter( aMrgSet );
const SfxPoolItem* pItem;
+ const SfxPoolItem* pIterItem = aIter.GetCurItem();
do {
- sal_uInt16 nWhich = aIter.GetCurItem()->Which();
+ sal_uInt16 nWhich = pIterItem->Which();
if( SfxItemState::SET != pTmp->aAttrSet.GetItemState( nWhich,
- false, &pItem ) || *pItem != *aIter.GetCurItem() )
+ false, &pItem ) || *pItem != *pIterItem)
aMrgSet.ClearItem( nWhich );
- if( aIter.IsAtEnd() )
- break;
- aIter.NextItem();
- } while( true );
+ pIterItem = aIter.NextItem();
+ } while(pIterItem);
if( !aMrgSet.Count() )
return;
@@ -1110,15 +1107,14 @@ void SvxRTFItemStackType::SetRTFDefaults( const SfxItemSet& rDefaults )
if( rDefaults.Count() )
{
SfxItemIter aIter( rDefaults );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
do {
- sal_uInt16 nWhich = aIter.GetCurItem()->Which();
+ sal_uInt16 nWhich = pItem->Which();
if( SfxItemState::SET != aAttrSet.GetItemState( nWhich, false ))
- aAttrSet.Put( *aIter.GetCurItem() );
+ aAttrSet.Put(*pItem);
- if( aIter.IsAtEnd() )
- break;
- aIter.NextItem();
- } while( true );
+ pItem = aIter.NextItem();
+ } while(pItem);
}
}