summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2020-11-27 13:26:26 +0100
committerEike Rathke <erack@redhat.com>2020-11-27 17:24:35 +0100
commit1a0f9a9c56e7b7952b813b3efd34f9be6c853957 (patch)
treed27a75502e34e036a2c3536987da3ef94ced46d9 /sal
parent33e0221cac467d32debe4fab6592517b0c1c195e (diff)
Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up
The mix with SAL_N_ELEMENTS() was confusing and even wrong in one case. Change-Id: Ife73342b0efc01ed4e76e217d372fc32500c9b2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106764 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/math.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 81fa0cf925b7..6ed4906270e0 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -292,7 +292,7 @@ void doubleToString(typename T::String ** pResult,
constexpr char pDig[] = "7976931348623157";
constexpr char pRou[] = "8087931459623267"; // the only up-carry is 80
static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit count mismatch");
- constexpr sal_Int32 nDig2 = SAL_N_ELEMENTS(pRou) - 2;
+ constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8; // + "-1.E+308"
const char pSlot[5][2][3] =
{ // rounded, not
@@ -314,7 +314,7 @@ void doubleToString(typename T::String ** pResult,
T::appendAscii(pResult, pResultCapacity, &nResultOffset,
RTL_CONSTASCII_STRINGPARAM("-"));
- nDecPlaces = std::clamp<sal_Int32>( nDecPlaces, 0, SAL_N_ELEMENTS(pRou));
+ nDecPlaces = std::clamp<sal_Int32>( nDecPlaces, 0, RTL_CONSTASCII_LENGTH(pRou));
if (nDecPlaces == 0)
{
T::appendAscii(pResult, pResultCapacity, &nResultOffset,
@@ -342,7 +342,7 @@ void doubleToString(typename T::String ** pResult,
const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
: ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 0))));
- T::appendAscii(pResult, pResultCapacity, &nResultOffset, pDig, nDecPlaces - 1);
+ T::appendAscii(pResult, pResultCapacity, &nResultOffset, pDig, nDecPlaces);
T::appendAscii(pResult, pResultCapacity, &nResultOffset, pSlot[nSlot][nDec-1], nDec);
}
}