vcl/source/filter/graphicfilter.cxx | 7 +++--- vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx | 33 +++++++++++++++++++------------ 2 files changed, 25 insertions(+), 15 deletions(-)
New commits: commit b44167edcbdb94b471da5d6ef390edfa1bf4fe36 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed May 30 20:37:20 2018 +0200 Try harder to find a matching file extension Potential regression from 2a39163aef4211c9d19cb1faee7f55d3718355b6 Change-Id: I67f1f11bd52a1dbf0f77a35df7ad556437ccd39b (cherry picked from commit 3c78a19ed66b44ebb2db7b160fa92a010a3c42aa) Reviewed-on: https://gerrit.libreoffice.org/55889 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx index a222d603270c..e4f5ac395b8d 100644 --- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx @@ -705,23 +705,32 @@ namespace bool lcl_matchFilter( const rtl::OUString& rFilter, const rtl::OUString& rExt ) { - const sal_Int32 nBegin = rFilter.indexOf(rExt); + const sal_Unicode cSep {';'}; + sal_Int32 nIdx {0}; - if (nBegin<0) // not found - return false; + for (;;) + { + const sal_Int32 nBegin = rFilter.indexOf(rExt, nIdx); - const sal_Unicode cSep{';'}; + if (nBegin<0) // not found + break; - // Check if the found occurrence is an exact match: left side - if (nBegin>0 && rFilter[nBegin-1]!=cSep) - return false; + // Let nIdx point to end of matched string, useful in order to + // check string boundaries and also for a possible next iteration + nIdx = nBegin + rExt.getLength(); - // Check if the found occurrence is an exact match: right side - const sal_Int32 nEnd = nBegin + rExt.getLength(); - if (nEnd<rFilter.getLength() && rFilter[nEnd]!=cSep) - return false; + // Check if the found occurrence is an exact match: right side + if (nIdx<rFilter.getLength() && rFilter[nIdx]!=cSep) + continue; - return true; + // Check if the found occurrence is an exact match: left side + if (nBegin>0 && rFilter[nBegin-1]!=cSep) + continue; + + return true; + } + + return false; } } commit 133a56d75d77275fd9a0dcc08e759be14adc523f Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Wed May 30 20:49:22 2018 +0200 Improve 1a2ee0ecd5b0cff52922c1d261f7d03a57a52ca0 Change-Id: I50f369f28c3b97ba7fed494cb238b7756920abc6 (cherry picked from commit 91b5e86d5ef1318bd894b1fc3b537fb4615673da) Reviewed-on: https://gerrit.libreoffice.org/55890 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 6e37dd6d3ff1..870c5586ea82 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -2439,8 +2439,9 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else { - sal_Int32 nIdx{0}; - do { + sal_Int32 nIdx {aFilterPath.isEmpty() ? -1 : 0}; + while (nIdx>=0) + { #ifndef DISABLE_DYNLOADING OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(0, ';', nIdx), aFilterName ) ); osl::Module aLibrary( aPhysicalName ); @@ -2471,7 +2472,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r } else nStatus = ERRCODE_GRFILTER_FILTERERROR; - } while (nIdx>=0); + } } } if( nStatus != ERRCODE_NONE ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits