[Libreoffice-commits] core.git: hwpfilter/Library_hwp.mk hwpfilter/source vcl/workben
Caolán McNamara
caolanm at redhat.com
Fri Aug 21 08:18:13 PDT 2015
hwpfilter/Library_hwp.mk | 1 +
hwpfilter/source/hwpreader.cxx | 21 +++++++++++++++++++++
vcl/workben/fftester.cxx | 14 ++++++++++++++
3 files changed, 36 insertions(+)
New commits:
commit 5684fbce646bfd6514e7857a9e79c02a89c5346d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 21 16:17:26 2015 +0100
add hwp to fftester
Change-Id: Ibf819307905295580cb6a813f6d003a7dabc86b5
diff --git a/hwpfilter/Library_hwp.mk b/hwpfilter/Library_hwp.mk
index 08aaf5c..e3b6284 100644
--- a/hwpfilter/Library_hwp.mk
+++ b/hwpfilter/Library_hwp.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_Library_use_libraries,hwp,\
cppuhelper \
sal \
utl \
+ tl \
$(gb_UWINAPI) \
))
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 5240584..8698189 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -26,6 +26,7 @@
#include <math.h>
#include <osl/diagnose.h>
+#include <tools/stream.hxx>
#include <comphelper/newarray.hxx>
#include "fontmap.hxx"
@@ -123,6 +124,26 @@ HwpReader::~HwpReader()
delete d;
}
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportHWP(const OUString &rURL)
+{
+ SvFileStream aFileStream(rURL, StreamMode::READ);
+ std::unique_ptr<HStream> stream(new HStream);
+ byte aData[32768];
+ sal_Size nRead, nBlock = 32768;
+
+ while (true)
+ {
+ nRead = aFileStream.Read(aData, nBlock);
+ if (nRead == 0)
+ break;
+ stream->addData(aData, (int)nRead);
+ }
+
+ HWPFile hwpfile;
+ if (hwpfile.ReadHwpFile(stream.release()))
+ return false;
+ return true;
+}
sal_Bool HwpReader::filter(const Sequence< PropertyValue >& rDescriptor) throw(RuntimeException, std::exception)
{
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 8de9d18a..9c9ee1b 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -64,6 +64,7 @@ using namespace cppu;
extern "C" { static void SAL_CALL thisModule() {} }
typedef bool (*WFilterCall)(const OUString &rUrl, const OUString &rFlt);
+typedef bool (*HFilterCall)(const OUString &rUrl);
/* This constant specifies the number of inputs to process before restarting.
* This is optional, but helps limit the impact of memory leaks and similar
@@ -333,6 +334,19 @@ try_again:
else
ret = (int) (*pfnImport)(out, OUString("CWW8"));
}
+ else if (strcmp(argv[2], "hwp") == 0)
+ {
+ static HFilterCall pfnImport(0);
+ if (!pfnImport)
+ {
+ osl::Module aLibrary;
+ aLibrary.loadRelative(&thisModule, "libhwplo.so", SAL_LOADMODULE_LAZY);
+ pfnImport = reinterpret_cast<HFilterCall>(
+ aLibrary.getFunctionSymbol("TestImportHWP"));
+ aLibrary.release();
+ }
+ ret = (int) (*pfnImport)(out);
+ }
}
/* To signal successful completion of a run, we need to deliver
More information about the Libreoffice-commits
mailing list