[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 4 commits - canvas/source sd/source slideshow/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Tue Jan 10 03:32:28 PST 2012


 canvas/source/directx/dx_impltools.cxx                       |    4 -
 canvas/source/tools/spriteredrawmanager.cxx                  |   31 +++++------
 canvas/source/vcl/textlayout.cxx                             |    4 -
 sd/source/core/stlpool.cxx                                   |   28 +++++----
 slideshow/source/engine/animationnodes/basecontainernode.cxx |    3 -
 slideshow/source/engine/eventmultiplexer.cxx                 |    4 -
 slideshow/source/engine/tools.cxx                            |    2 
 7 files changed, 38 insertions(+), 38 deletions(-)

New commits:
commit 0585c2f892db7c7e3aa454b79768e34703b15186
Author: julien2412 <serval2412 at yahoo.fr>
Date:   Mon Jan 9 18:03:11 2012 +0100

    Fix crash when play particular presentation with sound
    
    This fixes fdo#44533.

diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx
index 991452f..2af5b34 100644
--- a/canvas/source/tools/spriteredrawmanager.cxx
+++ b/canvas/source/tools/spriteredrawmanager.cxx
@@ -271,18 +271,18 @@ namespace canvas
             ++aCurrRecord;
         }
 
-        VectorOfSprites::iterator aBegin( aUpdatableSprites.begin() );
-        VectorOfSprites::iterator aEnd  ( aUpdatableSprites.end() );
-        ::std::sort( aBegin,
-                     aEnd,
+        ::std::sort( aUpdatableSprites.begin(),
+                     aUpdatableSprites.end(),
                      aSpriteComparator );
 
-        aEnd = ::std::unique( aBegin, aEnd );
+        VectorOfSprites::iterator aEnd=
+            ::std::unique( aUpdatableSprites.begin(),
+                           aUpdatableSprites.end() );
 
         // for each unique sprite, check the change event vector,
         // calculate the update operation from that, and add the
         // result to the aUpdateArea.
-        ::std::for_each( aBegin,
+        ::std::for_each( aUpdatableSprites.begin(),
                          aEnd,
                          SpriteUpdater( rUpdateAreas,
                                         maChangeRecords) );
@@ -298,7 +298,8 @@ namespace canvas
         VectorOfSprites aUnchangedSprites;
         ::std::set_difference( aSortedSpriteVector.begin(),
                                aSortedSpriteVector.end(),
-                               aBegin, aEnd,
+                               aUpdatableSprites.begin(),
+                               aEnd,
                                ::std::back_insert_iterator< VectorOfSprites >(aUnchangedSprites) );
 
         // add each remaining unchanged sprite to connected ranges,
commit 334bbec9d40eec73fd67652210a67f90966a360b
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Tue Jan 10 11:42:11 2012 +0100

    Tools container rework regression fix (for fdo#41657)
    
    Don't de-reference invalid iterator (and no point in doing anything
    with an empty style sheet list anyway).

diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index f6ee1bd..3625bbf 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -681,24 +681,26 @@ void SdStyleSheetPool::CopyLayoutSheets(const String& rLayoutName, SdStyleSheetP
     std::vector<SfxStyleSheetBase*> aOutlineSheets;
     CreateOutlineSheetList(rLayoutName,aOutlineSheets);
 
-    std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
-
-    SfxStyleSheetBase* pParent = *it;
-    ++it;
-
-    while (it != aOutlineSheets.end())
+    if( !aOutlineSheets.empty() )
     {
-        pSheet = *it;
+        std::vector<SfxStyleSheetBase*>::iterator it = aOutlineSheets.begin();
+        SfxStyleSheetBase* pParent = *it;
+        ++it;
 
-        if (!pSheet)
-            break;
+        while (it != aOutlineSheets.end())
+        {
+            pSheet = *it;
 
-        if (pSheet->GetParent().Len() == 0)
-            pSheet->SetParent(pParent->GetName());
+            if (!pSheet)
+                break;
 
-        pParent = pSheet;
+            if (pSheet->GetParent().Len() == 0)
+                pSheet->SetParent(pParent->GetName());
 
-        ++it;
+            pParent = pSheet;
+
+            ++it;
+        }
     }
 }
 
commit 46daad95f8b65b91a0a30bda451dceff05408ecd
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Mon Jan 9 18:35:27 2012 +0100

    Avoid pointless const_cast, use getConstArray in all cases.
    
    Another code-review follow-up fix from fdo#44533 - don't use
    Sequence::getArray, that tends to create a new copy everytime you
    call.

diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx
index 946a9b2..63bcabe 100644
--- a/canvas/source/directx/dx_impltools.cxx
+++ b/canvas/source/directx/dx_impltools.cxx
@@ -452,8 +452,8 @@ namespace dxcanvas
                     // TODO(F1): Closed/open polygons
 
                     // convert from RealPoint2D array to Gdiplus::PointF array
-                    ::std::transform( const_cast< uno::Sequence< geometry::RealPoint2D >& >(points[nCurrPoly]).getArray(),
-                                      const_cast< uno::Sequence< geometry::RealPoint2D >& >(points[nCurrPoly]).getArray()+nCurrSize,
+                    ::std::transform( points[nCurrPoly].getConstArray(),
+                                      points[nCurrPoly].getConstArray()+nCurrSize,
                                       aPoints.begin(),
                                       implGdiPlusPointFromRealPoint2D );
 
diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index 89711e5..4dd036f 100644
--- a/canvas/source/vcl/textlayout.cxx
+++ b/canvas/source/vcl/textlayout.cxx
@@ -465,8 +465,8 @@ namespace vclcanvas
                                                      renderState);
 
         // fill integer offsets
-        ::std::transform( const_cast< uno::Sequence< double >& >(inputOffsets).getConstArray(),
-                          const_cast< uno::Sequence< double >& >(inputOffsets).getConstArray()+inputOffsets.getLength(),
+        ::std::transform( inputOffsets.getConstArray(),
+                          inputOffsets.getConstArray()+inputOffsets.getLength(),
                           outputOffsets,
                           OffsetTransformer( aMatrix ) );
     }
commit f4f4be98ba753657f914f16abaec79865bea99d0
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Mon Jan 9 18:04:58 2012 +0100

    Fix more incorrect iterator re-use.
    
    Follow-up fix for 540963d879296ef81f883305057e63465b2ff586
    std::algos use iterator arguments by value, and may change them.

diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx
index af2c279..991452f 100644
--- a/canvas/source/tools/spriteredrawmanager.cxx
+++ b/canvas/source/tools/spriteredrawmanager.cxx
@@ -411,16 +411,11 @@ namespace canvas
         if( nNumSprites > 3 || nNumSprites < 1 )
             return false;
 
-        const SpriteConnectedRanges::ComponentListType::const_iterator aBegin(
-            rUpdateArea.maComponentList.begin() );
-        const SpriteConnectedRanges::ComponentListType::const_iterator aEnd(
-            rUpdateArea.maComponentList.end() );
-
         // now, calc the _true_ update area, by merging all sprite's
         // true update areas into one rectangle
-        ::basegfx::B2DRange aTrueArea( aBegin->second.getUpdateArea() );
-        ::std::for_each( aBegin,
-                         aEnd,
+        ::basegfx::B2DRange aTrueArea( rUpdateArea.maComponentList.begin()->second.getUpdateArea() );
+        ::std::for_each( rUpdateArea.maComponentList.begin(),
+                         rUpdateArea.maComponentList.end(),
                          ::boost::bind( (void (basegfx::B2DRange::*)(const basegfx::B2DRange&))(
                                             &basegfx::B2DRange::expand),
                                         aTrueArea,
@@ -428,9 +423,12 @@ namespace canvas
                                                        ::boost::bind( ::o3tl::select2nd<AreaComponent>(),
                                                                       _1 ) ) ) );
 
+        const SpriteConnectedRanges::ComponentListType::const_iterator aEnd(
+            rUpdateArea.maComponentList.end() );
+
         // and check whether _any_ of the sprites tells that its area
         // update will not be opaque.
-        return (::std::find_if( aBegin,
+        return (::std::find_if( rUpdateArea.maComponentList.begin(),
                                 aEnd,
                                 ::boost::bind( &SpriteRedrawManager::isAreaUpdateNotOpaque,
                                                this,
diff --git a/slideshow/source/engine/animationnodes/basecontainernode.cxx b/slideshow/source/engine/animationnodes/basecontainernode.cxx
index bf00001..fd81654 100644
--- a/slideshow/source/engine/animationnodes/basecontainernode.cxx
+++ b/slideshow/source/engine/animationnodes/basecontainernode.cxx
@@ -113,10 +113,9 @@ void BaseContainerNode::appendChildNode( AnimationNodeSharedPtr const& pNode )
 bool BaseContainerNode::isChildNode( AnimationNodeSharedPtr const& pNode ) const
 {
     // find given notifier in child vector
-    VectorOfNodes::const_iterator const iBegin( maChildren.begin() );
     VectorOfNodes::const_iterator const iEnd( maChildren.end() );
     VectorOfNodes::const_iterator const iFind(
-        std::find( iBegin, iEnd, pNode ) );
+        std::find( maChildren.begin(), iEnd, pNode ) );
     return (iFind != iEnd);
 }
 
diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx
index 8bb0f08..d162718 100644
--- a/slideshow/source/engine/eventmultiplexer.cxx
+++ b/slideshow/source/engine/eventmultiplexer.cxx
@@ -617,10 +617,10 @@ bool EventMultiplexerImpl::notifyMouseHandlers(
     // find corresponding view (to map mouse position into user
     // coordinate space)
     UnoViewVector::const_iterator       aIter;
-    const UnoViewVector::const_iterator aBegin( mrViewContainer.begin() );
     const UnoViewVector::const_iterator aEnd  ( mrViewContainer.end() );
     if( (aIter=::std::find_if(
-             aBegin, aEnd,
+             mrViewContainer.begin(),
+             aEnd,
              boost::bind( std::equal_to< uno::Reference<
                           presentation::XSlideShowView > >(),
                           boost::cref( xView ),
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index e36f4ee..7dabb90 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -472,7 +472,7 @@ namespace slideshow
                                                               pArray + nLen,
                                                               NamedValueComparator( rSearchKey ) );
 
-            if( pFound == pArray + nLen )
+            if( pFound == rSequence.getConstArray() + nLen )
                 return false;
 
             return true;


More information about the Libreoffice-commits mailing list