QNetworkDiskCache: avoid a 31-bit truncation
authorMarc Mutz <marc.mutz@kdab.com>
Mon, 20 Aug 2012 14:24:59 +0000 (16:24 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 23 Aug 2012 16:05:31 +0000 (18:05 +0200)
Network operations whose content size exceed 2G are not unheard of, and
they probably shouldn't be cached, so use the correct toX() function, one
that doesn't truncate the value in the header.

Change-Id: Ie4e68a3120c85952dd2cc9feb73c5844e20b9aa3
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
src/network/access/qnetworkdiskcache.cpp

index 4afca95..e68158f 100644 (file)
@@ -197,7 +197,7 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData)
 
     foreach (const QNetworkCacheMetaData::RawHeader &header, metaData.rawHeaders()) {
         if (header.first.toLower() == "content-length") {
-            qint64 size = header.second.toInt();
+            const qint64 size = header.second.toLongLong();
             if (size > (maximumCacheSize() * 3)/4)
                 return 0;
             break;