[Libreoffice-commits] .: 2 commits - o3tl/inc o3tl/qa sd/source sw/inc sw/source

Michael Stahl mst at kemper.freedesktop.org
Wed Aug 1 03:56:11 PDT 2012


 o3tl/inc/o3tl/sorted_vector.hxx           |   11 ++++++-----
 o3tl/qa/test-sorted_vector.cxx            |    6 ++----
 sd/source/filter/eppt/pptexanimations.cxx |    6 +-----
 sd/source/filter/eppt/pptx-epptooxml.cxx  |    6 +-----
 sw/inc/docary.hxx                         |    2 +-
 sw/inc/ndhints.hxx                        |    4 ++--
 sw/source/filter/html/htmlfly.hxx         |    3 +--
 sw/source/ui/utlui/content.cxx            |    3 +--
 8 files changed, 15 insertions(+), 26 deletions(-)

New commits:
commit 3e3acee762fac71f7356ed1305a64e0278278081
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 1 12:52:09 2012 +0200

    sorted_vector: turn Find parameter into template
    
    Enforces same type parameters for sorted_vector and Find, and makes
    it easier to use.
    
    Change-Id: Ide456a48f015cb0a9dea7a0bf2bcf2ccad527fd1

diff --git a/o3tl/inc/o3tl/sorted_vector.hxx b/o3tl/inc/o3tl/sorted_vector.hxx
index 4d442dd..6f444d9 100644
--- a/o3tl/inc/o3tl/sorted_vector.hxx
+++ b/o3tl/inc/o3tl/sorted_vector.hxx
@@ -27,12 +27,13 @@ struct find_unique;
     @tpl Compare comparison method
     @tpl Find   look up index of a Value in the array
 */
