You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2013/10/15 23:17:30 UTC

svn commit: r1532536 - /openoffice/trunk/main/cui/source/options/optsave.cxx

Author: arielch
Date: Tue Oct 15 21:17:30 2013
New Revision: 1532536

URL: http://svn.apache.org/r1532536
Log:
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

Modified:
    openoffice/trunk/main/cui/source/options/optsave.cxx

Modified: openoffice/trunk/main/cui/source/options/optsave.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/cui/source/options/optsave.cxx?rev=1532536&r1=1532535&r2=1532536&view=diff
==============================================================================
--- openoffice/trunk/main/cui/source/options/optsave.cxx (original)
+++ openoffice/trunk/main/cui/source/options/optsave.cxx Tue Oct 15 21:17:30 2013
@@ -655,32 +655,29 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_
 /* -----------------------------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--------------------------------