[Pkg-owncloud-commits] [owncloud-client] 67/175: TransmissionChecksum: Removed "pseudo" thread worker functions

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Aug 8 10:36:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 1f7274c2f270c401290238173ee2fd5d06038adf
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed May 20 10:45:20 2015 +0200

    TransmissionChecksum: Removed "pseudo" thread worker functions
    
    Removed the Worker postfix from the method names to reflect their non
    threaded character, they moved into a thread in the Validator class.
    
    Thanks ckamm for review.
---
 src/libsync/filesystem.cpp                    | 38 +++------------------------
 src/libsync/filesystem.h                      |  4 ---
 src/libsync/transmissionchecksumvalidator.cpp | 12 ++++-----
 3 files changed, 9 insertions(+), 45 deletions(-)

diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp
index b80d485..873af19 100644
--- a/src/libsync/filesystem.cpp
+++ b/src/libsync/filesystem.cpp
@@ -402,7 +402,7 @@ QString FileSystem::fileSystemForPath(const QString & path)
 }
 #endif
 
-QByteArray FileSystem::calcMd5Worker( const QString& filename )
+QByteArray FileSystem::calcMd5( const QString& filename )
 {
     QByteArray arr;
 
@@ -420,7 +420,7 @@ QByteArray FileSystem::calcMd5Worker( const QString& filename )
     return arr;
 }
 
-QByteArray FileSystem::calcSha1Worker( const QString& filename )
+QByteArray FileSystem::calcSha1( const QString& filename )
 {
     QByteArray arr;
 
@@ -439,7 +439,7 @@ QByteArray FileSystem::calcSha1Worker( const QString& filename )
 }
 
 #ifdef ZLIB_FOUND
-QByteArray FileSystem::calcAdler32Worker( const QString& filename )
+QByteArray FileSystem::calcAdler32( const QString& filename )
 {
   unsigned int adler = adler32(0L, Z_NULL, 0);
 
@@ -456,36 +456,4 @@ QByteArray FileSystem::calcAdler32Worker( const QString& filename )
 }
 #endif
 
-QByteArray FileSystem::calcMd5( const QString& fileName )
-{
-    QFuture<QByteArray> f1 = QtConcurrent::run(calcMd5Worker, fileName );
-    f1.waitForFinished();
-
-    const QByteArray md5 = f1.result();
-
-    return md5;
-}
-
-QByteArray FileSystem::calcSha1( const QString& fileName )
-{
-    QFuture<QByteArray> f1 = QtConcurrent::run(calcSha1Worker, fileName );
-    f1.waitForFinished();
-
-    const QByteArray sha1 = f1.result();
-
-    return sha1;
-}
-
-#ifdef ZLIB_FOUND
-QByteArray FileSystem::calcAdler32( const QString& fileName )
-{
-    QFuture<QByteArray> f1 = QtConcurrent::run(calcAdler32Worker, fileName );
-    f1.waitForFinished();
-
-    const QByteArray checksum = f1.result();
-
-    return checksum;
-}
-#endif
-
 } // namespace OCC
diff --git a/src/libsync/filesystem.h b/src/libsync/filesystem.h
index a2a1450..6e9b45c 100644
--- a/src/libsync/filesystem.h
+++ b/src/libsync/filesystem.h
@@ -121,10 +121,6 @@ bool openAndSeekFileSharedRead(QFile* file, QString* error, qint64 seek);
 QString fileSystemForPath(const QString & path);
 #endif
 
-/**
- * Calculate the checksum of a file in a worker thread. Each function waits
- * until the calculation is finished.
- */
 QByteArray calcMd5( const QString& fileName );
 QByteArray calcSha1( const QString& fileName );
 QByteArray calcAdler32( const QString& fileName );
diff --git a/src/libsync/transmissionchecksumvalidator.cpp b/src/libsync/transmissionchecksumvalidator.cpp
index a9af205..b01f9e0 100644
--- a/src/libsync/transmissionchecksumvalidator.cpp
+++ b/src/libsync/transmissionchecksumvalidator.cpp
@@ -59,18 +59,18 @@ void TransmissionChecksumValidator::uploadValidation( SyncFileItem *item )
         if( checksumType == checkSumMD5C ) {
             item->_checksum = checkSumMD5C;
             item->_checksum += ":";
-            _watcher.setFuture(QtConcurrent::run(FileSystem::calcMd5Worker, _filePath));
+            _watcher.setFuture(QtConcurrent::run(FileSystem::calcMd5, _filePath));
 
         } else if( checksumType == checkSumSHA1C ) {
             item->_checksum = checkSumSHA1C;
             item->_checksum += ":";
-            _watcher.setFuture(QtConcurrent::run( FileSystem::calcSha1Worker, _filePath));
+            _watcher.setFuture(QtConcurrent::run( FileSystem::calcSha1, _filePath));
         }
 #ifdef ZLIB_FOUND
         else if( checksumType == checkSumAdlerC) {
             item->_checksum = checkSumAdlerC;
             item->_checksum += ":";
-            _watcher.setFuture(QtConcurrent::run(FileSystem::calcAdler32Worker, _filePath));
+            _watcher.setFuture(QtConcurrent::run(FileSystem::calcAdler32, _filePath));
         }
 #endif
         else {
@@ -117,13 +117,13 @@ void TransmissionChecksumValidator::downloadValidation( const QByteArray& checks
 
     // start the calculation in different thread
     if( type == checkSumMD5C ) {
-        _watcher.setFuture(QtConcurrent::run(FileSystem::calcMd5Worker, _filePath));
+        _watcher.setFuture(QtConcurrent::run(FileSystem::calcMd5, _filePath));
     } else if( type == checkSumSHA1C ) {
-        _watcher.setFuture(QtConcurrent::run(FileSystem::calcSha1Worker, _filePath));
+        _watcher.setFuture(QtConcurrent::run(FileSystem::calcSha1, _filePath));
     }
 #ifdef ZLIB_FOUND
     else if( type == checkSumAdlerUpperC ) {
-        _watcher.setFuture(QtConcurrent::run(FileSystem::calcAdler32Worker, _filePath));
+        _watcher.setFuture(QtConcurrent::run(FileSystem::calcAdler32, _filePath));
     }
 #endif
     else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list