Bug 148645 - com.sun.star.sheet.addin.Analysis.getDec2Hex does not take integer 'places' value
Summary: com.sun.star.sheet.addin.Analysis.getDec2Hex does not take integer 'places' v...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/need-fo...
Whiteboard: target:24.8.0
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2022-04-18 09:15 UTC by Mike Kaganski
Modified: 2024-02-09 12:38 UTC (History)
5 users (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 Mike Kaganski 2022-04-18 09:15:12 UTC
Consider this code:

sub TestDec2Hex
   oService = createUNOService("com.sun.star.sheet.addin.Analysis")

   MsgBox oService.getDec2Hex(Nothing, 1234, Empty)
   MsgBox oService.getDec2Hex(Nothing, 1234, "")
   MsgBox oService.getDec2Hex(Nothing, 1234, "8")
   MsgBox oService.getDec2Hex(Nothing, 1234, 8.1)
   MsgBox oService.getDec2Hex(Nothing, 1234, 8.0)
   MsgBox oService.getDec2Hex(Nothing, 1234, 8)
end sub

All the calls to getDec2Hex will succeed, *except for the last two*, where '8.0' and '8' are passed as the last 'places' argument. So, the most natural way of using the function is unavailable.

Code pointer:
The function is implemented in scaddins/source/analysis/analysis.cxx. It uses ScaAnyConverter::getInt32 to handle the uno::Any value of the places argument. The task is to change the code that extracts the value, to allow not only empty values, strings and doubles, but also other numerical types, as the argument value.

The easy hack should include a unit test.
Comment 1 Buovjaga 2022-05-04 06:12:09 UTC
Changing to medium difficulty as unit test is included
Comment 2 Rafael Lima 2024-01-31 13:38:30 UTC
Hi @Hao, this bug has been ASSIGNED to you for more than 6 months. Do you plan to keep working on a fix for it? If not, please change the bug status back to NEW. Thanks!
Comment 3 Commit Notification 2024-02-05 07:31:48 UTC
Luv Sharma committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5986ab58db89ee73dc1bc30a7f3800ccb598a3b6

tdf#148645  getDec2Hex now takes  integer 'places' value

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2024-02-05 08:56:01 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bc5e5cb08a91a5daf0e9a5e78cf304b52e1ad369

tdf#148645: add unit test

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2024-02-09 12:38:59 UTC
Luv Sharma committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5fef3ebe9efd4d4e8569e620e82771f5560c5524

tdf#148645 getDec2Hex now takes  integer 'places' value (updated)

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.