forms/source/component/DatabaseForm.cxx |    6 +++---
 include/tools/inetmsg.hxx               |    6 +++---
 tools/source/inet/inetstrm.cxx          |    5 +----
 3 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 7de4661827c5bed7beaf2c286242e48cfe4154e8
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Dec 30 09:49:57 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Dec 30 13:45:53 2023 +0100

    no need to use SvLockBytes in forms
    
    Change-Id: Ide586997d504e0fbdb72aa1db77c49ba3d6007c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161437
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/forms/source/component/DatabaseForm.cxx 
b/forms/source/component/DatabaseForm.cxx
index 0d6aafaaa5cf..4bad0608b5bc 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -938,11 +938,11 @@ void ODatabaseForm::InsertTextPart( INetMIMEMessage& 
rParent, std::u16string_vie
     pChild->SetContentTransferEncoding("8bit");
 
     // Body
-    SvMemoryStream* pStream = new SvMemoryStream;
+    std::unique_ptr<SvMemoryStream> pStream(new SvMemoryStream);
     pStream->WriteLine( OUStringToOString(rData, 
rtl_getTextEncodingFromMimeCharset(pBestMatchingEncoding)) );
     pStream->FlushBuffer();
     pStream->Seek( 0 );
-    pChild->SetDocumentLB( new SvLockBytes(pStream, true) );
+    pChild->SetDocumentLB( std::move(pStream) );
     rParent.AttachChild( std::move(pChild) );
 }
 
@@ -1001,7 +1001,7 @@ void ODatabaseForm::InsertFilePart( INetMIMEMessage& 
rParent, std::u16string_vie
 
 
     // Body
-    pChild->SetDocumentLB( new SvLockBytes(pStream.release(), true) );
+    pChild->SetDocumentLB( std::move(pStream) );
     rParent.AttachChild( std::move(pChild) );
 }
 
diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx
index 8617b0b91bf1..8171da95d1af 100644
--- a/include/tools/inetmsg.hxx
+++ b/include/tools/inetmsg.hxx
@@ -77,7 +77,7 @@ class SAL_WARN_UNUSED UNLESS_MERGELIBS(TOOLS_DLLPUBLIC) 
INetMIMEMessage
     ::std::vector< std::unique_ptr<INetMessageHeader> >
                     m_aHeaderList;
 
-    SvLockBytesRef  m_xDocLB;
+    std::unique_ptr<SvStream> m_xDocLB;
 
     ::std::map<InetMessageMime, sal_uInt32>   m_nMIMEIndex;
     INetMIMEMessage*                          pParent;
@@ -139,8 +139,8 @@ public:
         }
     }
 
-    SvLockBytes* GetDocumentLB() const { return m_xDocLB.get(); }
-    void         SetDocumentLB (SvLockBytes *pDocLB) { m_xDocLB = pDocLB; }
+    SvStream* GetDocumentLB() const { return m_xDocLB.get(); }
+    void      SetDocumentLB (std::unique_ptr<SvStream> pDocLB) { m_xDocLB = 
std::move(pDocLB); }
 
     static bool ParseDateField (
         std::u16string_view rDateField, DateTime& rDateTime);
diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx
index ac33f5eda4a3..f4a841da9331 100644
--- a/tools/source/inet/inetstrm.cxx
+++ b/tools/source/inet/inetstrm.cxx
@@ -75,10 +75,7 @@ int INetMIMEMessageStream::GetBodyLine(char* pData, 
sal_uInt32 nSize)
 
     if (pSourceMsg->GetDocumentLB())
     {
-        if (pMsgStrm == nullptr)
-            pMsgStrm.reset(new SvStream (pSourceMsg->GetDocumentLB()));
-
-        sal_uInt32 nRead = pMsgStrm->ReadBytes(pWBuf, (pWEnd - pWBuf));
+        sal_uInt32 nRead = pSourceMsg->GetDocumentLB()->ReadBytes(pWBuf, 
(pWEnd - pWBuf));
         pWBuf += nRead;
     }
 

Reply via email to