[Libreoffice-commits] core.git: filter/CppunitTest_filter_pcx_test.mk filter/CppunitTest_filter_ras_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:03:02 UTC 2021


 filter/CppunitTest_filter_pcx_test.mk                                |   38 ----------
 filter/CppunitTest_filter_ras_test.mk                                |   38 ----------
 filter/Library_gie.mk                                                |    2 
 filter/Module_filter.mk                                              |    2 
 filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu |   21 ++---
 filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu |   21 ++---
 include/vcl/graphicfilter.hxx                                        |    4 +
 solenv/clang-format/excludelist                                      |   12 +--
 vcl/CppunitTest_vcl_filters_test.mk                                  |    6 +
 vcl/Library_vcl.mk                                                   |    2 
 vcl/inc/filter/PcxReader.hxx                                         |   26 ++++++
 vcl/inc/filter/RasReader.hxx                                         |   26 ++++++
 vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx                    |   18 +---
 vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx                    |   18 +---
 vcl/source/filter/FilterConfigCache.cxx                              |   12 +--
 vcl/source/filter/graphicfilter.cxx                                  |   38 +++++++---
 vcl/source/filter/ipcx/ipcx.cxx                                      |    4 -
 vcl/source/filter/iras/iras.cxx                                      |    4 -
 vcl/workben/fftester.cxx                                             |   24 +-----
 vcl/workben/pcxfuzzer.cxx                                            |    5 -
 vcl/workben/rasfuzzer.cxx                                            |    5 -
 21 files changed, 146 insertions(+), 180 deletions(-)

New commits:
commit 1093c21ed9736368ecfb8f5c7935db31256671f0
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Feb 14 23:20:28 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Feb 17 04:02:13 2021 +0100

    Move RAS and PCX reader from filter module into VCL
    
    Change-Id: Id846abf257b598489a59ebf9b62b19840a950322
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111015
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/filter/CppunitTest_filter_pcx_test.mk b/filter/CppunitTest_filter_pcx_test.mk
deleted file mode 100644
index 12334d75ad42..000000000000
--- a/filter/CppunitTest_filter_pcx_test.mk
+++ /dev/null
@@ -1,38 +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_pcx_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_pcx_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_pcx_test, \
-    filter/qa/cppunit/filters-pcx-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_pcx_test, \
-    gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_pcx_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_pcx_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_pcx_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_pcx_test,\
-    configmgr/source/configmgr \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_pcx_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/CppunitTest_filter_ras_test.mk b/filter/CppunitTest_filter_ras_test.mk
deleted file mode 100644
index 50f6852a7b2b..000000000000
--- a/filter/CppunitTest_filter_ras_test.mk
+++ /dev/null
@@ -1,38 +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_ras_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_ras_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_ras_test, \
-    filter/qa/cppunit/filters-ras-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_ras_test, \
-    gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_ras_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_ras_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_ras_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_ras_test,\
-    configmgr/source/configmgr \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_ras_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 73120a524ac3..54a1e1fb00db 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -52,8 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/egif/egif \
     filter/source/graphicfilter/eps/eps \
     filter/source/graphicfilter/egif/giflzwc \
-    filter/source/graphicfilter/ipcx/ipcx \
-    filter/source/graphicfilter/iras/iras \
     filter/source/graphicfilter/ieps/ieps \
     filter/source/graphicfilter/ipsd/ipsd \
     filter/source/graphicfilter/ipbm/ipbm \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 36ba307c12fb..548e6f27c690 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -58,10 +58,8 @@ $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_dxf_test \
     CppunitTest_filter_eps_test \
     CppunitTest_filter_pcd_test \
-    CppunitTest_filter_pcx_test \
     CppunitTest_filter_ppm_test \
     CppunitTest_filter_psd_test \
-    CppunitTest_filter_ras_test \
     CppunitTest_filter_svg \
 ))
 endif
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu
index 4f8eb67340e4..da49344d4e60 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pcx_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="pcx_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>pcx_Zsoft_Paintbrush</value></prop>
-        <prop oor:name="FormatName"><value>ipx</value></prop>
-        <prop oor:name="RealFilterName"><value>PCX - Zsoft Paintbrush</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PCX - Zsoft Paintbrush</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pcx_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>pcx_Zsoft_Paintbrush</value></prop>
+    <prop oor:name="FormatName"><value>SVPCX</value></prop>
+    <prop oor:name="RealFilterName"><value>PCX - Zsoft Paintbrush</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PCX - Zsoft Paintbrush</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu
index 95108022b03a..7e9a3b2bbc07 100644
--- a/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/ras_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="ras_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
-        <prop oor:name="FormatName"><value>ira</value></prop>
-        <prop oor:name="RealFilterName"><value>RAS - Sun Rasterfile</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">RAS - Sun Raster Image</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="ras_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+    <prop oor:name="FormatName"><value>SVRAS</value></prop>
+    <prop oor:name="RealFilterName"><value>RAS - Sun Rasterfile</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">RAS - Sun Raster Image</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 3e7ebd385827..17632d2759a4 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -82,6 +82,8 @@ namespace o3tl
 #define IMP_TGA                 "SVTGA"
 #define IMP_PICT                "SVPICT"
 #define IMP_MET                 "SVMET"
