[Libreoffice-commits] core.git: include/tools svtools/qa sw/qa sw/source tools/source writerperfect/qa writerperfect/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 4 13:03:36 UTC 2018


 include/tools/stream.hxx                                   |    4 ++--
 svtools/qa/unit/testHtmlWriter.cxx                         |    2 +-
 sw/qa/extras/uiwriter/uiwriter.cxx                         |    2 +-
 sw/source/core/edit/edglss.cxx                             |    2 +-
 tools/source/stream/stream.cxx                             |    5 -----
 writerperfect/qa/unit/EPUBExportTest.cxx                   |    5 ++---
 writerperfect/source/writer/exp/XMLBase64ImportContext.cxx |    2 +-
 writerperfect/source/writer/exp/xmlimp.cxx                 |    6 +++---
 8 files changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 1a049bc17c5f5ca524289efb73981292c32c58a1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Oct 4 09:15:18 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Oct 4 15:03:06 2018 +0200

    drop SvMemoryStream::GetBuffer
    
    since it does the same thing as GetData()
    
    Change-Id: I18d35aa4e67ad7775987160c021863d0de90179b
    Reviewed-on: https://gerrit.libreoffice.org/61350
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 86a29f8093ff..3793094155d6 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -666,11 +666,11 @@ public:
 
     virtual void    ResetError() override;
 
-    const void*    GetBuffer();
-    sal_uInt64     GetSize();
+    sal_uInt64      GetSize();
     std::size_t     GetEndOfData() const { return nEndOfData; }
     const void*     GetData() { Flush(); return pBuf; }
 
+    // return the buffer currently in use, and allocate a new buffer internally
     void*           SwitchBuffer();
     // the buffer is not owned by this class
     void            SetBuffer( void* pBuf, std::size_t nSize, std::size_t nEOF );
diff --git a/svtools/qa/unit/testHtmlWriter.cxx b/svtools/qa/unit/testHtmlWriter.cxx
index 2edf9665b607..e1ef5650c8dc 100644
--- a/svtools/qa/unit/testHtmlWriter.cxx
+++ b/svtools/qa/unit/testHtmlWriter.cxx
@@ -25,7 +25,7 @@ OString extractFromStream(SvMemoryStream& rStream)
     rStream.WriteChar('\0');
     rStream.Flush();
     rStream.Seek(STREAM_SEEK_TO_BEGIN);
-    return OString(static_cast<const sal_Char*>(rStream.GetBuffer()));
+    return OString(static_cast<const sal_Char*>(rStream.GetData()));
 }
 
 }
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 12c3e08cb150..48a0477cd67b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -967,7 +967,7 @@ void SwUiWriterTest::testExportRTF()
     SwWriter aWrt(aStream, *xClpDoc);
     aWrt.Write(xWrt);
 
-    OString aData(static_cast<const sal_Char*>(aStream.GetBuffer()), aStream.GetSize());
+    OString aData(static_cast<const sal_Char*>(aStream.GetData()), aStream.GetSize());
 
     //Amusingly eventually there was a commit id with "ccc" in it, and so the rtf contained
     //{\*\generator LibreOfficeDev/4.4.0.0.alpha0$Linux_X86_64 LibreOffice_project/f70664ccc6837f2cc21a29bb4f44e41e100efe6b}
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 2949a095f592..3ece061f823c 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -311,7 +311,7 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, ParaBreakType nHndlParaBrk )
             {
                 aStream.WriteUInt16( '\0' );
 
-                const sal_Unicode *p = static_cast<sal_Unicode const *>(aStream.GetBuffer());
+                const sal_Unicode *p = static_cast<sal_Unicode const *>(aStream.GetData());
                 if (p)
                     rBuf = OUString(p);
                 else
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 5526f8a509df..a99754d972bf 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1653,11 +1653,6 @@ SvMemoryStream::~SvMemoryStream()
     }
 }
 
