filter/source/graphic/GraphicExportFilter.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
New commits: commit 5d1bfa6586bad79f2ab9279bcecfee9c245d4501 Author: Eike Rathke <er...@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 <er...@redhat.com> Tested-by: Eike Rathke <er...@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" ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits