[git] GPGME - branch, master, updated. gpgme-1.12.0-133-g73b2f40
by Andre Heinecke
cvs at cvs.gnupg.org
Thu Feb 21 13:06:25 CET 2019
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".
The branch, master has been updated
via 73b2f40ae5e6881991dea609b0781373b28d7d30 (commit)
via 6175025c822678102c3f089e37952aa84b19a3ec (commit)
from 4c49417cc0dbd7f34269aff00fccafba150af744 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 73b2f40ae5e6881991dea609b0781373b28d7d30
Author: Andre Heinecke <aheinecke at gnupg.org>
Date: Thu Feb 21 13:05:55 2019 +0100
cpp: Add ostream operators for import result
* lang/cpp/src/importresult.cpp: Add ostream operators.
* lang/cpp/src/importresult.h: Update accordingly.
diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
index 05943ca..20a3174 100644
--- a/lang/cpp/src/importresult.cpp
+++ b/lang/cpp/src/importresult.cpp
@@ -35,6 +35,9 @@
#include <cstring>
#include <string.h>
+#include <strings.h>
+#include <istream>
+#include <iterator>
class GpgME::ImportResult::Private
{
@@ -224,3 +227,42 @@ GpgME::Import::Status GpgME::Import::status() const
}
return static_cast<Status>(result);
}
+
+std::ostream &GpgME::operator<<(std::ostream &os,
+ const GpgME::ImportResult &result)
+{
+ os << "GpgME::ImportResult(";
+ if (!result.isNull()) {
+ os << "\n considered: " << result.numConsidered()
+ << "\n without UID: " << result.numKeysWithoutUserID()
+ << "\n imported: " << result.numImported()
+ << "\n RSA Imported: " << result.numRSAImported()
+ << "\n unchanged: " << result.numUnchanged()
+ << "\n newUserIDs: " << result.newUserIDs()
+ << "\n newSubkeys: " << result.newSubkeys()
+ << "\n newSignatures: " << result.newSignatures()
+ << "\n newRevocations: " << result.newRevocations()
+ << "\n numSecretKeysConsidered: " << result.numSecretKeysConsidered()
+ << "\n numSecretKeysImported: " << result.numSecretKeysImported()
+ << "\n numSecretKeysUnchanged: " << result.numSecretKeysUnchanged()
+ << "\n"
+ << "\n notImported: " << result.notImported()
+ << "\n numV3KeysSkipped: " << result.numV3KeysSkipped()
+ << "\n imports:\n";
+ const std::vector<Import> imp = result.imports();
+ std::copy(imp.begin(), imp.end(),
+ std::ostream_iterator<Import>(os, "\n"));
+ }
+ return os << ')';
+}
+
+std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::Import &imp)
+{
+ os << "GpgME::Import(";
+ if (!imp.isNull()) {
+ os << "\n fpr: " << (imp.fingerprint() ? imp.fingerprint() : "null")
+ << "\n status: " << imp.status()
+ << "\n err: " << imp.error();
+ }
+ return os << ')';
+}
diff --git a/lang/cpp/src/importresult.h b/lang/cpp/src/importresult.h
index 0547679..bcd956c 100644
--- a/lang/cpp/src/importresult.h
+++ b/lang/cpp/src/importresult.h
@@ -129,7 +129,10 @@ private:
unsigned int idx;
};
-}
+GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const ImportResult &irs);
+GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Import &imp);
+
+} // namespace GpgME
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(ImportResult)
GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Import)
commit 6175025c822678102c3f089e37952aa84b19a3ec
Author: Andre Heinecke <aheinecke at gnupg.org>
Date: Thu Feb 21 13:04:54 2019 +0100
cpp: Make GpgME::Data::toKeys really const
* lang/cpp/src/data.cpp (GpgME::Data::toKeys): Rewind afterards.
--
This fixes unexpected behavior that the seek pointer is changed
after calling the const toKeys.
diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp
index 547ec76..7a93cbc 100644
--- a/lang/cpp/src/data.cpp
+++ b/lang/cpp/src/data.cpp
@@ -256,6 +256,8 @@ std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const
while (!gpgme_op_keylist_next (ctx->impl()->ctx, &key)) {
ret.push_back(GpgME::Key(key, false));
}
+ gpgme_data_seek (d->data, 0, SEEK_SET);
+
delete ctx;
return ret;
}
-----------------------------------------------------------------------
Summary of changes:
lang/cpp/src/data.cpp | 2 ++
lang/cpp/src/importresult.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
lang/cpp/src/importresult.h | 5 ++++-
3 files changed, 48 insertions(+), 1 deletion(-)
hooks/post-receive
--
GnuPG Made Easy
http://git.gnupg.org
More information about the Gnupg-commits
mailing list