From a17e221225915c140c7840904cb9b46d75731edc Mon Sep 17 00:00:00 2001 From: Ariel Constenla-Haile Date: Tue, 15 Oct 2013 21:17:30 +0000 Subject: 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 --- cui/source/options/optsave.cxx | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index a67b864b75a2..99d58e6be460 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 rProperties) +OUString lcl_ExtracUIName(const Sequence &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-------------------------------- -- cgit v1.2.3