https://bugs.documentfoundation.org/show_bug.cgi?id=159412

            Bug ID: 159412
           Summary: Passing Integer-sized Long argument via script.invoke
                    as 0
           Product: LibreOffice
           Version: 7.2.0.4 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

First reported at
https://ask.libreoffice.org/t/is-this-a-bug-in-script-invoke-passing-integer-sized-long-argument-as-0/101256/4
.
There Mike Kaganski said he had tested it in 7.2, where the error occurred, and
7.1, which worked correctly.

I have left Severity / Hardware / OS at their default values, as they sound
plausible.

---
When I try to pass a `Long` via `script.invoke` it is passed as 0 if the
receiving argument is declared as `Long` but the value fits in an Integer. If
the same value is passed to `Any` or `Integer`, the correct value is received.
Values that need a `Long` are also correctly received.

Whenever `Script_invoke_Bug_invokee_3` in the code below is called (because the
value fits in an `Integer`), it reports `y_A` as 0! In all other cases the
correct value is reported.

I am running this version:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Calc: threaded

```
Const Int_Max = 2 ^ 15 - 1              ' Seems to be right
Const Int_Min = - 2 ^ 15                ' Seems to be right

Sub Script_invoke_Bug
        Dim     z_Integer                                       as      Integer
:       z_Integer       = 1024
        Script_invoke_Bug_invoker (z_Integer)

        Dim     z_Long_1024                                     as      Integer
:       z_Long_1024     = 1024
        Script_invoke_Bug_invoker (z_Long_1024)

        Dim     z_Long                                          as      Long   
:       z_Long          = 1048576
        Script_invoke_Bug_invoker (z_Long)

        Script_invoke_Bug_invoker (1048575)

        Script_invoke_Bug_invoker (Int_Max)

        Script_invoke_Bug_invoker (Int_Max + 1)

        Script_invoke_Bug_invoker (Int_Min)

        Script_invoke_Bug_invoker (Int_Min - 1)
End Sub

Sub Script_invoke_Bug_invoker (y as Any)
        Dim     z_Count                                         as Integer     
:       z_Count         = IIf (y < Int_Min or Int_Max < y, 2, 3)
        Dim     z_Invokee                                       as      String 
:       z_Invokee       = "Script_invoke_Bug_invokee_" + z_Count
        Dim     z_URI                                           as      String 
:       z_URI           = "vnd.sun.star.script:Standard.Pjt_Scratch." +
z_Invokee + "?language=Basic&location=application"
        Dim z_Script                                    as      Object  :      
z_Script        = ThisComponent.scriptProvider.getScript (z_URI)

        Dim     z_Parameters    (0 to 2)        as      Any
        z_Parameters (0)        = y
        z_Parameters (1)        = y
        z_Parameters (2)        = y

        Dim     z_Out_Parameter_Indices ()      as      Integer
        Dim     z_Out_Parameters                ()      as      Any

        z_Script.invoke (z_Parameters, z_Out_Parameter_Indices,
z_Out_Parameters)
End Sub

Sub Script_invoke_Bug_invokee_3 (y_A as Long, y_B as Integer, y_C as Any)
        MsgBox ("A = " + y_A + ",  B = " + y_B + ",  C = " + y_C)
End Sub

Sub Script_invoke_Bug_invokee_2 (y_A as Long, y_C as Any)
        MsgBox ("A = " + y_A + ",  C = " + y_C)
End Sub
```

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to