From 184d66caa5f7f93b7383319c5c8985524e0dc824 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 5 Mar 2015 10:52:17 +0200 Subject: 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 --- src/corelib/io/qdatastream.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib/io/qdatastream.h') 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); }; -- cgit v1.2.3