summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-28 11:15:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-29 09:00:52 +0200
commit6dbae37b8d2d2d1ecad85c772fd684803b5a52cb (patch)
treecb6637327913a5f9641c2c0065de4c6a00983947 /comphelper
parentdc06c8f4989fc28d0c31ebd333e53dfe0e0f5f66 (diff)
loplugin:constantparam (1)
Change-Id: I25077e391ecca1b678062d261a83d88daadf0a58 Reviewed-on: https://gerrit.libreoffice.org/59701 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/sequence.cxx49
1 files changed, 7 insertions, 42 deletions
diff --git a/comphelper/source/misc/sequence.cxx b/comphelper/source/misc/sequence.cxx
index 9236ee7d9bb6..81079de2223c 100644
--- a/comphelper/source/misc/sequence.cxx
+++ b/comphelper/source/misc/sequence.cxx
@@ -21,56 +21,21 @@
namespace comphelper
{
-css::uno::Sequence<sal_Int16> findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue, bool _bOnlyFirst)
+sal_Int32 findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue)
{
sal_Int32 nLength = _rList.getLength();
- if( _bOnlyFirst )
+ // at which position do I find the value?
+ const OUString* pTArray = _rList.getConstArray();
+ for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray)
{
- // at which position do I find the value?
- sal_Int32 nPos = -1;
- const OUString* pTArray = _rList.getConstArray();
- for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray)
+ if( *pTArray == _rValue )
{
- if( *pTArray == _rValue )
- {
- nPos = i;
- break;
- }
+ return i;
}
-
- // fill sequence
- if( nPos>-1 )
- {
- css::uno::Sequence<sal_Int16> aRetSeq( 1 );
- aRetSeq.getArray()[0] = static_cast<sal_Int16>(nPos);
-
- return aRetSeq;
- }
-
- return css::uno::Sequence<sal_Int16>();
-
}
- else
- {
- css::uno::Sequence<sal_Int16> aRetSeq( nLength );
- sal_Int16* pReturn = aRetSeq.getArray();
-
- // how often does the value occur?
- const OUString* pTArray = _rList.getConstArray();
- for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray)
- {
- if( *pTArray == _rValue )
- {
- *pReturn = static_cast<sal_Int16>(i);
- ++pReturn;
- }
- }
-
- aRetSeq.realloc(pReturn - aRetSeq.getArray());
- return aRetSeq;
- }
+ return -1;
}
} // namespace comphelper