From 1a1fd1566c0a88a11bd3e39e8a97fcbfd3ffaa19 Mon Sep 17 00:00:00 2001 From: Mate Barany Date: Mon, 28 Nov 2022 17:08:00 +0100 Subject: [PATCH] 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 --- src/corelib/serialization/qxmlstream_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/serialization/qxmlstream_p.h b/src/corelib/serialization/qxmlstream_p.h index ce9d70789a..b1fee62e04 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); }