diff options
author | U-DESKTOP-8OSNV7R\DrRobotto <andreas.heinisch@yahoo.de> | 2019-12-24 12:22:34 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-01-05 21:42:27 +0100 |
commit | 0b4f8bf571baf2ccd5a8aafdc4deb41867420be3 (patch) | |
tree | 5f5af8179e6180f118000df70f49e9783bf66c98 /basic/source | |
parent | 5fbc89478eb91d9b97f0c3d65d9946a5cec31ea3 (diff) |
tdf#129596 Distinguish between integer and long while loading immediate values
During the generation of CONST_ expressions, distinguish between
integer and long and load the correct value in the immediate load step.
Change-Id: Ib4eb65d7fae3163043899ad8234816b1ebd7316b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85779
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basic/source')
-rwxr-xr-x[-rw-r--r--] | basic/source/comp/exprgen.cxx | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | basic/source/runtime/runtime.cxx | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index d1ebb48c4c09..3981bef2fb5e 100644..100755 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -72,8 +72,10 @@ void SbiExprNode::Gen( SbiCodeGen& rGen, RecursiveMode eRecMode ) case SbxEMPTY: rGen.Gen( SbiOpcode::EMPTY_ ); break; + case SbxLONG: case SbxINTEGER: - rGen.Gen( SbiOpcode::CONST_, static_cast<short>(nVal) ); + nStringId = rGen.GetParser()->aGblStrings.Add(nVal, eType); + rGen.Gen( SbiOpcode::CONST_, nStringId ); break; case SbxSTRING: nStringId = rGen.GetParser()->aGblStrings.Add( aStrVal ); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index d2cb9fe988b5..3a9cb95264d5 100644..100755 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -2803,8 +2803,18 @@ void SbiRuntime::StepLOADSC( sal_uInt32 nOp1 ) void SbiRuntime::StepLOADI( sal_uInt32 nOp1 ) { SbxVariable* p = new SbxVariable; - p->PutInteger( static_cast<sal_Int16>( nOp1 ) ); - PushVar( p ); + + OUString aStr = pImg->GetString(static_cast<short>(nOp1)); + double n = ::rtl::math::stringToDouble(aStr, '.', ','); + if (n >= SbxMININT && n <= SbxMAXINT) + { + p->PutInteger(static_cast<sal_Int16>(n)); + } + else + { + p->PutLong(static_cast<sal_Int32>(n)); + } + PushVar(p); } // store a named argument in Argv (+Arg-no. from 1!) |