diff options
-rw-r--r-- | hwpfilter/source/hwpreader.cxx | 31 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpfilter.cxx | 3 |
2 files changed, 20 insertions, 14 deletions
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index cf1dbd452d16..cf13db054a50 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -118,21 +118,28 @@ HwpReader::~HwpReader() extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportHWP(SvStream &rStream) { - std::unique_ptr<HStream> stream(new HStream); - byte aData[32768]; - std::size_t nRead, nBlock = 32768; + try + { + std::unique_ptr<HStream> stream(new HStream); + byte aData[32768]; + std::size_t nRead, nBlock = 32768; + + while (true) + { + nRead = rStream.ReadBytes(aData, nBlock); + if (nRead == 0) + break; + stream->addData(aData, (int)nRead); + } - while (true) + HWPFile hwpfile; + if (hwpfile.ReadHwpFile(stream.release())) + return false; + } + catch (...) { - nRead = rStream.ReadBytes(aData, nBlock); - if (nRead == 0) - break; - stream->addData(aData, (int)nRead); + return false; } - - HWPFile hwpfile; - if (hwpfile.ReadHwpFile(stream.release())) - return false; return true; } diff --git a/lotuswordpro/source/filter/lwpfilter.cxx b/lotuswordpro/source/filter/lwpfilter.cxx index 8f8c8a365209..cfa6b42ff405 100644 --- a/lotuswordpro/source/filter/lwpfilter.cxx +++ b/lotuswordpro/source/filter/lwpfilter.cxx @@ -215,13 +215,12 @@ int ReadWordproFile(SvStream &rStream, uno::Reference<css::xml::sax::XDocumentHa //Reset all static objects,because this function may be called many times. XFGlobalReset(); reader.Read(); - - return 0; } catch (...) { return 1; } + return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |