From 41a30f6d9f59b08213ab2c307036be9bc9b6f876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 31 Jan 2023 11:48:19 +0100 Subject: [PATCH] cpp: Fix debug output of SignatureMode * lang/cpp/src/context.cpp (operator<<): Treat signature mode as combination of a 2-bit flag and a 1-bit flag. -- This fixes the output for normal signature mode. GnuPG-bug-id: 6342 --- lang/cpp/src/context.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp index f93887f5..afe32299 100644 --- a/lang/cpp/src/context.cpp +++ b/lang/cpp/src/context.cpp @@ -1906,10 +1906,18 @@ std::ostream &operator<<(std::ostream &os, KeyListMode mode) std::ostream &operator<<(std::ostream &os, SignatureMode mode) { os << "GpgME::SignatureMode("; -#define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0) +#undef CHECK + switch (mode & (NormalSignatureMode|Detached|Clearsigned)) { +#define CHECK( x ) case x: os << #x; break CHECK(NormalSignatureMode); CHECK(Detached); CHECK(Clearsigned); +#undef CHECK + default: + os << "???" "(" << static_cast(mode) << ')'; + break; + } +#define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0) CHECK(SignArchive); #undef CHECK return os << ')';