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 --- examples/network/threadedfortuneserver/fortunethread.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'examples/network/threadedfortuneserver/fortunethread.cpp') diff --git a/examples/network/threadedfortuneserver/fortunethread.cpp b/examples/network/threadedfortuneserver/fortunethread.cpp index 5e70dd08b9..ec5bb5a168 100644 --- a/examples/network/threadedfortuneserver/fortunethread.cpp +++ b/examples/network/threadedfortuneserver/fortunethread.cpp @@ -63,10 +63,7 @@ void FortuneThread::run() QByteArray block; QDataStream out(&block, QIODevice::WriteOnly); out.setVersion(QDataStream::Qt_4_0); - out << (quint16)0; out << text; - out.device()->seek(0); - out << (quint16)(block.size() - sizeof(quint16)); //! [3] //! [4] tcpSocket.write(block); -- cgit v1.2.3