mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
remove a few warnings reported by sonarcloud to tidy the code
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
37c867bf30
commit
ad32bc7ce5
1 changed files with 5 additions and 7 deletions
|
@ -250,8 +250,7 @@ void PropagateLocalRename::start()
|
|||
|
||||
emit propagator()->touchedFile(existingFile);
|
||||
emit propagator()->touchedFile(targetFile);
|
||||
QString renameError;
|
||||
if (!FileSystem::rename(existingFile, targetFile, &renameError)) {
|
||||
if (QString renameError; !FileSystem::rename(existingFile, targetFile, &renameError)) {
|
||||
done(SyncFileItem::NormalError, renameError);
|
||||
return;
|
||||
}
|
||||
|
@ -279,7 +278,7 @@ void PropagateLocalRename::start()
|
|||
const auto oldFile = _item->_file;
|
||||
|
||||
if (!_item->isDirectory()) { // Directories are saved at the end
|
||||
SyncFileItem newItem(*_item);
|
||||
auto newItem(*_item);
|
||||
if (oldRecord.isValid()) {
|
||||
newItem._checksumHeader = oldRecord._checksumHeader;
|
||||
}
|
||||
|
@ -292,7 +291,7 @@ void PropagateLocalRename::start()
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
auto dbQueryResult = propagator()->_journal->getFilesBelowPath(oldFile.toUtf8(), [oldFile, this] (const SyncJournalFileRecord &record) -> void {
|
||||
const auto dbQueryResult = propagator()->_journal->getFilesBelowPath(oldFile.toUtf8(), [oldFile, this] (const SyncJournalFileRecord &record) -> void {
|
||||
const auto oldFileName = record._path;
|
||||
const auto oldFileNameString = QString::fromUtf8(oldFileName);
|
||||
auto newFileNameString = oldFileNameString;
|
||||
|
@ -314,7 +313,7 @@ void PropagateLocalRename::start()
|
|||
return;
|
||||
}
|
||||
|
||||
auto newItem = SyncFileItem::fromSyncJournalFileRecord(oldRecord);
|
||||
const auto newItem = SyncFileItem::fromSyncJournalFileRecord(oldRecord);
|
||||
newItem->_file = newFileNameString;
|
||||
const auto result = propagator()->updateMetadata(*newItem);
|
||||
if (!result) {
|
||||
|
@ -345,8 +344,7 @@ void PropagateLocalRename::start()
|
|||
|
||||
bool PropagateLocalRename::deleteOldDbRecord(const QString &fileName)
|
||||
{
|
||||
SyncJournalFileRecord oldRecord;
|
||||
if (!propagator()->_journal->getFileRecord(fileName, &oldRecord)) {
|
||||
if (SyncJournalFileRecord oldRecord; !propagator()->_journal->getFileRecord(fileName, &oldRecord)) {
|
||||
qCWarning(lcPropagateLocalRename) << "could not get file from local DB" << fileName;
|
||||
done(SyncFileItem::NormalError, tr("could not get file %1 from local DB").arg(fileName));
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue