summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authortushar <tusharrai282@gmail.com>2021-01-22 02:33:21 +0530
committerMike Kaganski <mike.kaganski@collabora.com>2021-01-22 19:05:49 +0100
commit61d2014254a6bf1da68e2f13d3de2c099fcb8883 (patch)
treea4baf0644205b43bbcba769d1d073ca6506e9a37 /scripting
parent651e9e7278fffa79248fb173432de0af4a622b5d (diff)
tdf#133889 Upcasting the type of actual parameter.
Type of actual parameter is made same as formal parameter.This is done to undo the conversions made in sbxToUnoValueImpl. Change-Id: I8c7a880503d927eb43ad38eac4bf01451442834b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109773 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basscript.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx
index 16ffeb9dc9ee..4d6f2477ed92 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -210,6 +210,21 @@ namespace basprov
if (auto* p = pInfo->GetParam(static_cast<sal_uInt16>(i) + 1))
{
SbxDataType t = static_cast<SbxDataType>(p->eType & 0x0FFF);
+ // tdf#133889 Revert the downcasting performed in sbxToUnoValueImpl
+ // to allow passing by reference.
+ SbxDataType a = xSbxVar->GetType();
+ if (t == SbxSINGLE && (a == SbxINTEGER || a == SbxLONG))
+ {
+ sal_Int32 val = xSbxVar->GetLong();
+ if (val >= -16777216 && val <= 16777215)
+ xSbxVar->SetType(t);
+ }
+ else if (t == SbxDOUBLE && (a == SbxINTEGER || a == SbxLONG))
+ xSbxVar->SetType(t);
+ else if (t == SbxLONG && a == SbxINTEGER)
+ xSbxVar->SetType(t);
+ else if (t == SbxULONG && a == SbxUSHORT)
+ xSbxVar->SetType(t);
// Enable passing by ref
if (t != SbxVARIANT)
xSbxVar->SetFlag(SbxFlagBits::Fixed);