summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforlist.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index c1d45cc9bd60..0c1e28661fb8 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -4290,12 +4290,16 @@ void SvNumberFormatter::ImpInitCurrencyTable()
}
-static void addToCurrencyFormatsList( NfWSStringsDtor& rStrArr, const OUString& rFormat )
+static std::ptrdiff_t addToCurrencyFormatsList( NfWSStringsDtor& rStrArr, const OUString& rFormat )
{
// Prevent duplicates even over subsequent calls of
// GetCurrencyFormatStrings() with the same vector.
- if (std::find( rStrArr.begin(), rStrArr.end(), rFormat) == rStrArr.end())
- rStrArr.push_back( rFormat);
+ NfWSStringsDtor::const_iterator it( std::find( rStrArr.begin(), rStrArr.end(), rFormat));
+ if (it != rStrArr.end())
+ return it - rStrArr.begin();
+
+ rStrArr.push_back( rFormat);
+ return rStrArr.size() - 1;
}
@@ -4324,9 +4328,7 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
+ ";"
+ aRed
+ aNegativeBank;
- addToCurrencyFormatsList( rStrArr, format2);
-
- nDefault = rStrArr.size() - 1;
+ nDefault = addToCurrencyFormatsList( rStrArr, format2);
}
else
{
@@ -4379,8 +4381,7 @@ sal_uInt16 SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr
{
addToCurrencyFormatsList( rStrArr, format3);
}
- addToCurrencyFormatsList( rStrArr, format4);
- nDefault = rStrArr.size() - 1;
+ nDefault = addToCurrencyFormatsList( rStrArr, format4);
if (rCurr.GetDigits())
{
addToCurrencyFormatsList( rStrArr, format5);