Bug 46581 - EasyHack: Avoid temporary rtl::OUString
Summary: EasyHack: Avoid temporary rtl::OUString
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2012-02-24 09:25 UTC by Thomas Arnhold
Modified: 2015-12-15 12:16 UTC (History)
2 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 Thomas Arnhold 2012-02-24 09:25:28 UTC
There are lots of temporary OUStrings for if-else constructs in the source code. This is an example:

if (itr->first == rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(STR_GLOBAL_RANGE_NAME)))

this should better be:
if (itr->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(STR_GLOBAL_RANGE_NAME)))

More from this is seen in this commit: http://cgit.freedesktop.org/libreoffice/core/commit/?id=dcd7dc43376c914027b76525959a9cea71d9279e

To get an overview where such constructs are used:

./g grep ' == OUString('
./g grep ' == rtl::OUString('
./g grep ' == ::rtl::OUString('

And maybe much more (think about OUString(..) == ...).

Goal would be to replace all of these occurence with equalsAsciiL.
Comment 1 lauregl 2012-04-18 03:32:24 UTC
I've fixed this in one file. Once it gets pushed (case it does) i'll continue with the remaining files
Comment 2 Thomas Arnhold 2012-04-19 08:00:29 UTC
This EasyHack has become obsolete due to new overloaded operators like "==" for OUStrings. See RTL_CONSTASCII_STRINGPARAM removal.
Comment 3 Robinson Tryon (qubit) 2015-12-15 12:16:35 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillCpp)
[NinjaEdit]