diff options
Diffstat (limited to 'src/corelib/serialization/qcborvalue.cpp')
-rw-r--r-- | src/corelib/serialization/qcborvalue.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 96d3feaf1b..970ae23352 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -48,6 +48,7 @@ #include <qlocale.h> #include <private/qnumeric_p.h> #include <qscopedvaluerollback.h> +#include <private/qsimd_p.h> #include <qstack.h> #include <new> @@ -1082,6 +1083,24 @@ void QCborContainerPrivate::replaceAt_complex(Element &e, const QCborValue &valu } } +// in qstring.cpp +void qt_to_latin1_unchecked(uchar *dst, const ushort *uc, qsizetype len); + +Q_NEVER_INLINE void QCborContainerPrivate::appendAsciiString(const QString &s) +{ + qsizetype len = s.size(); + QtCbor::Element e; + e.value = addByteData(nullptr, len); + e.type = QCborValue::String; + e.flags = Element::HasByteData | Element::StringIsAscii; + elements.append(e); + + char *ptr = data.data() + e.value + sizeof(ByteData); + uchar *l = reinterpret_cast<uchar *>(ptr); + const ushort *uc = (const ushort *)s.unicode(); + qt_to_latin1_unchecked(l, uc, len); +} + QT_WARNING_DISABLE_MSVC(4146) // unary minus operator applied to unsigned type, result still unsigned static int compareContainer(const QCborContainerPrivate *c1, const QCborContainerPrivate *c2); static int compareElementNoData(const Element &e1, const Element &e2) |