+#define IMP_RAS                 "SVRAS"
+#define IMP_PCX                 "SVPCX"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -366,6 +368,8 @@ public:
     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);
+    static ErrCode readRAS(SvStream & rStream, Graphic & rGraphic);
+    static ErrCode readPCX(SvStream & rStream, Graphic & rGraphic);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 7705f0281316..5b288d1687b7 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3900,10 +3900,8 @@ filter/inc/strings.hxx
 filter/qa/cppunit/filters-dxf-test.cxx
 filter/qa/cppunit/filters-eps-test.cxx
 filter/qa/cppunit/filters-pcd-test.cxx
-filter/qa/cppunit/filters-pcx-test.cxx
 filter/qa/cppunit/filters-ppm-test.cxx
 filter/qa/cppunit/filters-psd-test.cxx
-filter/qa/cppunit/filters-ras-test.cxx
 filter/qa/cppunit/msfilter-test.cxx
 filter/qa/cppunit/priority-test.cxx
 filter/qa/cppunit/xslt-test.cxx
@@ -3973,9 +3971,7 @@ filter/source/graphicfilter/idxf/idxf.cxx
 filter/source/graphicfilter/ieps/ieps.cxx
 filter/source/graphicfilter/ipbm/ipbm.cxx
 filter/source/graphicfilter/ipcd/ipcd.cxx
-filter/source/graphicfilter/ipcx/ipcx.cxx
 filter/source/graphicfilter/ipsd/ipsd.cxx
-filter/source/graphicfilter/iras/iras.cxx
 filter/source/msfilter/countryid.cxx
 filter/source/msfilter/dffpropset.cxx
 filter/source/msfilter/escherex.cxx
@@ -14819,10 +14815,12 @@ vcl/qa/cppunit/dndtest.cxx
 vcl/qa/cppunit/errorhandler.cxx
 vcl/qa/cppunit/font.cxx
 vcl/qa/cppunit/fontmetric.cxx
+vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-ras-test.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,9 +14930,11 @@ 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/ipcx/ipcx.cxx
 vcl/source/filter/ipict/ipict.cxx
 vcl/source/filter/ipict/shape.cxx
 vcl/source/filter/ipict/shape.hxx
