diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2015-03-05 10:52:17 +0200 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2016-01-13 16:31:33 +0000 |
commit | 184d66caa5f7f93b7383319c5c8985524e0dc824 (patch) | |
tree | 272ce3f066d3c80f77dfca50fd0914b341c2f9da /src/corelib/io/qdatastream.h | |
parent | ca6f11dcf207aa51ce32c9813ad1ab3790bb31ee (diff) |
QDataStream: handle incomplete reads from QIODevice
This adds a way to resume reading from a stream after a ReadPastEnd error.
This is done by introducing a stream read transaction mechanism that keeps
read data in an internal buffer and rolls it back on failure.
[ChangeLog][QtCore] Added QDataStream startTransaction(),
commitTransaction(), rollbackTransaction(), abortTransaction()
functions to support read transactions.
Task-number: QTBUG-44418
Change-Id: Ibf946e1939a5573c4182fea7e26608947218c2d9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qdatastream.h')
-rw-r--r-- | src/corelib/io/qdatastream.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index 744829c659..a72842671a 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -168,6 +168,11 @@ public: int skipRawData(int len); + void startTransaction(); + bool commitTransaction(); + void rollbackTransaction(); + void abortTransaction(); + private: Q_DISABLE_COPY(QDataStream) @@ -179,6 +184,8 @@ private: ByteOrder byteorder; int ver; Status q_status; + + int readBlock(char *data, int len); }; |