diff options
author | Øystein Heskestad <oystein.heskestad@qt.io> | 2022-01-07 09:57:34 +0100 |
---|---|---|
committer | Øystein Heskestad <oystein.heskestad@qt.io> | 2022-01-17 09:48:12 +0100 |
commit | 74955f386d859ffe573487b73e17e81754bd6e8b (patch) | |
tree | a14e08a1a488fbff912feffc875de6dbccff8047 /src/corelib/serialization | |
parent | 88dda89329330119bcb97788e84a30b2bf1cb23a (diff) |
Replace QString::utf16 with QString::data where appropriate
QString::utf16() needlessly detaches fromRawData() to ensure a
terminating NUL. Use data() where we don't require said NUL, taking
care not call the mutable data() overload, which would detach,
too.
Task-number: QTBUG-98763
Change-Id: Ibd5e56798c0c666893c12c91ff0881842b8430c7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/serialization')
-rw-r--r-- | src/corelib/serialization/qjsonparser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/serialization/qjsonparser.cpp b/src/corelib/serialization/qjsonparser.cpp index 2514319e0e..168a2f6f7b 100644 --- a/src/corelib/serialization/qjsonparser.cpp +++ b/src/corelib/serialization/qjsonparser.cpp @@ -910,7 +910,7 @@ bool Parser::parseString() return false; } - container->appendByteData(reinterpret_cast<const char *>(ucs4.utf16()), ucs4.size() * 2, + container->appendByteData(reinterpret_cast<const char *>(ucs4.constData()), ucs4.size() * 2, QCborValue::String, QtCbor::Element::StringIsUtf16); END; return true; |