1 From f02c20cc9c5756690b07abfd02a43533547ba2ef Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
3 Date: Fri, 19 Aug 2022 11:05:37 +0200
4 Subject: [PATCH] cpp: Fix building with C++11
6 * lang/cpp/src/importresult.cpp (ImportResult::mergeWith): Replace
7 'auto' in lambdas with the actual type.
10 Generic lambdas require C++14.
14 lang/cpp/src/importresult.cpp | 14 +++++++-------
15 1 file changed, 7 insertions(+), 7 deletions(-)
17 diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
18 index 06258729..0a7ad03d 100644
19 --- a/lang/cpp/src/importresult.cpp
20 +++ b/lang/cpp/src/importresult.cpp
21 @@ -152,17 +152,17 @@ void GpgME::ImportResult::mergeWith(const ImportResult &other)
23 // was this key also considered during the first import
24 const auto consideredInFirstImports =
25 - std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
26 + std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
27 return i->fpr && !strcmp(i->fpr, fpr);
29 // did we see this key already in the list of keys of the other import
30 const auto consideredInPreviousOtherImports =
31 - std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
32 + std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
33 return i->fpr && !strcmp(i->fpr, fpr);
35 // was anything added to this key during the other import
36 const auto changedInOtherImports =
37 - std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const auto i) {
38 + std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
39 return i->fpr && !strcmp(i->fpr, fpr) && (i->status != 0);
41 if (consideredInFirstImports && !consideredInPreviousOtherImports) {
42 @@ -177,15 +177,15 @@ void GpgME::ImportResult::mergeWith(const ImportResult &other)
44 // now do the same for the secret key counts
45 const auto secretKeyConsideredInFirstImports =
46 - std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const auto i) {
47 + std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
48 return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
50 const auto secretKeyConsideredInPreviousOtherImports =
51 - std::any_of(std::begin(other.d->imports), it, [fpr](const auto i) {
52 + std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
53 return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
55 const auto secretKeyChangedInOtherImports =
56 - std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const auto i) {
57 + std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
58 return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET) && (i->status != GPGME_IMPORT_SECRET);
60 if (secretKeyConsideredInFirstImports && !secretKeyConsideredInPreviousOtherImports) {
61 @@ -204,7 +204,7 @@ void GpgME::ImportResult::mergeWith(const ImportResult &other)
62 d->imports.reserve(d->imports.size() + other.d->imports.size());
63 std::transform(std::begin(other.d->imports), std::end(other.d->imports),
64 std::back_inserter(d->imports),
65 - [](const auto import) {
66 + [](const gpgme_import_status_t import) {
67 gpgme_import_status_t copy = new _gpgme_import_status{*import};
69 copy->fpr = strdup(import->fpr);