From 5811d069d3b391e9fd77c1062a2d96be41645422 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Fri, 16 Jun 2023 14:33:19 +0200 Subject: qt, cpp: Support larger size-hint on 32 bit builds * NEWS: Mention this. * lang/cpp/src/data.h, lang/cpp/src/data.cpp (Data::setSizeHint): New. * lang/qt/src/qgpgmedecryptjob.cpp, lang/qt/src/qgpgmedecryptverifyarchivejob.cpp, lang/qt/src/qgpgmedecryptverifyjob.cpp, lang/qt/src/qgpgmeencryptjob.cpp, lang/qt/src/qgpgmesignencryptjob.cpp, lang/qt/src/qgpgmesignjob.cpp, lang/qt/src/qgpgmeverifydetachedjob.cpp, lang/qt/src/qgpgmeverifyopaquejob.cpp: Set size for input IODevice. -- This fixes the case where the old detection of the size of QIOdevice using seek would overflow and instead explicitly uses QIODevice::size to check for the size and pass it through as an uint64. GnuPG-Bug-Id: T6534 --- lang/cpp/src/data.cpp | 6 ++++++ lang/cpp/src/data.h | 4 ++++ 2 files changed, 10 insertions(+) (limited to 'lang/cpp/src') diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp index 54d156c3..cf43b5bd 100644 --- a/lang/cpp/src/data.cpp +++ b/lang/cpp/src/data.cpp @@ -285,3 +285,9 @@ GpgME::Error GpgME::Data::setFlag(const char *name, const char *value) { return Error(gpgme_data_set_flag(d->data, name, value)); } + +GpgME::Error GpgME::Data::setSizeHint(uint64_t size) +{ + const std::string val = std::to_string(size); + return Error(gpgme_data_set_flag(d->data, "size-hint", val.c_str())); +} diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h index ea394804..178bc309 100644 --- a/lang/cpp/src/data.h +++ b/lang/cpp/src/data.h @@ -27,6 +27,7 @@ #include "key.h" #include // for size_t, off_t +#include // unit64_t #include // FILE #include #include @@ -125,6 +126,9 @@ public: /** See gpgme_data_set_flag */ Error setFlag(const char *name, const char *value); + /** Set a size hint for this data e.g. for progress calculations. */ + Error setSizeHint(uint64_t size); + class Private; Private *impl() { -- cgit v1.2.3