aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/function/ArchiveFileOperator.cpp15
-rw-r--r--src/core/function/CharsetOperator.cpp6
-rw-r--r--src/core/function/aes/aes_ssl_cbc.cpp4
-rw-r--r--src/core/model/GpgData.cpp3
-rw-r--r--src/core/thread/Task.cpp2
5 files changed, 9 insertions, 21 deletions
diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp
index 04c9326f..8aad0500 100644
--- a/src/core/function/ArchiveFileOperator.cpp
+++ b/src/core/function/ArchiveFileOperator.cpp
@@ -136,8 +136,6 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive(
}
for (;;) {
- bool needcr = false;
-
entry = archive_entry_new();
r = archive_read_next_header2(disk, entry);
@@ -149,15 +147,6 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive(
}
archive_read_disk_descend(disk);
-#ifdef WINDOWS
- auto entry_path =
- QString::fromStdWString(std::wstring(archive_entry_pathname_w(entry)))
- .toUtf8()
- .toStdString();
-#else
- auto entry_path = std::string(archive_entry_pathname_utf8(entry));
-#endif
-
SPDLOG_DEBUG("Adding: {} size: {} bytes: {} file type: {}",
archive_entry_pathname_utf8(entry),
archive_entry_size(entry), archive_entry_filetype(entry));
@@ -201,7 +190,6 @@ void GpgFrontend::ArchiveFileOperator::ExtractArchive(
struct archive *a;
struct archive *ext;
struct archive_entry *entry;
- int r;
a = archive_read_new();
ext = archive_write_disk_new();
@@ -241,8 +229,9 @@ void GpgFrontend::ArchiveFileOperator::ExtractArchive(
archive_error_string(a));
throw std::runtime_error("archive_read_open_filename() failed");
}
+
for (;;) {
- r = archive_read_next_header(a, &entry);
+ int r = archive_read_next_header(a, &entry);
if (r == ARCHIVE_EOF) break;
if (r != ARCHIVE_OK) {
SPDLOG_ERROR("archive_read_next_header() failed: {}",
diff --git a/src/core/function/CharsetOperator.cpp b/src/core/function/CharsetOperator.cpp
index 0e40e317..72c5e72b 100644
--- a/src/core/function/CharsetOperator.cpp
+++ b/src/core/function/CharsetOperator.cpp
@@ -117,12 +117,10 @@ bool GpgFrontend::CharsetOperator::Convert2Utf8(const std::string &buffer,
if (status == U_BUFFER_OVERFLOW_ERROR) {
status = U_ZERO_ERROR;
- target_limit = target_capacity + 1;
out_buffer.clear();
out_buffer.resize(target_capacity);
- target_capacity =
- ucnv_convert(from_encode.c_str(), to_encode.c_str(), out_buffer.data(),
- out_buffer.size(), buffer.data(), buffer.size(), &status);
+ ucnv_convert(from_encode.c_str(), to_encode.c_str(), out_buffer.data(),
+ out_buffer.size(), buffer.data(), buffer.size(), &status);
}
if (U_FAILURE(status)) {
diff --git a/src/core/function/aes/aes_ssl_cbc.cpp b/src/core/function/aes/aes_ssl_cbc.cpp
index 88a54baa..3aa80ef5 100644
--- a/src/core/function/aes/aes_ssl_cbc.cpp
+++ b/src/core/function/aes/aes_ssl_cbc.cpp
@@ -59,7 +59,7 @@ uint8_t *aes_256_cbc_encrypt(EVP_CIPHER_CTX *e, uint8_t *plaintext, int *len) {
/* max ciphertext len for a n bytes of plaintext is n + AES_BLOCK_SIZE -1
* bytes */
int c_len = *len + AES_BLOCK_SIZE, f_len = 0;
- auto *ciphertext = (uint8_t *)malloc(c_len);
+ auto *ciphertext = static_cast<uint8_t *>(malloc(c_len));
/* allows reusing of 'e' for multiple encryption cycles */
EVP_EncryptInit_ex(e, nullptr, nullptr, nullptr, nullptr);
@@ -86,7 +86,7 @@ uint8_t *aes_256_cbc_encrypt(EVP_CIPHER_CTX *e, uint8_t *plaintext, int *len) {
uint8_t *aes_256_cbc_decrypt(EVP_CIPHER_CTX *e, uint8_t *ciphertext, int *len) {
/* plaintext will always be equal to or lesser than length of ciphertext*/
int p_len = *len, f_len = 0;
- auto *plaintext = (uint8_t *)malloc(p_len);
+ auto *plaintext = static_cast<uint8_t *>(malloc(p_len));
EVP_DecryptInit_ex(e, nullptr, nullptr, nullptr, nullptr);
EVP_DecryptUpdate(e, plaintext, &p_len, ciphertext, *len);
diff --git a/src/core/model/GpgData.cpp b/src/core/model/GpgData.cpp
index 5aa95dc6..05f61a46 100644
--- a/src/core/model/GpgData.cpp
+++ b/src/core/model/GpgData.cpp
@@ -40,7 +40,8 @@ GpgFrontend::GpgData::GpgData() {
GpgFrontend::GpgData::GpgData(void* buffer, size_t size, bool copy) {
gpgme_data_t data;
- auto err = gpgme_data_new_from_mem(&data, (const char*)buffer, size, copy);
+ auto err = gpgme_data_new_from_mem(&data, static_cast<const char*>(buffer),
+ size, copy);
assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR);
data_ref_ = std::unique_ptr<struct gpgme_data, _data_ref_deleter>(data);
diff --git a/src/core/thread/Task.cpp b/src/core/thread/Task.cpp
index f3c6ae86..7173b69e 100644
--- a/src/core/thread/Task.cpp
+++ b/src/core/thread/Task.cpp
@@ -218,7 +218,7 @@ void GpgFrontend::Thread::Task::DataObject::free_heap_ptr(Destructor *ptr) {
if (ptr->destroy != nullptr) {
ptr->destroy(ptr->p_obj);
}
- free((void *)ptr->p_obj);
+ free(const_cast<void *>(ptr->p_obj));
delete ptr;
}