diff options
author | saturneric <[email protected]> | 2023-12-23 12:07:26 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-12-23 12:07:26 +0000 |
commit | 4f29479ec7c128ab035d76e32006d8b0c7d0b9f1 (patch) | |
tree | 006f58359a2a0ade32513139a969cf4650c52234 | |
parent | fix: gen key test cases typeid rtti issues (diff) | |
download | GpgFrontend-4f29479ec7c128ab035d76e32006d8b0c7d0b9f1.tar.gz GpgFrontend-4f29479ec7c128ab035d76e32006d8b0c7d0b9f1.zip |
fix: solve all issues of test cases on macos m1
Diffstat (limited to '')
-rw-r--r-- | src/app.cpp | 1 | ||||
-rw-r--r-- | src/core/function/gpg/GpgBasicOperator.cpp | 10 | ||||
-rw-r--r-- | src/core/function/gpg/GpgBasicOperator.h | 3 | ||||
-rw-r--r-- | src/core/function/gpg/GpgCommandExecutor.cpp | 1 | ||||
-rw-r--r-- | src/core/function/gpg/GpgFileOpera.cpp | 4 | ||||
-rw-r--r-- | src/core/model/DataObject.h | 1 | ||||
-rw-r--r-- | src/core/model/GFBuffer.cpp | 58 | ||||
-rw-r--r-- | src/core/model/GFBuffer.h | 54 | ||||
-rw-r--r-- | src/core/model/GpgData.cpp | 53 | ||||
-rw-r--r-- | src/core/model/GpgData.h | 8 | ||||
-rw-r--r-- | src/core/model/GpgEncryptResult.cpp | 61 | ||||
-rw-r--r-- | src/core/model/GpgEncryptResult.h | 51 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/test/GpgFrontendTest.cpp | 1 | ||||
-rw-r--r-- | src/test/core/GpgCoreTest.cpp | 5 | ||||
-rw-r--r-- | src/test/core/GpgCoreTestBasicOpera.cpp | 18 | ||||
-rw-r--r-- | src/ui/function/RaisePinentry.cpp | 1 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 3 |
18 files changed, 292 insertions, 42 deletions
diff --git a/src/app.cpp b/src/app.cpp index 4a7d97f3..f978ef8b 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -32,7 +32,6 @@ #include "core/GpgConstants.h" #include "core/GpgCoreInit.h" #include "module/GpgFrontendModuleInit.h" -#include "spdlog/spdlog.h" #include "ui/GpgFrontendUIInit.h" // main diff --git a/src/core/function/gpg/GpgBasicOperator.cpp b/src/core/function/gpg/GpgBasicOperator.cpp index f559a086..4a615813 100644 --- a/src/core/function/gpg/GpgBasicOperator.cpp +++ b/src/core/function/gpg/GpgBasicOperator.cpp @@ -31,9 +31,9 @@ #include <gpg-error.h> #include "core/GpgModel.h" +#include "core/model/GpgEncryptResult.h" #include "core/utils/AsyncUtils.h" #include "core/utils/GpgUtils.h" -#include "spdlog/spdlog.h" namespace GpgFrontend { @@ -60,8 +60,8 @@ void GpgFrontend::GpgBasicOperator::Encrypt(KeyListPtr keys, gpgme_op_encrypt(ctx_.DefaultContext(), recipients.data(), GPGME_ENCRYPT_ALWAYS_TRUST, data_in, data_out)); data_object->Swap( - {NewResult(gpgme_op_encrypt_result(ctx_.DefaultContext())), - data_out.Read2Buffer()}); + {GpgEncryptResult(gpgme_op_encrypt_result(ctx_.DefaultContext())), + data_out.Read2GFBuffer()}); return err; }, @@ -69,11 +69,11 @@ void GpgFrontend::GpgBasicOperator::Encrypt(KeyListPtr keys, } auto GpgFrontend::GpgBasicOperator::Decrypt( - BypeArrayRef in_buffer, GpgFrontend::ByteArrayPtr& out_buffer, + GFBuffer in_buffer, GpgFrontend::ByteArrayPtr& out_buffer, GpgFrontend::GpgDecrResult& result) -> GpgFrontend::GpgError { GpgError err; - GpgData data_in(in_buffer.data(), in_buffer.size()); + GpgData data_in(in_buffer.Data(), in_buffer.Size()); GpgData data_out; err = CheckGpgError(gpgme_op_decrypt(ctx_.DefaultContext(), data_in, data_out)); diff --git a/src/core/function/gpg/GpgBasicOperator.h b/src/core/function/gpg/GpgBasicOperator.h index 72cd0347..9eb10f80 100644 --- a/src/core/function/gpg/GpgBasicOperator.h +++ b/src/core/function/gpg/GpgBasicOperator.h @@ -31,6 +31,7 @@ #include "core/function/basic/GpgFunctionObject.h" #include "core/function/gpg/GpgContext.h" #include "core/function/result_analyse/GpgResultAnalyse.h" +#include "core/model/GFBuffer.h" #include "core/typedef/CoreTypedef.h" #include "core/typedef/GpgTypedef.h" @@ -101,7 +102,7 @@ class GPGFRONTEND_CORE_EXPORT GpgBasicOperator * @param result the result of the operation * @return error code */ - auto Decrypt(BypeArrayRef in_buffer, ByteArrayPtr& out_buffer, + auto Decrypt(GFBuffer in_buffer, ByteArrayPtr& out_buffer, GpgDecrResult& result) -> GpgError; /** diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 1717c6e0..02d22d07 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -35,7 +35,6 @@ #include "core/module/Module.h" #include "core/thread/Task.h" #include "core/thread/TaskRunnerGetter.h" -#include "spdlog/spdlog.h" namespace GpgFrontend { diff --git a/src/core/function/gpg/GpgFileOpera.cpp b/src/core/function/gpg/GpgFileOpera.cpp index bce3fcd8..32f8c3ab 100644 --- a/src/core/function/gpg/GpgFileOpera.cpp +++ b/src/core/function/gpg/GpgFileOpera.cpp @@ -84,8 +84,8 @@ auto GpgFrontend::GpgFileOpera::DecryptFile(const std::string& in_path, } ByteArrayPtr out_buffer; - auto err = - GpgBasicOperator::GetInstance().Decrypt(in_buffer, out_buffer, result); + auto err = GpgBasicOperator::GetInstance().Decrypt(GFBuffer(in_buffer), + out_buffer, result); assert(CheckGpgError(err) == GPG_ERR_NO_ERROR); diff --git a/src/core/model/DataObject.h b/src/core/model/DataObject.h index 63c829c5..56c86bf6 100644 --- a/src/core/model/DataObject.h +++ b/src/core/model/DataObject.h @@ -34,7 +34,6 @@ #include "core/GpgFrontendCoreExport.h" #include "core/utils/MemoryUtils.h" -#include "spdlog/spdlog.h" namespace GpgFrontend { diff --git a/src/core/model/GFBuffer.cpp b/src/core/model/GFBuffer.cpp new file mode 100644 index 00000000..6c1acb90 --- /dev/null +++ b/src/core/model/GFBuffer.cpp @@ -0,0 +1,58 @@ +/** + * Copyright (C) 2021 Saturneric <[email protected]> + * + * 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 "GFBuffer.h" + +namespace GpgFrontend { + +GFBuffer::GFBuffer() + : buffer_(SecureCreateSharedObject<std::vector<std::byte>>()) {} + +GFBuffer::GFBuffer(const std::string& str) + : buffer_(SecureCreateSharedObject<std::vector<std::byte>>()) { + std::transform(str.begin(), str.end(), buffer_->begin(), + [](const char c) { return static_cast<std::byte>(c); }); +} +GFBuffer::GFBuffer(const char* c_str) + : buffer_(SecureCreateSharedObject<std::vector<std::byte>>()) { + if (c_str == nullptr) { + return; + } + + size_t const length = std::strlen(c_str); + buffer_->reserve(length); + buffer_->assign(reinterpret_cast<const std::byte*>(c_str), + reinterpret_cast<const std::byte*>(c_str) + length); +} +auto GFBuffer::Data() -> std::byte* { return buffer_->data(); } + +void GFBuffer::Resize(size_t size) { buffer_->resize(size); } + +auto GFBuffer::Size() -> size_t { return buffer_->size(); } + +} // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GFBuffer.h b/src/core/model/GFBuffer.h new file mode 100644 index 00000000..b99415e3 --- /dev/null +++ b/src/core/model/GFBuffer.h @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2021 Saturneric <[email protected]> + * + * 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 + * + */ + +#pragma once + +#include "core/GpgFrontendCoreExport.h" +#include "core/utils/MemoryUtils.h" + +namespace GpgFrontend { + +class GPGFRONTEND_CORE_EXPORT GFBuffer { + public: + GFBuffer(); + + explicit GFBuffer(const std::string& str); + + explicit GFBuffer(const char* c_str); + + auto Data() -> std::byte*; + + void Resize(size_t size); + + auto Size() -> size_t; + + private: + std::shared_ptr<std::vector<std::byte>> buffer_; +}; + +} // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgData.cpp b/src/core/model/GpgData.cpp index 60e6ace2..286ca0ce 100644 --- a/src/core/model/GpgData.cpp +++ b/src/core/model/GpgData.cpp @@ -28,6 +28,12 @@ #include "core/model/GpgData.h" +#include "core/typedef/GpgTypedef.h" + +namespace GpgFrontend { + +constexpr size_t kBufferSize = 32 * 1024; + GpgFrontend::GpgData::GpgData() { gpgme_data_t data; @@ -47,33 +53,52 @@ GpgFrontend::GpgData::GpgData(const void* buffer, size_t size, bool copy) { data_ref_ = std::unique_ptr<struct gpgme_data, DataRefDeleter>(data); } -/** - * Read gpgme-Data to QByteArray - * mainly from http://basket.kde.org/ (kgpgme.cpp) - */ -#define BUF_SIZE (32 * 1024) - -GpgFrontend::ByteArrayPtr GpgFrontend::GpgData::Read2Buffer() { +auto GpgFrontend::GpgData::Read2Buffer() -> GpgFrontend::ByteArrayPtr { gpgme_off_t ret = gpgme_data_seek(*this, 0, SEEK_SET); ByteArrayPtr out_buffer = std::make_unique<std::string>(); - if (ret) { - gpgme_error_t err = gpgme_err_code_from_errno(errno); + if (ret != 0) { + GpgError const err = gpgme_err_code_from_errno(errno); assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); } else { - char buf[BUF_SIZE + 2]; + std::array<std::byte, kBufferSize + 2> buf; - while ((ret = gpgme_data_read(*this, buf, BUF_SIZE)) > 0) { + while ((ret = gpgme_data_read(*this, buf.data(), kBufferSize)) > 0) { const size_t size = out_buffer->size(); out_buffer->resize(static_cast<int>(size + ret)); - memcpy(out_buffer->data() + size, buf, ret); + memcpy(out_buffer->data() + size, buf.data(), ret); + } + if (ret < 0) { + GpgError const err = gpgme_err_code_from_errno(errno); + assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); + } + } + return out_buffer; +} + +auto GpgData::Read2GFBuffer() -> GFBuffer { + gpgme_off_t ret = gpgme_data_seek(*this, 0, SEEK_SET); + GFBuffer out_buffer; + + if (ret != 0) { + const GpgError err = gpgme_err_code_from_errno(errno); + assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); + } else { + std::array<std::byte, kBufferSize + 2> buf; + + while ((ret = gpgme_data_read(*this, buf.data(), kBufferSize)) > 0) { + const size_t size = out_buffer.Size(); + out_buffer.Resize(static_cast<int>(size + ret)); + memcpy(out_buffer.Data() + size, buf.data(), ret); } if (ret < 0) { - gpgme_error_t err = gpgme_err_code_from_errno(errno); + const GpgError err = gpgme_err_code_from_errno(errno); assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); } } return out_buffer; } -GpgFrontend::GpgData::operator gpgme_data_t() { return data_ref_.get(); }
\ No newline at end of file +GpgFrontend::GpgData::operator gpgme_data_t() { return data_ref_.get(); } + +} // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgData.h b/src/core/model/GpgData.h index ed5afc77..a7c51c06 100644 --- a/src/core/model/GpgData.h +++ b/src/core/model/GpgData.h @@ -29,6 +29,7 @@ #pragma once #include "core/GpgFrontendCoreExport.h" +#include "core/model/GFBuffer.h" #include "core/typedef/CoreTypedef.h" namespace GpgFrontend { @@ -67,6 +68,13 @@ class GPGFRONTEND_CORE_EXPORT GpgData { */ auto Read2Buffer() -> ByteArrayPtr; + /** + * @brief + * + * @return ByteArrayPtr + */ + auto Read2GFBuffer() -> GFBuffer; + private: /** * @brief diff --git a/src/core/model/GpgEncryptResult.cpp b/src/core/model/GpgEncryptResult.cpp new file mode 100644 index 00000000..9228d3e1 --- /dev/null +++ b/src/core/model/GpgEncryptResult.cpp @@ -0,0 +1,61 @@ +/** + * Copyright (C) 2021 Saturneric <[email protected]> + * + * 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 "GpgEncryptResult.h" + +namespace GpgFrontend { +GpgEncryptResult::GpgEncryptResult(gpgme_encrypt_result_t r) + : result_ref_(std::shared_ptr<struct _gpgme_op_encrypt_result>( + (gpgme_result_ref(r), r), [](gpgme_encrypt_result_t p) { + if (p != nullptr) { + gpgme_result_unref(p); + } + })) {} + +GpgEncryptResult::GpgEncryptResult() = default; + +GpgEncryptResult::~GpgEncryptResult() = default; + +auto GpgEncryptResult::IsGood() -> bool { return result_ref_ != nullptr; } + +auto GpgEncryptResult::InvalidRecipients() + -> std::vector<std::tuple<std::string, GpgError>> { + std::vector<std::tuple<std::string, GpgError>> result; + for (auto* invalid_key = result_ref_->invalid_recipients; + invalid_key != nullptr; invalid_key = invalid_key->next) { + try { + result.emplace_back(std::string{invalid_key->fpr}, invalid_key->reason); + } catch (...) { + SPDLOG_ERROR( + "caught exception when processing invalid_recipients, " + "maybe nullptr of fpr"); + } + } + return result; +} +} // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgEncryptResult.h b/src/core/model/GpgEncryptResult.h new file mode 100644 index 00000000..56484f49 --- /dev/null +++ b/src/core/model/GpgEncryptResult.h @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2021 Saturneric <[email protected]> + * + * 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 + * + */ + +#pragma once + +#include "core/typedef/GpgTypedef.h" + +namespace GpgFrontend { + +class GPGFRONTEND_CORE_EXPORT GpgEncryptResult { + public: + auto IsGood() -> bool; + + auto InvalidRecipients() -> std::vector<std::tuple<std::string, GpgError>>; + + explicit GpgEncryptResult(gpgme_encrypt_result_t); + + GpgEncryptResult(); + + virtual ~GpgEncryptResult(); + + private: + std::shared_ptr<struct _gpgme_op_encrypt_result> result_ref_ = nullptr; ///< +}; + +} // namespace GpgFrontend
\ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 3bffe608..9e9bf091 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,6 @@ #include "cmd.h" #include "core/utils/MemoryUtils.h" #include "init.h" -#include "spdlog/spdlog.h" namespace po = boost::program_options; diff --git a/src/test/GpgFrontendTest.cpp b/src/test/GpgFrontendTest.cpp index 0cc2c45e..73a18654 100644 --- a/src/test/GpgFrontendTest.cpp +++ b/src/test/GpgFrontendTest.cpp @@ -43,7 +43,6 @@ #include "core/function/gpg/GpgContext.h" #include "core/function/gpg/GpgKeyImportExporter.h" #include "core/utils/IOUtils.h" -#include "spdlog/spdlog.h" namespace GpgFrontend::Test { diff --git a/src/test/core/GpgCoreTest.cpp b/src/test/core/GpgCoreTest.cpp index 1e33536f..1d7ddaa0 100644 --- a/src/test/core/GpgCoreTest.cpp +++ b/src/test/core/GpgCoreTest.cpp @@ -31,13 +31,10 @@ #include "core/function/gpg/GpgKeyImportExporter.h" #include "core/utils/IOUtils.h" #include "core/utils/MemoryUtils.h" -#include "spdlog/spdlog.h" namespace GpgFrontend::Test { void GpgCoreTest::TearDown() {} -void GpgCoreTest::SetUp() { - -} +void GpgCoreTest::SetUp() {} } // namespace GpgFrontend::Test diff --git a/src/test/core/GpgCoreTestBasicOpera.cpp b/src/test/core/GpgCoreTestBasicOpera.cpp index d54b4f20..b79ca659 100644 --- a/src/test/core/GpgCoreTestBasicOpera.cpp +++ b/src/test/core/GpgCoreTestBasicOpera.cpp @@ -32,6 +32,7 @@ #include "core/function/gpg/GpgBasicOperator.h" #include "core/function/gpg/GpgKeyGetter.h" #include "core/function/result_analyse/GpgDecryptResultAnalyse.h" +#include "core/model/GpgEncryptResult.h" #include "core/utils/GpgUtils.h" namespace GpgFrontend::Test { @@ -46,15 +47,16 @@ TEST_F(GpgCoreTest, CoreEncryptDecrTest) { GpgBasicOperator::GetInstance().Encrypt( keys, encrypt_text, [encrypt_text](GpgError err, const DataObjectPtr& data_obj) { - auto result = ExtractParams<GpgEncrResult>(data_obj, 0); - auto encr_out_buffer = ExtractParams<ByteArrayPtr>(data_obj, 1); - ASSERT_EQ(result->invalid_recipients, nullptr); + ASSERT_TRUE((data_obj->Check<GpgEncryptResult, GFBuffer>())); + auto result = ExtractParams<GpgEncryptResult>(data_obj, 0); + auto encr_out_buffer = ExtractParams<GFBuffer>(data_obj, 1); + ASSERT_TRUE(result.InvalidRecipients().empty()); ASSERT_EQ(CheckGpgError(err), GPG_ERR_NO_ERROR); GpgDecrResult d_result; ByteArrayPtr decr_out_data; err = GpgBasicOperator::GetInstance(kGpgFrontendDefaultChannel) - .Decrypt(*encr_out_buffer, decr_out_data, d_result); + .Decrypt(encr_out_buffer, decr_out_data, d_result); ASSERT_EQ(CheckGpgError(err), GPG_ERR_NO_ERROR); ASSERT_NE(d_result->recipients, nullptr); ASSERT_EQ(std::string(d_result->recipients->keyid), "6A2764F8298DEB29"); @@ -63,7 +65,7 @@ TEST_F(GpgCoreTest, CoreEncryptDecrTest) { } TEST_F(GpgCoreTest, CoreEncryptDecrTest_KeyNotFound_1) { - ByteArrayPtr encr_out_data = std::make_unique<ByteArray>( + auto encr_out_data = GFBuffer( "-----BEGIN PGP MESSAGE-----\n" "\n" "hQEMA6UM/S9sZ32MAQf9Fb6gp6nvgKTQBv2mmjXia6ODXYq6kNeLsPVzLCbHyWOs\n" @@ -79,14 +81,14 @@ TEST_F(GpgCoreTest, CoreEncryptDecrTest_KeyNotFound_1) { GpgDecrResult d_result; ByteArrayPtr decr_out_data; auto err = GpgBasicOperator::GetInstance(kGpgFrontendDefaultChannel) - .Decrypt(*encr_out_data, decr_out_data, d_result); + .Decrypt(encr_out_data, decr_out_data, d_result); ASSERT_EQ(CheckGpgError(err), GPG_ERR_NO_SECKEY); ASSERT_NE(d_result->recipients, nullptr); ASSERT_EQ(std::string(d_result->recipients->keyid), "A50CFD2F6C677D8C"); } TEST_F(GpgCoreTest, CoreEncryptDecrTest_KeyNotFound_ResultAnalyse) { - ByteArrayPtr encr_out_data = std::make_unique<ByteArray>( + auto encr_out_data = GFBuffer( "-----BEGIN PGP MESSAGE-----\n" "\n" "hQEMA6UM/S9sZ32MAQf9Fb6gp6nvgKTQBv2mmjXia6ODXYq6kNeLsPVzLCbHyWOs\n" @@ -102,7 +104,7 @@ TEST_F(GpgCoreTest, CoreEncryptDecrTest_KeyNotFound_ResultAnalyse) { GpgDecrResult d_result; ByteArrayPtr decr_out_data; auto err = GpgBasicOperator::GetInstance(kGpgFrontendDefaultChannel) - .Decrypt(*encr_out_data, decr_out_data, d_result); + .Decrypt(encr_out_data, decr_out_data, d_result); ASSERT_EQ(CheckGpgError(err), GPG_ERR_NO_SECKEY); ASSERT_NE(d_result->recipients, nullptr); ASSERT_EQ(std::string(d_result->recipients->keyid), "A50CFD2F6C677D8C"); diff --git a/src/ui/function/RaisePinentry.cpp b/src/ui/function/RaisePinentry.cpp index f47962f4..31804fa8 100644 --- a/src/ui/function/RaisePinentry.cpp +++ b/src/ui/function/RaisePinentry.cpp @@ -32,7 +32,6 @@ #include "core/function/CoreSignalStation.h" #include "pinentry/pinentrydialog.h" -#include "spdlog/spdlog.h" namespace GpgFrontend::UI { diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index eea2075c..728818ab 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -45,7 +45,6 @@ #include "core/typedef/GpgTypedef.h" #include "core/utils/CommonUtils.h" #include "core/utils/GpgUtils.h" -#include "spdlog/spdlog.h" #include "ui/UserInterfaceUtils.h" #include "ui/dialog/SignersPicker.h" #include "ui/dialog/help/AboutDialog.h" @@ -272,7 +271,7 @@ void MainWindow::slot_decrypt() { GpgDecrResult result = nullptr; auto decrypted = GpgFrontend::SecureCreateSharedObject<ByteArray>(); GpgError error = GpgFrontend::GpgBasicOperator::GetInstance().Decrypt( - buffer, decrypted, result); + GFBuffer(buffer), decrypted, result); data_object->Swap({error, result, decrypted}); } catch (const std::runtime_error& e) { |