diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-08-27 11:40:59 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-08-28 08:07:09 +0200 |
commit | 33ecd0d5c4fff9511a8436513936a3f7044a775a (patch) | |
tree | c25809adda140ff89d9f2a2b6dfadba17e188fb0 /sfx2/source/appl | |
parent | 554834484a3323f73b5aeace246bcd9635368967 (diff) |
Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString
more efficient at least for C++20 (by replacing its internals with a constexpr-
generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount,
conditionally for C++20 for now).
For a configure-wise bare-bones build on Linux, size reported by `du -bs
instdir` grew by 118792 bytes from 1155636636 to 1155755428.
In most places just a u"..." string literal prefix had to be added. In some
places
char const a[] = "...";
variables have been changed to char16_t, and a few places required even further
changes to code (which prompted the addition of include/o3tl/string_view.hxx
helper function o3tl::equalsIgnoreAsciiCase and the additional
OUString::createFromAscii overload).
For all uses of macros expanding to string literals, the relevant uses have been
rewritten as
u"" MACRO
instead of changing the macro definitions. It should be possible to change at
least some of those macro definitions (and drop the u"" from their call sites)
in follow-up commits.
Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 4b71403785a4..6f28580b0511 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -702,7 +702,7 @@ bool SfxHelp::Start(const OUString& rURL, weld::Widget* pWidget) /// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org static bool impl_showOnlineHelp( const OUString& rURL ) { - static const OUStringLiteral aInternal("vnd.sun.star.help://"); + static const OUStringLiteral aInternal(u"vnd.sun.star.help://"); if ( rURL.getLength() <= aInternal.getLength() || !rURL.startsWith(aInternal) ) return false; @@ -851,7 +851,7 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) { // /.../runtime/org.libreoffice.LibreOffice.Help/<arch>/<branch>/<sha>/files // because the extension's files are stored at a different place than the app's files, // so use this hack until flatpak itself provides a better solution: - static constexpr auto segments = OUStringLiteral("/app/org.libreoffice.LibreOffice/"); + static constexpr auto segments = OUStringLiteral(u"/app/org.libreoffice.LibreOffice/"); auto const i1 = path.lastIndexOf(segments); // use lastIndexOf instead of indexOf, in case the user-controlled prefix /.../ // happens to contain such segments diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index e82c0a49d98a..63c7e106a2e3 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -127,7 +127,7 @@ const ResIdToResName pToolBarResToName[] = // Sort the Children according their alignment // The order corresponds to the enum SfxChildAlignment (->CHILDWIN.HXX). -constexpr OUStringLiteral g_aLayoutManagerPropName = "LayoutManager"; +constexpr OUStringLiteral g_aLayoutManagerPropName = u"LayoutManager"; // Help to make changes to the alignment compatible! LayoutManagerListener::LayoutManagerListener( @@ -443,9 +443,9 @@ void SfxWorkWindow::Sort_Impl() bSorted = true; } -constexpr OUStringLiteral g_aStatusBarResName( "private:resource/statusbar/statusbar" ); -constexpr OUStringLiteral g_aTbxTypeName( "private:resource/toolbar/" ); -constexpr OUStringLiteral g_aProgressBarResName( "private:resource/progressbar/progressbar" ); +constexpr OUStringLiteral g_aStatusBarResName( u"private:resource/statusbar/statusbar" ); +constexpr OUStringLiteral g_aTbxTypeName( u"private:resource/toolbar/" ); +constexpr OUStringLiteral g_aProgressBarResName( u"private:resource/progressbar/progressbar" ); // constructor for workwin of a Frame |