[Libreoffice-commits] .: 3 commits - filter/qa hwpfilter/qa lotuswordpro/qa sc/qa sd/qa sot/qa svl/inc svl/source svtools/qa sw/CppunitTest_sw_filters_test.mk sw/qa sw/source unotest/inc unotest/source writerfilter/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 1 06:14:35 PDT 2012
filter/qa/cppunit/filters-pict-test.cxx | 7 -
filter/qa/cppunit/filters-tga-test.cxx | 7 -
filter/qa/cppunit/filters-tiff-test.cxx | 7 -
hwpfilter/qa/cppunit/test_hwpfilter.cxx | 9 +
lotuswordpro/qa/cppunit/test_lotuswordpro.cxx | 6 -
sc/qa/unit/filters-test.cxx | 43 ++++---
sc/qa/unit/subsequent_export-test.cxx | 2
sc/qa/unit/subsequent_filters-test.cxx | 117 +++++++++++++++------
sd/qa/unit/filters-test.cxx | 11 +
sd/qa/unit/regression-test.cxx | 11 +
sot/qa/cppunit/test_sot.cxx | 9 -
svl/inc/svl/ctypeitm.hxx | 6 -
svl/inc/svl/stritem.hxx | 2
svl/source/items/ctypeitm.cxx | 12 +-
svtools/qa/cppunit/filters-test.cxx | 7 -
sw/CppunitTest_sw_filters_test.mk | 2
sw/qa/core/data/odt/pass/CVE-2012-4233-1.odt |binary
sw/qa/core/filters-test.cxx | 24 +++-
sw/source/core/layout/laycache.cxx | 19 +--
sw/source/filter/xml/swxml.cxx | 8 -
unotest/inc/unotest/filters-test.hxx | 19 ++-
unotest/source/cpp/filters-test.cxx | 34 ++++--
writerfilter/qa/cppunittests/rtftok/testrtftok.cxx | 9 +
23 files changed, 258 insertions(+), 113 deletions(-)
New commits:
commit c2913591d895666c7b8019e3307355511a7a5f95
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 1 13:12:21 2012 +0000
rework filters test to squeeze through extra flags
that are needed to load .odt, .sxw etc files, and
add a regression test for CVE-2012-4233
Change-Id: Ie178725ded3d76942030d12f23074de519cf62de
diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/filter/qa/cppunit/filters-pict-test.cxx
index 69228f3..9e5a296 100644
--- a/filter/qa/cppunit/filters-pict-test.cxx
+++ b/filter/qa/cppunit/filters-pict-test.cxx
@@ -34,7 +34,9 @@ class PictFilterTest
public:
PictFilterTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -47,7 +49,8 @@ public:
};
bool PictFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aFileStream(rURL, STREAM_READ);
Graphic aGraphic;
diff --git a/filter/qa/cppunit/filters-tga-test.cxx b/filter/qa/cppunit/filters-tga-test.cxx
index c0eba97..9edcf62 100644
--- a/filter/qa/cppunit/filters-tga-test.cxx
+++ b/filter/qa/cppunit/filters-tga-test.cxx
@@ -54,7 +54,9 @@ class TgaFilterTest
public:
TgaFilterTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -67,7 +69,8 @@ public:
};
bool TgaFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aFileStream(rURL, STREAM_READ);
Graphic aGraphic;
diff --git a/filter/qa/cppunit/filters-tiff-test.cxx b/filter/qa/cppunit/filters-tiff-test.cxx
index 942ad16..b967393 100644
--- a/filter/qa/cppunit/filters-tiff-test.cxx
+++ b/filter/qa/cppunit/filters-tiff-test.cxx
@@ -54,7 +54,9 @@ class TiffFilterTest
public:
TiffFilterTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -67,7 +69,8 @@ public:
};
bool TiffFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aFileStream(rURL, STREAM_READ);
Graphic aGraphic;
diff --git a/hwpfilter/qa/cppunit/test_hwpfilter.cxx b/hwpfilter/qa/cppunit/test_hwpfilter.cxx
index 18b6ebf..88a09a0 100644
--- a/hwpfilter/qa/cppunit/test_hwpfilter.cxx
+++ b/hwpfilter/qa/cppunit/test_hwpfilter.cxx
@@ -45,7 +45,11 @@ namespace
{
public:
virtual void setUp();
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
+
void test();
CPPUNIT_TEST_SUITE(HwpFilterTest);
@@ -66,7 +70,8 @@ namespace
}
bool HwpFilterTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
uno::Sequence< beans::PropertyValue > aDescriptor(1);
aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
index 81225e8..566c7e9 100644
--- a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
+++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx
@@ -48,7 +48,8 @@ namespace
virtual void setUp();
virtual bool load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &);
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
void test();
@@ -70,7 +71,8 @@ namespace
}
bool LotusWordProTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
uno::Sequence< beans::PropertyValue > aDescriptor(1);
aDescriptor[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index a7b050d..b4a9fa1 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -68,7 +68,7 @@ using namespace ::com::sun::star::uno;
namespace {
struct FileFormat {
- const char* pName; const char* pFilterName; const char* pTypeName; sal_uLong nFormatType;
+ const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType;
};
FileFormat aFileFormats[] = {
@@ -89,9 +89,13 @@ class ScFiltersTest
public:
ScFiltersTest();
- virtual bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
+ virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL,
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion);
+
ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType=0);
+ const rtl::OUString &rUserData, const rtl::OUString& rTypeName,
+ unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion);
void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath);
void createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rFilePath);
@@ -142,20 +146,18 @@ private:
};
ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType)
+ const rtl::OUString &rUserData, const rtl::OUString& rTypeName,
+ unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion)
{
- sal_uInt32 nFormat = 0;
- if (nFormatType)
- nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
- SfxFilter* aFilter = new SfxFilter(
+ SfxFilter* pFilter = new SfxFilter(
rFilter,
- rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(),
- rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) );
- aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
+ rtl::OUString(), nFilterFlags, nClipboardID, rTypeName, 0, rtl::OUString(),
+ rUserData, rtl::OUString("private:factory/scalc*") );
+ pFilter->SetVersion(nFilterVersion);
ScDocShellRef xDocShRef = new ScDocShell;
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
- pSrcMed->SetFilter(aFilter);
+ pSrcMed->SetFilter(pFilter);
if (!xDocShRef->DoLoad(pSrcMed))
{
xDocShRef->DoClose();
@@ -167,9 +169,11 @@ ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUStr
}
bool ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData)
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion)
{
- ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData, rtl::OUString());
+ ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData,
+ rtl::OUString(), nFilterFlags, nClipboardID, nFilterVersion);
bool bLoaded = xDocShRef.Is();
//reference counting of ScDocShellRef is very confused.
if (bLoaded)
@@ -227,7 +231,11 @@ void ScFiltersTest::testDir(osl::Directory& rDir, sal_uInt32 nType)
std::cout << "File: " << rtl::OUStringToOString(sURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
//rtl::OStringBuffer aMessage("Failed loading: ");
//aMessage.append(rtl::OUStringToOString(sURL, RTL_TEXTENCODING_UTF8));
- ScDocShellRef xDocSh = load( aFilterName,sURL, rtl::OUString(),aFilterType, aFileFormats[nType].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[nType].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, sURL, rtl::OUString(),
+ aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
// use this only if you're sure that all files can be loaded
// pay attention to lock files
//CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), xDocSh.Is());
@@ -300,7 +308,10 @@ ScDocShellRef ScFiltersTest::loadDoc(const rtl::OUString& rName, sal_Int32 nForm
rtl::OUString aFileName;
createFileURL( rName, aFileExtension, aFileName );
rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType);
+ unsigned int nFormatType = aFileFormats[nFormat].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT(xDocSh.Is());
return xDocSh;
}
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index ba190b9..b3fd4de 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -51,7 +51,7 @@ using namespace ::com::sun::star::uno;
namespace {
struct FileFormat {
- const char* pName; const char* pFilterName; const char* pTypeName; sal_uLong nFormatType;
+ const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType;
};
FileFormat aFileFormats[] = {
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 10db9ae..798ce07 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -83,7 +83,7 @@ using namespace ::com::sun::star::uno;
namespace {
struct FileFormat {
- const char* pName; const char* pFilterName; const char* pTypeName; sal_uLong nFormatType;
+ const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType;
};
FileFormat aFileFormats[] = {
@@ -105,9 +105,13 @@ class ScFiltersTest
public:
ScFiltersTest();
- virtual bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
+ virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL,
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion);
+
ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType=0);
+ const rtl::OUString &rUserData, const rtl::OUString& rTypeName,
+ unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion);
void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath);
void createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rFilePath);
@@ -230,20 +234,18 @@ private:
};
ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType)
+ const rtl::OUString &rUserData, const rtl::OUString& rTypeName,
+ unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion)
{
- sal_uInt32 nFormat = 0;
- if (nFormatType)
- nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS;
- SfxFilter* aFilter = new SfxFilter(
+ SfxFilter* pFilter = new SfxFilter(
rFilter,
- rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(),
- rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) );
- aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
+ rtl::OUString(), nFilterFlags, nClipboardID, rTypeName, 0, rtl::OUString(),
+ rUserData, rtl::OUString("private:factory/scalc*") );
+ pFilter->SetVersion(nFilterVersion);
ScDocShellRef xDocShRef = new ScDocShell;
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
- pSrcMed->SetFilter(aFilter);
+ pSrcMed->SetFilter(pFilter);
if (!xDocShRef->DoLoad(pSrcMed))
{
xDocShRef->DoClose();
@@ -255,9 +257,11 @@ ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUStr
}
bool ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData)
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion)
{
- ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData, rtl::OUString());
+ ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData,
+ rtl::OUString(), nFilterFlags, nClipboardID, nFilterVersion);
bool bLoaded = xDocShRef.Is();
//reference counting of ScDocShellRef is very confused.
if (bLoaded)
@@ -272,7 +276,10 @@ ScDocShellRef ScFiltersTest::loadDoc(const rtl::OUString& rName, sal_Int32 nForm
rtl::OUString aFileName;
createFileURL( rName, aFileExtension, aFileName );
rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8);
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType);
+ unsigned int nFormatType = aFileFormats[nFormat].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT(xDocSh.Is());
return xDocSh;
}
@@ -933,7 +940,10 @@ void ScFiltersTest::testBugFixesODS()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[0].pTypeName, strlen(aFileFormats[0].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[0].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[0].nFormatType);
+ unsigned int nFormatType = aFileFormats[0].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.ods", xDocSh.Is());
@@ -969,7 +979,10 @@ void ScFiltersTest::testBugFixesXLS()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[1].pTypeName, strlen(aFileFormats[1].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[1].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[1].nFormatType);
+ unsigned int nFormatType = aFileFormats[1].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.xls", xDocSh.Is());
@@ -987,7 +1000,10 @@ void ScFiltersTest::testBugFixesXLSX()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[2].pTypeName, strlen(aFileFormats[2].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[2].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[2].nFormatType);
+ unsigned int nFormatType = aFileFormats[2].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.xlsx", xDocSh.Is());
@@ -1211,7 +1227,11 @@ void ScFiltersTest::testBrokenQuotesCSV()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[CSV].pTypeName, strlen(aFileFormats[CSV].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[CSV].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[CSV].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[CSV].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load fdo48621_broken_quotes.csv", xDocSh.Is());
ScDocument* pDoc = xDocSh->GetDocument();
@@ -1235,7 +1255,12 @@ void ScFiltersTest::testSharedFormulaXLSX()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[XLSX].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[XLSX].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
xDocSh->DoHardRecalc(true);
CPPUNIT_ASSERT_MESSAGE("Failed to load shared-formula.xlsx", xDocSh.Is());
@@ -1265,7 +1290,11 @@ void ScFiltersTest::testCellValueXLSX()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[XLSX].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[XLSX].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is());
ScDocument* pDoc = xDocSh->GetDocument();
@@ -1335,7 +1364,11 @@ void ScFiltersTest::testControlImport()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[XLSX].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[XLSX].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is());
@@ -1359,7 +1392,12 @@ void ScFiltersTest::testNumberFormatHTML()
rtl::OUString aFileName;
createFileURL(aFileNameBase, aFileExt, aFileName);
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[HTML].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[HTML].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
CPPUNIT_ASSERT_MESSAGE("Failed to load numberformat.html", xDocSh.Is());
ScDocument* pDoc = xDocSh->GetDocument();
@@ -1386,7 +1424,12 @@ void ScFiltersTest::testNumberFormatCSV()
rtl::OUString aFileName;
createFileURL(aFileNameBase, aFileExt, aFileName);
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[CSV].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[CSV].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
CPPUNIT_ASSERT_MESSAGE("Failed to load numberformat.html", xDocSh.Is());
ScDocument* pDoc = xDocSh->GetDocument();
@@ -1413,7 +1456,12 @@ void ScFiltersTest::testCellAnchoredShapesODS()
rtl::OUString aFileName;
createFileURL(aFileNameBase, aFileExt, aFileName);
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[ODS].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-shapes.ods", xDocSh.Is());
// There are two cell-anchored objects on the first sheet.
@@ -1468,7 +1516,12 @@ void ScFiltersTest::testPivotTableBasicODS()
rtl::OUString aFileName;
createFileURL(aFileNameBase, aFileExt, aFileName);
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[ODS].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
CPPUNIT_ASSERT_MESSAGE("Failed to load pivot-table-basic.ods", xDocSh.Is());
ScDocument* pDoc = xDocSh->GetDocument();
@@ -1570,7 +1623,11 @@ void ScFiltersTest::testColorScaleODS()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[ODS].pTypeName, strlen(aFileFormats[ODS].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[ODS].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[ODS].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load colorScale.ods", xDocSh.Is());
@@ -1590,7 +1647,11 @@ void ScFiltersTest::testColorScaleXLSX()
createFileURL(aFileNameBase, aFileExtension, aFileName);
rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8);
std::cout << aFileFormats[XLSX].pName << " Test" << std::endl;
- ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType);
+
+ unsigned int nFormatType = aFileFormats[XLSX].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
CPPUNIT_ASSERT_MESSAGE("Failed to load colorScale.xlsx", xDocSh.Is());
diff --git a/sd/qa/unit/filters-test.cxx b/sd/qa/unit/filters-test.cxx
index 76fd560..f274c2c 100644
--- a/sd/qa/unit/filters-test.cxx
+++ b/sd/qa/unit/filters-test.cxx
@@ -62,7 +62,10 @@ public:
SdFiltersTest();
::sd::DrawDocShellRef loadURL( const rtl::OUString &rURL );
- virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
+ virtual bool load( const rtl::OUString &rFilter,
+ const rtl::OUString &rURL, const rtl::OUString &rUserData,
+ unsigned int nFilterFlags, unsigned int nClipboardID,
+ unsigned int nFilterVersion);
virtual void setUp();
virtual void tearDown();
@@ -179,12 +182,14 @@ void SdFiltersTest::testN778859()
}
bool SdFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData)
+ const rtl::OUString &rUserData, unsigned int nFilterFlags, unsigned int nClipboardID,
+ unsigned int nFilterVersion)
{
SfxFilter aFilter(
rFilter,
- rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
+ rtl::OUString(), nFilterFlags, nClipboardID, rtl::OUString(), 0, rtl::OUString(),
rUserData, rtl::OUString() );
+ aFilter.SetVersion(nFilterVersion);
::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell();
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
diff --git a/sd/qa/unit/regression-test.cxx b/sd/qa/unit/regression-test.cxx
index 266f538..e378ff0 100644
--- a/sd/qa/unit/regression-test.cxx
+++ b/sd/qa/unit/regression-test.cxx
@@ -76,7 +76,10 @@ public:
SdFiltersTest();
::sd::DrawDocShellRef loadURL( const rtl::OUString &rURL );
- virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
+ virtual bool load( const rtl::OUString &rFilter,
+ const rtl::OUString &rURL, const rtl::OUString &rUserData,
+ unsigned int nFilterFlags, unsigned int nClipboardID,
+ unsigned int nFilterVersion);
virtual void setUp();
virtual void tearDown();
@@ -246,12 +249,14 @@ void SdFiltersTest::testStuff(::sd::DrawDocShellRef xDocShRef, const rtl::OStrin
}
bool SdFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData)
+ const rtl::OUString &rUserData, unsigned int nFilterFlags, unsigned int nClipboardID,
+ unsigned int nFilterVersion)
{
SfxFilter aFilter(
rFilter,
- rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
+ rtl::OUString(), nFilterFlags, nClipboardID, rtl::OUString(), 0, rtl::OUString(),
rUserData, rtl::OUString() );
+ aFilter.SetVersion(nFilterVersion);
::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell();
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index d0bda11..dc4b38f 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -52,7 +52,8 @@ namespace
bool checkStorage( const SotStorageRef &xObjStor );
virtual bool load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &);
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
void test();
@@ -107,9 +108,6 @@ namespace
for( SvStorageInfoList::iterator aIt = aInfoList.begin();
aIt != aInfoList.end(); ++aIt )
{
-// fprintf( stderr, "Stream '%s' size %ld\n",
-// rtl::OUStringToOString( aIt->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-// (long)aIt->GetSize() );
if( aIt->IsStorage() )
{
SotStorageRef xChild( xObjStor->OpenSotStorage( aIt->GetName() ) );
@@ -123,7 +121,8 @@ namespace
}
bool SotTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
SvFileStream aStream(rURL, STREAM_READ);
SotStorageRef xObjStor = new SotStorage(aStream);
diff --git a/svtools/qa/cppunit/filters-test.cxx b/svtools/qa/cppunit/filters-test.cxx
index 483a72b..a9b5afd 100644
--- a/svtools/qa/cppunit/filters-test.cxx
+++ b/svtools/qa/cppunit/filters-test.cxx
@@ -46,7 +46,9 @@ class SvtoolsFiltersTest
public:
SvtoolsFiltersTest() : BootstrapFixture(true, false) {}
- virtual bool load(const rtl::OUString &, const rtl::OUString &rURL, const rtl::OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
/**
* Ensure CVEs remain unbroken
@@ -59,7 +61,8 @@ public:
};
bool SvtoolsFiltersTest::load(const rtl::OUString &,
- const rtl::OUString &rURL, const rtl::OUString &)
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
GraphicFilter aGraphicFilter(false);
SvFileStream aFileStream(rURL, STREAM_READ);
diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk
index a97329e..ee57d87 100644
--- a/sw/CppunitTest_sw_filters_test.mk
+++ b/sw/CppunitTest_sw_filters_test.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
+ package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
sfx2/util/sfx \
@@ -91,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
ucb/source/ucp/file/ucpfile1 \
unoxml/source/service/unoxml \
$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
+ xmloff/source/transform/xof \
))
$(eval $(call gb_CppunitTest_use_configuration,sw_filters_test))
diff --git a/sw/qa/core/data/odt/fail/.gitignore b/sw/qa/core/data/odt/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/data/odt/indeterminate/.gitignore b/sw/qa/core/data/odt/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/data/odt/pass/.gitignore b/sw/qa/core/data/odt/pass/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/data/odt/pass/CVE-2012-4233-1.odt b/sw/qa/core/data/odt/pass/CVE-2012-4233-1.odt
new file mode 100644
index 0000000..9d3c3dc
Binary files /dev/null and b/sw/qa/core/data/odt/pass/CVE-2012-4233-1.odt differ
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 4df9b07..46a1af6 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -62,7 +62,9 @@ class SwFiltersTest
, public test::BootstrapFixture
{
public:
- bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData);
+ virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL,
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion);
virtual void setUp();
// Ensure CVEs remain unbroken
@@ -77,12 +79,14 @@ private:
};
bool SwFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL,
- const rtl::OUString &rUserData)
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion)
{
SfxFilter* pFilter = new SfxFilter(
- rFilter,
- rtl::OUString(), 0, 0, rtl::OUString(), 0, rtl::OUString(),
- rUserData, rtl::OUString() );
+ rFilter, rtl::OUString(), nFilterFlags,
+ nClipboardID, rtl::OUString(), 0, rtl::OUString(),
+ rUserData, rtl::OUString());
+ pFilter->SetVersion(nFilterVersion);
SwDocShellRef xDocShRef = new SwDocShell;
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
@@ -104,7 +108,15 @@ void SwFiltersTest::testCVEs()
{
testDir(rtl::OUString("Staroffice XML (Writer)"),
getURLFromSrc("/sw/qa/core/data/xml/"),
- rtl::OUString(FILTER_XML));
+ rtl::OUString(FILTER_XML),
+ SFX_FILTER_IMPORT | SFX_FILTER_OWN | SFX_FILTER_DEFAULT,
+ -1, SOFFICE_FILEFORMAT_CURRENT);
+
+ testDir(rtl::OUString("writer8"),
+ getURLFromSrc("/sw/qa/core/data/odt/"),
+ rtl::OUString(FILTER_XML),
+ SFX_FILTER_IMPORT | SFX_FILTER_OWN | SFX_FILTER_DEFAULT,
+ -1, SOFFICE_FILEFORMAT_CURRENT);
testDir(rtl::OUString("MS Word 97"),
getURLFromSrc("/sw/qa/core/data/ww8/"),
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 80af530..310818d 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -162,11 +162,11 @@ sal_Int32 ReadThroughComponent(
RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" );
// get filter
+ OUString aFilterName(OUString::createFromAscii(pFilterName));
uno::Reference< xml::sax::XDocumentHandler > xFilter(
- rFactory->createInstanceWithArguments(
- OUString::createFromAscii(pFilterName), rFilterArguments),
- UNO_QUERY );
- OSL_ENSURE( xFilter.is(), "Can't instantiate filter component." );
+ rFactory->createInstanceWithArguments(aFilterName, rFilterArguments),
+ UNO_QUERY);
+ SAL_WARN_IF(!xFilter.is(), "sw", "Can't instantiate filter component: " << aFilterName);
if( !xFilter.is() )
return ERR_SWG_READ_ERROR;
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "%s created", pFilterName );
diff --git a/unotest/inc/unotest/filters-test.hxx b/unotest/inc/unotest/filters-test.hxx
index d26c7f7..390ad05 100644
--- a/unotest/inc/unotest/filters-test.hxx
+++ b/unotest/inc/unotest/filters-test.hxx
@@ -27,6 +27,7 @@
* instead of those above.
*/
+#include <comphelper/documentconstants.hxx>
#include <rtl/ustring.hxx>
#include "unotest/detail/unotestdllapi.hxx"
@@ -56,21 +57,33 @@ public:
//root dir of test files, must contain pass, fail, indeterminate
const rtl::OUString &rURL,
//additional filter data for SfxFilter
- const rtl::OUString &rUserData);
+ const rtl::OUString &rUserData = rtl::OUString(),
+ //SfxFilterFlags for SfxFilter
+ unsigned int nFilterFlags = SFX_FILTER_IMPORT,
+ //Clipboard id for SfxFilter
+ unsigned int nClipboardID = 0,
+ //additional filter version for SfxFilter
+ unsigned int nFilterVersion = 0);
virtual bool load(
const rtl::OUString &rFilter,
const rtl::OUString &rURL,
- const rtl::OUString &rUserData) = 0;
+ const rtl::OUString &rUserData,
+ unsigned int nFilterFlags,
+ unsigned int nClipboardID,
+ unsigned int nFilterVersion) = 0;
protected:
~FiltersTest() {}
void recursiveScan(
+ filterStatus nExpected,
const rtl::OUString &rFilter,
const rtl::OUString &rURL,
const rtl::OUString &rUserData,
- filterStatus nExpected);
+ unsigned int nFilterFlags,
+ unsigned int nClipboardID,
+ unsigned int nFilterVersion);
};
}
diff --git a/unotest/source/cpp/filters-test.cxx b/unotest/source/cpp/filters-test.cxx
index 64c6159..07467a3 100644
--- a/unotest/source/cpp/filters-test.cxx
+++ b/unotest/source/cpp/filters-test.cxx
@@ -70,8 +70,10 @@ void decode(const rtl::OUString& rIn, const rtl::OUString &rOut)
rtl_cipher_destroy(cipher);
}
-void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData,
- filterStatus nExpected)
+void FiltersTest::recursiveScan(filterStatus nExpected,
+ const rtl::OUString &rFilter, const rtl::OUString &rURL,
+ const rtl::OUString &rUserData, unsigned int nFilterFlags,
+ unsigned int nClipboardID, unsigned int nFilterVersion)
{
osl::Directory aDir(rURL);
@@ -83,7 +85,10 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
aItem.getFileStatus(aFileStatus);
rtl::OUString sURL = aFileStatus.getFileURL();
if (aFileStatus.getFileType() == osl::FileStatus::Directory)
- recursiveScan(rFilter, sURL, rUserData, nExpected);
+ {
+ recursiveScan(nExpected, rFilter, sURL, rUserData,
+ nFilterFlags, nClipboardID, nFilterVersion);
+ }
else
{
rtl::OUString sTmpFile;
@@ -121,7 +126,8 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
//the hanging input file is visible
fprintf(stderr, "%s,", aRes.getStr());
sal_uInt32 nStartTime = osl_getGlobalTimer();
- bool bRes = load(rFilter, sURL, rUserData);
+ bool bRes = load(rFilter, sURL, rUserData, nFilterFlags,
+ nClipboardID, nFilterVersion);
sal_uInt32 nEndTime = osl_getGlobalTimer();
if (bEncrypted)
@@ -137,15 +143,21 @@ void FiltersTest::recursiveScan(const rtl::OUString &rFilter, const rtl::OUStrin
CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close());
}
-void FiltersTest::testDir(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData)
+void FiltersTest::testDir(const rtl::OUString &rFilter,
+ const rtl::OUString &rURL, const rtl::OUString &rUserData,
+ unsigned int nFilterFlags, unsigned int nClipboardID,
+ unsigned int nFilterVersion)
{
fprintf(stderr, "File tested,Test Result,Execution Time (ms)\n");
- recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pass")),
- rUserData, test::pass);
- recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fail")),
- rUserData, test::fail);
- recursiveScan(rFilter, rURL + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("indeterminate")),
- rUserData, test::indeterminate);
+ recursiveScan(test::pass, rFilter,
+ rURL + rtl::OUString("pass"),
+ rUserData, nFilterFlags, nClipboardID, nFilterVersion);
+ recursiveScan(test::fail, rFilter,
+ rURL + rtl::OUString("fail"),
+ rUserData, nFilterFlags, nClipboardID, nFilterVersion);
+ recursiveScan(test::indeterminate, rFilter,
+ rURL + rtl::OUString("indeterminate"),
+ rUserData, nFilterFlags, nClipboardID, nFilterVersion);
}
}
diff --git a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
index e5e656c..69e0e7b 100644
--- a/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
+++ b/writerfilter/qa/cppunittests/rtftok/testrtftok.cxx
@@ -45,7 +45,10 @@ public:
virtual void setUp();
- virtual bool load(const OUString &, const OUString &rURL, const OUString &);
+ virtual bool load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int);
+
void test();
CPPUNIT_TEST_SUITE(RtfTest);
@@ -62,7 +65,9 @@ void RtfTest::setUp()
m_xFilter = uno::Reference< document::XFilter >(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW);
}
-bool RtfTest::load(const OUString &, const OUString &rURL, const OUString &)
+bool RtfTest::load(const rtl::OUString &,
+ const rtl::OUString &rURL, const rtl::OUString &,
+ unsigned int, unsigned int, unsigned int)
{
uno::Sequence< beans::PropertyValue > aDescriptor(1);
aDescriptor[0].Name = "URL";
commit 2ffd82c350efb7d04ea0019fc1845f314940f995
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 1 13:09:47 2012 +0000
XubString->OUString
Change-Id: Iea7d8681cdcd45d545826af63fc689640dfe29f0
diff --git a/svl/inc/svl/ctypeitm.hxx b/svl/inc/svl/ctypeitm.hxx
index bf7495f..eef9c6c 100644
--- a/svl/inc/svl/ctypeitm.hxx
+++ b/svl/inc/svl/ctypeitm.hxx
@@ -28,13 +28,13 @@ class CntContentTypeItem : public CntUnencodedStringItem
{
private:
INetContentType _eType;
- XubString _aPresentation;
+ OUString _aPresentation;
public:
TYPEINFO();
CntContentTypeItem();
- CntContentTypeItem( sal_uInt16 nWhich, const XubString& rType );
+ CntContentTypeItem( sal_uInt16 nWhich, const OUString& rType );
CntContentTypeItem( const CntContentTypeItem& rOrig );
virtual SfxPoolItem* Create( SvStream& rStream,
@@ -47,7 +47,7 @@ public:
virtual SfxPoolItem* Clone( SfxItemPool *pPool = NULL ) const;
- void SetValue( const XubString& rNewVal );
+ void SetValue( const OUString& rNewVal );
using SfxPoolItem::Compare;
virtual int Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const;
diff --git a/svl/inc/svl/stritem.hxx b/svl/inc/svl/stritem.hxx
index 87b65c7..a410921 100644
--- a/svl/inc/svl/stritem.hxx
+++ b/svl/inc/svl/stritem.hxx
@@ -31,7 +31,7 @@ public:
SfxStringItem() {}
- SfxStringItem(sal_uInt16 which, const XubString & rValue):
+ SfxStringItem(sal_uInt16 which, const OUString & rValue):
CntUnencodedStringItem(which, rValue) {}
SfxStringItem(sal_uInt16 nWhich, SvStream & rStream);
diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx
index 0ab7c2e..dc15162 100644
--- a/svl/source/items/ctypeitm.cxx
+++ b/svl/source/items/ctypeitm.cxx
@@ -46,7 +46,7 @@ CntContentTypeItem::CntContentTypeItem()
}
//----------------------------------------------------------------------------
-CntContentTypeItem::CntContentTypeItem( sal_uInt16 which, const XubString& rType )
+CntContentTypeItem::CntContentTypeItem( sal_uInt16 which, const OUString& rType )
: CntUnencodedStringItem( which, rType ),
_eType( CONTENT_TYPE_NOT_INIT )
{
@@ -122,11 +122,11 @@ SfxPoolItem* CntContentTypeItem::Clone( SfxItemPool* /* pPool */ ) const
}
//----------------------------------------------------------------------------
-void CntContentTypeItem::SetValue( const XubString& rNewVal )
+void CntContentTypeItem::SetValue( const OUString& rNewVal )
{
// De-initialize enum type and presentation.
_eType = CONTENT_TYPE_NOT_INIT;
- _aPresentation.Erase();
+ _aPresentation = OUString();
CntUnencodedStringItem::SetValue( rNewVal );
}
@@ -150,7 +150,7 @@ SfxItemPresentation CntContentTypeItem::GetPresentation(
XubString & rText,
const IntlWrapper * pIntlWrapper) const
{
- if (_aPresentation.Len() == 0)
+ if (_aPresentation.isEmpty())
{
DBG_ASSERT(pIntlWrapper,
"CntContentTypeItem::GetPresentation(): No IntlWrapper");
@@ -160,7 +160,7 @@ SfxItemPresentation CntContentTypeItem::GetPresentation(
pIntlWrapper->
getLocale());
}
- if (_aPresentation.Len() > 0)
+ if (!_aPresentation.isEmpty())
{
rText = _aPresentation;
return SFX_ITEM_PRESENTATION_COMPLETE;
@@ -217,7 +217,7 @@ bool CntContentTypeItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uIn
SetValue(aValue);
else
SetValue(
- INetContentTypes::RegisterContentType(aValue, UniString()));
+ INetContentTypes::RegisterContentType(aValue, OUString()));
return true;
}
commit 5346394e9fb82c4a15ca7202f5d7ca6d27165aff
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 1 12:44:54 2012 +0000
valgrind: Conditional jump or move depends on uninitialised value
Change-Id: I7b59ddc4f9170c33e948f30194a662f27b871fcc
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index f639d7a..8752828 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -114,19 +114,19 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream )
// height of fly frames
bUseFlyCache = aIo.GetMinorVersion() >= 1;
- sal_uInt8 cFlags;
- sal_uInt32 nIndex, nOffset;
-
aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES );
aIo.OpenFlagRec();
aIo.CloseFlagRec();
while( aIo.BytesLeft() && !aIo.HasError() )
{
+ sal_uInt32 nIndex(0), nOffset(0);
+
switch( aIo.Peek() )
{
case SW_LAYCACHE_IO_REC_PARA:
+ {
aIo.OpenRec( SW_LAYCACHE_IO_REC_PARA );
- cFlags = aIo.OpenFlagRec();
+ sal_uInt8 cFlags = aIo.OpenFlagRec();
aIo.GetStream() >> nIndex;
if( (cFlags & 0x01) != 0 )
aIo.GetStream() >> nOffset;
@@ -136,6 +136,7 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream )
Insert( SW_LAYCACHE_IO_REC_PARA, nIndex, (xub_StrLen)nOffset );
aIo.CloseRec( SW_LAYCACHE_IO_REC_PARA );
break;
+ }
case SW_LAYCACHE_IO_REC_TABLE:
aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE );
aIo.OpenFlagRec();
@@ -150,8 +151,8 @@ sal_Bool SwLayCacheImpl::Read( SvStream& rStream )
aIo.OpenRec( SW_LAYCACHE_IO_REC_FLY );
aIo.OpenFlagRec();
aIo.CloseFlagRec();
- sal_Int32 nX, nY, nW, nH;
- sal_uInt16 nPgNum;
+ sal_Int32 nX(0), nY(0), nW(0), nH(0);
+ sal_uInt16 nPgNum(0);
aIo.GetStream() >> nPgNum >> nIndex
>> nX >> nY >> nW >> nH;
SwFlyCache* pFly = new SwFlyCache( nPgNum, nIndex, nX, nY, nW, nH );
@@ -1188,7 +1189,7 @@ sal_Bool SwLayCacheIoImpl::OpenRec( sal_uInt8 cType )
}
else
{
- sal_uInt32 nVal;
+ sal_uInt32 nVal(0);
*pStream >> nVal;
sal_uInt8 cRecTyp = (sal_uInt8)nVal;
if( !nVal || cRecTyp != cType ||
@@ -1266,7 +1267,7 @@ sal_uInt32 SwLayCacheIoImpl::BytesLeft()
sal_uInt8 SwLayCacheIoImpl::Peek()
{
- sal_uInt8 c = 0;
+ sal_uInt8 c(0);
if( !bError )
{
sal_uInt32 nPos = pStream->Tell();
@@ -1292,7 +1293,7 @@ void SwLayCacheIoImpl::SkipRec()
sal_uInt8 SwLayCacheIoImpl::OpenFlagRec()
{
OSL_ENSURE( !bWriteMode, "OpenFlagRec illegal in write mode" );
- sal_uInt8 cFlags;
+ sal_uInt8 cFlags(0);
*pStream >> cFlags;
nFlagRecEnd = pStream->Tell() + ( cFlags & 0x0F );
return (cFlags >> 4);
More information about the Libreoffice-commits
mailing list