summaryrefslogtreecommitdiff
path: root/xmlsecurity
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 /xmlsecurity
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 'xmlsecurity')
-rw-r--r--xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx18
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx2
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx20
-rw-r--r--xmlsecurity/source/helper/ooxmlsecexporter.cxx10
4 files changed, 25 insertions, 25 deletions
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 9b4017db7d50..c682f0735588 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -429,9 +429,9 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testGood)
{
const std::initializer_list<OUStringLiteral> aNames = {
// We failed to determine if this is good or bad.
- "good-non-detached.pdf",
+ u"good-non-detached.pdf",
// Boolean value for dictionary key caused read error.
- "dict-bool.pdf",
+ u"dict-bool.pdf",
};
for (const auto& rName : aNames)
@@ -451,18 +451,18 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testTokenize)
{
const std::initializer_list<OUStringLiteral> aNames = {
// We looped on this broken input.
- "no-eof.pdf",
+ u"no-eof.pdf",
// ']' in a name token was mishandled.
- "name-bracket.pdf",
+ u"name-bracket.pdf",
// %%EOF at the end wasn't followed by a newline.
- "noeol.pdf",
+ u"noeol.pdf",
// File that's intentionally smaller than 1024 bytes.
- "small.pdf",
- "tdf107149.pdf",
+ u"small.pdf",
+ u"tdf107149.pdf",
// Nested parentheses were not handled.
- "tdf114460.pdf",
+ u"tdf114460.pdf",
// Valgrind was unhappy about this.
- "forcepoint16.pdf",
+ u"forcepoint16.pdf",
};
for (const auto& rName : aNames)
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 0ae9679dd00c..b48aae8784bb 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -356,7 +356,7 @@ void CertificateViewerCertPathTP::InsertCert(const weld::TreeIter* pParent, cons
const css::uno::Reference< css::security::XCertificate >& rxCert,
bool bValid)
{
- auto const sImage = bValid ? OUStringLiteral(BMP_CERT_OK) : OUStringLiteral(BMP_CERT_NOT_OK);
+ auto const sImage = bValid ? OUStringLiteral(u"" BMP_CERT_OK) : OUStringLiteral(u"" BMP_CERT_NOT_OK);
maUserData.emplace_back(std::make_unique<CertPath_UserData>(rxCert, bValid));
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maUserData.back().get())));
mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, false, mxScratchIter.get());
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 615d526f509e..ff0ce32ec7d7 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -455,15 +455,15 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void)
// FIXME: call GpgME::dirInfo("bindir") somewhere in
// SecurityEnvironmentGpg or whatnot
// FIXME: perhaps poke GpgME for uiserver, and hope it returns something useful?
- static const OUStringLiteral aGUIServers[] = { "Gpg4win\\kleopatra.exe",
- "Gpg4win\\bin\\kleopatra.exe",
- "GNU\\GnuPG\\kleopatra.exe",
- "GNU\\GnuPG\\launch-gpa.exe",
- "GNU\\GnuPG\\gpa.exe",
- "GnuPG\\bin\\gpa.exe",
- "GNU\\GnuPG\\bin\\kleopatra.exe",
- "GNU\\GnuPG\\bin\\launch-gpa.exe",
- "GNU\\GnuPG\\bin\\gpa.exe",
+ static const OUStringLiteral aGUIServers[] = { u"Gpg4win\\kleopatra.exe",
+ u"Gpg4win\\bin\\kleopatra.exe",
+ u"GNU\\GnuPG\\kleopatra.exe",
+ u"GNU\\GnuPG\\launch-gpa.exe",
+ u"GNU\\GnuPG\\gpa.exe",
+ u"GnuPG\\bin\\gpa.exe",
+ u"GNU\\GnuPG\\bin\\kleopatra.exe",
+ u"GNU\\GnuPG\\bin\\launch-gpa.exe",
+ u"GNU\\GnuPG\\bin\\gpa.exe",
};
static const OUString aPath = [] {
OUString sRet;
@@ -480,7 +480,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void)
if (aPath.isEmpty())
return;
#else
- static const OUStringLiteral aGUIServers[] = { "kleopatra", "seahorse", "gpa", "kgpg" };
+ static const OUStringLiteral aGUIServers[] = { u"kleopatra", u"seahorse", u"gpa", u"kgpg" };
const char* cPath = getenv("PATH");
if (!cPath)
return;
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 8a356a5bb44e..fbb35b5c9034 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -87,9 +87,9 @@ public:
bool OOXMLSecExporter::Impl::isOOXMLDenylist(const OUString& rStreamName)
{
static const std::initializer_list<OUStringLiteral> vDenylist
- = { "/%5BContent_Types%5D.xml", "/docProps/app.xml", "/docProps/core.xml",
+ = { u"/%5BContent_Types%5D.xml", u"/docProps/app.xml", u"/docProps/core.xml",
// Don't attempt to sign other signatures for now.
- "/_xmlsignatures" };
+ u"/_xmlsignatures" };
// Just check the prefix, as we don't care about the content type part of the stream name.
return std::any_of(vDenylist.begin(), vDenylist.end(), [&](const OUStringLiteral& rLiteral) {
return rStreamName.startsWith(rLiteral);
@@ -99,9 +99,9 @@ bool OOXMLSecExporter::Impl::isOOXMLDenylist(const OUString& rStreamName)
bool OOXMLSecExporter::Impl::isOOXMLRelationDenylist(const OUString& rRelationName)
{
static const std::initializer_list<OUStringLiteral> vDenylist = {
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",
- "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
- "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
+ u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",
+ u"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
+ u"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
};
return std::find(vDenylist.begin(), vDenylist.end(), rRelationName) != vDenylist.end();
}