https://bugs.freedesktop.org/show_bug.cgi?id=42492

             Bug #: 42492
           Summary: BASIC HEX command on 64-bit systems not returning 16
                    characters on  negative long integer
    Classification: Unclassified
           Product: LibreOffice
           Version: LibO 3.3.4 release
          Platform: x86-64 (AMD64)
        OS/Version: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
        AssignedTo: [email protected]
        ReportedBy: [email protected]


With the 64-bit version of Linux the LibreOffice BASIC HEX command, when
performed on a negative LONG integer, returns only the first 15 characters. It
is failing to return the least significant nibble, the 16th character. 

See sample code below that was run from LibreOffice Writer 3.3.4 OOO330m19
(Build:401) tag libreoffice-3.3.3.1, Ubuntu package 1:3.3.4-0ubuntu1 on an
installation of x86-64bit Ubuntu 11.04 with Linux kernel 2.6.38-12 generic
Gnome 2.32.1 

Additionally it can be observed in the sample below, that on 64-bit systems the
BASIC HEX command, when performed on negative SHORT integers, will return only
8 characters. Possibly the specifications calls for this and it is the correct
length for the return string. If not, then it would appear to be a problem and
it should be returning a string of 16 characters.

Thanks and regards,
irs.

Sub SampleCodeOfHexProblemFor64Bit

' Issue 1: The HEX return string of negative long integers is missing the least
significant nibble.
' Only the first 15 characters are being returned, instead of a total of 16.

dim longTemp as long

longTemp = -1
msgbox HEX(longTemp) & " : " & Cstr(Len(HEX(longTemp))    'Returns:
FFFFFFFFFFFFFFF : 15
    ' should be: FFFFFFFFFFFFFFFF : 16

longTemp = - 17
msgbox HEX(longTemp) & " : " & Cstr(Len(HEX(longTemp))    'Returns:
FFFFFFFFFFFFFFE : 15
    ' should be: FFFFFFFFFFFFFFEF : 16

longTemp = - 32768
msgbox HEX(longTemp) & " : " & Cstr(Len(HEX(longTemp))    'Returns:
FFFFFFFFFFFF800 : 15
    'Should be: FFFFFFFFFFFF8000 : 16

longTemp = - 32769
msgbox HEX(longTemp) & " : " & Cstr(Len(HEX(longTemp))    'Returns:
FFFFFFFFFFFF7FF : 15
    'should be: FFFFFFFFFFFF7FFF : 16

longTemp = - 32785
msgbox HEX(longTemp) & " : " & Cstr(Len(HEX(longTemp))    'Returns:
FFFFFFFFFFFF7FE : 15 
    'should be: FFFFFFFFFFFF7FEF : 16

'===
' Issue 2: The HEX return of negative short integers is 8 hex characters. 
' Possibly this is the way the HEX string is supposed to be returned?
' Maybe on a 64-bit system they should be being returned as 16 hex characters.

dim integerTemp as integer
integerTemp = -1
msgbox HEX(integerTemp) & " : " & Cstr(Len(HEX(integerTemp)) 'Returns: FFFFFFFF
: 8
    ' On 64-bit system should it return as: FFFFFFFFFFFFFFFF : 16 ?

integerTemp = -17
msgbox HEX(integerTemp) & " : " & Cstr(Len(HEX(integerTemp)) 'Returns: FFFFFFEF
: 8
    ' On 64-Bit system should it return as FFFFFFFFFFFFFFEF : 16 ?

integerTemp = -32768 '<--- Highest possible negative 16-bit signed integer
msgbox HEX(integerTemp) & " : " & Cstr(Len(HEX(integerTemp)) 'Returns: FFFF8000
: 8
    ' On 64-Bit system should it return as FFFFFFFFFFFF8000 : 16 ?

end sub

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to