summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2013-10-15 21:17:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-10-16 11:59:49 +0100
commit831e35610c91556567d5e0bc14a4125ebdc2ac35 (patch)
tree15b51b8d5b823f06c46c96483148fcfb9d1f025d
parent500822eeb46698c7317f57de72b2489d98042374 (diff)
Resolves: #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: - instead of compareToAscii, use operator==, which is optimized for performance (cherry picked from commit a17e221225915c140c7840904cb9b46d75731edc) Conflicts: cui/source/options/optsave.cxx Change-Id: Ifffd2b9014210c885f03ff8116ea97625b903cba
-rw-r--r--cui/source/options/optsave.cxx27
1 files changed, 16 insertions, 11 deletions
diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 31a164d58ca5..ce66f0960051 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -519,24 +519,29 @@ IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
return 0;
}
-static OUString lcl_ExtracUIName(const Sequence<PropertyValue> rProperties)
+static OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties)
{
- OUString sRet;
- 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 == "UIName")
{
- if ( pProperties[nProp].Value >>= sRet )
- break;
+ OUString sUIName;
+ if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
+ return sUIName;
}
- else if(!pProperties[nProp].Name.compareToAscii("Name"))
+ else if (rName == "Name")
{
- if ( !sRet.getLength() )
- pProperties[nProp].Value >>= sRet;
+ pPropVal->Value >>= sName;
}
}
- return sRet;
+
+ OSL_ENSURE( false, "Filter without UIName!" );
+
+ return sName;
}
IMPL_LINK( SfxSaveTabPage, FilterHdl_Impl, ListBox *, pBox )