From d9ceb50238596a14fc836a6499724516cb447cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 20 Feb 2022 00:41:41 +0000 Subject: [PATCH] Add a few more comments explaining copy direction. --- src/util/externalcommandhelper.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/externalcommandhelper.cpp b/src/util/externalcommandhelper.cpp index 5c7e115..e2566cf 100644 --- a/src/util/externalcommandhelper.cpp +++ b/src/util/externalcommandhelper.cpp @@ -1,5 +1,5 @@ /* - SPDX-FileCopyrightText: 2017-2020 Andrius Štikonas + SPDX-FileCopyrightText: 2017-2022 Andrius Štikonas SPDX-FileCopyrightText: 2018 Huzaifa Faruqui SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho SPDX-FileCopyrightText: 2018-2019 Harald Sitter @@ -188,11 +188,14 @@ QVariantMap ExternalCommandHelper::CopyFileData(const QString& sourceDevice, con reply[QStringLiteral("success")] = true; // This enum specified whether individual blocks are moved left or right + // When source and target devices are the same we have to be careful not to overwrite + // source data with newly written data. We don't have to do this if sourceDevice is not + // targetDevice but there are no disadvantages in applying the same scheme. // When partition is moved to the left, we start with the leftmost block, // and move it further left, then second leftmost block and so on. // But when we move partition to the right, we start with rightmost block. // To account for this difference, we introduce CopyDirection variable which takes - // care of some of the differences between these two cases. + // care of some of the differences in offset calculation between these two cases. enum CopyDirection : qint8 { Left = 1, Right = -1,