[Libreoffice-commits] core.git: 3 commits - basic/source svl/source sw/inc sw/source

Michael Stahl mstahl at redhat.com
Fri Apr 12 10:16:36 PDT 2013


 basic/source/classes/propacc.cxx       |    6 ++++
 svl/source/numbers/zforlist.cxx        |    4 +-
 sw/inc/IMark.hxx                       |   49 +++++++++++++++++++++++++++++++++
 sw/source/core/crsr/crbm.cxx           |    7 ++--
 sw/source/core/doc/docbm.cxx           |    8 ++---
 sw/source/core/unocore/unoportenum.cxx |    4 --
 sw/source/filter/writer/writer.cxx     |    3 --
 7 files changed, 66 insertions(+), 15 deletions(-)

New commits:
commit 9617741fdfc0b22ff39d2195af5a2966f4fe51e2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Apr 12 17:40:11 2013 +0200

    basic: SbCompare_UString_PropertyValue_Impl MSVC workaround
    
    MSVC 2008 with _DEBUG calls this with parameters in wrong order so needs
    another overload to make it happy.
    
    Change-Id: I906483ecf5325d7aa742e3d93afb151501374abb

diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index bbde713..67cd65a 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -60,6 +60,12 @@ struct SbCompare_UString_PropertyValue_Impl
    {
       return lhs.Name.compareTo(rhs) < 0;
    }
+#ifdef DBG_UTIL
+   bool operator() (PropertyValue const & lhs, const PropertyValue& rhs)
+   {
+       return lhs.Name.compareTo(rhs.Name) < 0;
+   }
+#endif
 };
 
 int CDECL SbCompare_Properties_Impl( const void *arg1, const void *arg2 )
commit e348c88d3d8db2b6a443a4811d815f40ac17fb44
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Apr 9 23:53:19 2013 +0200

    sw: remove usage of boost::bind for IMarks
    
    Apple llvm-g++ 4.2.1 with _GLIBCXX_DEBUG won't eat boost::bind with
    IMark::StartsAfter, and MSVC 2008 with _DEBUG even doesn't like
    IMark::StartsBefore.
    
    They evidently try to call the comparison operator with arguments in the
    wrong order.
    
    Change-Id: Ib11a79a459e84ac9d7046824678ad4ccdacc67d0

diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index 1087ef2..f0e20a6 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -23,6 +23,7 @@
 #include <calbck.hxx>
 #include <pam.hxx>
 #include <boost/operators.hpp>
+#include <boost/shared_ptr.hpp>
 #include <map>
 #include "swdll.hxx"
 
@@ -36,6 +37,7 @@ struct SwPosition;
 
 namespace sw { namespace mark
 {
+
     class SAL_DLLPUBLIC_EXPORT IMark
         : virtual public SwModify // inherited as interface
         , public ::boost::totally_ordered<IMark>
@@ -108,6 +110,53 @@ namespace sw { namespace mark
             virtual bool IsChecked() const =0;
             virtual void SetChecked(bool checked) =0;
     };
+
+    // Apple llvm-g++ 4.2.1 with _GLIBCXX_DEBUG won't eat boost::bind for this
+    // Neither will MSVC 2008 with _DEBUG
+    struct CompareIMarkStartsAfter
+    {
+        bool operator()(SwPosition const& rPos,
+                        boost::shared_ptr<sw::mark::IMark> const& pMark)
+        {
+            return pMark->StartsAfter(rPos);
+        }
+#ifdef DBG_UTIL
+        bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark,
+                        SwPosition const& rPos)
+        {
+            return pMark->StartsBefore(rPos);
+        }
+        bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark1,
+                        boost::shared_ptr<sw::mark::IMark> const& pMark2)
+        {
+            return (*pMark1) < (*pMark2);
+        }
+#endif
+    };
+
+    // MSVC 2008 with _DEBUG calls this with parameters in wrong order
+    // so it needs 3 overloads...
+    struct CompareIMarkStartsBefore
+    {
+        bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark,
+                        SwPosition const& rPos)
+        {
+            return pMark->StartsBefore(rPos);
+        }
+#ifdef DBG_UTIL
+        bool operator()(SwPosition const& rPos,
+                        boost::shared_ptr<sw::mark::IMark> const& pMark)
+        {
+            return pMark->StartsAfter(rPos);
+        }
+        bool operator()(boost::shared_ptr<sw::mark::IMark> const& pMark1,
+                        boost::shared_ptr<sw::mark::IMark> const& pMark2)
+        {
+            return (*pMark1) < (*pMark2);
+        }
+#endif
+    };
+
 }}
 #endif
 
diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx
index 8c09412..b61575f 100644
--- a/sw/source/core/crsr/crbm.cxx
+++ b/sw/source/core/crsr/crbm.cxx
@@ -20,7 +20,6 @@
 #include "crsrsh.hxx"
 #include "ndtxt.hxx"
 #include <docary.hxx>
-#include <boost/bind.hpp>
 
 #include "IMark.hxx"
 #include "callnk.hxx"
@@ -135,11 +134,11 @@ bool SwCrsrShell::GoNextBookmark()
     IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
     IDocumentMarkAccess::container_t vCandidates;
     remove_copy_if(
-        upper_bound(
+        upper_bound( // finds the first that is starting after
             pMarkAccess->getBookmarksBegin(),
             pMarkAccess->getBookmarksEnd(),
             *GetCrsr()->GetPoint(),
-            boost::bind(&::sw::mark::IMark::StartsAfter, _2, _1)), // finds the first that is starting after
+            sw::mark::CompareIMarkStartsAfter()),
         pMarkAccess->getBookmarksEnd(),
         back_inserter(vCandidates),
         &lcl_IsInvisibleBookmark);
