[Libreoffice-commits] core.git: filter/source
Eike Rathke
erack at redhat.com
Fri Sep 22 20:57:31 UTC 2017
filter/source/graphic/GraphicExportFilter.cxx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 5d1bfa6586bad79f2ab9279bcecfee9c245d4501
Author: Eike Rathke <erack at redhat.com>
Date: Fri Sep 22 17:06:42 2017 +0200
Apply replaceFirst() only once
It's unnecessary to call if a replacement was already done and might
even harm, though unlikely. (e.g. file extension "web")
Change-Id: I6615c9a31178770429b523e0ee878661f1b2b6e8
Reviewed-on: https://gerrit.libreoffice.org/42667
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/filter/source/graphic/GraphicExportFilter.cxx b/filter/source/graphic/GraphicExportFilter.cxx
index ab7fb6d1ad97..b2569879fe19 100644
--- a/filter/source/graphic/GraphicExportFilter.cxx
+++ b/filter/source/graphic/GraphicExportFilter.cxx
@@ -48,11 +48,16 @@ void GraphicExportFilter::gatherProperties( const uno::Sequence< beans::Property
if ( aProperty.Name == "FilterName" )
{
aProperty.Value >>= aInternalFilterName;
- aInternalFilterName = aInternalFilterName.replaceFirst("draw_", "");
- aInternalFilterName = aInternalFilterName.replaceFirst("impress_", "");
+ const sal_Int32 nLen = aInternalFilterName.getLength();
aInternalFilterName = aInternalFilterName.replaceFirst("calc_", "");
- aInternalFilterName = aInternalFilterName.replaceFirst("writer_", "");
- aInternalFilterName = aInternalFilterName.replaceFirst("web_", "");
+ if (aInternalFilterName.getLength() == nLen)
+ aInternalFilterName = aInternalFilterName.replaceFirst("writer_", "");
+ if (aInternalFilterName.getLength() == nLen)
+ aInternalFilterName = aInternalFilterName.replaceFirst("web_", "");
+ if (aInternalFilterName.getLength() == nLen)
+ aInternalFilterName = aInternalFilterName.replaceFirst("draw_", "");
+ if (aInternalFilterName.getLength() == nLen)
+ aInternalFilterName = aInternalFilterName.replaceFirst("impress_", "");
}
else if ( aProperty.Name == "FilterData" )
{
More information about the Libreoffice-commits
mailing list