Kaydet (Commit) 85d1b74f authored tarafından Eike Rathke's avatar Eike Rathke

eliminate xub_StrLen left-over

Change-Id: I4862481d69ac86bf082e35b28d6326444deafee8
üst a8c5adab
...@@ -31,9 +31,8 @@ namespace utl { ...@@ -31,9 +31,8 @@ namespace utl {
digits per group. If the last group was encountered the iterator will digits per group. If the last group was encountered the iterator will
always return the last grouping. always return the last grouping.
Grouping values are sanitized to be 0 <= value <= SAL_MAX_UINT16, even if Grouping values are sanitized to be >= 0, even if originally signed
originally Int32, to be able to easily cast it down to String's xub_StrLen. sal_Int32.
This shouldn't make any difference in practice.
Usage example with a string buffer containing a decimal representation of Usage example with a string buffer containing a decimal representation of
an integer number. Note that of course this loop could be optimized to not an integer number. Note that of course this loop could be optimized to not
...@@ -81,11 +80,9 @@ class DigitGroupingIterator ...@@ -81,11 +80,9 @@ class DigitGroupingIterator
if (mnGroup < maGroupings.getLength()) if (mnGroup < maGroupings.getLength())
{ {
sal_Int32 n = maGroupings[mnGroup]; sal_Int32 n = maGroupings[mnGroup];
OSL_ENSURE( 0 <= n && n <= SAL_MAX_UINT16, "DigitGroupingIterator::getGrouping: far out"); SAL_WARN_IF( n < 0, "unotools", "DigitGroupingIterator::getGrouping: negative grouping");
if (n < 0) if (n < 0)
n = 0; // sanitize ... n = 0; // sanitize ...
else if (n > SAL_MAX_UINT16)
n = SAL_MAX_UINT16; // limit for use with xub_StrLen
return n; return n;
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment