diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2025-08-19 08:48:31 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2025-08-20 11:44:28 +0200 |
| commit | eaeeb6b5d38afc3ef249dfd827dad1181bef14d2 (patch) | |
| tree | 03a52735ccff2150f8534ee5090fad387bd84107 /src/corelib/serialization/qxmlstream.cpp | |
| parent | 37f774c4e910fb6d4266b3f5ac2adafb95487ec0 (diff) | |
QXmlStream: don't use Structured Bindings
Decoder::operator() already returns a proper struct with named
members, so decomposing that using SB can do no good, except
introducing a dependency on the order of the struct, which is
counter-productive.
Fix by receiving the result in a proper variable and using the
struct's member names.
Amends 53622aca2ad0d13bd16d8307dc28f915c8878b75.
The idea may have been to avoid churning the surrounding code, but
follow-up c08766abf2267f4eeda159c5688309d22d319722 touched all
lines using the result, anyway, so we don't need SB anymore to
keep the old names.
Pick-to: 6.10
Change-Id: I2890754c2c2189cc2fa395f4500ca6c3cb115d7d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/serialization/qxmlstream.cpp')
| -rw-r--r-- | src/corelib/serialization/qxmlstream.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/serialization/qxmlstream.cpp b/src/corelib/serialization/qxmlstream.cpp index 72e4a5c0f61..3b68ba4b71b 100644 --- a/src/corelib/serialization/qxmlstream.cpp +++ b/src/corelib/serialization/qxmlstream.cpp @@ -3280,8 +3280,8 @@ void QXmlStreamWriterPrivate::writeEscaped(QAnyStringView s, bool escapeWhitespa while (it != end) { auto next_it = it; - auto [uc, encodingError] = decoder(next_it, end); - switch (uc) { + const auto decoded = decoder(next_it, end); + switch (decoded.value) { case u'<': replacement = "<"_L1; break; @@ -3315,13 +3315,13 @@ void QXmlStreamWriterPrivate::writeEscaped(QAnyStringView s, bool escapeWhitespa Q_ASSERT(!replacement.isNull()); break; default: - if (uc > 0x1F) + if (decoded.value > 0x1F) break; // ASCII control characters Q_FALLTHROUGH(); case 0xFFFE: case 0xFFFF: - raiseError(encodingError + raiseError(decoded.encodingError ? QXmlStreamWriter::Error::Encoding : QXmlStreamWriter::Error::InvalidCharacter); if (stopWritingOnError) |
