diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-09 08:40:15 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-04-11 21:12:13 +0200 |
commit | 4256651047bae66d5c81b9ec5d5ff4e361443cf3 (patch) | |
tree | adf9e8ec4ff7971d8df97798d14b25db36f6bb6a /src/corelib/serialization/qcborvalue.cpp | |
parent | 421e7621faa50bf9007076d6be4e0da9514edc59 (diff) |
QCborValue: avoid a double isAscii check
The QCborValue(QL1S) constructor checks if the parameter is ASCII.
If it's not, it converts it to a QString and stores as such.
However, the QString is checked *again* for being ASCII. We know
it isn't -- skip this recheck.
Change-Id: I7a4776759b2b14aab955cffebde6e3b64f8ed1d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/serialization/qcborvalue.cpp')
-rw-r--r-- | src/corelib/serialization/qcborvalue.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index b83ce226dc..ac8ba481dd 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -1065,6 +1065,12 @@ Q_NEVER_INLINE void QCborContainerPrivate::appendAsciiString(QStringView s) qt_to_latin1_unchecked(l, s.utf16(), len); } +void QCborContainerPrivate::appendNonAsciiString(QStringView s) +{ + appendByteData(reinterpret_cast<const char *>(s.utf16()), s.size() * 2, + QCborValue::String, QtCbor::Element::StringIsUtf16); +} + QCborValue QCborContainerPrivate::extractAt_complex(Element e) { // create a new container for the returned value, containing the byte data |