From f8a513cee895e656563ca90297b46f21e1e1edb3 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Sat, 19 Mar 2022 16:42:47 +0800 Subject: (core, ui): fix codacy issues. 1. The scope of the variable 'r' can be reduced. 2. Class 'IMAPFolder' does not have a copy constructor which is recommended since it has dynamic memory/resource allocation(s). 3. Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). --- src/core/function/ArchiveFileOperator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/function/ArchiveFileOperator.cpp') diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index 1a1ffaec..17f29df1 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -231,11 +231,11 @@ void GpgFrontend::ArchiveFileOperator::ExtractArchive( LOG(ERROR) << "cannot read from stdin"; } #ifdef WINDOWS - if ((r = archive_read_open_filename_w(a, archive_path.wstring().c_str(), - 10240))) { + if (archive_read_open_filename_w(a, archive_path.wstring().c_str(), + 10240) != ARCHIVE_OK) { #else - if ((r = archive_read_open_filename(a, archive_path.u8string().c_str(), - 10240))) { + if (archive_read_open_filename(a, archive_path.u8string().c_str(), + 10240) != ARCHIVE_OK) { #endif LOG(ERROR) << "archive_read_open_filename() failed: " << archive_error_string(a); -- cgit v1.2.3