aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function/FileOperator.cpp
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2022-07-23 14:54:51 +0000
committerGitHub <[email protected]>2022-07-23 14:54:51 +0000
commitb244320b2d228189767aa6d59febceb6b64527fb (patch)
tree179d34e2a3e84231fad72c4bbe9f74673d0b74d0 /src/core/function/FileOperator.cpp
parentMerge pull request #68 from saturneric/develop-2.0.8 (diff)
parentfeat(project): add rpm package support (diff)
downloadGpgFrontend-2.0.9.tar.gz
GpgFrontend-2.0.9.zip
Merge pull request #70 from saturneric/dev/2.0.8/saturnericv2.0.9
Develop 2.0.9.1
Diffstat (limited to '')
-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);