There is a minor issue with the fix that was applied to V3.6.1 onward to correct "Bug 42492 - BASIC HEX command on 64-bit systems not returning 16 characters on negative long integer" Previously LibreOffice BASIC Hex strings returned Upper Case character "A" through "F". A check of Microsoft's VB V6 and Office 2003 shows that these version of BASIC also return Upper Case characters "A" to "F". The Hex that LibreOffice BASIC is now returning has lower case characters "a" through "f". This could cause problems when running older LibreOffice macros or importing and running the macros of MS Office files. regards, Ian. Example code.... Sub Main Dim DecimalLong as Long DecimalLong = -2136224273 Msgbox HEX(DecimalLong) 'Return string after V3.6.1 release is: 80abcdef 'Return string should be: 80ABCDEF End Sub
I can reproduce this bug. I'm looking into fixing this.
Submitted the fix today. To reproduce the bug in existing code: 1. Click Tools > Macros > Organize Macros > LibreOffice BASIC; 2. On the left pane ("Macro From Field"), Navigate to My Macros > Standard > Module1 (or wherever you want to test); 3. On the right pane ("Existing Macros In"), select "main"; 4. Click the "Edit" button; 5. Paste in the following code: Sub Main Dim DecimalLong as Long DecimalLong = -2136224273 Msgbox HEX(DecimalLong) 'Return string after V3.6.1 release is: 80abcdef 'Return string should be: 80ABCDEF End Sub 6. Press F5; 7. Observe that the message box contains the string "80abcdef". After my change: 1. Click Tools > Macros > Organize Macros > LibreOffice BASIC; 2. On the left pane ("Macro From Field"), Navigate to My Macros > Standard > Module1 (or wherever you want to test); 3. On the right pane ("Existing Macros In"), select "main"; 4. Click the "Edit" button; 5. Paste in the following code: Sub Main Dim DecimalLong as Long DecimalLong = -2136224273 Msgbox HEX(DecimalLong) 'Return string after V3.6.1 release is: 80abcdef 'Return string should be: 80ABCDEF End Sub 6. Press F5; 7. Observe that the message box contains the string "80ABCDEF". What I am changing: Instead of returning lowercase characters with BASIC's HEX command, uppercase characters are now returned. Digits from 0-9 are not affected. This change utilizes on OUString's toAsciiUpperCase() method.
Christopher Copits committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a8fdb0ba4d83e7df5b8c325aabf4ba2fa28e9545 fdo#58222 The BASIC HEX Command now returns uppercase hexadecimal characters The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Christopher Copits committed a patch related to this issue. It has been pushed to "libreoffice-4-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=43a3f734f9df07bbd11cad3e9418814b37be058c&h=libreoffice-4-0 fdo#58222 The BASIC HEX Command now returns uppercase hexadecimal characters It will be available in LibreOffice 4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.