Doc: Fix readString() and readByteArray() code snippets

Both of these functions return a StringResult, which has no
StringResult::code member. Instead, use the existing
StringResult::status member.

Fixes: QTBUG-122254
Pick-to: 6.6 6.5 6.2
Change-Id: I0b9bfa1fc9a30e9c542ab90f3d8f4243bdeda762
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 57388179a41a169d4f6d65a385f605af31722bf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Andreas Eliasson 2024-02-15 12:03:19 +01:00 committed by Qt Cherry-pick Bot
parent 6816da00a9
commit cd664a7f39

View File

@ -271,12 +271,12 @@ using namespace Qt::StringLiterals;
{ {
QString result; QString result;
auto r = reader.readString(); auto r = reader.readString();
while (r.code == QCborStreamReader::Ok) { while (r.status == QCborStreamReader::Ok) {
result += r.data; result += r.data;
r = reader.readString(); r = reader.readString();
} }
if (r.code == QCborStreamReader::Error) { if (r.status == QCborStreamReader::Error) {
// handle error condition // handle error condition
result.clear(); result.clear();
} }
@ -289,12 +289,12 @@ using namespace Qt::StringLiterals;
{ {
QBytearray result; QBytearray result;
auto r = reader.readBytearray(); auto r = reader.readBytearray();
while (r.code == QCborStreamReader::Ok) { while (r.status == QCborStreamReader::Ok) {
result += r.data; result += r.data;
r = reader.readByteArray(); r = reader.readByteArray();
} }
if (r.code == QCborStreamReader::Error) { if (r.status == QCborStreamReader::Error) {
// handle error condition // handle error condition
result.clear(); result.clear();
} }