Bug 145539 - Convert string literals defined as const char[] in header files to constexpr OUStringLiteral
Summary: Convert string literals defined as const char[] in header files to constexpr ...
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Po-Yen Huang
URL:
Whiteboard: target:7.3.0
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2021-11-04 11:26 UTC by Hossein
Modified: 2022-05-03 06:00 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2021-11-04 11:26:07 UTC
There are several string literals in the header files, defined in various ways like const char[]. You should convert string literals in header files from "const char[]" to "constexpr OUStringLiteral".

Instances of the literals defined as "const char[]" can be found using:

git grep "^const char" *.hxx|grep -F [

A sample can be found here:
https://git.libreoffice.org/core/+/8fb366c13ac1b23c455c32afc085bca2edff03bb
Comment 1 Po-Yen Huang 2021-11-05 02:57:19 UTC
I pushed a patch to gerrit: https://gerrit.libreoffice.org/c/core/+/124724
Please review it :-)
Comment 2 Commit Notification 2021-11-25 14:59:00 UTC
Jeff Huang committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7b0e0409c3f24dfe37d9c43ffa439b56ea719868

tdf#145539 const OUString -> constexpr OUStringLiteral

It will be available in 7.3.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 3 Po-Yen Huang 2021-12-24 02:51:13 UTC
When I use 'git grep "^const char" *.hxx| grep -F [', I can only find this place, so this issue should be closed when 7.3.0 is out I think?
Comment 4 Xisco Faulí 2022-05-02 14:50:30 UTC
(In reply to Po-Yen Huang from comment #3)
> When I use 'git grep "^const char" *.hxx| grep -F [', I can only find this
> place, so this issue should be closed when 7.3.0 is out I think?

Should this issue be closed as RESOLVED FIXED now ?
Comment 5 Po-Yen Huang 2022-05-03 01:10:19 UTC
(In reply to Xisco Faulí from comment #4)
> (In reply to Po-Yen Huang from comment #3)
> > When I use 'git grep "^const char" *.hxx| grep -F [', I can only find this
> > place, so this issue should be closed when 7.3.0 is out I think?
> 
> Should this issue be closed as RESOLVED FIXED now ?

I think yes, if no other one find another string for this.
Comment 6 Buovjaga 2022-05-03 05:22:34 UTC
What about all the ones where const char is not immediately at the beginning of the line:

git grep "const char" *.hxx| grep -F [
Comment 7 Po-Yen Huang 2022-05-03 05:44:46 UTC
(In reply to Buovjaga from comment #6)
> What about all the ones where const char is not immediately at the beginning
> of the line:
> 
> git grep "const char" *.hxx| grep -F [

Ah yeah, there are some strings when using this command, should they be all replaced?
Comment 8 Buovjaga 2022-05-03 06:00:46 UTC
(In reply to Po-Yen Huang from comment #7)
> (In reply to Buovjaga from comment #6)
> > What about all the ones where const char is not immediately at the beginning
> > of the line:
> > 
> > git grep "const char" *.hxx| grep -F [
> 
> Ah yeah, there are some strings when using this command, should they be all
> replaced?

Let's wait for Hossein's opinion (he comes back in a couple of days)