type byte in Basic

Hi all,

in looking at https://ask.libreoffice.org/de/question/97628/base64-encodedecode/ I came across a problem with type "byte" in Basic and do not know whether it is a bug or not:

I want to write bytes to a file.
I use
dim oOutputStream as variant
oOutputStream = createUnoService("com.sun.star.io.SequenceOutputStream")
and later on
oOutputStream.writeBytes(...)

If I define dim nA as byte
then nA = 195 is OK, but writeBytes(array(nA)) fails
and nA = -61 fails, but writeBytes(array(-61)) works.

It seems a variable of type byte can have values in range [0..255], but writeBytes can only use values in range [-128..127].

I have used dim nA as variant in the end, but wonder about the different ranges.

Kind regards
Regina

<https://cgit.freedesktop.org/libreoffice/core/commit/?id=b5594f06c47c38afcb1ac160fd8796d7ca180be5> "Cater for UNO (signed) vs. BASIC (unsigned) byte mismatch"

Hi Stephan,

Wow! Identified as bug and fixed immediately. That is great.

Kind regards
Regina

Stephan Bergmann schrieb: