diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2016-04-15 13:50:36 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2016-04-15 13:03:46 +0000 |
commit | e9793bb9792dadfd6c0503bbac260c512451cf06 (patch) | |
tree | 7e90753be43890808c3e45ce4a2370713d976e9b /svx | |
parent | 7ae232623a423b078dd54d06e5fe52e89994b391 (diff) |
Use an iterator for loop to avoid calling n times std::advance
Change-Id: I8ba45094cc86cdef07ebbfe334c6c42a108f073e
Reviewed-on: https://gerrit.libreoffice.org/24107
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 05037da5ee5e..2a2f6218d480 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -591,19 +591,17 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize } // remove all entries with set flag - for ( size_t i = 0; i < aObjectList.size(); ) + GalleryObjectList::const_iterator aEnd = aObjectList.end(); + for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aEnd ; /* increment is in the body ofloop */) { - pEntry = aObjectList[ i ]; - if( pEntry->mbDelete ) + if( (*it)->mbDelete ) { - Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( pEntry ) ) ); - Broadcast( GalleryHint( GalleryHintType::OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uLong >( pEntry ) ) ); - GalleryObjectList::iterator it = aObjectList.begin(); - ::std::advance( it, i ); - aObjectList.erase( it ); - delete pEntry; + Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( *it ) ) ); + Broadcast( GalleryHint( GalleryHintType::OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uLong >( *it ) ) ); + delete *it; + it = aObjectList.erase( it ); } - else ++i; + else ++it; } // update theme |