+vcl/source/filter/iras/iras.cxx
 vcl/source/filter/ixbm/xbmread.cxx
 vcl/source/filter/ixpm/rgbtable.hxx
 vcl/source/filter/ixpm/xpmread.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index b643a2580791..87a5da8e9284 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -10,11 +10,13 @@
 $(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
+    vcl/qa/cppunit/graphicfilter/filters-met-test \
+    vcl/qa/cppunit/graphicfilter/filters-pcx-test \
+    vcl/qa/cppunit/graphicfilter/filters-pict-test \
+    vcl/qa/cppunit/graphicfilter/filters-ras-test \
     vcl/qa/cppunit/graphicfilter/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 a5e624f80c0a..08815ddc95e1 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -438,10 +438,12 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
     vcl/source/filter/imet/ios2met \
+    vcl/source/filter/ipcx/ipcx \
     vcl/source/filter/ipict/ipict \
     vcl/source/filter/ipict/shape \
     vcl/source/filter/ipdf/pdfread \
     vcl/source/filter/ipdf/pdfdocument \
+    vcl/source/filter/iras/iras \
     vcl/source/filter/itga/itga \
     vcl/source/filter/itiff/ccidecom \
     vcl/source/filter/itiff/itiff \
diff --git a/vcl/inc/filter/PcxReader.hxx b/vcl/inc/filter/PcxReader.hxx
new file mode 100644
index 000000000000..73e182c62895
--- /dev/null
+++ b/vcl/inc/filter/PcxReader.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 ImportPcxGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/filter/RasReader.hxx b/vcl/inc/filter/RasReader.hxx
new file mode 100644
index 000000000000..ea658cb317c0
--- /dev/null
+++ b/vcl/inc/filter/RasReader.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 ImportRasGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/pcx/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/.gitignore
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-1.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-2.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-2.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-2.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-2.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-3.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-3.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-3.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-3.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2008-1097-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2008-1097-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2008-1097-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2008-1097-1.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/hang-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/hang-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/hang-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/hang-1.pcx
diff --git a/filter/qa/cppunit/data/pcx/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcx/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcx/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcx/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/pcx/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcx/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcx/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcx/pass/.gitignore
diff --git a/filter/qa/cppunit/data/pcx/pass/rhbz469075-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/pass/rhbz469075-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/pass/rhbz469075-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/pass/rhbz469075-1.pcx
diff --git a/filter/qa/cppunit/data/ras/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ras/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/.gitignore
diff --git a/filter/qa/cppunit/data/ras/fail/CVE-2007-2356-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2007-2356-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/CVE-2007-2356-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2007-2356-1.ras
diff --git a/filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2008-1097-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2008-1097-1.ras
diff --git a/filter/qa/cppunit/data/ras/fail/crash-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/crash-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/crash-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/crash-1.ras
diff --git a/filter/qa/cppunit/data/ras/fail/hang-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/hang-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/hang-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/hang-1.ras
diff --git a/filter/qa/cppunit/data/ras/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ras/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ras/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ras/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/ras/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ras/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ras/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ras/pass/.gitignore
diff --git a/filter/qa/cppunit/data/ras/pass/marbles.ras b/vcl/qa/cppunit/graphicfilter/data/ras/pass/marbles.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/pass/marbles.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/pass/marbles.ras
diff --git a/filter/qa/cppunit/filters-pcx-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-pcx-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
index 3a28e24626fa..5297631517da 100644
--- a/filter/qa/cppunit/filters-pcx-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/PcxReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        ipxGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,17 @@ bool PcxFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return ipxGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportPcxGraphic(aFileStream, aGraphic);
 }
 
 void PcxFilterTest::testCVEs()
 {
+#ifndef DISABLE_CVE_TESTS
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/pcx/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/pcx/"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(PcxFilterTest);
 
-CPPUNIT_PLUGIN_IMPLEMENT();
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/filters-ras-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-ras-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
index 2f3b678e4e0a..d986c7d0dbf1 100644
--- a/filter/qa/cppunit/filters-ras-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/RasReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        iraGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,17 @@ bool RasFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return iraGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportRasGraphic(aFileStream, aGraphic);
 }
 
 void RasFilterTest::testCVEs()
 {
+#ifndef DISABLE_CVE_TESTS
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/ras/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/ras/"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(RasFilterTest);
 
-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 a004e693641d..2263c36b6dbe 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, IMP_MET, nullptr
+    IMP_TGA, IMP_PICT, IMP_MET, IMP_RAS, IMP_PCX, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -54,8 +54,8 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
 
 const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
 {
-    "egi", "icd", "ipd", "ipx", "ipb", "epb", "epg",
-    "epp", "ira", "era", "exp", nullptr
+    "egi", "icd", "ipd", "ipb", "epb", "epg",
+    "epp", nullptr
 };
 
 void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
@@ -235,12 +235,11 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "pct","1","SVPICT",
     "pcd","1","icd",
     "psd","1","ipd",
-    "pcx","1","ipx",
+    "pcx","1","SVPCX",
     "pbm","1","ipb",
     "pgm","1","ipb",
     "ppm","1","ipb",
-    "ras","1","ira",
-    "ras","2","era",
+    "ras","1","SVRAS",
     "svm","1","SVMETAFILE",
     "svm","2","SVMETAFILE",
     "tga","1","SVTGA",
@@ -252,7 +251,6 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "wmf","2","SVWMF",
     "xbm","1","SVIXBM",
     "xpm","1","SVIXPM",
-    "xpm","2","exp",
     "svg","1","SVISVG",
     "svg","2","SVESVG",
     nullptr
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 7b394dcd90b5..e80291e6a3e0 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -52,6 +52,8 @@
 #include <filter/TgaReader.hxx>
 #include <filter/PictReader.hxx>
 #include <filter/MetReader.hxx>
+#include <filter/RasReader.hxx>
+#include <filter/PcxReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -647,8 +649,6 @@ extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterCo
 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 );
-extern "C" bool ipxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool iraGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 
 #endif
 
@@ -667,10 +667,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipdGraphicImport"));
         else if (maFormatName == "ips")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipsGraphicImport"));
-        else if (maFormatName == "ipx")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipxGraphicImport"));
-        else if (maFormatName == "ira")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("iraGraphicImport"));
  #else
         if (maFormatName ==  "icd")
             mpfnImport = icdGraphicImport;
@@ -682,10 +678,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = ipdGraphicImport;
         else if (maFormatName ==  "ips")
             mpfnImport = ipsGraphicImport;
-        else if (maFormatName ==  "ipx")
-            mpfnImport = ipxGraphicImport;
-        else if (maFormatName ==  "ira")
-            mpfnImport = iraGraphicImport;
  #endif
     }
 
@@ -1415,7 +1407,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"ipb", u"ipd", u"ips", u"ipx", u"ira",
+        u"icd", u"idx", u"ipb", u"ipd", u"ips",
     };
 
     // Load library for each filter.
@@ -1729,6 +1721,22 @@ ErrCode GraphicFilter::readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkTy
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readRAS(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportRasGraphic(rStream, rGraphic))
+        return ERRCODE_NONE;
+    else
+        return ERRCODE_GRFILTER_FILTERERROR;
+}
+
+ErrCode GraphicFilter::readPCX(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportPcxGraphic(rStream, rGraphic))
+        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*/,
@@ -1854,6 +1862,14 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readMET(rIStream, rGraphic, eLinkType);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_RAS))
+        {
+            nStatus = readRAS(rIStream, rGraphic);
+        }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_PCX))
+        {
+            nStatus = readPCX(rIStream, rGraphic);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/vcl/source/filter/ipcx/ipcx.cxx
similarity index 99%
rename from filter/source/graphicfilter/ipcx/ipcx.cxx
rename to vcl/source/filter/ipcx/ipcx.cxx
index 67cbc947fefc..413ba95f4256 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/vcl/source/filter/ipcx/ipcx.cxx
@@ -22,6 +22,7 @@
 #include <vcl/graph.hxx>
 #include <vcl/BitmapTools.hxx>
 #include <tools/stream.hxx>
+#include <filter/PcxReader.hxx>
 
 class FilterConfigItem;
 
@@ -398,8 +399,7 @@ void PCXReader::ImplReadPalette( unsigned int nCol )
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-ipxGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportPcxGraphic(SvStream & rStream, Graphic & rGraphic)
 {
     PCXReader aPCXReader(rStream);
     bool bRetValue = aPCXReader.ReadPCX(rGraphic);
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/vcl/source/filter/iras/iras.cxx
similarity index 99%
rename from filter/source/graphicfilter/iras/iras.cxx
rename to vcl/source/filter/iras/iras.cxx
index 5205d6253e22..415e3224d6fb 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/vcl/source/filter/iras/iras.cxx
@@ -22,6 +22,7 @@
 #include <vcl/BitmapTools.hxx>
 #include <sal/log.hxx>
 #include <tools/stream.hxx>
+#include <filter/RasReader.hxx>
 
 class FilterConfigItem;
 
@@ -394,8 +395,7 @@ sal_uInt8 RASReader::ImplGetByte()
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-iraGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportRasGraphic( SvStream & rStream, Graphic & rGraphic)
 {
     bool bRet = false;
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index a3f5d1d3d4f7..893565e457d3 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -46,6 +46,8 @@
 #include <filter/TgaReader.hxx>
 #include <filter/PictReader.hxx>
 #include <filter/MetReader.hxx>
+#include <filter/RasReader.hxx>
+#include <filter/PcxReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -249,33 +251,15 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if (strcmp(argv[2], "pcx") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("ipxGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportPcxGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "ras") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("iraGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportRasGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "tga") == 0)
         {
diff --git a/vcl/workben/pcxfuzzer.cxx b/vcl/workben/pcxfuzzer.cxx
index e2b72fb7e765..2785cf4c4eec 100644
--- a/vcl/workben/pcxfuzzer.cxx
+++ b/vcl/workben/pcxfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/PcxReader.hxx>
 
 #include <config_features.h>
 #include <osl/detail/component-mapping.h>
@@ -39,8 +40,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
     return nullptr;
 }
 
-extern "C" bool ipxGraphicImport(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem);
-
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
     TypicalFuzzerInitialize(argc, argv);
@@ -51,7 +50,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)ipxGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportPcxGraphic(aStream, aGraphic);
     return 0;
 }
 
diff --git a/vcl/workben/rasfuzzer.cxx b/vcl/workben/rasfuzzer.cxx
index 734180b5998b..84678eace5be 100644
--- a/vcl/workben/rasfuzzer.cxx
+++ b/vcl/workben/rasfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/RasReader.hxx>
 
 #include <config_features.h>
 #include <osl/detail/component-mapping.h>
@@ -39,8 +40,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
     return nullptr;
 }
 
-extern "C" bool iraGraphicImport(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem);
-
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
     TypicalFuzzerInitialize(argc, argv);
@@ -51,7 +50,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)iraGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportRasGraphic(aStream, aGraphic);
     return 0;
 }
 


More information about the Libreoffice-commits mailing list