Bug 126358 - FIREBIRD: Migration of negative DECIMAL creates unusable values
Summary: FIREBIRD: Migration of negative DECIMAL creates unusable values
Status: RESOLVED DUPLICATE of bug 126268
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Database-Firebird-Migration
  Show dependency treegraph
Reported: 2019-07-12 07:04 UTC by Xisco Faulí
Modified: 2019-07-12 11:08 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:

ddbb (5.66 KB, application/vnd.oasis.opendocument.database)
2019-07-12 07:04 UTC, Xisco Faulí

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2019-07-12 07:04:04 UTC
Created attachment 152735 [details]

Steps to reproduce:
1. Open attached document
2. Migrate it to firebird

-> negative Decimal are incorrectly migrated

Reproduced in

Build ID: 44df407f63bc20c402b513e9e38470517a775317
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

The behaviour is incorrect since it was introduced in https://cgit.freedesktop.org/libreoffice/core/commit/?id=6039d2463b4cc503b963811b3b1471de3291ee09
Comment 1 Xisco Faulí 2019-07-12 09:46:02 UTC
Changing https://opengrok.libreoffice.org/xref/core/dbaccess/source/filter/hsqldb/rowinputbinary.cxx?r=2e26ef34#53 from

int shifted_in = (bytes[i] & (1 << (7 - j))) ? 1 : 0;


int shifted_in = (bytes[i] & (1 << (7 - j))) ? 0 : 1;

would make the negative numbers to be displayed correctly... we would just need to append the '-' sign at the beginning
Comment 2 Xisco Faulí 2019-07-12 11:08:01 UTC
Closing as dupe of 126268

*** This bug has been marked as a duplicate of bug 126268 ***