[Libreoffice-commits] .: slideshow/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Tue Jan 10 15:15:11 PST 2012


 slideshow/source/engine/shapes/drawshapesubsetting.cxx |   34 ++++++++---------
 1 file changed, 16 insertions(+), 18 deletions(-)

New commits:
commit 122cb4ff9cdeea5c3c9b7a0a60f26cadb13a71fa
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Wed Jan 11 00:05:50 2012 +0100

    Fix fdo#43820 - properly initialize iterators before math.

diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
index 80c142c..eea1202 100644
--- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx
+++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
@@ -725,9 +725,13 @@ namespace slideshow
             class FindNthElementFunctor
             {
             public:
-                FindNthElementFunctor( sal_Int32                                nNodeIndex,
-                                       DrawShapeSubsetting::IndexClassificator  eClass ) :
+                FindNthElementFunctor( sal_Int32                                                      nNodeIndex,
+                                       DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rLastBegin,
+                                       DrawShapeSubsetting::IndexClassificatorVector::const_iterator& rLastEnd,
+                                       DrawShapeSubsetting::IndexClassificator                        eClass ) :
                     mnNodeIndex( nNodeIndex ),
+                    mrLastBegin( rLastBegin ),
+                    mrLastEnd( rLastEnd ),
                     meClass( eClass )
                 {
                 }
@@ -740,8 +744,8 @@ namespace slideshow
                     if( eCurrElemClassification == meClass &&
                         nCurrElemCount == mnNodeIndex )
                     {
-                        maLastBegin = rCurrElemBegin;
-                        maLastEnd = rCurrElemEnd;
+                        mrLastBegin = rCurrElemBegin;
+                        mrLastEnd = rCurrElemEnd;
 
                         return false; // abort iteration, we've
                                       // already found what we've been
@@ -751,20 +755,10 @@ namespace slideshow
                     return true; // keep on truckin'
                 }
 
-                DrawShapeSubsetting::IndexClassificatorVector::const_iterator getBeginElement() const
-                {
-                    return maLastBegin;
-                }
-
-                DrawShapeSubsetting::IndexClassificatorVector::const_iterator getEndElement() const
-                {
-                    return maLastEnd;
-                }
-
             private:
                 sal_Int32                                                       mnNodeIndex;
-                DrawShapeSubsetting::IndexClassificatorVector::const_iterator   maLastBegin;
-                DrawShapeSubsetting::IndexClassificatorVector::const_iterator   maLastEnd;
+                DrawShapeSubsetting::IndexClassificatorVector::const_iterator&  mrLastBegin;
+                DrawShapeSubsetting::IndexClassificatorVector::const_iterator&  mrLastEnd;
                 DrawShapeSubsetting::IndexClassificator                         meClass;
             };
 
@@ -789,17 +783,21 @@ namespace slideshow
             const IndexClassificator eRequestedClass(
                 mapDocTreeNode( eNodeType ) );
 
+            DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastBegin(rEnd);
+            DrawShapeSubsetting::IndexClassificatorVector::const_iterator aLastEnd(rEnd);
+
             // create a nth element functor for the requested class of
             // actions, and nNodeIndex as the target index
             FindNthElementFunctor aFunctor( nNodeIndex,
+                                            aLastBegin,
+                                            aLastEnd,
                                             eRequestedClass );
 
             // find given index in the given range
             iterateActionClassifications( aFunctor, rBegin, rEnd );
 
             return makeTreeNode( maActionClassVector.begin(),
-                                 aFunctor.getBeginElement(),
-                                 aFunctor.getEndElement(),
+                                 aLastBegin, aLastEnd,
                                  eNodeType );
         }
 


More information about the Libreoffice-commits mailing list