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 /comphelper | |
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 'comphelper')
-rw-r--r-- | comphelper/source/container/embeddedobjectcontainer.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/backupfilehelper.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/profilezone.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/storagehelper.cxx | 4 | ||||
-rw-r--r-- | comphelper/source/officeinstdir/officeinstallationdirectories.cxx | 4 | ||||
-rw-r--r-- | comphelper/source/xml/ofopxmlhelper.cxx | 36 |
6 files changed, 25 insertions, 25 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 8e812823e044..6056cafd4c63 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -914,7 +914,7 @@ bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed // the media type will be provided with object insertion OUString aOrigStorMediaType; uno::Reference< beans::XPropertySet > xStorProps( pImpl->mxStorage, uno::UNO_QUERY_THROW ); - static const OUStringLiteral s_sMediaType("MediaType"); + static const OUStringLiteral s_sMediaType(u"MediaType"); xStorProps->getPropertyValue( s_sMediaType ) >>= aOrigStorMediaType; SAL_WARN_IF( aOrigStorMediaType.isEmpty(), "comphelper.container", "No valuable media type in the storage!" ); diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index a5eb716d0942..02e279623971 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -353,7 +353,7 @@ namespace typedef std::vector< ExtensionInfoEntry > ExtensionInfoEntryVector; - const OUStringLiteral gaRegPath { "/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml" }; + const OUStringLiteral gaRegPath { u"/registry/com.sun.star.comp.deployment.bundle.PackageRegistryBackend/backenddb.xml" }; class ExtensionInfo { diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx index 5abcca8a80b3..8f82331dd41b 100644 --- a/comphelper/source/misc/profilezone.cxx +++ b/comphelper/source/misc/profilezone.cxx @@ -58,7 +58,7 @@ long long addRecording(const char * aProfileId, long long aCreateTime) OUString sRecordingData(OUString::number(osl_getThreadIdentifier(nullptr)) + " " + OUString::number(aTime/1000000.0) + " " + aString + ": " + - (aCreateTime == 0 ? OUStringLiteral("start") : OUStringLiteral("stop")) + + (aCreateTime == 0 ? OUStringLiteral(u"start") : OUStringLiteral(u"stop")) + (aCreateTime != 0 ? (" " + OUString::number((aTime - aCreateTime)/1000.0) + " ms") : OUString(""))); ::osl::MutexGuard aGuard( g_aMutex ); diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 9c2f47444513..c5bff7559f6a 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -284,8 +284,8 @@ sal_Int32 OStorageHelper::GetXStorageFormat( else { // the mediatype is not known - OUString aMsg = OUStringLiteral(__func__) - + ":" + OUString aMsg = __func__ + + OUStringLiteral(u":") + OUString::number(__LINE__) + ": unknown media type '" + aMediaType diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index 2a8bb326e6ae..79dfcd9ebb48 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -75,8 +75,8 @@ static bool makeCanonicalFileURL( OUString & rURL ) namespace comphelper { -OUStringLiteral const g_aOfficeBrandDirMacro("$(brandbaseurl)"); -OUStringLiteral const g_aUserDirMacro("$(userdataurl)"); +OUStringLiteral const g_aOfficeBrandDirMacro(u"$(brandbaseurl)"); +OUStringLiteral const g_aUserDirMacro(u"$(userdataurl)"); OfficeInstallationDirectories::OfficeInstallationDirectories( const uno::Reference< uno::XComponentContext > & xCtx ) diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx index 325b2c85b147..9e8886b48f24 100644 --- a/comphelper/source/xml/ofopxmlhelper.cxx +++ b/comphelper/source/xml/ofopxmlhelper.cxx @@ -196,12 +196,12 @@ void WriteContentSequence( xWriter->setOutputStream( xOutStream ); - static const OUStringLiteral aTypesElement("Types"); - static const OUStringLiteral aDefaultElement("Default"); - static const OUStringLiteral aOverrideElement("Override"); - static const OUStringLiteral aContentTypeAttr("ContentType"); - static const OUStringLiteral aCDATAString("CDATA"); - static const OUStringLiteral aWhiteSpace(" "); + static const OUStringLiteral aTypesElement(u"Types"); + static const OUStringLiteral aDefaultElement(u"Default"); + static const OUStringLiteral aOverrideElement(u"Override"); + static const OUStringLiteral aContentTypeAttr(u"ContentType"); + static const OUStringLiteral aCDATAString(u"CDATA"); + static const OUStringLiteral aWhiteSpace(u" "); // write the namespace AttributeList* pRootAttrList = new AttributeList; @@ -269,20 +269,20 @@ uno::Sequence< uno::Sequence< beans::StringPair > > ReadSequence_Impl( } // namespace OFOPXMLHelper // Relations info related strings -OUStringLiteral const g_aRelListElement("Relationships"); -OUStringLiteral const g_aRelElement( "Relationship" ); -OUStringLiteral const g_aIDAttr( "Id" ); -OUStringLiteral const g_aTypeAttr( "Type" ); -OUStringLiteral const g_aTargetModeAttr( "TargetMode" ); -OUStringLiteral const g_aTargetAttr( "Target" ); +OUStringLiteral const g_aRelListElement(u"Relationships"); +OUStringLiteral const g_aRelElement( u"Relationship" ); +OUStringLiteral const g_aIDAttr( u"Id" ); +OUStringLiteral const g_aTypeAttr( u"Type" ); +OUStringLiteral const g_aTargetModeAttr( u"TargetMode" ); +OUStringLiteral const g_aTargetAttr( u"Target" ); // ContentType related strings -OUStringLiteral const g_aTypesElement( "Types" ); -OUStringLiteral const g_aDefaultElement( "Default" ); -OUStringLiteral const g_aOverrideElement( "Override" ); -OUStringLiteral const g_aExtensionAttr( "Extension" ); -OUStringLiteral const g_aPartNameAttr( "PartName" ); -OUStringLiteral const g_aContentTypeAttr( "ContentType" ); +OUStringLiteral const g_aTypesElement( u"Types" ); +OUStringLiteral const g_aDefaultElement( u"Default" ); +OUStringLiteral const g_aOverrideElement( u"Override" ); +OUStringLiteral const g_aExtensionAttr( u"Extension" ); +OUStringLiteral const g_aPartNameAttr( u"PartName" ); +OUStringLiteral const g_aContentTypeAttr( u"ContentType" ); OFOPXMLHelper_Impl::OFOPXMLHelper_Impl( sal_uInt16 nFormat ) : m_nFormat( nFormat ) |