-template<class Value, class Compare = std::less<Value>,
-         class Find = find_unique<Value, Compare> >
+template<typename Value, typename Compare = std::less<Value>,
+     template<typename, typename> class Find = find_unique >
 class sorted_vector
     : private std::vector<Value>
 {
 private:
+    typedef Find<Value, Compare> Find_t;
     typedef typename std::vector<Value> base_t;
     typedef typename std::vector<Value>::iterator  iterator;
 public:
@@ -47,7 +48,7 @@ public:
 
     std::pair<const_iterator,bool> insert( const Value& x )
     {
-        std::pair<const_iterator, bool> const ret(Find()(begin(), end(), x));
+        std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
         if (!ret.second)
         {
             const_iterator const it = base_t::insert(
@@ -59,7 +60,7 @@ public:
 
     size_type erase( const Value& x )
     {
-        std::pair<const_iterator, bool> const ret(Find()(begin(), end(), x));
+        std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
         if (ret.second)
         {
             base_t::erase(begin_nonconst() + (ret.first - begin()));
@@ -129,7 +130,7 @@ public:
      */
     const_iterator find( const Value& x ) const
     {
-        std::pair<const_iterator, bool> const ret(Find()(begin(), end(), x));
+        std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
         return (ret.second) ? ret.first : end();
     }
 
diff --git a/o3tl/qa/test-sorted_vector.cxx b/o3tl/qa/test-sorted_vector.cxx
index 1b321c9..8e9e719 100644
--- a/o3tl/qa/test-sorted_vector.cxx
+++ b/o3tl/qa/test-sorted_vector.cxx
@@ -136,8 +136,7 @@ public:
     void testBasics_FindPtr()
     {
         o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent>,
-            o3tl::find_partialorder_ptrequals<SwContent*,
-                o3tl::less_ptr_to<SwContent> > > aVec;
+            o3tl::find_partialorder_ptrequals> aVec;
         SwContent *p1 = new SwContent(1);
         SwContent *p2 = new SwContent(2);
         SwContent *p2_2 = new SwContent(2);
@@ -195,8 +194,7 @@ public:
     void testErase_FindPtr()
     {
         o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent>,
-            o3tl::find_partialorder_ptrequals<SwContent*,
-                o3tl::less_ptr_to<SwContent> > > aVec;
+            o3tl::find_partialorder_ptrequals> aVec;
         SwContent *p1 = new SwContent(1);
         SwContent *p1_2 = new SwContent(1);
         SwContent *p1_3 = new SwContent(1);
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 7c9f928..4f9b9af 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -145,7 +145,7 @@ struct CompareSwRedlineTbl
 };
 class _SwRedlineTbl
     : public o3tl::sorted_vector<SwRedline*, CompareSwRedlineTbl,
-        o3tl::find_partialorder_ptrequals<SwRedline*, CompareSwRedlineTbl> >
+                o3tl::find_partialorder_ptrequals>
 {
 public:
     ~_SwRedlineTbl();
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index 154c957..773bb1f 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -76,14 +76,14 @@ struct CompareSwpHtStart
     bool operator()(SwTxtAttr* const lhs, SwTxtAttr* const rhs) const;
 };
 class SwpHtStart : public o3tl::sorted_vector<SwTxtAttr*, CompareSwpHtStart,
-    o3tl::find_partialorder_ptrequals<SwTxtAttr*, CompareSwpHtStart> > {};
+    o3tl::find_partialorder_ptrequals> {};
 
 struct CompareSwpHtEnd
 {
     bool operator()(SwTxtAttr* const lhs, SwTxtAttr* const rhs) const;
 };
 class SwpHtEnd : public o3tl::sorted_vector<SwTxtAttr*, CompareSwpHtEnd,
-    o3tl::find_partialorder_ptrequals<SwTxtAttr*, CompareSwpHtEnd> > {};
+    o3tl::find_partialorder_ptrequals> {};
 
 // Class SwpHintsArr
 
diff --git a/sw/source/filter/html/htmlfly.hxx b/sw/source/filter/html/htmlfly.hxx
index 19b14e0..8184d5c 100644
--- a/sw/source/filter/html/htmlfly.hxx
+++ b/sw/source/filter/html/htmlfly.hxx
@@ -130,8 +130,7 @@ public:
 class SwHTMLPosFlyFrms
     : public o3tl::sorted_vector<SwHTMLPosFlyFrm*,
                 o3tl::less_ptr_to<SwHTMLPosFlyFrm>,
-                o3tl::find_partialorder_ptrequals<SwHTMLPosFlyFrm*,
-                    o3tl::less_ptr_to<SwHTMLPosFlyFrm> > >
+                o3tl::find_partialorder_ptrequals>
 {};
 
 #endif
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index f150239..9330f46 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -106,8 +106,7 @@ using namespace ::com::sun::star::container;
 
 class SwContentArr
     : public o3tl::sorted_vector<SwContent*, o3tl::less_ptr_to<SwContent>,
-                o3tl::find_partialorder_ptrequals<SwContent*,
-                    o3tl::less_ptr_to<SwContent> > >
+                o3tl::find_partialorder_ptrequals>
 {
 public:
     ~SwContentArr() { DeleteAndDestroyAll(); }
commit 77165efb4eb4d9735f8dd4f8c99044a36d60a611
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Aug 1 12:10:39 2012 +0200

    Revert "WaE: indexes past the end of an array"
    
    This reverts commit 51e3df40bc757b46636a3d74681a597fe35063ba.
    
    The fix was correct at the time it was done, but unfortunately now it
    conflicts with 89f08dce89adfddd3fb8e00b7a7a9c5da2a4943e, which fixes the
    same problem by changing the definition of DFF_ANIM_PROPERTY_ID_COUNT.

diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 736a595..75634f3 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -963,11 +963,7 @@ sal_Int16 AnimationExporter::exportAnimPropertySet( SvStream& rStrm, const Refer
 
     // storing user data into pAny, to allow direct access later
     const Sequence< NamedValue > aUserData = xNode->getUserData();
-
-    // ids start from 1, DFF_ANIM_PROPERTY_ID_COUNT is the highest id
-    // number
-    const ::com::sun::star::uno::Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT + 1 ];
-
+    const ::com::sun::star::uno::Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
     GetUserData( aUserData, pAny, sizeof( pAny ) );
 
     if( pAny[ DFF_ANIM_AFTEREFFECT ] )
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index dd36bd7..2b83a7b 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -986,11 +986,7 @@ void PowerPointExport::WriteAnimationNodeCommonPropsStart( FSHelperPtr pFS, cons
     }
 
     const Sequence< NamedValue > aUserData = rXNode->getUserData();
-
-    // ids start from 1, DFF_ANIM_PROPERTY_ID_COUNT is the highest id
-    // number
-    const Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT + 1];
-
+    const Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
     AnimationExporter::GetUserData( aUserData, pAny, sizeof( pAny ) );
 
     sal_Int16 nType = 0;


More information about the Libreoffice-commits mailing list