[Libreoffice-commits] core.git: filter/CppunitTest_filter_met_test.mk filter/Library_gie.mk filter/Module_filter.mk filter/qa filter/source include/vcl solenv/clang-format vcl/CppunitTest_vcl_filters_test.mk vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source vcl/workben
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 17 03:02:39 UTC 2021
filter/CppunitTest_filter_met_test.mk | 39 --------
filter/Library_gie.mk | 1
filter/Module_filter.mk | 1
filter/source/config/fragments/internalgraphicfilters/met_Import.xcu | 21 ++--
include/vcl/graphicfilter.hxx | 2
solenv/clang-format/excludelist | 4
vcl/CppunitTest_vcl_filters_test.mk | 1
vcl/Library_vcl.mk | 3
vcl/inc/filter/MetReader.hxx | 26 +++++
vcl/qa/cppunit/graphicfilter/filters-met-test.cxx | 16 ---
vcl/source/filter/FilterConfigCache.cxx | 4
vcl/source/filter/graphicfilter.cxx | 45 ++++------
vcl/source/filter/imet/ios2met.cxx | 4
vcl/workben/fftester.cxx | 12 --
vcl/workben/metfuzzer.cxx | 5 -
15 files changed, 77 insertions(+), 107 deletions(-)
New commits:
commit e916e8c1816a17408cba52787035ffd9fbae5789
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Feb 14 22:45:04 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Feb 17 04:01:52 2021 +0100
Move MET reader from filter module into VCL
Change-Id: I478ef775bc73349094f88012ceb57b1712a27f55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111012
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/filter/CppunitTest_filter_met_test.mk b/filter/CppunitTest_filter_met_test.mk
deleted file mode 100644
index 6bf756f2a671..000000000000
--- a/filter/CppunitTest_filter_met_test.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_CppunitTest_CppunitTest,filter_met_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_met_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_met_test, \
- filter/qa/cppunit/filters-met-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_met_test, \
- gie \
- sal \
- test \
- tl \
- unotest \
- vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_met_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_met_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_met_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_met_test,\
- configmgr/source/configmgr \
- i18npool/util/i18npool \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_met_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 4f383a0770bd..73120a524ac3 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -57,7 +57,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
filter/source/graphicfilter/ieps/ieps \
filter/source/graphicfilter/ipsd/ipsd \
filter/source/graphicfilter/ipbm/ipbm \
- filter/source/graphicfilter/ios2met/ios2met \
filter/source/graphicfilter/idxf/dxf2mtf \
filter/source/graphicfilter/idxf/dxfblkrd \
filter/source/graphicfilter/idxf/dxfentrd \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 18481a33c0e1..36ba307c12fb 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -57,7 +57,6 @@ ifneq ($(DISABLE_CVE_TESTS),TRUE)
$(eval $(call gb_Module_add_check_targets,filter,\
CppunitTest_filter_dxf_test \
CppunitTest_filter_eps_test \
- CppunitTest_filter_met_test \
CppunitTest_filter_pcd_test \
CppunitTest_filter_pcx_test \
CppunitTest_filter_ppm_test \
diff --git a/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
index c13a17f952db..8e6aa1b9ea7a 100644
--- a/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
@@ -15,13 +15,14 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->
- <node oor:name="met_Import" oor:op="replace" >
- <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
- <prop oor:name="FormatName"><value>ime</value></prop>
- <prop oor:name="RealFilterName"><value>MET - OS/2 Metafile</value></prop>
- <prop oor:name="UIComponent"/>
- <prop oor:name="UIName">
- <value xml:lang="en-US">MET - OS/2 Metafile</value>
- </prop>
- <prop oor:name="Flags"><value>IMPORT</value></prop>
- </node>
+
+<node oor:name="met_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+ <prop oor:name="FormatName"><value>SVMET</value></prop>
+ <prop oor:name="RealFilterName"><value>MET - OS/2 Metafile</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">MET - OS/2 Metafile</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 055fa895a353..3e7ebd385827 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -81,6 +81,7 @@ namespace o3tl
#define IMP_TIFF "SVTIFF"
#define IMP_TGA "SVTGA"
#define IMP_PICT "SVPICT"
+#define IMP_MET "SVMET"
#define EXP_BMP "SVBMP"
#define EXP_SVMETAFILE "SVMETAFILE"
#define EXP_WMF "SVWMF"
@@ -364,6 +365,7 @@ public:
static ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName);
static ErrCode readTGA(SvStream & rStream, Graphic & rGraphic);
static ErrCode readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+ static ErrCode readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
private:
OUString aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 312b98050cb7..7705f0281316 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3899,7 +3899,6 @@ external/unixODBC/inc/odbc/sqlucode.h
filter/inc/strings.hxx
filter/qa/cppunit/filters-dxf-test.cxx
filter/qa/cppunit/filters-eps-test.cxx
-filter/qa/cppunit/filters-met-test.cxx
filter/qa/cppunit/filters-pcd-test.cxx
filter/qa/cppunit/filters-pcx-test.cxx
filter/qa/cppunit/filters-ppm-test.cxx
@@ -3972,7 +3971,6 @@ filter/source/graphicfilter/idxf/dxfvec.cxx
filter/source/graphicfilter/idxf/dxfvec.hxx
filter/source/graphicfilter/idxf/idxf.cxx
filter/source/graphicfilter/ieps/ieps.cxx
-filter/source/graphicfilter/ios2met/ios2met.cxx
filter/source/graphicfilter/ipbm/ipbm.cxx
filter/source/graphicfilter/ipcd/ipcd.cxx
filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -14824,6 +14822,7 @@ vcl/qa/cppunit/fontmetric.cxx
vcl/qa/cppunit/graphicfilter/filters-test.cxx
vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
vcl/qa/cppunit/lifecycle.cxx
vcl/qa/cppunit/svm/svmtest.cxx
vcl/qa/cppunit/timer.cxx
@@ -14932,6 +14931,7 @@ vcl/source/filter/etiff/etiff.cxx
vcl/source/filter/igif/decode.cxx
vcl/source/filter/igif/decode.hxx
vcl/source/filter/igif/gifread.cxx
+vcl/source/filter/imet/ios2met.cxx
vcl/source/filter/ipict/ipict.cxx
vcl/source/filter/ipict/shape.cxx
vcl/source/filter/ipict/shape.hxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 3d958cc7f7ad..b643a2580791 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
vcl/qa/cppunit/graphicfilter/filters-tiff-test \
vcl/qa/cppunit/graphicfilter/filters-tga-test \
vcl/qa/cppunit/graphicfilter/filters-pict-test \
+ vcl/qa/cppunit/graphicfilter/filters-met-test \
))
$(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 7b4701995b3e..a5e624f80c0a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -437,11 +437,12 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/filter/GraphicFormatDetector \
vcl/source/filter/igif/decode \
vcl/source/filter/igif/gifread \
- vcl/source/filter/itga/itga \
+ vcl/source/filter/imet/ios2met \
vcl/source/filter/ipict/ipict \
vcl/source/filter/ipict/shape \
vcl/source/filter/ipdf/pdfread \
vcl/source/filter/ipdf/pdfdocument \
+ vcl/source/filter/itga/itga \
vcl/source/filter/itiff/ccidecom \
vcl/source/filter/itiff/itiff \
vcl/source/filter/itiff/lzwdecom \
diff --git a/vcl/inc/filter/MetReader.hxx b/vcl/inc/filter/MetReader.hxx
new file mode 100644
index 000000000000..6855cf7a3fc9
--- /dev/null
+++ b/vcl/inc/filter/MetReader.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <vcl/graph.hxx>
+
+VCL_DLLPUBLIC bool ImportMetGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/met/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/met/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/.gitignore
diff --git a/filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/afl-divide-zero-1.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/afl-divide-zero-1.met
diff --git a/filter/qa/cppunit/data/met/fail/crash-1.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/crash-1.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/crash-1.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/crash-1.met
diff --git a/filter/qa/cppunit/data/met/fail/hang-1.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/hang-1.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/hang-1.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/hang-1.met
diff --git a/filter/qa/cppunit/data/met/fail/hang-2.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/hang-2.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/hang-2.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/hang-2.met
diff --git a/filter/qa/cppunit/data/met/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/met/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/met/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/met/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/met/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/met/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/met/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/met/pass/.gitignore
diff --git a/filter/qa/cppunit/data/met/pass/hang-3.met b/vcl/qa/cppunit/graphicfilter/data/met/pass/hang-3.met
similarity index 100%
rename from filter/qa/cppunit/data/met/pass/hang-3.met
rename to vcl/qa/cppunit/graphicfilter/data/met/pass/hang-3.met
diff --git a/filter/qa/cppunit/data/met/pass/sample.met b/vcl/qa/cppunit/graphicfilter/data/met/pass/sample.met
similarity index 100%
rename from filter/qa/cppunit/data/met/pass/sample.met
rename to vcl/qa/cppunit/graphicfilter/data/met/pass/sample.met
diff --git a/filter/qa/cppunit/filters-met-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-met-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
index e850a06a37df..ff00920ed326 100644
--- a/filter/qa/cppunit/filters-met-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
@@ -12,15 +12,9 @@
#include <vcl/FilterConfigItem.hxx>
#include <tools/stream.hxx>
#include <vcl/graph.hxx>
+#include <filter/MetReader.hxx>
-extern "C"
-{
- SAL_DLLPUBLIC_EXPORT bool SAL_CALL
- imeGraphicImport(SvStream & rStream, Graphic & rGraphic,
- FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
/* Implementation of Filters test */
@@ -51,17 +45,15 @@ bool MetFilterTest::load(const OUString &,
{
SvFileStream aFileStream(rURL, StreamMode::READ);
Graphic aGraphic;
- return imeGraphicImport(aFileStream, aGraphic, nullptr);
+ return ImportMetGraphic(aFileStream, aGraphic);
}
void MetFilterTest::testCVEs()
{
testDir(OUString(),
- m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/met/"));
+ m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/met/"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(MetFilterTest);
-CPPUNIT_PLUGIN_IMPLEMENT();
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index 6f9dd9bc13f6..a004e693641d 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -43,7 +43,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameLi
{
IMP_BMP, IMP_GIF, IMP_PNG, IMP_JPEG, IMP_XBM, IMP_XPM,
EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, IMP_TIFF, EXP_TIFF,
- IMP_TGA, IMP_PICT, nullptr
+ IMP_TGA, IMP_PICT, IMP_MET, nullptr
};
const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -229,7 +229,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
"jpg","2","SVEJPEG",
"mov","1","SVMOV",
"mov","2","SVMOV",
- "met","1","ime",
+ "met","1","SVMET",
"png","1","SVIPNG",
"png","2","SVEPNG",
"pct","1","SVPICT",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 210742388bd7..7b394dcd90b5 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -51,6 +51,7 @@
#include <filter/TiffWriter.hxx>
#include <filter/TgaReader.hxx>
#include <filter/PictReader.hxx>
+#include <filter/MetReader.hxx>
#include <osl/module.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/awt/Size.hpp>
@@ -643,7 +644,6 @@ ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const
extern "C" bool icdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool imeGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool ipbGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool ipdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
extern "C" bool ipsGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
@@ -661,8 +661,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("icdGraphicImport"));
else if (maFormatName == "idx")
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("idxGraphicImport"));
- else if (maFormatName == "ime")
- mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("imeGraphicImport"));
else if (maFormatName == "ipb")
mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipbGraphicImport"));
else if (maFormatName == "ipd")
@@ -678,8 +676,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
mpfnImport = icdGraphicImport;
else if (maFormatName == "idx")
mpfnImport = idxGraphicImport;
- else if (maFormatName == "ime")
- mpfnImport = imeGraphicImport;
else if (maFormatName == "ipb")
mpfnImport = ipbGraphicImport;
else if (maFormatName == "ipd")
@@ -1328,6 +1324,10 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
{
eLinkType = GfxLinkType::NativePct;
}
+ else if (aFilterName == IMP_MET)
+ {
+ eLinkType = GfxLinkType::NativeMet;
+ }
else
{
nStatus = ERRCODE_GRFILTER_FILTERERROR;
@@ -1355,15 +1355,6 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
if (!pFunc)
nStatus = ERRCODE_GRFILTER_FILTERERROR;
- else
- {
- OUString aShortName;
- if (nFormat != GRFILTER_FORMAT_DONTKNOW)
- aShortName = GetImportFormatShortName(nFormat).toAsciiUpperCase();
-
- if( aShortName.startsWith(MET_SHORTNAME))
- eLinkType = GfxLinkType::NativeMet;
- }
}
}
@@ -1424,7 +1415,7 @@ void GraphicFilter::preload()
sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFilterPath, ';');
ImpFilterLibCache& rCache = Cache::get();
static const std::initializer_list<std::u16string_view> aFilterNames = {
- u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipx", u"ira",
+ u"icd", u"idx", u"ipb", u"ipd", u"ips", u"ipx", u"ira",
};
// Load library for each filter.
@@ -1727,6 +1718,17 @@ ErrCode GraphicFilter::readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkT
return ERRCODE_GRFILTER_FILTERERROR;
}
+ErrCode GraphicFilter::readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType)
+{
+ if (ImportMetGraphic(rStream, rGraphic))
+ {
+ rLinkType = GfxLinkType::NativeMet;
+ return ERRCODE_NONE;
+ }
+ else
+ return ERRCODE_GRFILTER_FILTERERROR;
+}
+
ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream,
sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags,
const css::uno::Sequence< css::beans::PropertyValue >* /*pFilterData*/,
@@ -1848,6 +1850,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
{
nStatus = readPICT(rIStream, rGraphic, eLinkType);
}
+ else if (aFilterName.equalsIgnoreAsciiCase(IMP_MET))
+ {
+ nStatus = readMET(rIStream, rGraphic, eLinkType);
+ }
else
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
@@ -1888,15 +1894,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
}
if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem.get() ) )
nStatus = ERRCODE_GRFILTER_FORMATERROR;
- else
- {
- // try to set link type if format matches
- if( nFormat != GRFILTER_FORMAT_DONTKNOW )
- {
- if( aShortName.startsWith( MET_SHORTNAME ) )
- eLinkType = GfxLinkType::NativeMet;
- }
- }
}
}
}
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/vcl/source/filter/imet/ios2met.cxx
similarity index 99%
rename from filter/source/graphicfilter/ios2met/ios2met.cxx
rename to vcl/source/filter/imet/ios2met.cxx
index f17565ebd715..1d0b83ba1fb3 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -28,6 +28,7 @@
#include <vcl/virdev.hxx>
#include <vcl/lineinfo.hxx>
#include <vcl/gdimtf.hxx>
+#include <filter/MetReader.hxx>
#include <math.h>
#include <memory>
@@ -2786,8 +2787,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF
//================== GraphicImport - the exported function ================
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-imeGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportMetGraphic(SvStream & rStream, Graphic & rGraphic)
{
OS2METReader aOS2METReader;
GDIMetaFile aMTF;
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 443456299434..a3f5d1d3d4f7 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -45,6 +45,7 @@
#include <filter/TiffReader.hxx>
#include <filter/TgaReader.hxx>
#include <filter/PictReader.hxx>
+#include <filter/MetReader.hxx>
#include <osl/file.hxx>
#include <osl/module.hxx>
#include <tools/stream.hxx>
@@ -191,18 +192,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
}
else if (strcmp(argv[2], "met") == 0)
{
- static PFilterCall pfnImport(nullptr);
- if (!pfnImport)
- {
- osl::Module aLibrary;
- aLibrary.loadRelative(&thisModule, "libgielo.so");
- pfnImport = reinterpret_cast<PFilterCall>(
- aLibrary.getFunctionSymbol("imeGraphicImport"));
- aLibrary.release();
- }
Graphic aGraphic;
SvFileStream aFileStream(out, StreamMode::READ);
- ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+ ret = static_cast<int>(ImportMetGraphic(aFileStream, aGraphic));
}
else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0)
{
diff --git a/vcl/workben/metfuzzer.cxx b/vcl/workben/metfuzzer.cxx
index fd506432996e..acaaf9d1b3da 100644
--- a/vcl/workben/metfuzzer.cxx
+++ b/vcl/workben/metfuzzer.cxx
@@ -10,6 +10,7 @@
#include <tools/stream.hxx>
#include <vcl/FilterConfigItem.hxx>
#include "commonfuzzer.hxx"
+#include <filter/MetReader.hxx>
#include <config_features.h>
#include <osl/detail/component-mapping.h>
@@ -48,8 +49,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
return nullptr;
}
-extern "C" bool imeGraphicImport(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem);
-
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
{
TypicalFuzzerInitialize(argc, argv);
@@ -60,7 +59,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
Graphic aGraphic;
- (void)imeGraphicImport(aStream, aGraphic, nullptr);
+ (void)ImportMetGraphic(aStream, aGraphic);
return 0;
}
More information about the Libreoffice-commits
mailing list