diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-04-09 09:39:06 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-04-09 09:50:30 +0200 |
commit | 4c8d29f4f26bfa30689b2b98414fe874225b9a2e (patch) | |
tree | b7c548dd8663a14c5961f494e622e8cc9dda2c17 /sw/qa | |
parent | 5180805c3f74998c27b0ab0af3292f9d35a61a1b (diff) |
html export: Simplify & speed-up the test.
Change-Id: I619e4441898fe10e319d9f95413f078003364579
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/htmlexport/htmlexport.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 18b28627058d..4e42cb417e95 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: |