diff options
author | baltasarq <baltasarq@gmail.com> | 2021-06-22 12:55:21 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-06-25 16:26:50 +0200 |
commit | 5eedb3beeaeed88de0d1ebd041a9f15ceea7e78c (patch) | |
tree | 1f317cb23e1aa28cfca51ca460c68b5e189901bb /basic/source/comp/symtbl.cxx | |
parent | 4c267311ed7bedfd373db2afc12cad9757922ce1 (diff) |
tdf#142460: properly handle boolean values in string pool
This makes sure that results of comparison of literals have proper boolean type,
and that this type is properly stored to/read from the string pool.
This introduces a new non-standard "type" character used in the pool: 'b'. It is
not a proper type character used in Basic (unlike '%'/'&'/'!'/'@'), but we have
to use this trick locally, because we need to pass the type that has no own type
character.
The change should be backward-compatible: older versions reading the value should
just ignore the 'b', and read the value as double.
Change-Id: Ibd4a70b366331342346eb171c8ed3c7026279596
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117655
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source/comp/symtbl.cxx')
-rw-r--r-- | basic/source/comp/symtbl.cxx | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index d9e7fcae6abc..ed245a364874 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -66,6 +66,8 @@ short SbiStringPool::Add( double n, SbxDataType t ) char buf[40]{}; switch( t ) { + // tdf#142460 - properly handle boolean values in string pool + case SbxBOOL: snprintf( buf, sizeof(buf), "%db", static_cast<short>(n) ); break; // tdf#131296 - store numeric value including its type character // See GetSuffixType in basic/source/comp/scanner.cxx for type characters case SbxINTEGER: snprintf( buf, sizeof(buf), "%d%%", static_cast<short>(n) ); break; |