[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source vcl/source vcl/workben
Caolán McNamara
caolanm at redhat.com
Sun Apr 2 21:50:39 UTC 2017
sw/inc/shellio.hxx | 4 +--
sw/source/filter/ww8/ww8par.cxx | 22 ++++++++++++++----
sw/source/filter/ww8/ww8scan.cxx | 2 -
vcl/source/gdi/gfxlink.cxx | 4 +--
vcl/workben/fftester.cxx | 47 ++++++++++++++++++++++++++++-----------
5 files changed, 57 insertions(+), 22 deletions(-)
New commits:
commit 74917d23782413aa0f129bcf9e6bf5a1c496d23b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 2 21:05:48 2017 +0100
split up doc testing for three major variants
Change-Id: Iac1b5cb1c209ba27d185c8a7ba1e59c663553d77
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 283422710fc2..298f4c465647 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -177,13 +177,13 @@ protected:
#define SW_STREAM_READER 1
#define SW_STORAGE_READER 2
-extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportDOC(const OUString &rUrl, const OUString &rFltName);
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName);
extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportRTF(SvStream &rStream);
class SW_DLLPUBLIC Reader
{
friend class SwReader;
- friend bool TestImportDOC(const OUString &rUrl, const OUString &rFltName);
+ friend bool TestImportDOC(SvStream &rStream, const OUString &rFltName);
friend bool TestImportRTF(SvStream &rStream);
rtl::Reference<SwDoc> mxTemplate;
OUString aTemplateNm;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 108bf115eee5..f86a2c263a2d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -6190,16 +6190,15 @@ extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOC()
return new WW8Reader;
}
-extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportDOC(const OUString &rURL, const OUString &rFltName)
+bool SAL_CALL TestImportDOC(SvStream &rStream, const OUString &rFltName)
{
Reader *pReader = ImportDOC();
- SvFileStream aFileStream(rURL, StreamMode::READ);
tools::SvRef<SotStorage> xStorage;
- pReader->pStrm = &aFileStream;
+ pReader->pStrm = &rStream;
if (rFltName != "WW6")
{
- xStorage = tools::SvRef<SotStorage>(new SotStorage(aFileStream));
+ xStorage = tools::SvRef<SotStorage>(new SotStorage(rStream));
pReader->pStg = xStorage.get();
}
pReader->SetFltName(rFltName);
@@ -6223,6 +6222,21 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportDOC(const OUString &rURL
return bRet;
}
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW8(SvStream &rStream)
+{
+ return TestImportDOC(rStream, "CWW8");
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW6(SvStream &rStream)
+{
+ return TestImportDOC(rStream, "CWW6");
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW2(SvStream &rStream)
+{
+ return TestImportDOC(rStream, "WW6");
+}
+
sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize )
{
sal_uLong nRet = ERR_SWG_READ_ERROR;
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 3364acdf3f58..fc441fdee489 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -87,7 +87,7 @@ namespace
const wwSprmSearcher *wwSprmParser::GetWW2SprmSearcher()
{
//double lock me
- // WW7- Sprms
+ // WW2 Sprms
static const SprmInfoRow aSprms[] =
{
{ 0, { 0, L_FIX} }, // "Default-sprm", will be skipped
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 63e33e14b735..636970f6ee48 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -323,26 +323,47 @@ try_again:
SvFileStream aFileStream(out, StreamMode::READ);
ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr);
}
- else if ( (strcmp(argv[2], "doc") == 0) ||
- (strcmp(argv[2], "ww8") == 0) ||
- (strcmp(argv[2], "ww6") == 0) ||
- (strcmp(argv[2], "ww2") == 0) )
+ else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 0))
{
- static WFilterCall pfnImport(nullptr);
+ static FFilterCall pfnImport(nullptr);
if (!pfnImport)
{
osl::Module aLibrary;
aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
- pfnImport = reinterpret_cast<WFilterCall>(
- aLibrary.getFunctionSymbol("TestImportDOC"));
+ pfnImport = reinterpret_cast<FFilterCall>(
+ aLibrary.getFunctionSymbol("TestImportWW8"));
+ aLibrary.release();
+ }
+ SvFileStream aFileStream(out, StreamMode::READ);
+ ret = (int) (*pfnImport)(aFileStream);
+ }
+ else if (strcmp(argv[2], "ww6") == 0)
+ {
+ static FFilterCall pfnImport(nullptr);
+ if (!pfnImport)
+ {
+ osl::Module aLibrary;
+ aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
+ pfnImport = reinterpret_cast<FFilterCall>(
+ aLibrary.getFunctionSymbol("TestImportWW6"));
aLibrary.release();
}
- if (strcmp(argv[2], "ww6") == 0)
- ret = (int) (*pfnImport)(out, OUString("CWW6"));
- else if (strcmp(argv[2], "ww2") == 0)
- ret = (int) (*pfnImport)(out, OUString("WW6"));
- else
- ret = (int) (*pfnImport)(out, OUString("CWW8"));
+ SvFileStream aFileStream(out, StreamMode::READ);
+ ret = (int) (*pfnImport)(aFileStream);
+ }
+ else if (strcmp(argv[2], "ww2") == 0)
+ {
+ static FFilterCall pfnImport(nullptr);
+ if (!pfnImport)
+ {
+ osl::Module aLibrary;
+ aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY);
+ pfnImport = reinterpret_cast<FFilterCall>(
+ aLibrary.getFunctionSymbol("TestImportWW2"));
+ aLibrary.release();
+ }
+ SvFileStream aFileStream(out, StreamMode::READ);
+ ret = (int) (*pfnImport)(aFileStream);
}
else if (strcmp(argv[2], "rtf") == 0)
{
commit 6fd66ad94040d46904eba8f2ac2b4270787a756a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 2 19:17:04 2017 +0100
we're either reading or writing, not both
Change-Id: I6b004c7f7957f3843d37063b182cac0cd07e5f44
diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx
index 8921aaf081f3..a0a69ef2d82c 100644
--- a/vcl/source/gdi/gfxlink.cxx
+++ b/vcl/source/gdi/gfxlink.cxx
@@ -141,7 +141,7 @@ void GfxLink::SwapOut()
if (!aURL.isEmpty())
{
std::shared_ptr<GfxLink::SwapOutData> pSwapOut = std::make_shared<SwapOutData>(aURL); // aURL is removed in the destructor
- SvStream* pOStm = aTempFile.GetStream(StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
+ SvStream* pOStm = aTempFile.GetStream(StreamMode::STD_WRITE);
if (pOStm)
{
pOStm->WriteBytes(mpSwapInData.get(), mnSwapInDataSize);
@@ -266,7 +266,7 @@ std::shared_ptr<sal_uInt8> GfxLink::GetSwapInData() const
std::shared_ptr<sal_uInt8> pData;
- SvFileStream aFileStream(mpSwapOutData->maURL, StreamMode::READWRITE);
+ SvFileStream aFileStream(mpSwapOutData->maURL, StreamMode::STD_READ);
pData = o3tl::make_shared_array<sal_uInt8>(mnSwapInDataSize);
aFileStream.ReadBytes(pData.get(), mnSwapInDataSize);
bool bError = (ERRCODE_NONE != aFileStream.GetError());
More information about the Libreoffice-commits
mailing list