diff options
-rw-r--r-- | dbaccess/qa/unit/data/tdf126268.odb | bin | 4877 -> 5015 bytes | |||
-rw-r--r-- | dbaccess/qa/unit/tdf126268.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/rowinputbinary.cxx | 20 |
3 files changed, 23 insertions, 3 deletions
diff --git a/dbaccess/qa/unit/data/tdf126268.odb b/dbaccess/qa/unit/data/tdf126268.odb Binary files differindex ffd00c140791..434a4238ba3b 100644 --- a/dbaccess/qa/unit/data/tdf126268.odb +++ b/dbaccess/qa/unit/data/tdf126268.odb diff --git a/dbaccess/qa/unit/tdf126268.cxx b/dbaccess/qa/unit/tdf126268.cxx index 967d5e671ff0..ffbe6361a231 100644 --- a/dbaccess/qa/unit/tdf126268.cxx +++ b/dbaccess/qa/unit/tdf126268.cxx @@ -49,8 +49,10 @@ struct expect_t OUString number; }; -static const expect_t expect[] - = { { 1, "0.00" }, { 2, "25.00" }, { 3, "26.00" }, { 4, "30.4" }, { 5, "45.8" } }; +static const expect_t expect[] = { + { 1, "0.00" }, { 2, "25.00" }, { 3, "26.00" }, { 4, "30.4" }, { 5, "45.8" }, + { 6, "-25.00" }, { 7, "-26.00" }, { 8, "-30.4" }, { 9, "-45.8" }, +}; void Tdf126268Test::testNumbers() { diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx index a12ab0513abf..b75c8574dccf 100644 --- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx +++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx @@ -89,9 +89,27 @@ OUString lcl_double_dabble(const std::vector<sal_uInt8>& bytes) OUString lcl_makeStringFromBigint(const std::vector<sal_uInt8>& bytes) { std::vector<sal_uInt8> aBytes{ bytes }; + OUStringBuffer sRet; + // two's complement + if ((bytes[0] & 0x80) != 0) + { + sRet.append("-"); + for (auto& byte : aBytes) + byte = ~byte; + // add 1 to byte array + // FIXME e.g. 10000 valid ? + for (size_t i = aBytes.size() - 1; i != 0; --i) + { + aBytes[i] += 1; + if (aBytes[i] != 0) + break; + } + } // convert binary to BCD - return lcl_double_dabble(aBytes); + OUString sNum = lcl_double_dabble(aBytes); + sRet.append(sNum); + return sRet.makeStringAndClear(); } OUString lcl_putDot(const OUString& sNum, sal_Int32 nScale) |