[Libreoffice-commits] core.git: sd/source

Caolán McNamara caolanm at redhat.com
Tue Dec 16 12:25:47 PST 2014


 sd/source/ui/dlg/animobjs.cxx |   22 ++++++++++++++--------
 sd/source/ui/inc/animobjs.hxx |    2 +-
 2 files changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 1c32b8747e0a2051b9abcb1e681c3ca08c039269
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 16 17:31:23 2014 +0000

    this horror depends on unsigned max increment to wrap-around to 0
    
    understandable dbgutil out of bounds iterator checking regression from
    
    commit 3af368f0f8e6691aa2eef177ccfcfcb95885c84b
    Date:   Tue Aug 14 21:03:04 2012 +0200
        AnimationWindow: convert List to std::vector
    
    Change-Id: I8ff3e0726cc0d6e643f2f4e08b0ca41e327e5efc

diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 67c292a..96375d2 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -556,7 +556,8 @@ void AnimationWindow::UpdateControl(bool const bDisableCtrls)
 
     if (!m_FrameList.empty() && !bMovie)
     {
-        aNumFldBitmap.SetValue(m_nCurrentFrame + 1);
+        size_t nIndex = m_nCurrentFrame + 1;
+        aNumFldBitmap.SetValue(nIndex);
 
         // if there is at least 1 object in the list
         aBtnFirst.Enable();
@@ -847,8 +848,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
 
                         long nTime = rAnimBmp.nWait;
                         ::tools::Time* pTime = new ::tools::Time( 0, 0, nTime / 100, nTime % 100 );
+                        size_t nIndex = m_nCurrentFrame + 1;
                         m_FrameList.insert(
-                                m_FrameList.begin() + m_nCurrentFrame + 1,
+                                m_FrameList.begin() + nIndex,
                                 ::std::make_pair(pBitmapEx, pTime));
 
                         // increment => next one inserted after this one
@@ -874,9 +876,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
                             pSnapShot->GetModel(), pSnapShot).GetBitmapEx() );
 
                     ::tools::Time* pTime = new ::tools::Time( aTimeField.GetTime() );
-
+                    size_t nIndex = m_nCurrentFrame + 1;
                     m_FrameList.insert(
-                            m_FrameList.begin() + m_nCurrentFrame + 1,
+                            m_FrameList.begin() + nIndex,
                             ::std::make_pair(pBitmapEx, pTime));
 
                     // increment => next one inserted after this one
@@ -896,8 +898,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
 
             ::tools::Time* pTime = new ::tools::Time( aTimeField.GetTime() );
 
+            size_t nIndex = m_nCurrentFrame + 1;
             m_FrameList.insert(
-                    m_FrameList.begin() + m_nCurrentFrame + 1,
+                    m_FrameList.begin() + nIndex,
                     ::std::make_pair(pBitmapEx, pTime));
         }
 
@@ -907,7 +910,8 @@ void AnimationWindow::AddObj (::sd::View& rView )
             SdrMark*    pMark   = rMarkList.GetMark(0);
             SdrObject*  pObject = pMark->GetMarkedSdrObj();
             SdrObject*  pClone  = pObject->Clone();
-            pPage->InsertObject(pClone, m_nCurrentFrame + 1);
+            size_t nIndex = m_nCurrentFrame + 1;
+            pPage->InsertObject(pClone, nIndex);
         }
         // several objects: group the clones
         else if (nMarkCount > 1)
@@ -926,8 +930,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
 
                     ::tools::Time* pTime = new ::tools::Time( aTimeField.GetTime() );
 
+                    size_t nIndex = m_nCurrentFrame + 1;
                     m_FrameList.insert(
-                        m_FrameList.begin() + m_nCurrentFrame + 1,
+                        m_FrameList.begin() + nIndex,
                         ::std::make_pair(pBitmapEx, pTime));
 
                     // increment => next one inserted after this one
@@ -945,7 +950,8 @@ void AnimationWindow::AddObj (::sd::View& rView )
                 for (size_t nObject= 0; nObject < nMarkCount; ++nObject)
                     pObjList->InsertObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()->Clone());
 
-                pPage->InsertObject(pCloneGroup, m_nCurrentFrame + 1);
+                size_t nIndex = m_nCurrentFrame + 1;
+                pPage->InsertObject(pCloneGroup, nIndex);
             }
         }
 
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index c4fe3bf..44654b1 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -125,7 +125,7 @@ private:
 
     vcl::Window*       pWin;
     ::std::vector< ::std::pair<BitmapEx*, ::tools::Time*> > m_FrameList;
-    static const size_t EMPTY_FRAMELIST = ULONG_MAX;
+    static const size_t EMPTY_FRAMELIST = std::numeric_limits<size_t>::max();
     size_t          m_nCurrentFrame;
     SdDrawDocument* pMyDoc;
 


More information about the Libreoffice-commits mailing list