[Libreoffice-commits] core.git: comphelper/source include/comphelper

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 30 09:33:51 UTC 2021


 comphelper/source/streaming/seqstream.cxx |    8 +++-----
 include/comphelper/seqstream.hxx          |    5 ++---
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit bb2470ffb749ed95e77cc112ee08a46c8b99be36
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 30 09:48:57 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 30 11:33:17 2021 +0200

    osl::Mutex->std::mutx in OSequenceOutputStream
    
    Change-Id: I1924cc0910c5dfb431b676a0f50f922779920594
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119697
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/comphelper/source/streaming/seqstream.cxx b/comphelper/source/streaming/seqstream.cxx
index b33c63f0931b..9ad5db7254b8 100644
--- a/comphelper/source/streaming/seqstream.cxx
+++ b/comphelper/source/streaming/seqstream.cxx
@@ -153,7 +153,7 @@ OSequenceOutputStream::OSequenceOutputStream(Sequence< sal_Int8 >& _rSeq, double
 
 void SAL_CALL OSequenceOutputStream::writeBytes( const Sequence< sal_Int8 >& _rData )
 {
-    MutexGuard aGuard(m_aMutex);
+    std::lock_guard aGuard(m_aMutex);
     if (!m_bConnected)
         throw NotConnectedException();
 
@@ -193,7 +193,7 @@ void SAL_CALL OSequenceOutputStream::writeBytes( const Sequence< sal_Int8 >& _rD
 
 void SAL_CALL OSequenceOutputStream::flush(  )
 {
-    MutexGuard aGuard(m_aMutex);
+    std::lock_guard aGuard(m_aMutex);
     if (!m_bConnected)
         throw NotConnectedException();
 
@@ -203,8 +203,6 @@ void SAL_CALL OSequenceOutputStream::flush(  )
 
 void OSequenceOutputStream::finalizeOutput()
 {
-    MutexGuard aGuard(m_aMutex);
-
     // cut the sequence to the real size
     m_rSequence.realloc(m_nSize);
     // and don't allow any further accesses
@@ -213,7 +211,7 @@ void OSequenceOutputStream::finalizeOutput()
 
 void SAL_CALL OSequenceOutputStream::closeOutput()
 {
-    MutexGuard aGuard(m_aMutex);
+    std::lock_guard aGuard(m_aMutex);
     if (!m_bConnected)
         throw NotConnectedException();
 
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
index 88db729832c5..6cf22fdb6ebb 100644
--- a/include/comphelper/seqstream.hxx
+++ b/include/comphelper/seqstream.hxx
@@ -24,7 +24,6 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
-#include <osl/mutex.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <comphelper/comphelperdllapi.h>
 #include <mutex>
@@ -74,7 +73,6 @@ class SAL_DLLPUBLIC_TEMPLATE OSequenceOutputStream_Base
 class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OSequenceOutputStream final : public OSequenceOutputStream_Base
 {
 private:
-    void finalizeOutput();
     css::uno::Sequence< sal_Int8 >&                 m_rSequence;
     double                                          m_nResizeFactor;
     sal_Int32 const                                 m_nMinimumResize;
@@ -85,8 +83,9 @@ private:
     bool                                            m_bConnected;
         // closeOutput has been called ?
 
-    ::osl::Mutex                                    m_aMutex;
+    std::mutex                                      m_aMutex;
 
+    void finalizeOutput();
     virtual ~OSequenceOutputStream() override { if (m_bConnected) finalizeOutput(); }
 
 public:


More information about the Libreoffice-commits mailing list