QHttpNetworkReply:readBodyFast return early if nothing to read.
authorMartin Petersson <Martin.Petersson@nokia.com>
Wed, 9 May 2012 12:07:32 +0000 (14:07 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 16 May 2012 02:24:35 +0000 (04:24 +0200)
Incase there is no bytesAvailable on the socket there is no need to
try to read.

Change-Id: Ied9e4b8d86854b356a733fab4948739db206b6ad
Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
src/network/access/qhttpnetworkreply.cpp

index 4f358ed..bcfe48f 100644 (file)
@@ -620,6 +620,8 @@ qint64 QHttpNetworkReplyPrivate::readBodyFast(QAbstractSocket *socket, QByteData
     if (readBufferMaxSize)
         toBeRead = qMin(toBeRead, readBufferMaxSize);
 
+    if (!toBeRead)
+        return 0;
 
     QByteArray bd;
     bd.resize(toBeRead);