summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-08-27 11:40:59 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-08-28 08:07:09 +0200
commit33ecd0d5c4fff9511a8436513936a3f7044a775a (patch)
treec25809adda140ff89d9f2a2b6dfadba17e188fb0 /ucb
parent554834484a3323f73b5aeace246bcd9635368967 (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 'ucb')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx4
-rw-r--r--ucb/source/ucp/file/filglob.cxx4
-rw-r--r--ucb/source/ucp/file/filtask.cxx34
-rw-r--r--ucb/source/ucp/package/pkgcontent.cxx4
-rw-r--r--ucb/source/ucp/package/pkguri.cxx4
-rw-r--r--ucb/source/ucp/webdav-neon/DAVProperties.cxx51
6 files changed, 52 insertions, 49 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 641c17f9d04c..336967ac3190 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1715,8 +1715,8 @@ namespace cmis
try
{
sRet = isFolder( uno::Reference< ucb::XCommandEnvironment >() )
- ? OUStringLiteral(CMIS_FOLDER_TYPE)
- : OUStringLiteral(CMIS_FILE_TYPE);
+ ? OUStringLiteral(u"" CMIS_FOLDER_TYPE)
+ : OUStringLiteral(u"" CMIS_FILE_TYPE);
}
catch (const uno::RuntimeException&)
{
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 15277a2bc8bd..624597a40075 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -498,8 +498,8 @@ namespace fileaccess {
Sequence< OUString > aSeq( 1 );
aSeq[0] =
( errorCode == TASKHANDLING_NONAMESET_INSERT_COMMAND ) ?
- OUStringLiteral("Title") :
- OUStringLiteral("ContentType");
+ OUStringLiteral(u"Title") :
+ OUStringLiteral(u"ContentType");
aAny <<= MissingPropertiesException(
"a property is missing, necessary to create a content",
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index b515cc11a72e..d25bd1a55f9a 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -116,23 +116,23 @@ TaskManager::MyProperty::MyProperty( bool theisNat
// Default properties
-const OUStringLiteral Title( "Title" );
-const OUStringLiteral CasePreservingURL( "CasePreservingURL" );
-const OUStringLiteral IsDocument( "IsDocument" );
-const OUStringLiteral IsFolder( "IsFolder" );
-const OUStringLiteral DateModified( "DateModified" );
-const OUStringLiteral Size( "Size" );
-const OUStringLiteral IsVolume( "IsVolume" );
-const OUStringLiteral IsRemoveable( "IsRemoveable" );
-const OUStringLiteral IsRemote( "IsRemote" );
-const OUStringLiteral IsCompactDisc( "IsCompactDisc" );
-const OUStringLiteral IsFloppy( "IsFloppy" );
-const OUStringLiteral IsHidden( "IsHidden" );
-const OUStringLiteral ContentType( "ContentType" );
-const OUStringLiteral IsReadOnly( "IsReadOnly" );
-const OUStringLiteral CreatableContentsInfo( "CreatableContentsInfo" );
-const OUStringLiteral TaskManager::FolderContentType( "application/vnd.sun.staroffice.fsys-folder" );
-const OUStringLiteral TaskManager::FileContentType( "application/vnd.sun.staroffice.fsys-file" );
+const OUStringLiteral Title( u"Title" );
+const OUStringLiteral CasePreservingURL( u"CasePreservingURL" );
+const OUStringLiteral IsDocument( u"IsDocument" );
+const OUStringLiteral IsFolder( u"IsFolder" );
+const OUStringLiteral DateModified( u"DateModified" );
+const OUStringLiteral Size( u"Size" );
+const OUStringLiteral IsVolume( u"IsVolume" );
+const OUStringLiteral IsRemoveable( u"IsRemoveable" );
+const OUStringLiteral IsRemote( u"IsRemote" );
+const OUStringLiteral IsCompactDisc( u"IsCompactDisc" );
+const OUStringLiteral IsFloppy( u"IsFloppy" );
+const OUStringLiteral IsHidden( u"IsHidden" );
+const OUStringLiteral ContentType( u"ContentType" );
+const OUStringLiteral IsReadOnly( u"IsReadOnly" );
+const OUStringLiteral CreatableContentsInfo( u"CreatableContentsInfo" );
+const OUStringLiteral TaskManager::FolderContentType( u"application/vnd.sun.staroffice.fsys-folder" );
+const OUStringLiteral TaskManager::FileContentType( u"application/vnd.sun.staroffice.fsys-file" );
TaskManager::TaskManager( const uno::Reference< uno::XComponentContext >& rxContext,
FileProvider* pProvider, bool bWithConfig )
diff --git a/ucb/source/ucp/package/pkgcontent.cxx b/ucb/source/ucp/package/pkgcontent.cxx
index 127c1cfb63e7..794e769fe661 100644
--- a/ucb/source/ucp/package/pkgcontent.cxx
+++ b/ucb/source/ucp/package/pkgcontent.cxx
@@ -224,8 +224,8 @@ OUString Content::getContentType(
return ( "application/"
+ aScheme
+ ( bFolder
- ? OUStringLiteral("-folder")
- : OUStringLiteral("-stream") ) );
+ ? OUStringLiteral(u"-folder")
+ : OUStringLiteral(u"-stream") ) );
}
diff --git a/ucb/source/ucp/package/pkguri.cxx b/ucb/source/ucp/package/pkguri.cxx
index d1f530d4634d..dfcde478938b 100644
--- a/ucb/source/ucp/package/pkguri.cxx
+++ b/ucb/source/ucp/package/pkguri.cxx
@@ -109,8 +109,8 @@ void PackageUri::init() const
{
m_aParam +=
( !m_aParam.isEmpty()
- ? OUStringLiteral( "&purezip" )
- : OUStringLiteral( "?purezip" ) );
+ ? OUStringLiteral( u"&purezip" )
+ : OUStringLiteral( u"?purezip" ) );
}
aPureUri = aPureUri.replaceAt( 0,
diff --git a/ucb/source/ucp/webdav-neon/DAVProperties.cxx b/ucb/source/ucp/webdav-neon/DAVProperties.cxx
index 3d6bb94dc115..4bbf6d41f3d8 100644
--- a/ucb/source/ucp/webdav-neon/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVProperties.cxx
@@ -28,22 +28,25 @@
#include <string.h>
+
+#include <o3tl/string_view.hxx>
+
#include "DAVProperties.hxx"
using namespace webdav_ucp;
-const OUStringLiteral DAVProperties::CREATIONDATE("DAV:creationdate");
-const OUStringLiteral DAVProperties::DISPLAYNAME("DAV:displayname");
-const OUStringLiteral DAVProperties::GETCONTENTLANGUAGE("DAV:getcontentlanguage");
-const OUStringLiteral DAVProperties::GETCONTENTLENGTH("DAV:getcontentlength");
-const OUStringLiteral DAVProperties::GETCONTENTTYPE("DAV:getcontenttype");
-const OUStringLiteral DAVProperties::GETETAG("DAV:getetag");
-const OUStringLiteral DAVProperties::GETLASTMODIFIED("DAV:getlastmodified");
-const OUStringLiteral DAVProperties::LOCKDISCOVERY("DAV:lockdiscovery");
-const OUStringLiteral DAVProperties::RESOURCETYPE("DAV:resourcetype");
-const OUStringLiteral DAVProperties::SOURCE("DAV:source");
-const OUStringLiteral DAVProperties::SUPPORTEDLOCK("DAV:supportedlock");
-const OUStringLiteral DAVProperties::EXECUTABLE("http://apache.org/dav/props/executable");
+const OUStringLiteral DAVProperties::CREATIONDATE(u"DAV:creationdate");
+const OUStringLiteral DAVProperties::DISPLAYNAME(u"DAV:displayname");
+const OUStringLiteral DAVProperties::GETCONTENTLANGUAGE(u"DAV:getcontentlanguage");
+const OUStringLiteral DAVProperties::GETCONTENTLENGTH(u"DAV:getcontentlength");
+const OUStringLiteral DAVProperties::GETCONTENTTYPE(u"DAV:getcontenttype");
+const OUStringLiteral DAVProperties::GETETAG(u"DAV:getetag");
+const OUStringLiteral DAVProperties::GETLASTMODIFIED(u"DAV:getlastmodified");
+const OUStringLiteral DAVProperties::LOCKDISCOVERY(u"DAV:lockdiscovery");
+const OUStringLiteral DAVProperties::RESOURCETYPE(u"DAV:resourcetype");
+const OUStringLiteral DAVProperties::SOURCE(u"DAV:source");
+const OUStringLiteral DAVProperties::SUPPORTEDLOCK(u"DAV:supportedlock");
+const OUStringLiteral DAVProperties::EXECUTABLE(u"http://apache.org/dav/props/executable");
void DAVProperties::createNeonPropName( const OUString & rFullName,
NeonPropName & rName )
@@ -117,18 +120,18 @@ void DAVProperties::createUCBPropName( const char * nspace,
// Some servers send XML without proper namespaces. Assume "DAV:"
// in this case, if name is a well-known dav property name.
// Although this is not 100% correct, it solves many problems.
- if ( aName.equalsIgnoreAsciiCaseAscii(DAVProperties::RESOURCETYPE.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::RESOURCETYPE.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::SUPPORTEDLOCK.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::LOCKDISCOVERY.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::CREATIONDATE.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::DISPLAYNAME.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::GETCONTENTLANGUAGE.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::GETCONTENTLENGTH.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::GETCONTENTTYPE.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::GETETAG.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::GETLASTMODIFIED.data + 4) ||
- aName.equalsIgnoreAsciiCaseAscii(DAVProperties::SOURCE.data + 4) )
+ if ( o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::RESOURCETYPE).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::RESOURCETYPE).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::SUPPORTEDLOCK).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::LOCKDISCOVERY).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::CREATIONDATE).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::DISPLAYNAME).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::GETCONTENTLANGUAGE).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::GETCONTENTLENGTH).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::GETCONTENTTYPE).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::GETETAG).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::GETLASTMODIFIED).substr(4)) ||
+ o3tl::equalsIgnoreAsciiCase(aName, std::u16string_view(DAVProperties::SOURCE).substr(4)) )
aNameSpace = "DAV:";
}