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

            Bug ID: 168226
           Summary: Use o3tl::convert() for unit conversion instead of
                    custom formula
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: [email protected]
          Reporter: [email protected]

Description:
Unit conversion is done in various places in LibreOffice core. It is
recommended to use the built-in function: o3tl::convert instead of writing a
custom formula. The goal is to the increase accuracy and avoid errors, and also
to be able to handle possible overflows.

This is an example commit:

Use o3tl::convert instead of manual conversion
6cbadf8bf1295a9c3d1d9a389e8cf076314facf4

This task is described in more details in this blog post:
https://dev.blog.documentfoundation.org/2025/08/28/unit-conversion-in-libreoffice-code/

Code Pointers:
To to find instances to change, one can try finding some magic numbers listed
in the blog post. For example, consider measuring a line based on twips:

line – Line unit (312 twip)

If you search for 312 as a whole word, you may find some examples:

$ git grep -w 312 *.cxx

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to