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

Matteo Casalin (via logerrit) logerrit at kemper.freedesktop.org
Sat Apr 6 21:44:02 UTC 2019


 framework/source/layoutmanager/helpers.cxx |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

New commits:
commit 63497d3a60dfb045cafd6db9ce89c4bff0dc8507
Author:     Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Wed Feb 27 08:08:53 2019 +0100
Commit:     Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Sat Apr 6 23:43:41 2019 +0200

    Simplify: avoid OUString copy() and get just needed tokens
    
    Change-Id: I708f222e408223cfaeaac56f87d68375f1d0503f
    Reviewed-on: https://gerrit.libreoffice.org/69237
    Tested-by: Jenkins
    Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>

diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx
index a5e4762f2e8b..7659be20cf04 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -197,11 +197,8 @@ OUString getElementTypeFromResourceURL( const OUString& aResourceURL )
     OUString aUIResourceURL( UIRESOURCE_URL );
     if ( aResourceURL.startsWith( aUIResourceURL ) )
     {
-        sal_Int32       nIndex = 0;
-        OUString aPathPart   = aResourceURL.copy( aUIResourceURL.getLength() );
-        aPathPart.getToken( 0, '/', nIndex );
-
-        return aPathPart.getToken( 0, '/', nIndex );
+        sal_Int32 nIndex{ aUIResourceURL.getLength() };
+        return aResourceURL.getToken( 1, '/', nIndex );
     }
 
     return OUString();
@@ -212,12 +209,9 @@ void parseResourceURL( const OUString& aResourceURL, OUString& aElementType, OUS
     OUString aUIResourceURL( UIRESOURCE_URL );
     if ( aResourceURL.startsWith( aUIResourceURL ) )
     {
-        sal_Int32       nIndex = 0;
-        OUString aPathPart   = aResourceURL.copy( aUIResourceURL.getLength() );
-        aPathPart.getToken( 0, '/', nIndex );
-
-        aElementType = aPathPart.getToken( 0, '/', nIndex );
-        aElementName = aPathPart.getToken( 0, '/', nIndex );
+        sal_Int32 nIndex{ aUIResourceURL.getLength() };
+        aElementType = aResourceURL.getToken( 1, '/', nIndex );
+        aElementName = aResourceURL.getToken( 0, '/', nIndex );
     }
 }
 


More information about the Libreoffice-commits mailing list