[Libreoffice-commits] core.git: 8 commits - dbaccess/source include/rtl include/salhelper sal/osl sc/inc sc/source svtools/source sw/source

Noel Grandin noel at peralex.com
Mon Jul 14 02:09:04 PDT 2014


 dbaccess/source/core/dataaccess/ModelImpl.cxx |    8 +++-----
 dbaccess/source/core/dataaccess/ModelImpl.hxx |   11 +++--------
 include/rtl/ref.hxx                           |   23 +----------------------
 include/salhelper/refobj.hxx                  |   17 ++++++-----------
 sal/osl/unx/mutex.c                           |    7 ++++++-
 sc/inc/undosort.hxx                           |    6 +++---
 sc/source/core/data/table3.cxx                |    1 -
 svtools/source/control/roadmap.cxx            |    5 ++++-
 svtools/source/uno/unoiface.cxx               |    2 +-
 sw/source/core/doc/docbm.cxx                  |    2 +-
 10 files changed, 28 insertions(+), 54 deletions(-)

New commits:
commit 33fd0d8ae6a6b4e5226991e39fe755d84cb78280
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 14 10:14:52 2014 +0200

    loplugin:unreffun
    
    Change-Id: Ia1b49091c91e257e4c9e1ef328c412ea3f1a451d

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index f500582..032daa8 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1798,7 +1798,7 @@ namespace
         long int m_nIdx;
         bool m_bOther;
         sal_Int32 m_nCntnt;
-#if OSL_DEBUG_LEVEL > 0
+#if 0
         void Dump()
         {
             SAL_INFO("sw.core", "Index: " << m_nIdx << "\tOther: " << m_bOther << "\tContent: " << m_nCntnt);
commit 0b34104ca19cf37cb18409bfddf868866e358b14
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 14 09:55:20 2014 +0200

    loplugin:saloverride
    
    Change-Id: Ia9a02ea6dfa3e59ff5e8bc7da229793e97f3567e

diff --git a/sc/inc/undosort.hxx b/sc/inc/undosort.hxx
index 388fcfa..283b99f 100644
--- a/sc/inc/undosort.hxx
+++ b/sc/inc/undosort.hxx
@@ -22,9 +22,9 @@ class UndoSort : public ScSimpleUndo
 public:
     UndoSort( ScDocShell* pDocSh, const ReorderParam& rParam );
 
-    virtual OUString GetComment() const;
-    virtual void Undo();
-    virtual void Redo();
+    virtual OUString GetComment() const SAL_OVERRIDE;
+    virtual void Undo() SAL_OVERRIDE;
+    virtual void Redo() SAL_OVERRIDE;
 
 private:
     void Execute( bool bUndo );
commit ea73e43ac5696bea5b37ed010101168fd2cb60c1
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 14 09:47:47 2014 +0200

    loplugin:unreffun
    
    Change-Id: Iaee48db2736a7fd2855e3a0ad7a39ea7d21a2d3d

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 64f0ef5..6306f6a 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -388,7 +388,6 @@ public:
 
     SCCOLROW    GetStart() const { return nStart; }
     SCCOLROW GetLast() const { return mnLastIndex; }
-    SCSIZE      GetCount() const { return nCount; }
 
     const std::vector<SCCOLROW>& GetOrderIndices() const { return maOrderIndices; }
 
commit c14a3c1de2a093a8cfcb454a5d32c9810820cbd1
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jul 14 09:03:06 2014 +0200

    workaround hack that trips up externandnotdefined clang plugin
    
    Change-Id: I2f458cbd582c3e7cfe433915483c0b0489467471

diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index a8eb99d..1ee4418 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -25,7 +25,12 @@
 #include <pthread.h>
 #include <stdlib.h>
 
-#if defined LINUX /* bad hack */
+/* Bad hack. This function has two problems - on older systems it has a different name,
+   and on some older systems it is not defined in the header file.
+   Unfortunately there is no completely foolproof test, so we're just working around
+   the issue here. The __clang__ test prevents this hack from triggering the check
+   in the externandnotdefined clang plugin. */
+#if defined LINUX && ! defined __clang__
 int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
 #define pthread_mutexattr_settype pthread_mutexattr_setkind_np
 #define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
commit 24f28634fa60ed5860edd1728567b7c3e7fa9573
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 11 16:33:39 2014 +0200

    Todo -> TODO
    
    Change-Id: I13e2351c182065be1a849b944e892f0072ce358a

diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index bcd9083..2c3ea4d 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -1470,7 +1470,7 @@ void SVTXRoadmap::propertyChange( const ::com::sun::star::beans::PropertyChangeE
             pField->ChangeRoadmapItemID( (RoadmapTypes::ItemId)nID, (RoadmapTypes::ItemId)nNewID );
         }
     //    else
-            // Todo: handle Interactive appropriately
+            // TODO handle Interactive appropriately
     }
 }
 
commit b43fdc54e534b9fae1d0e4deb45a4357120f8af4
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 11 16:33:02 2014 +0200

    cid#1194925 Resource leak
    
    add an assert so that coverity knows the leak can't happen
    
    Change-Id: I0109309ccc53b1b22420cbf9ac497d8d677a4ea7

diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index 11f6596..01960b8 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -365,8 +365,11 @@ namespace svt
 
     void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const OUString& _RoadmapItem, ItemId _nUniqueId, bool _bEnabled )
     {
+        // make coverity happy, because then it knows the return value from InsertHyperLabel won't leak
+        assert( _nUniqueId != RMINCOMPLETE );
+
         InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled );
-            // Todo: YPos is superfluous, if items are always appended
+        // TODO YPos is superfluous, if items are always appended
         UpdatefollowingHyperLabels( _Index + 1 );
     }
 
commit 0c6c66b64a9572a8e474f6dfdedcbebfe54758af
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 11 16:32:28 2014 +0200

    remove IReference
    
    now that it is unused
    
    Change-Id: I95d9f4cc50114dd9f9c9f5d095372766f44b3094

diff --git a/include/rtl/ref.hxx b/include/rtl/ref.hxx
index 3e90ed2..77de66a 100644
--- a/include/rtl/ref.hxx
+++ b/include/rtl/ref.hxx
@@ -30,28 +30,7 @@
 namespace rtl
 {
 
-/** Interface for a reference type.
-*/
-class IReference
-{
-public:
-    /** @see osl_incrementInterlockedCount.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() = 0;
-
-    /** @see osl_decrementInterlockedCount.
-     */
-    virtual oslInterlockedCount SAL_CALL release() = 0;
-
-#if !defined _MSC_VER // public -> protected changes mangled names there
-protected:
-#endif
-    ~IReference() {}
-        // avoid warnings about virtual members and non-virtual dtor
-};
-
-
-/** Template reference class for reference type derived from IReference.
+/** Template reference class for reference type.
 */
 template <class reference_type>
 class Reference
diff --git a/include/salhelper/refobj.hxx b/include/salhelper/refobj.hxx
index 6278e2f..f84c312 100644
--- a/include/salhelper/refobj.hxx
+++ b/include/salhelper/refobj.hxx
@@ -31,7 +31,7 @@ namespace salhelper
 
 
 
-class ReferenceObject : public rtl::IReference
+class ReferenceObject
 {
     /** Representation.
      */
@@ -63,27 +63,22 @@ public:
 public:
     /** Construction.
      */
-    inline ReferenceObject() : m_nReferenceCount (0)
+    inline ReferenceObject() : m_nReferenceCount(0)
     {}
 
 
-    /** IReference.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE
+    void SAL_CALL acquire()
     {
-        return osl_atomic_increment (&m_nReferenceCount);
+        osl_atomic_increment(&m_nReferenceCount);
     }
 
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE
+    void SAL_CALL release()
     {
-        oslInterlockedCount result;
-        result = ::osl_atomic_decrement (&m_nReferenceCount);
-        if (result == 0)
+        if (osl_atomic_decrement(&m_nReferenceCount) == 0)
         {
             // Last reference released.
             delete this;
         }
-        return (result);
     }
 
 protected:
commit 96afb3cf40d913dfcfc6f51240efd33f9d0740a6
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jul 11 16:01:03 2014 +0200

    ODatabaseModelImpl doesn't need to be using rtl::IReference
    
    Change-Id: Ia08d57b33af93ceb5c60c48602c403f893bbccc2

diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index 05e6e30..1a3fa23 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -981,12 +981,12 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b
     return xModel;
 }
 
-oslInterlockedCount SAL_CALL ODatabaseModelImpl::acquire()
+void SAL_CALL ODatabaseModelImpl::acquire()
 {
-    return osl_atomic_increment(&m_refCount);
+    osl_atomic_increment(&m_refCount);
 }
 
-oslInterlockedCount SAL_CALL ODatabaseModelImpl::release()
+void SAL_CALL ODatabaseModelImpl::release()
 {
     if ( osl_atomic_decrement(&m_refCount) == 0 )
     {
@@ -996,9 +996,7 @@ oslInterlockedCount SAL_CALL ODatabaseModelImpl::release()
         m_pDBContext->storeTransientProperties(*this);
         revokeDataSource();
         delete this;
-        return 0;
     }
-    return m_refCount;
 }
 
 void ODatabaseModelImpl::commitStorages()
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index bfe6b23..1c7d0d8 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -144,8 +144,7 @@ typedef ::utl::SharedUNOComponent< ::com::sun::star::embed::XStorage >  SharedSt
 class ODatabaseContext;
 class DocumentStorageAccess;
 class OSharedConnectionManager;
-class ODatabaseModelImpl    :public ::rtl::IReference
-                            ,public ::sfx2::IMacroDocumentAccess
+class ODatabaseModelImpl    :public ::sfx2::IMacroDocumentAccess
                             ,public ::sfx2::IModifiableDocument
 {
 public:
@@ -374,13 +373,9 @@ public:
 
     inline const ::comphelper::SharedMutex& getSharedMutex() const { return m_aMutex; }
 
-    /** @see osl_incrementInterlockedCount.
-     */
-    virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
+    void SAL_CALL acquire();
 
-    /** @see osl_decrementInterlockedCount.
-     */
-    virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
+    void SAL_CALL release();
 
     /// returns a all known data source settings, including their default values
     static const AsciiPropertyValue* getDefaultDataSourceSettings();


More information about the Libreoffice-commits mailing list