[Libreoffice-commits] core.git: sw/qa

Jan Holesovsky kendy at collabora.com
Wed Apr 9 01:54:26 PDT 2014


 sw/qa/extras/htmlexport/htmlexport.cxx |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 4c8d29f4f26bfa30689b2b98414fe874225b9a2e
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Apr 9 09:39:06 2014 +0200

    html export: Simplify & speed-up the test.
    
    Change-Id: I619e4441898fe10e319d9f95413f078003364579

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 18b2862..4e42cb4 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -13,12 +13,16 @@
 
 #include <com/sun/star/awt/Gradient.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
+#include <rtl/byteseq.hxx>
+
 #include <swmodule.hxx>
 #include <usrpref.hxx>
 
 #include <libxml/HTMLparser.h>
 #include <libxml/HTMLtree.h>
 
+using namespace rtl;
+
 class Test : public SwModelTestBase
 {
 private:
@@ -34,19 +38,13 @@ protected:
     htmlDocPtr parseHtml()
     {
         SvFileStream aFileStream(m_aTempFile.GetURL(), STREAM_READ);
-        aFileStream.Seek(STREAM_SEEK_TO_END);
-        sal_Size nSize = aFileStream.Tell();
-        aFileStream.Seek(STREAM_SEEK_TO_BEGIN);
-        OStringBuffer aDocument(nSize);
+        sal_Size nSize = aFileStream.remainingSize();
 
-        char cCharacter;
-        for (sal_Size i = 0; i<nSize; ++i)
-        {
-            aFileStream.ReadChar(cCharacter);
-            aDocument.append(cCharacter);
-        }
+        ByteSequence aBuffer(nSize + 1);
+        aFileStream.Read(aBuffer.getArray(), nSize);
 
-        return htmlParseDoc((xmlChar*)aDocument.getStr(), NULL);
+        aBuffer[nSize] = 0;
+        return htmlParseDoc(reinterpret_cast<xmlChar*>(aBuffer.getArray()), NULL);
     }
 
 private:


More information about the Libreoffice-commits mailing list