From a0c528a19044599eaad029b063f595697bb018aa Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 31 Aug 2023 19:35:09 +0800 Subject: [PATCH] Replace comments about relevancy of chunk to propagat v1 with variable name change Signed-off-by: Claudio Cambra --- src/common/syncjournaldb.cpp | 13 ++++--------- src/common/syncjournaldb.h | 2 +- src/libsync/bulkpropagatorjob.cpp | 2 +- src/libsync/propagateuploadv1.cpp | 6 +++--- test/testsyncjournaldb.cpp | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index 03719c6d2bf8..c277f0460235 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -1648,7 +1648,7 @@ SyncJournalDb::UploadInfo SyncJournalDb::getUploadInfo(const QString &file) if (query->next().hasData) { bool ok = true; - res._chunk = query->intValue(0); + res._chunkUploadV1 = query->intValue(0); res._transferid = query->int64Value(1); res._errorCount = query->intValue(2); res._size = query->int64Value(3); @@ -1678,7 +1678,7 @@ void SyncJournalDb::setUploadInfo(const QString &file, const SyncJournalDb::Uplo } query->bindValue(1, file); - query->bindValue(2, i._chunk); + query->bindValue(2, i._chunkUploadV1); query->bindValue(3, i._transferid); query->bindValue(4, i._errorCount); query->bindValue(5, i._size); @@ -2714,13 +2714,8 @@ bool operator==(const SyncJournalDb::DownloadInfo &lhs, bool operator==(const SyncJournalDb::UploadInfo &lhs, const SyncJournalDb::UploadInfo &rhs) { - return lhs._errorCount == rhs._errorCount - && lhs._chunk == rhs._chunk - && lhs._modtime == rhs._modtime - && lhs._valid == rhs._valid - && lhs._size == rhs._size - && lhs._transferid == rhs._transferid - && lhs._contentChecksum == rhs._contentChecksum; + return lhs._errorCount == rhs._errorCount && lhs._chunkUploadV1 == rhs._chunkUploadV1 && lhs._modtime == rhs._modtime && lhs._valid == rhs._valid + && lhs._size == rhs._size && lhs._transferid == rhs._transferid && lhs._contentChecksum == rhs._contentChecksum; } QDebug& operator<<(QDebug &stream, const SyncJournalFileRecord::EncryptionStatus status) diff --git a/src/common/syncjournaldb.h b/src/common/syncjournaldb.h index 1d7892a626cd..01cc1e39012b 100644 --- a/src/common/syncjournaldb.h +++ b/src/common/syncjournaldb.h @@ -115,7 +115,7 @@ class OCSYNC_EXPORT SyncJournalDb : public QObject }; struct UploadInfo { - int _chunk = 0; // Relevant to PropagateUploadV1 only + int _chunkUploadV1 = 0; uint _transferid = 0; qint64 _size = 0; qint64 _modtime = 0; diff --git a/src/libsync/bulkpropagatorjob.cpp b/src/libsync/bulkpropagatorjob.cpp index f1b838731178..08dbadcbca73 100644 --- a/src/libsync/bulkpropagatorjob.cpp +++ b/src/libsync/bulkpropagatorjob.cpp @@ -140,7 +140,7 @@ void BulkPropagatorJob::doStartUpload(SyncFileItemPtr item, // in reconcile (issue #5106) SyncJournalDb::UploadInfo pi; pi._valid = true; - pi._chunk = 0; // Relevant to PropagateUploadV1 only + pi._chunkUploadV1 = 0; pi._transferid = 0; // We set a null transfer id because it is not chunked. pi._modtime = item->_modtime; pi._errorCount = 0; diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index f5ccb805311f..c51fdd3bee7a 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -53,7 +53,7 @@ void PropagateUploadFileV1::doStartUpload() } if (progressInfo._valid && progressInfo.isChunked() && progressInfo._modtime == _item->_modtime && progressInfo._size == _item->_size && (progressInfo._contentChecksum == _item->_checksumHeader || progressInfo._contentChecksum.isEmpty() || _item->_checksumHeader.isEmpty())) { - _startChunk = progressInfo._chunk; + _startChunk = progressInfo._chunkUploadV1; _transferId = progressInfo._transferid; qCInfo(lcPropagateUploadV1) << _item->_file << ": Resuming from chunk " << _startChunk; } else if (_chunkCount <= 1 && !_item->_checksumHeader.isEmpty()) { @@ -62,7 +62,7 @@ void PropagateUploadFileV1::doStartUpload() // in reconcile (issue #5106) SyncJournalDb::UploadInfo pi; pi._valid = true; - pi._chunk = 0; + pi._chunkUploadV1 = 0; pi._transferid = 0; // We set a null transfer id because it is not chunked. Q_ASSERT(_item->_modtime > 0); if (_item->_modtime <= 0) { @@ -297,7 +297,7 @@ void PropagateUploadFileV1::slotPutFinished() currentChunk = qMin(currentChunk, putJob->_chunk - 1); } } - pi._chunk = (currentChunk + _startChunk + 1) % _chunkCount; // next chunk to start with + pi._chunkUploadV1 = (currentChunk + _startChunk + 1) % _chunkCount; // next chunk to start with pi._transferid = _transferId; Q_ASSERT(_item->_modtime > 0); if (_item->_modtime <= 0) { diff --git a/test/testsyncjournaldb.cpp b/test/testsyncjournaldb.cpp index 405ab269d383..79cb88a13813 100644 --- a/test/testsyncjournaldb.cpp +++ b/test/testsyncjournaldb.cpp @@ -153,7 +153,7 @@ private slots: QVERIFY(!record._valid); record._errorCount = 5; - record._chunk = 12; + record._chunkUploadV1 = 12; record._transferid = 812974891; record._size = 12894789147; record._modtime = dropMsecs(QDateTime::currentDateTime());