aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/FileOperator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function/FileOperator.cpp')
-rw-r--r--src/core/function/FileOperator.cpp66
1 files changed, 34 insertions, 32 deletions
diff --git a/src/core/function/FileOperator.cpp b/src/core/function/FileOperator.cpp
index 4977b3a9..fcbdb91c 100644
--- a/src/core/function/FileOperator.cpp
+++ b/src/core/function/FileOperator.cpp
@@ -1,30 +1,30 @@
/**
-* Copyright (C) 2021 Saturneric
-*
-* This file is part of GpgFrontend.
-*
-* GpgFrontend is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* GpgFrontend is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
-*
-* The initial version of the source code is inherited from
-* the gpg4usb project, which is under GPL-3.0-or-later.
-*
-* All the source code of GpgFrontend was modified and released by
-* Saturneric<[email protected]> starting on May 12, 2021.
-*
-* SPDX-License-Identifier: GPL-3.0-or-later
-*
-*/
+ * Copyright (C) 2021 Saturneric
+ *
+ * This file is part of GpgFrontend.
+ *
+ * GpgFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GpgFrontend is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from
+ * the gpg4usb project, which is under GPL-3.0-or-later.
+ *
+ * All the source code of GpgFrontend was modified and released by
+ * Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
#include "FileOperator.h"
@@ -56,9 +56,11 @@ bool GpgFrontend::FileOperator::ReadFileStd(
const std::filesystem::path& file_name, std::string& data) {
QByteArray byte_data;
#ifdef WINDOWS
- bool res = ReadFile(QString::fromStdU16String(file_name.u16string()).toUtf8(), byte_data);
+ bool res = ReadFile(QString::fromStdU16String(file_name.u16string()).toUtf8(),
+ byte_data);
#else
- bool res = ReadFile(QString::fromStdString(file_name.u8string()).toUtf8(), byte_data);
+ bool res = ReadFile(QString::fromStdString(file_name.u8string()).toUtf8(),
+ byte_data);
#endif
data = byte_data.toStdString();
return res;
@@ -66,7 +68,8 @@ bool GpgFrontend::FileOperator::ReadFileStd(
bool GpgFrontend::FileOperator::WriteFileStd(
const std::filesystem::path& file_name, const std::string& data) {
- return WriteFile(QString::fromStdString(file_name.u8string()).toUtf8(), QByteArray::fromStdString(data));
+ return WriteFile(QString::fromStdString(file_name.u8string()).toUtf8(),
+ QByteArray::fromStdString(data));
}
std::string GpgFrontend::FileOperator::CalculateHash(
@@ -80,12 +83,11 @@ std::string GpgFrontend::FileOperator::CalculateHash(
ss << " " << _("filename") << _(": ")
<< file_path.filename().u8string().c_str() << std::endl;
-
QFile f(info.filePath());
f.open(QFile::ReadOnly);
auto buffer = f.readAll();
- ss << " " << _("file size(bytes)") << _(": ")
- << buffer.size() << std::endl;
+ ss << " " << _("file size(bytes)") << _(": ") << buffer.size()
+ << std::endl;
f.close();
if (f.open(QFile::ReadOnly)) {
auto hash_md5 = QCryptographicHash(QCryptographicHash::Md5);