sax/source/tools/CachedOutputStream.hxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit c82deb94f78d303fe82b4d689941028f0cb36184
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Jan 29 17:36:37 2025 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Feb 5 12:02:48 2025 +0100

    avoid uno_type_sequence_construct cost
    
    Change-Id: I5ef2d5d0b88fdffa1e425ffb182586a897858fde
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180916
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sax/source/tools/CachedOutputStream.hxx 
b/sax/source/tools/CachedOutputStream.hxx
index 7d9e514c345c..f62fe2359575 100644
--- a/sax/source/tools/CachedOutputStream.hxx
+++ b/sax/source/tools/CachedOutputStream.hxx
@@ -11,6 +11,7 @@
 #define INCLUDED_SAX_SOURCE_TOOLS_CACHEDOUTPUTSTREAM_HXX
 
 #include <sal/types.h>
+#include <rtl/byteseq.hxx>
 
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
@@ -34,7 +35,7 @@ class CachedOutputStream
 
     /// ForMerge structure is used for sorting elements in Writer
     std::shared_ptr< ForMergeBase > mpForMerge;
-    const css::uno::Sequence<sal_Int8> mpCache;
+    const rtl::ByteSequence maCache;
     /// Output stream, usually writing data into files.
     css::uno::Reference< css::io::XOutputStream > mxOutputStream;
     uno_Sequence *pSeq;
@@ -42,8 +43,8 @@ class CachedOutputStream
     bool mbWriteToOutStream;
 
 public:
-    CachedOutputStream() : mpCache(mnMaximumSize)
-                         , pSeq(mpCache.get())
+    CachedOutputStream() : maCache(mnMaximumSize, rtl::BYTESEQ_NODEFAULT)
+                         , pSeq(maCache.get())
                          , mnCacheWrittenSize(0)
                          , mbWriteToOutStream(true)
     {}
@@ -103,9 +104,9 @@ public:
         // resize the Sequence to written size
         pSeq->nElements = mnCacheWrittenSize;
         if (mbWriteToOutStream)
-            mxOutputStream->writeBytes( mpCache );
+            mxOutputStream->writeBytes( css::uno::toUnoSequence(maCache) );
         else
-            mpForMerge->append( mpCache );
+            mpForMerge->append( css::uno::toUnoSequence(maCache) );
         // and next time write to the beginning
         mnCacheWrittenSize = 0;
     }

Reply via email to