[Libreoffice-commits] core.git: oox/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Jun 2 09:41:36 UTC 2017


 oox/source/core/xmlfilterbase.cxx |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

New commits:
commit 4bd4a922298c170fad2f90ff9e1e1344fdc51ad7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jun 2 09:34:11 2017 +0200

    oox: clean up lclHasSuffix() and its copy&pasted version
    
    These were added before rtl::OUString::endsWith() was introduced.
    
    Change-Id: Ia8ee94c58429b3c5981d4f180d944aefe8cb0201
    Reviewed-on: https://gerrit.libreoffice.org/38339
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 04e58ab6f0af..19f06ffcda85 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -88,12 +88,6 @@ using ::sax_fastparser::FastSerializerHelper;
 
 namespace {
 
-bool lclHasSuffix( const OUString& rFragmentPath, const OUString& rSuffix )
-{
-    sal_Int32 nSuffixPos = rFragmentPath.getLength() - rSuffix.getLength();
-    return (nSuffixPos >= 0) && rFragmentPath.match( rSuffix, nSuffixPos );
-}
-
 struct NamespaceIds: public rtl::StaticWithInit<
     Sequence< beans::Pair< OUString, sal_Int32 > >,
     NamespaceIds>
@@ -315,7 +309,7 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan
         return false;
 
     // try to import binary streams (fragment extension must be '.bin')
-    if( lclHasSuffix( aFragmentPath, mxImpl->maBinSuffix ) )
+    if (aFragmentPath.endsWith(mxImpl->maBinSuffix))
     {
         try
         {
@@ -387,8 +381,7 @@ Reference<XDocument> XmlFilterBase::importFragment( const OUString& aFragmentPat
         return xRet;
 
     // binary streams (fragment extension is '.bin') currently not supported
-    sal_Int32 nBinSuffixPos = aFragmentPath.getLength() - mxImpl->maBinSuffix.getLength();
-    if( (nBinSuffixPos >= 0) && aFragmentPath.match( mxImpl->maBinSuffix, nBinSuffixPos ) )
+    if (aFragmentPath.endsWith(mxImpl->maBinSuffix))
         return xRet;
 
     // try to import XML stream


More information about the Libreoffice-commits mailing list