From 151e48fef2a74a7d153a5a8eaff1088a4b1a9043 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 1 Apr 2011 14:58:26 +0200 Subject: QNetworkDiskCache: clean up after merge request changes include whitespace, parenting, recovering erroneously deleted code etc. Reviewed-by: Markus Goetz --- src/network/access/qnetworkdiskcache.cpp | 8 ++++---- .../declarative/qdeclarativedom/data/importlib/sublib/qmldir | 2 ++ tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp | 1 + .../network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp | 10 +++++----- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp index a5c0b3d..271494d 100644 --- a/src/network/access/qnetworkdiskcache.cpp +++ b/src/network/access/qnetworkdiskcache.cpp @@ -261,12 +261,11 @@ void QNetworkDiskCachePrivate::prepareLayout() //Create directory and subdirectories 0-F helper.mkpath(dataDirectory); - for ( uint i = 0; i < 16 ; i++ ) { + for (uint i = 0; i < 16 ; i++) { QString str = QString::number(i, 16); QString subdir = dataDirectory + str; helper.mkdir(subdir); } - } @@ -435,6 +434,7 @@ QIODevice *QNetworkDiskCache::data(const QUrl &url) #endif if (p) { buffer->setData((const char *)p, size); + file.take()->setParent(buffer.data()); } else { buffer->setData(file->readAll()); } @@ -605,7 +605,7 @@ QString QNetworkDiskCachePrivate::uniqueFileName(const QUrl &url) QByteArray id = QByteArray::number(*(qlonglong*)hash.result().data(), 36).left(8); // generates /<8-char filname.d> uint code = (uint)id.at(id.length()-1) % 16; - QString pathFragment = QString::number(code, 16) + QLatin1String("/") + QString pathFragment = QString::number(code, 16) + QLatin1Char('/') + QLatin1String(id) + CACHE_POSTFIX; return pathFragment; @@ -618,7 +618,7 @@ QString QNetworkDiskCachePrivate::tmpCacheFileName() const } /*! - Genrates fully qualified path of cached resource from a URL. + Generates fully qualified path of cached resource from a URL. */ QString QNetworkDiskCachePrivate::cacheFileName(const QUrl &url) const { diff --git a/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir index e69de29..98d6b74 100644 --- a/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir +++ b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir @@ -0,0 +1,2 @@ +Foo 1.1 Foo.qml +Foo 1.0 Foo.qml diff --git a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 91b0164..28c6027 100644 --- a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -181,6 +181,7 @@ void tst_QNetworkDiskCache::initTestCase() dir.rmdir(s + "data7"); // the number is the internal cache version dir.rmdir(s + "prepared"); dir.rmdir(s); + dir.rmdir(s + "http"); // delete directory used by 4.7 and earlier (would make the tests fail) } // This will be called after the last test function is executed. diff --git a/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index b87e327..55cbf55 100644 --- a/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/benchmarks/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -74,11 +74,11 @@ private: void initCacheObject(); QString cacheDir; QNetworkDiskCache *cache; - -public slots: + +public slots: void initTestCase(); void cleanupTestCase(); - + private slots: void timeInsertion_data(); @@ -147,7 +147,7 @@ void tst_qnetworkdiskcache::timeInsertion() // IMPORTANT: max cache size should be HugeCacheLimit, to avoid evictions below //time insertion of previously-uncached URLs. - QBENCHMARK_ONCE { + QBENCHMARK_ONCE { for (quint32 i = NumFakeCacheObjects; i < (NumFakeCacheObjects + NumInsertions); i++) { //prepare metata for url QNetworkCacheMetaData meta; @@ -274,7 +274,7 @@ void tst_qnetworkdiskcache::timeRemoval() QVERIFY(NumFakeCacheObjects > NumRemovals); //time removal of previously-inserted URL. - QBENCHMARK_ONCE { + QBENCHMARK_ONCE { for (quint32 i = 0; i < NumRemovals; i++) { QString fakeURL; QTextStream stream(&fakeURL); -- cgit v0.12