@@ -175,7 +174,7 @@ bool SwCrsrShell::GoPrevBookmark()
             pMarkAccess->getBookmarksBegin(),
             pMarkAccess->getBookmarksEnd(),
             *GetCrsr()->GetPoint(),
-            boost::bind(&::sw::mark::IMark::StartsAfter, _2, _1)),
+            sw::mark::CompareIMarkStartsAfter()),
         back_inserter(vCandidates),
         &lcl_IsInvisibleBookmark);
     sort(
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 4454659..858782e 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -127,7 +127,7 @@ namespace
             rMarks.begin(),
             rMarks.end(),
             rPos,
-            boost::bind(&IMark::StartsAfter, _2, _1)); // finds the first that is starting after
+            sw::mark::CompareIMarkStartsAfter());
         if(pMarkAfter == rMarks.end()) return NULL;
         return pMarkAfter->get();
     };
@@ -141,7 +141,7 @@ namespace
             rMarks.begin(),
             rMarks.end(),
             rPos,
-            boost::bind(&IMark::StartsAfter, _2, _1));
+            sw::mark::CompareIMarkStartsAfter());
         vCandidates.reserve(pCandidatesEnd - rMarks.begin());
         // only marks ending before are candidates
         remove_copy_if(
@@ -205,7 +205,7 @@ namespace
         for(IDocumentMarkAccess::iterator_t ppCurrentMark = lower_bound(
                 rMarks.begin(), rMarks.end(),
                 rPos,
-                boost::bind(&IMark::StartsBefore, _1, _2));
+                sw::mark::CompareIMarkStartsBefore());
             ppCurrentMark != rMarks.end();
             ++ppCurrentMark)
         {
@@ -756,7 +756,7 @@ namespace sw { namespace mark
         iterator_t pMarkLow = lower_bound(
             m_vMarks.begin(), m_vMarks.end(),
             pMark->GetMarkStart(),
-            boost::bind(&IMark::StartsBefore, _1, _2));
+            sw::mark::CompareIMarkStartsBefore());
         // finds the first Mark that pMark is starting before
         // (pMark < pMarkHigh)
         //iterator_t pMarkHigh = upper_bound(
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 3d64484..5bfac66 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -56,7 +56,6 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <set>
 #include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
 #include <algorithm>
 #include <stack>
 
@@ -124,7 +123,6 @@ namespace
     };
     typedef std::multiset < SwXBookmarkPortion_ImplSharedPtr, BookmarkCompareStruct > SwXBookmarkPortion_ImplList;
 
-
     static void lcl_FillBookmarkArray(SwDoc& rDoc, SwUnoCrsr& rUnoCrsr, SwXBookmarkPortion_ImplList& rBkmArr)
     {
         IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess();
@@ -138,7 +136,7 @@ namespace
             pMarkAccess->getBookmarksBegin(),
             pMarkAccess->getBookmarksEnd(),
             aEndOfPara,
-            boost::bind(&::sw::mark::IMark::StartsAfter, _2, _1)); // finds the first that starts after
+            sw::mark::CompareIMarkStartsAfter()); // finds the first that starts after
 
         // search for all bookmarks that start or end in this paragraph
         const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode;
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 27a96d9..65fe69a 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -31,7 +31,6 @@
 #include <IMark.hxx>
 #include <numrule.hxx>
 #include <swerror.h>
-#include <boost/bind.hpp>
 #include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star;
@@ -173,7 +172,7 @@ sal_Int32 Writer::FindPos_Bkmk(const SwPosition& rPos) const
         pMarkAccess->getMarksBegin(),
         pMarkAccess->getMarksEnd(),
         rPos,
-        ::boost::bind(&::sw::mark::IMark::StartsBefore, _1, _2)); // find the first Mark that does not start before
+        sw::mark::CompareIMarkStartsBefore()); // find the first Mark that does not start before
     if(ppBkmk != pMarkAccess->getMarksEnd())
         return ppBkmk - pMarkAccess->getMarksBegin();
     return -1;
commit 85c5f6c1a78fae00fc13c5d1b7f045dc984589fb
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Apr 12 14:19:26 2013 +0200

    spurious warning C4701: potentially uninitialized local variable
    
    Change-Id: I2e99cbe9db6d5911f0c2ec61229cd47e07e99cdf

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index f432c6e..6b42aaa 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1253,7 +1253,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
     {
         // look for a defined standard
         sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
-        sal_uInt32 nKey;
+        sal_uInt32 nKey(0);
         SvNumberFormatTable::iterator it2 = aFTable.find( CLOffset );
         while ( it2 != aFTable.end() && (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
         {
@@ -3364,7 +3364,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
     {
         // look for a defined standard
         sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
-        sal_uInt32 nKey;
+        sal_uInt32 nKey(0);
         SvNumberFormatTable::iterator it2 = aFTable.lower_bound( CLOffset );
         while ( it2 != aFTable.end() && (nKey = it2->first) >= CLOffset && nKey < nStopKey )
         {


More information about the Libreoffice-commits mailing list