[Libreoffice-commits] core.git: Branch 'aoo/trunk' - cui/source

Ariel Constenla-Haile arielch at apache.org
Tue Oct 15 15:08:16 PDT 2013


 cui/source/options/optsave.cxx |   35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

New commits:
commit a17e221225915c140c7840904cb9b46d75731edc
Author: Ariel Constenla-Haile <arielch at apache.org>
Date:   Tue Oct 15 21:17:30 2013 +0000

    i122759 - Pass the Sequence by reference
    
    Despite it's name, rProperties, the Sequence is not a reference in the
    function signature.
    
    Besides, some small improvements:
    
    - remove the unused code related to the "Flags"
    - instead of compareToAscii, use equalsAsciiL, which is  optimized for
    performance

diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index a67b864..99d58e6 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -655,32 +655,29 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
 /* -----------------------------05.04.01 13:10--------------------------------
 
  ---------------------------------------------------------------------------*/
-OUString lcl_ExtracUIName(const Sequence<PropertyValue> rProperties)
+OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties)
 {
-    OUString sRet;
-    sal_Int32 nFlags;
-    const PropertyValue* pProperties = rProperties.getConstArray();
-    for(int nProp = 0; nProp < rProperties.getLength(); nProp++)
+    OUString sName;
+    const PropertyValue* pPropVal = rProperties.getConstArray();
+    const PropertyValue* const pEnd = pPropVal + rProperties.getLength();
+    for( ; pPropVal != pEnd; pPropVal++ )
     {
-        if(!pProperties[nProp].Name.compareToAscii("UIName"))
+        const OUString &rName = pPropVal->Name;
+        if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UIName" ) ) )
         {
-            if ( pProperties[nProp].Value >>= sRet )
-                break;
+            OUString sUIName;
+            if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
+                return sUIName;
         }
-        else if(!pProperties[nProp].Name.compareToAscii("Flags"))
+        else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ) ) )
         {
-            if ( pProperties[nProp].Value >>= nFlags )
-            {
-                nFlags &= 0x100;
-            }
-        }
-        else if(!pProperties[nProp].Name.compareToAscii("Name"))
-        {
-            if ( !sRet.getLength() )
-                pProperties[nProp].Value >>= sRet;
+            pPropVal->Value >>= sName;
         }
     }
-    return sRet;
+
+    OSL_ENSURE( false, "Filter without UIName!" );
+
+    return sName;
 }
 /* -----------------------------05.04.01 13:37--------------------------------
 


More information about the Libreoffice-commits mailing list