diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-01 09:07:49 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-01 16:01:13 +0200 |
commit | 6b6fde50ab6069f8f82b4666e6ac1f50db5fcf1d (patch) | |
tree | cb7a2a3c72805f8f54dd126bdd6bb12858787bb6 /sal | |
parent | afb95717c2c17d6f6c54abf0a0719d082d00e7f5 (diff) |
Consider leading minus
An overlook from commit be8da97976658ff19b4dd010bff328cd3f424c1b
Change-Id: I2f639a9d865b43b38e19ad35a0a9e6b5bc1c1c8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122863
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/math.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx index 970f2e298e02..ce939b907655 100644 --- a/sal/rtl/math.cxx +++ b/sal/rtl/math.cxx @@ -606,7 +606,8 @@ void doubleToString(typename T::String ** pResult, { for (sal_Int32 j = sLen; j >= 0; j--) { - typename T::Char cS = pBuf[j]; + typename T::Char* p2 = &pBuf[j]; + typename T::Char cS = *p2; if (j == 0 && bSign) { // Do not touch leading minus sign put earlier. @@ -617,22 +618,22 @@ void doubleToString(typename T::String ** pResult, { if (cS != '9') { - pBuf[j] = ++cS; + *p2 = ++cS; j = -1; // break loop } else { - pBuf[j] = '0'; + *p2 = '0'; if (j == 0 || (j == 1 && bSign)) { if (eFormat == rtl_math_StringFormat_F) { // insert '1' - std::memmove(pBuf + 1, pBuf, (p++ - pBuf) * sizeof(*p)); - pBuf[0] = '1'; + std::memmove(p2 + 1, p2, (p++ - p2) * sizeof(*p)); + *p2 = '1'; } else { - pBuf[j] = '1'; + *p2 = '1'; nExp++; } } |