sal/rtl/math.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
New commits: commit 6b6fde50ab6069f8f82b4666e6ac1f50db5fcf1d Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Oct 1 09:07:49 2021 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Oct 1 16:01:13 2021 +0200 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.kagan...@collabora.com> 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++; } }