summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMate Barany <mate.barany@qt.io>2022-11-28 17:08:00 +0100
committerMate Barany <mate.barany@qt.io>2022-12-10 01:00:02 +0100
commit1a1fd1566c0a88a11bd3e39e8a97fcbfd3ffaa19 (patch)
tree088328a7dfdbd560a12bfff54d529f61089b3371
parent7741665a9c841eee91dfc377d2633a26cefb2bf3 (diff)
Port QXmlStreamPrivateTagStack::addToStringStorage to QAnyStringView
This is a prerequisite of porting the QXmlStreamWriter API to QAnyStringView. Task-number: QTBUG-103302 Change-Id: I48eca902a7b8f0e0a52202936947a2b60353f08c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r--src/corelib/serialization/qxmlstream_p.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h
index ce9d70789a1..b1fee62e04d 100644
--- a/src/corelib/serialization/qxmlstream_p.h
+++ b/src/corelib/serialization/qxmlstream_p.h
@@ -195,13 +195,13 @@ public:
qsizetype initialTagStackStringStorageSize;
bool tagsDone;
- XmlStringRef addToStringStorage(QStringView s)
+ XmlStringRef addToStringStorage(QAnyStringView s)
{
qsizetype pos = tagStackStringStorageSize;
- qsizetype sz = s.size();
if (pos != tagStackStringStorage.size())
tagStackStringStorage.resize(pos);
- tagStackStringStorage.append(s.data(), sz);
+ s.visit([&](auto s) { tagStackStringStorage.append(s); });
+ qsizetype sz = (tagStackStringStorage.size() - pos);
tagStackStringStorageSize += sz;
return XmlStringRef(&tagStackStringStorage, pos, sz);
}