Clean up and const autofy BulkPropagatorJob::scheduleSelfOrChild
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 11 May 2023 11:57:28 +0000 (19:57 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 15 May 2023 12:46:21 +0000 (20:46 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/bulkpropagatorjob.cpp

index bbbc98ab1b6fb39ed5955fb79c9c135eb97e7b5b..f34fd8593c3064518c3889a1b0db9e53c3e2ab43 100644 (file)
@@ -82,19 +82,18 @@ BulkPropagatorJob::BulkPropagatorJob(OwncloudPropagator *propagator,
 
 bool BulkPropagatorJob::scheduleSelfOrChild()
 {
-    if (_items.empty()) {
-        return false;
-    }
-    if (!_pendingChecksumFiles.empty()) {
+    if (_items.empty() || !_pendingChecksumFiles.empty()) {
         return false;
     }
 
     _state = Running;
-    for(int i = 0; i < batchSize && !_items.empty(); ++i) {
-        auto currentItem = _items.front();
+
+    for(auto i = 0; i < batchSize && !_items.empty(); ++i) {
+        const auto currentItem = _items.front();
         _items.pop_front();
         _pendingChecksumFiles.insert(currentItem->_file);
-        QMetaObject::invokeMethod(this, [this, currentItem] () {
+
+        QMetaObject::invokeMethod(this, [this, currentItem] {
             UploadFileInfo fileToUpload;
             fileToUpload._file = currentItem->_file;
             fileToUpload._size = currentItem->_size;