diff options
author | Tamas Bunth <tamas.bunth@collabora.co.uk> | 2018-06-11 07:47:15 +0200 |
---|---|---|
committer | Tamás Bunth <btomi96@gmail.com> | 2018-06-14 13:15:04 +0200 |
commit | 1f91ebb586356aa77ecced15cd5e049f1ebca70c (patch) | |
tree | 6fee1ef7c062077ca1ebe4d5363a2725c41e83b9 | |
parent | f61c154a21ead9f27378e3c8dcee87678d17e334 (diff) |
tdf#118043 dbahsql: Fix putDot funciton
Change-Id: Ia49b7e852446b05a4e20a7ff0c32d8acc6da52b2
Reviewed-on: https://gerrit.libreoffice.org/55594
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
-rw-r--r-- | dbaccess/source/filter/hsqldb/rowinputbinary.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx index d47901d2d7a4..d40d5332851e 100644 --- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx +++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx @@ -114,13 +114,12 @@ OUString lcl_makeStringFromBigint(const std::vector<sal_uInt8> bytes) OUString lcl_putDot(const OUString& sNum, sal_Int32 nScale) { + // e.g. sNum = "0", nScale = 2 -> "0.00" OUStringBuffer sBuf{ sNum }; - if (nScale >= sNum.getLength()) - { - sal_Int32 nNullsToAppend = nScale - sNum.getLength(); - for (sal_Int32 i = 0; i < nNullsToAppend; ++i) - sBuf.insert(0, "0"); - } + sal_Int32 nNullsToAppend = nScale - sNum.getLength() + 1; + for (sal_Int32 i = 0; i < nNullsToAppend; ++i) + sBuf.insert(0, "0"); + if (nScale > 0) sBuf.insert(sBuf.getLength() - 1 - nScale, "."); return sBuf.makeStringAndClear(); |