diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/xml/qxmlstream.cpp | 4 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream.g | 14 | ||||
-rw-r--r-- | src/corelib/xml/qxmlstream_p.h | 14 |
3 files changed, 14 insertions, 18 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 3d600c2380..195466e803 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -775,8 +775,8 @@ QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack() tagStackStringStorage.reserve(32); tagStackStringStorageSize = 0; NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push(); - namespaceDeclaration.prefix = addToStringStorage(QLatin1String("xml")); - namespaceDeclaration.namespaceUri = addToStringStorage(QLatin1String("http://www.w3.org/XML/1998/namespace")); + namespaceDeclaration.prefix = addToStringStorage(QStringViewLiteral("xml")); + namespaceDeclaration.namespaceUri = addToStringStorage(QStringViewLiteral("http://www.w3.org/XML/1998/namespace")); initialTagStackStringStorageSize = tagStackStringStorageSize; } diff --git a/src/corelib/xml/qxmlstream.g b/src/corelib/xml/qxmlstream.g index d4dd7b2622..73085bda8a 100644 --- a/src/corelib/xml/qxmlstream.g +++ b/src/corelib/xml/qxmlstream.g @@ -205,20 +205,18 @@ public: bool tagsDone; inline QStringRef addToStringStorage(const QStringRef &s) { - int pos = tagStackStringStorageSize; - int sz = s.size(); - if (pos != tagStackStringStorage.size()) - tagStackStringStorage.resize(pos); - tagStackStringStorage.insert(pos, s.unicode(), sz); - tagStackStringStorageSize += sz; - return QStringRef(&tagStackStringStorage, pos, sz); + return addToStringStorage(qToStringViewIgnoringNull(s)); } inline QStringRef addToStringStorage(const QString &s) { + return addToStringStorage(qToStringViewIgnoringNull(s)); + } + QStringRef addToStringStorage(QStringView s) + { int pos = tagStackStringStorageSize; int sz = s.size(); if (pos != tagStackStringStorage.size()) tagStackStringStorage.resize(pos); - tagStackStringStorage.insert(pos, s.unicode(), sz); + tagStackStringStorage.append(s.data(), sz); tagStackStringStorageSize += sz; return QStringRef(&tagStackStringStorage, pos, sz); } diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index ab422ec48a..8ef6e4b8fe 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -701,20 +701,18 @@ public: bool tagsDone; inline QStringRef addToStringStorage(const QStringRef &s) { - int pos = tagStackStringStorageSize; - int sz = s.size(); - if (pos != tagStackStringStorage.size()) - tagStackStringStorage.resize(pos); - tagStackStringStorage.insert(pos, s.unicode(), sz); - tagStackStringStorageSize += sz; - return QStringRef(&tagStackStringStorage, pos, sz); + return addToStringStorage(qToStringViewIgnoringNull(s)); } inline QStringRef addToStringStorage(const QString &s) { + return addToStringStorage(qToStringViewIgnoringNull(s)); + } + QStringRef addToStringStorage(QStringView s) + { int pos = tagStackStringStorageSize; int sz = s.size(); if (pos != tagStackStringStorage.size()) tagStackStringStorage.resize(pos); - tagStackStringStorage.insert(pos, s.unicode(), sz); + tagStackStringStorage.append(s.data(), sz); tagStackStringStorageSize += sz; return QStringRef(&tagStackStringStorage, pos, sz); } |