Bug Hunting Session
Bug 58222 - BASIC's HEX Command since V3.6.1 (when bug 42492 fix was applied) now returns lower case "a" to "f" characters
Summary: BASIC's HEX Command since V3.6.1 (when bug 42492 fix was applied) now returns...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.6.1.1 rc
Hardware: All Linux (All)
: medium minor
Assignee: Christopher Copits
URL:
Whiteboard: target:4.1.0 target:4.0.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-13 03:56 UTC by irs
Modified: 2012-12-29 05:28 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description irs 2012-12-13 03:56:30 UTC

    
Comment 1 irs 2012-12-13 04:14:46 UTC
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
Comment 2 Christopher Copits 2012-12-17 22:43:11 UTC
I can reproduce this bug.

I'm looking into fixing this.
Comment 3 Christopher Copits 2012-12-19 23:38:22 UTC
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.
Comment 4 Not Assigned 2012-12-27 20:37:21 UTC
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.
Comment 5 Not Assigned 2012-12-29 05:16:38 UTC
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.