diff options
author | Eike Rathke <erack@redhat.com> | 2017-09-22 17:06:42 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-09-22 22:56:57 +0200 |
commit | 5d1bfa6586bad79f2ab9279bcecfee9c245d4501 (patch) | |
tree | fe3540ceec2db5dd04398226058819102f56f8cb /filter/source/graphic | |
parent | 4abe446536e13eb5860e67e4b0f0b3b5b1661782 (diff) |
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@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'filter/source/graphic')
-rw-r--r-- | filter/source/graphic/GraphicExportFilter.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
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" ) { |