[Libreoffice-bugs] [Bug 143193] New: Clean up Basic 'Format' implementation

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Jul 5 06:17:29 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=143193

            Bug ID: 143193
           Summary: Clean up Basic 'Format' implementation
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Keywords: difficultyInteresting, easyHack, skillCpp,
                    topicCleanup
          Severity: enhancement
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: mikekaganski at hotmail.com

Format function [1] is implemented in SbxValue::Format [2]. It has two
sections, first of which uses SvNumberFormatter, and the second uses home-grown
SbxBasicFormater. The latter handles non-numeric input, such as strings, Nulls,
etc., and also special Basic string formats like "Standard" or "ttttt". (Note
that the first section also handles some special formats, like "<" or "General
Date".)

Also the latter function handles potential numeric string cases which couldn't
be converted to number using SvNumberFormatter::IsNumberFormat, but succeeded
using ScanNumIntnl.

This makes the implementation buggy, inconsistent, and over-engineered. The
task is to unify special format string handling in the beginning of the
implementation, then process Null values, check if string should be converted
to number (analyzing the type of format string using SvNumberFormatter
facilities) and if it can be converted, and then use the normal
SvNumberFormatter processing.

The implementation should drop the special processing of "@" format character
used to indicate insertion of thousand separators (used currently when
processing "Standard" format) and non-standard string formatting characters '!'
and '\' (see bug 143183 comment 2).

The fix must include an extensive unit test.

[1]
https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/03120301.html?DbPAR=BASIC
[2]
https://opengrok.libreoffice.org/xref/core/basic/source/sbx/sbxscan.cxx?r=0771ac00&mo=19326&fi=660#660

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210705/c22d95d9/attachment.htm>


More information about the Libreoffice-bugs mailing list