diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-04-03 16:40:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-04-03 17:31:37 +0200 |
commit | 60797d61e4d8641a4177089b204c1af8c8a3b594 (patch) | |
tree | 99928dfec1fea3a1607fc704c6824117977ff76e /sd | |
parent | 58353884dc86bdb3c1464f8bbf8c3e131584b78a (diff) |
Fix uses of MAX_PRESOBJS
...broken in 10055ff899ed8f9c205155cd15c6de81cba37471 "convert PresObjKind to
scoped enum", causing CppunitTest_sd_import_tests to fail with
> sd/source/core/sdpage.cxx:1462:68: runtime error: index 7 out of bounds for type 'PresObjKind const[7]'
> #0 in findAutoLayoutShapesImpl(SdPage&, (anonymous namespace)::LayoutDescriptor const&, std::__debug::array<SdrObject*, 7ul>&, bool, bool) at sd/source/core/sdpage.cxx:1462:68
> #1 in SdPage::SetAutoLayout(AutoLayout, bool, bool) at sd/source/core/sdpage.cxx:1639:5
> #2 in SdGenericDrawPage::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) at sd/source/ui/unoidl/unopage.cxx:624:28
[...]
Change-Id: I04a0b87e952ff2a93f939221cc424d83a59df9a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91644
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/core/sdpage.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 8f697e1ec2f5..7f8178dea79f 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -1459,7 +1459,7 @@ static void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDe bool bMissing = false; // for each entry in the layoutdescriptor, arrange a presentation shape - for (int i = 0; (i <= static_cast<int>(PresObjKind::LAST)) && (rDescriptor.meKind[i] != PresObjKind::NONE); i++) + for (int i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != PresObjKind::NONE); i++) { PresObjKind eKind = rDescriptor.meKind[i]; SdrObject* pObj = nullptr; @@ -1482,7 +1482,7 @@ static void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDe return; // for each entry in the layoutdescriptor, look for an alternative shape - for (int i = 0; (i <= static_cast<int>(PresObjKind::LAST)) && (rDescriptor.meKind[i] != PresObjKind::NONE); i++) + for (int i = 0; (i < MAX_PRESOBJS) && (rDescriptor.meKind[i] != PresObjKind::NONE); i++) { if( rShapes[i] ) continue; @@ -1639,7 +1639,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, bool bInit, bool bCreate ) findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, bSwitchLayout ); // for each entry in the layoutdescriptor, arrange a presentation shape - for (int i = 0; (i <= static_cast<int>(PresObjKind::LAST)) && (aDescriptor.meKind[i] != PresObjKind::NONE); i++) + for (int i = 0; (i < MAX_PRESOBJS) && (aDescriptor.meKind[i] != PresObjKind::NONE); i++) { PresObjKind eKind = aDescriptor.meKind[i]; SdrObject* pObj = InsertAutoLayoutShape( aLayoutShapes[i], eKind, aDescriptor.mbVertical[i], aRectangle[i], bInit ); |