[Libreoffice-commits] core.git: dbaccess/source

Stephan Bergmann sbergman at redhat.com
Mon Aug 28 13:54:42 UTC 2017


 dbaccess/source/core/api/FilteredContainer.cxx |    2 +-
 dbaccess/source/core/api/RowSet.hxx            |    7 ++++++-
 dbaccess/source/core/api/tablecontainer.cxx    |    2 +-
 dbaccess/source/core/api/viewcontainer.cxx     |    2 +-
 dbaccess/source/core/dataaccess/connection.hxx |    4 +++-
 dbaccess/source/core/inc/FilteredContainer.hxx |   17 +++++++++++------
 dbaccess/source/core/inc/tablecontainer.hxx    |    7 ++++++-
 dbaccess/source/core/inc/viewcontainer.hxx     |    7 ++++++-
 8 files changed, 35 insertions(+), 13 deletions(-)

New commits:
commit 32e07ada197fb135ae78ee2b7c0c598a356bfabe
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Aug 28 15:49:36 2017 +0200

    Replace use of oslInterlockedCount with std::atomic, ORowSet::m_nInAppend
    
    Change-Id: I9040034d358e1f32ab052b70185a77da82f29ee4

diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx
index 43038b7274a7..49a36fdf12e3 100644
--- a/dbaccess/source/core/api/FilteredContainer.cxx
+++ b/dbaccess/source/core/api/FilteredContainer.cxx
@@ -240,7 +240,7 @@ sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std::vector<
                                  const Reference< XConnection >& _xCon,
                                  bool _bCase,
                                  IRefreshListener*  _pRefreshListener,
-                                 oslInterlockedCount& _nInAppend)
+                                 std::atomic<std::size_t>& _nInAppend)
         :OCollection(_rParent,_bCase,_rMutex,std::vector< OUString>())
         ,m_bConstructed(false)
         ,m_pRefreshListener(_pRefreshListener)
diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx
index b4dc3e067837..ad3024d661df 100644
--- a/dbaccess/source/core/api/RowSet.hxx
+++ b/dbaccess/source/core/api/RowSet.hxx
@@ -20,6 +20,11 @@
 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
 #define INCLUDED_DBACCESS_SOURCE_CORE_API_ROWSET_HXX
 
+#include <sal/config.h>
+
+#include <atomic>
+#include <cstddef>
+
 #include "apitools.hxx"
 #include "RowSetBase.hxx"
 
@@ -124,7 +129,7 @@ namespace dbaccess
         sal_Int32                   m_nTransactionIsolation;
         sal_Int32                   m_nPrivileges;
         sal_Int32                   m_nLastKnownRowCount;
-        oslInterlockedCount         m_nInAppend;
+        std::atomic<std::size_t>    m_nInAppend;
         bool                        m_bInsertingRow;
         bool                        m_bLastKnownRowCountFinal;
         bool                        m_bUseEscapeProcessing ;
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index cd03ff639e2a..c900a5e4ec0e 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -101,7 +101,7 @@ OTableContainer::OTableContainer(::cppu::OWeakObject& _rParent,
                                  bool _bCase,
                                  const Reference< XNameContainer >& _xTableDefinitions,
                                  IRefreshListener*  _pRefreshListener,
-                                 oslInterlockedCount& _nInAppend)
+                                 std::atomic<std::size_t>& _nInAppend)
     :OFilteredContainer(_rParent,_rMutex,_xCon,_bCase,_pRefreshListener,_nInAppend)
     ,m_xTableDefinitions(_xTableDefinitions)
     ,m_pTableMediator( nullptr )
diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx
index 111089ebac9a..ca2e9aac69cc 100644
--- a/dbaccess/source/core/api/viewcontainer.cxx
+++ b/dbaccess/source/core/api/viewcontainer.cxx
@@ -62,7 +62,7 @@ OViewContainer::OViewContainer(::cppu::OWeakObject& _rParent
                                  ,const Reference< XConnection >& _xCon
                                  ,bool _bCase
                                  ,IRefreshListener* _pRefreshListener
-                                 ,oslInterlockedCount& _nInAppend)
+                                 ,std::atomic<std::size_t>& _nInAppend)
     :OFilteredContainer(_rParent,_rMutex,_xCon,_bCase,_pRefreshListener,_nInAppend)
     ,m_bInElementRemoved(false)
 {
diff --git a/dbaccess/source/core/dataaccess/connection.hxx b/dbaccess/source/core/dataaccess/connection.hxx
index a1c3eb0acfac..449fb54d7252 100644
--- a/dbaccess/source/core/dataaccess/connection.hxx
+++ b/dbaccess/source/core/dataaccess/connection.hxx
@@ -21,6 +21,8 @@
 
 #include <sal/config.h>
 
+#include <atomic>
+#include <cstddef>
 #include <map>
 
 #include "apitools.hxx"
@@ -98,7 +100,7 @@ protected:
     OTableContainer*                m_pTables;
     OViewContainer*                 m_pViews;
     ::dbtools::WarningsContainer    m_aWarnings;
-    oslInterlockedCount             m_nInAppend;
+    std::atomic<std::size_t>        m_nInAppend;
     bool                            m_bSupportsViews;       // true when the getTableTypes return "VIEW" as type
     bool                            m_bSupportsUsers;
     bool                            m_bSupportsGroups;
diff --git a/dbaccess/source/core/inc/FilteredContainer.hxx b/dbaccess/source/core/inc/FilteredContainer.hxx
index 03b30c341f2c..dd90a81a12f4 100644
--- a/dbaccess/source/core/inc/FilteredContainer.hxx
+++ b/dbaccess/source/core/inc/FilteredContainer.hxx
@@ -19,6 +19,11 @@
 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_FILTEREDCONTAINER_HXX
 
+#include <sal/config.h>
+
+#include <atomic>
+#include <cstddef>
+
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/sdbc/XConnection.hpp>
 
@@ -40,7 +45,7 @@ namespace dbaccess
 
     protected:
         IRefreshListener*               m_pRefreshListener;
-        oslInterlockedCount&            m_nInAppend;
+        std::atomic<std::size_t>&       m_nInAppend;
 
         // holds the original container which where set in construct but they can be null
         css::uno::Reference< css::container::XNameAccess >    m_xMasterContainer;
@@ -68,19 +73,19 @@ namespace dbaccess
         class EnsureReset
         {
         public:
-            EnsureReset( oslInterlockedCount& _rValueLocation)
+            EnsureReset( std::atomic<std::size_t>& _rValueLocation)
                 :m_rValue( _rValueLocation )
             {
-                osl_atomic_increment(&m_rValue);
+                ++m_rValue;
             }
 
             ~EnsureReset()
             {
-                osl_atomic_decrement(&m_rValue);
+                --m_rValue;
             }
 
         private:
-            oslInterlockedCount&   m_rValue;
+            std::atomic<std::size_t>&   m_rValue;
         };
 
         /** retrieve a table type filter to pass to <member scope="css::sdbc">XDatabaseMetaData::getTables</member>,
@@ -103,7 +108,7 @@ namespace dbaccess
                             const css::uno::Reference< css::sdbc::XConnection >& _xCon,
                             bool _bCase,
                             IRefreshListener*   _pRefreshListener,
-                            oslInterlockedCount& _nInAppend
+                            std::atomic<std::size_t>& _nInAppend
                         );
 
         void dispose() { disposing(); }
diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx
index 9d9df2b0866d..77a39eabc609 100644
--- a/dbaccess/source/core/inc/tablecontainer.hxx
+++ b/dbaccess/source/core/inc/tablecontainer.hxx
@@ -20,6 +20,11 @@
 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_TABLECONTAINER_HXX
 
+#include <sal/config.h>
+
+#include <atomic>
+#include <cstddef>
+
 #include <cppuhelper/implbase1.hxx>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
@@ -89,7 +94,7 @@ namespace dbaccess
             bool _bCase,
             const css::uno::Reference< css::container::XNameContainer >&  _xTableDefinitions,
             IRefreshListener*   _pRefreshListener,
-            oslInterlockedCount& _nInAppend
+            std::atomic<std::size_t>& _nInAppend
             );
 
         virtual ~OTableContainer() override;
diff --git a/dbaccess/source/core/inc/viewcontainer.hxx b/dbaccess/source/core/inc/viewcontainer.hxx
index cc95885ceaab..7d1d27108f74 100644
--- a/dbaccess/source/core/inc/viewcontainer.hxx
+++ b/dbaccess/source/core/inc/viewcontainer.hxx
@@ -20,6 +20,11 @@
 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
 #define INCLUDED_DBACCESS_SOURCE_CORE_INC_VIEWCONTAINER_HXX
 
+#include <sal/config.h>
+
+#include <atomic>
+#include <cstddef>
+
 #include <cppuhelper/implbase1.hxx>
 
 #include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -62,7 +67,7 @@ namespace dbaccess
                         const css::uno::Reference< css::sdbc::XConnection >& _xCon,
                         bool _bCase,
                         IRefreshListener*   _pRefreshListener,
-                        oslInterlockedCount& _nInAppend
+                        std::atomic<std::size_t>& _nInAppend
                         );
 
         virtual ~OViewContainer() override;


More information about the Libreoffice-commits mailing list