summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-05-16 14:08:18 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-05-16 23:30:36 +0200
commit18a16533b9c8782c5ff642a37dd58f82c1eb881d (patch)
treee1a280b2e05457c79c53e88cb1ac52738aca0745 /src/corelib/text
parent68f220c93b3e831a3f9b8cee0df6bd2ec69f7a11 (diff)
QString: don't use utf16() just to create a u16string
QString::utf16() will detach from QStringLiterals in order to ensure NUL-termination, we don't need the returned pointer NUL-terminated, because we pass the length explicitly to the u16string ctor, so just use data(). Task-number: QTBUG-98763 Pick-to: 6.3 Change-Id: If883901a41480f469162ff4ed5bef927a3bf060a Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r--src/corelib/text/qstring.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index 484ce983a6..db2759f98b 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -1519,7 +1519,7 @@ inline QString QString::fromStdU16String(const std::u16string &s)
{ return fromUtf16(s.data(), int(s.size())); }
inline std::u16string QString::toStdU16String() const
-{ return std::u16string(reinterpret_cast<const char16_t*>(utf16()), length()); }
+{ return std::u16string(reinterpret_cast<const char16_t*>(data()), length()); }
inline QString QString::fromStdU32String(const std::u32string &s)
{ return fromUcs4(s.data(), int(s.size())); }