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
This commit is contained in:
Ingo Klöcker 2023-01-31 11:48:19 +01:00
parent 8c4436e73a
commit 41a30f6d9f
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9

View File

@ -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<int>(mode) << ')';
break;
}
#define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0)
CHECK(SignArchive);
#undef CHECK
return os << ')';