https://bugs.documentfoundation.org/show_bug.cgi?id=149447
--- Comment #4 from Mike Kaganski <mikekagan...@hotmail.com> --- The problem is the mismatch between Basic's Byte type (unsigned; 0..255) and UNO Byte [1], which is *signed* [2]. Calling a UNO method from Basic *always* includes conversion from Basic types to UNO types; for simple types, that is implemented in sbxToUnoValueImpl [3], which calls getUnoTypeForSbxValue (and that returns the signed type for an SbxBYTE [4]). This happens even before the next "Choose "smallest" representation for int values because up cast is allowed, downcast not" hackery, so the signed -128..+127 type is used in the following manipulations. Initially I thought we are doomed (because I imagined we are bound to the TypeClass constants), but immediately in the mentioned "Choose "smallest" representation for int values because up cast is allowed, downcast not" hackery, there are uses of cppu::UnoType<sal_uInt8> - i.e., an UNO type for *unsigned* 8-bit values. So the obvious solution would be to check the value of the passed Basic byte in the getUnoTypeForSbxValue, and if it's greater than 127, use the unsigned 8-bit type, otherwise, use the old signed one (to minimize possible changes). [1] https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1uno.html#a00683ed3ec24b47c36ead10a20d6f328aa7f492d725033c06576ac4ba21007297 [2] https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Simple_Types [3] https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbunoobj.cxx?r=f71606c9&mo=35778&fi=978#978 [4] https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbunoobj.cxx?r=f71606c9&mo=35778&fi=978#841 -- You are receiving this mail because: You are the assignee for the bug.