diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-09-30 20:22:30 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-01 06:33:11 +0200 |
commit | 1fc63383ccd8af144d681ba405f5ead863ac24e1 (patch) | |
tree | 77d41033131babef8db1dd7ffb6e00b0f0ac3237 /sw/source/core/doc/docfly.cxx | |
parent | 4814e8caa5f06c4fe438dfd7d7315e4a2410ea18 (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 'sw/source/core/doc/docfly.cxx')
-rw-r--r-- | sw/source/core/doc/docfly.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 908d25de5176..58f4521f94d0 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -448,9 +448,9 @@ lcl_SetFlyFrameAttr(SwDoc & rDoc, const SfxPoolItem* pItem; SfxItemIter aIter( rSet ); SfxItemSet aTmpSet( rDoc.GetAttrPool(), aFrameFormatSetRange ); - sal_uInt16 nWhich = aIter.GetCurItem()->Which(); + const SfxPoolItem* pItemIter = aIter.GetCurItem(); do { - switch( nWhich ) + switch(pItemIter->Which()) { case RES_FILL_ORDER: case RES_BREAK: @@ -460,24 +460,23 @@ lcl_SetFlyFrameAttr(SwDoc & rDoc, OSL_FAIL( "Unknown Fly attribute." ); [[fallthrough]]; case RES_CHAIN: - rSet.ClearItem( nWhich ); + rSet.ClearItem(pItemIter->Which()); break; case RES_ANCHOR: if( DONTMAKEFRMS != nMakeFrames ) break; [[fallthrough]]; default: - if( !IsInvalidItem( aIter.GetCurItem() ) && ( SfxItemState::SET != - rFlyFormat.GetAttrSet().GetItemState( nWhich, true, &pItem ) || - *pItem != *aIter.GetCurItem() )) - aTmpSet.Put( *aIter.GetCurItem() ); + if( !IsInvalidItem(pItemIter) && ( SfxItemState::SET != + rFlyFormat.GetAttrSet().GetItemState(pItemIter->Which(), true, &pItem ) || + *pItem != *pItemIter)) + aTmpSet.Put(*pItemIter); break; } - if( aIter.IsAtEnd() ) - break; + pItemIter = aIter.NextItem(); - } while( 0 != ( nWhich = aIter.NextItem()->Which() ) ); + } while (pItemIter && (0 != pItemIter->Which())); if( aTmpSet.Count() ) rFlyFormat.SetFormatAttr( aTmpSet ); |