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>bb10
parent
68f220c93b
commit
18a16533b9
|
|
@ -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())); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue