summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-06-18 15:18:26 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-06-18 22:17:06 +0200
commit90f872b4c9eac6ea1955876ff292a962f95577dd (patch)
treef31094d4769db6a0b0e53e12602dbf4af753a21d
parent568fba4a439f39aadeeb1bcd3603ef4efe9700da (diff)
Simplify a std::string_view construction
...and combine three calls to SvStream::WriteOString into one. Despite its name, SvStream::WriteOString takes a std::string_view, but which cannot be constructed from a u8"..." char8_t string literal. Besides the OStringLiteral detour, other fixes could have been a reinterpret_cast<char const *> (but which would have defeated constexpr'ness of the std::string_view construction) or a plain "..." char string literal with the UTF-8 encoding of \uFEFF spelled out as \0xEF\xBB\xBF. Change-Id: I029f061134381a67516cbc4b0479942684c80c20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117461 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--vcl/source/pdf/XmpMetadata.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx
index e1a6ecf02ce5..156e849f4097 100644
--- a/vcl/source/pdf/XmpMetadata.cxx
+++ b/vcl/source/pdf/XmpMetadata.cxx
@@ -35,9 +35,8 @@ void XmpMetadata::write()
mpMemoryStream = std::make_unique<SvMemoryStream>(4096 /*Initial*/, 64 /*Resize*/);
// Header
- mpMemoryStream->WriteOString("<?xpacket begin=\"");
- mpMemoryStream->WriteOString(OUStringToOString(u"\xFEFF", RTL_TEXTENCODING_UTF8));
- mpMemoryStream->WriteOString("\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n");
+ mpMemoryStream->WriteOString(
+ OStringLiteral(u8"<?xpacket begin=\"\uFEFF\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n"));
{
tools::XmlWriter aXmlWriter(mpMemoryStream.get());