-const void* SvMemoryStream::GetBuffer()
-{
-    return GetData();
-}
-
 sal_uInt64 SvMemoryStream::GetSize()
 {
     Flush();
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index 90e97ba77799..ecca84410866 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -286,8 +286,7 @@ void EPUBExportTest::testMimetype()
     OString aExpected("application/epub+zip");
     CPPUNIT_ASSERT(aMemoryStream.GetSize() > static_cast<sal_uInt64>(38 + aExpected.getLength()));
 
-    OString aActual(static_cast<const char*>(aMemoryStream.GetBuffer()) + 38,
-                    aExpected.getLength());
+    OString aActual(static_cast<const char*>(aMemoryStream.GetData()) + 38, aExpected.getLength());
     // This failed: actual data was some garbage, not the uncompressed mime type.
     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
 
@@ -907,7 +906,7 @@ void EPUBExportTest::testSVG()
 
     // This failed, there was a '<!DOCTYPE' line between the xml and the svg
     // one, causing a validation error.
-    OString aActual(static_cast<const char*>(aMemoryStream.GetBuffer()), aExpected.getLength());
+    OString aActual(static_cast<const char*>(aMemoryStream.GetData()), aExpected.getLength());
     CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
 
     // This failed, we used the xlink attribute namespace, but we did not
diff --git a/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx b/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx
index e7161e5295cf..0835bc20e0ad 100644
--- a/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx
+++ b/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx
@@ -30,7 +30,7 @@ void XMLBase64ImportContext::startElement(
 
 void XMLBase64ImportContext::endElement(const OUString& /*rName*/)
 {
-    m_aBinaryData.append(static_cast<const unsigned char*>(m_aStream.GetBuffer()),
+    m_aBinaryData.append(static_cast<const unsigned char*>(m_aStream.GetData()),
                          m_aStream.GetSize());
 }
 
diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx
index 6e647ccdadf8..f3a12c761f44 100644
--- a/writerperfect/source/writer/exp/xmlimp.cxx
+++ b/writerperfect/source/writer/exp/xmlimp.cxx
@@ -335,7 +335,7 @@ void XMLOfficeDocContext::HandleFixedLayoutPage(const FixedLayoutPage& rPage, bo
     librevenge::RVNGPropertyList aImageProperties;
     aImageProperties.insert("librevenge:mime-type", "image/svg+xml");
     librevenge::RVNGBinaryData aBinaryData;
-    aBinaryData.append(static_cast<const unsigned char*>(aMemoryStream.GetBuffer()),
+    aBinaryData.append(static_cast<const unsigned char*>(aMemoryStream.GetData()),
                        aMemoryStream.GetSize());
     aImageProperties.insert("office:binary-data", aBinaryData);
     mrImport.GetGenerator().insertBinaryObject(aImageProperties);
@@ -372,7 +372,7 @@ XMLImport::XMLImport(const uno::Reference<uno::XComponentContext>& xContext,
         SvFileStream aStream(aCoverImage, StreamMode::READ);
         SvMemoryStream aMemoryStream;
         aMemoryStream.WriteStream(aStream);
-        aBinaryData.append(static_cast<const unsigned char*>(aMemoryStream.GetBuffer()),
+        aBinaryData.append(static_cast<const unsigned char*>(aMemoryStream.GetData()),
                            aMemoryStream.GetSize());
         librevenge::RVNGPropertyList aCoverImageProperties;
         aCoverImageProperties.insert("office:binary-data", aBinaryData);
@@ -433,7 +433,7 @@ PopupState XMLImport::FillPopupData(const OUString& rURL, librevenge::RVNGProper
     librevenge::RVNGBinaryData aBinaryData;
     SvMemoryStream aMemoryStream;
     aMemoryStream.WriteStream(aStream);
-    aBinaryData.append(static_cast<const unsigned char*>(aMemoryStream.GetBuffer()),
+    aBinaryData.append(static_cast<const unsigned char*>(aMemoryStream.GetData()),
                        aMemoryStream.GetSize());
     rPropList.insert("office:binary-data", aBinaryData);
 


More information about the Libreoffice-commits mailing list