[Libreoffice-commits] core.git: basic/source

Stephan Bergmann sbergman at redhat.com
Thu Jun 8 12:48:47 UTC 2017


 basic/source/classes/sbunoobj.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b5594f06c47c38afcb1ac160fd8796d7ca180be5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 8 14:45:05 2017 +0200

    Cater for UNO (signed) vs. BASIC (unsigned) byte mismatch
    
    See <https://listarchives.libreoffice.org/global/users/msg51243.html>
    "[libreoffice-users] type byte in Basic", where
    
    > Sub Main
    >   dim oOutputStream as variant
    >   oOutputStream = createUnoService("com.sun.star.io.SequenceOutputStream")
    >   dim nA as byte
    >   nA = 195
    >   oOutputStream.writeBytes(array(nA))
    >   oOutputStream.flush
    >   dim back(0) as byte
    >   back = oOutputStream.getWrittenBytes
    >   MsgBox(back(0))
    > End Sub
    
    failed with "Inadmissible value or data type. Overflow." instead of showing
    "-61".
    
    Change-Id: I0445476c67510d5f8669a6e711e92332c01ec06c

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index dc1ba44bd3e5..0bd472e61394 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1429,7 +1429,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
                 bOverflow = true;
                 nVal = -128;
             }
-            else if( nVal > 127 )
+            else if( nVal > 255 ) // 128..255 map to -128..-1
             {
                 bOverflow = true;
                 nVal = 127;


More information about the Libreoffice-commits mailing list