diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2019-09-26 07:55:37 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-09-27 18:22:26 +0200 |
commit | d5b7627a0e738c0866b819910153b96b611813f8 (patch) | |
tree | 03f1cde7ed1286ee7bc3b4ac19d88d3163a47352 /basic/source | |
parent | 52f16d1f1d3d2712313fb50014474f43a1528c32 (diff) |
tdf#62326 - Macros: Converting Hex strings of negative value
If the value of the hex string lies within the range of 0x8000
(SbxMAXINT + 1) and 0xFFFF (SbxMAXUINT) inclusive, cast the value to 16 bit
in order to get signed integers, e.g., SbxMININT through SbxMAXINT.
Moved unit test to test_scanner.cxx in order to test basic hex
convertations. Removed old vba unit tests.
Change-Id: I247b41c40197afc5328ef5685c758c1dd1cefae5
Reviewed-on: https://gerrit.libreoffice.org/79583
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/comp/scanner.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 77424d4a369f..f08c0178d38e 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -487,7 +487,10 @@ bool SbiScanner::NextSym() ++nLineIdx; ++nCol; } - sal_Int32 ls = static_cast<sal_Int32>(lu); + // tdf#62326 - If the value of the hex string lies within the range of 0x8000 (SbxMAXINT + 1) + // and 0xFFFF (SbxMAXUINT) inclusive, cast the value to 16 bit in order to get + // signed integers, e.g., SbxMININT through SbxMAXINT + sal_Int32 ls = (lu > SbxMAXINT && lu <= SbxMAXUINT) ? static_cast<sal_Int16>(lu) : static_cast<sal_Int32>(lu); nVal = static_cast<double>(ls); eScanType = ( ls >= SbxMININT && ls <= SbxMAXINT ) ? SbxINTEGER : SbxLONG; if( bOverflow ) |