package/inc/ByteGrabber.hxx           |    2 --
 package/source/zipapi/ByteGrabber.cxx |   11 -----------
 2 files changed, 13 deletions(-)

New commits:
commit 4f5d694e5840b0b9bda15dc120e8b07d18d4cbd0
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Aug 15 19:33:55 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Aug 16 14:01:07 2024 +0200

    tdf#158556 ByteGrabber does not need a mutex
    
    it is only used from one place, and that place already locks a mutex
    around all usage
    
    Change-Id: I85a8d89220bee7806db5457d69cfcf2f11c1734d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171947
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/package/inc/ByteGrabber.hxx b/package/inc/ByteGrabber.hxx
index 4a93398a7704..075ff56d142d 100644
--- a/package/inc/ByteGrabber.hxx
+++ b/package/inc/ByteGrabber.hxx
@@ -29,8 +29,6 @@ namespace com::sun::star {
 }
 class ByteGrabber final
 {
-    std::mutex m_aMutex;
-
     css::uno::Reference < css::io::XInputStream > xStream;
     css::uno::Reference < css::io::XSeekable > xSeek;
     css::uno::Sequence < sal_Int8 > aSequence;
diff --git a/package/source/zipapi/ByteGrabber.cxx 
b/package/source/zipapi/ByteGrabber.cxx
index 0e701a60007f..50083b4dafc2 100644
--- a/package/source/zipapi/ByteGrabber.cxx
+++ b/package/source/zipapi/ByteGrabber.cxx
@@ -50,7 +50,6 @@ ByteGrabber::~ByteGrabber()
 
 void ByteGrabber::setInputStream (const uno::Reference < io::XInputStream >& 
xNewStream)
 {
-    std::scoped_lock aGuard( m_aMutex );
     xStream = xNewStream;
     xSeek.set(xNewStream, uno::UNO_QUERY);
 }
@@ -59,14 +58,12 @@ void ByteGrabber::setInputStream (const uno::Reference < 
io::XInputStream >& xNe
 sal_Int32 ByteGrabber::readBytes( uno::Sequence< sal_Int8 >& aData,
                                         sal_Int32 nBytesToRead )
 {
-    std::scoped_lock aGuard( m_aMutex );
     return xStream->readBytes(aData, nBytesToRead );
 }
 
 // XSeekable chained...
 void ByteGrabber::seek( sal_Int64 location )
 {
-    std::scoped_lock aGuard( m_aMutex );
     if (!xSeek.is() )
         throw io::IOException(THROW_WHERE );
 
@@ -75,7 +72,6 @@ void ByteGrabber::seek( sal_Int64 location )
 
 sal_Int64 ByteGrabber::getPosition(  )
 {
-    std::scoped_lock aGuard( m_aMutex );
     if (!xSeek.is() )
         throw io::IOException(THROW_WHERE );
 
@@ -84,7 +80,6 @@ sal_Int64 ByteGrabber::getPosition(  )
 
 sal_Int64 ByteGrabber::getLength(  )
 {
-    std::scoped_lock aGuard( m_aMutex );
     if (!xSeek.is() )
         throw io::IOException(THROW_WHERE );
 
@@ -93,8 +88,6 @@ sal_Int64 ByteGrabber::getLength(  )
 
 sal_uInt16 ByteGrabber::ReadUInt16()
 {
-    std::scoped_lock aGuard( m_aMutex );
-
     if (xStream->readBytes(aSequence, 2) != 2)
         return 0;
 
@@ -106,8 +99,6 @@ sal_uInt16 ByteGrabber::ReadUInt16()
 
 sal_uInt32 ByteGrabber::ReadUInt32()
 {
-    std::scoped_lock aGuard( m_aMutex );
-
     if (xStream->readBytes(aSequence, 4) != 4)
         return 0;
 
@@ -121,8 +112,6 @@ sal_uInt32 ByteGrabber::ReadUInt32()
 
 sal_uInt64 ByteGrabber::ReadUInt64()
 {
-    std::scoped_lock aGuard(m_aMutex);
-
     if (xStream->readBytes(aSequence, 8) != 8)
         return 0;
 

Reply via email to