From 0c2e282d2f6981f7b46a2d65e693ba5586b64926 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 16 Jan 2004 15:47:27 +0000 Subject: [PATCH] (_gpgme_map_gnupg_error): Handle numerical codes as used by GnuPG 1.9.x --- gpgme/ChangeLog | 7 ++++++- gpgme/conversion.c | 10 ++++++++++ gpgme/gpgme.h | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 923166f..a9703b7 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,6 +1,11 @@ +2004-01-16 Werner Koch + + * conversion.c (_gpgme_map_gnupg_error): Handle numerical codes as + used by GnuPG 1.9.x + 2004-01-13 Marcus Brinkmann - * gpgme.h (struct _gpgme_key_sig): Fix comment on REVOKED> + * gpgme.h (struct _gpgme_key_sig): Fix comment on REVOKED. 2004-01-12 Werner Koch diff --git a/gpgme/conversion.c b/gpgme/conversion.c index f55e9a6..8faf852 100644 --- a/gpgme/conversion.c +++ b/gpgme/conversion.c @@ -393,6 +393,16 @@ _gpgme_map_gnupg_error (char *err) { unsigned int i; + /* Future version of GnuPG might return the error code directly, so + we first test for a a numerical value and use that verbatim. + Note that this numerical value might be followed by an + udnerschore and the textual representation of the error code. */ + if (*err >= '0' && *err <= '9') + return strtoul (err, NULL, 10); + + /* Well, this is a token, use the mapping table to get the error. + The drawback is that we won't receive an error source and have to + use GPG as source. */ for (i = 0; i < DIM (gnupg_errors); i++) if (!strcmp (gnupg_errors[i].name, err)) return gpg_err_make (GPG_ERR_SOURCE_GPG, gnupg_errors[i].err); diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index c8e590a..110fad0 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -473,7 +473,7 @@ struct _gpgme_key_sig { struct _gpgme_key_sig *next; - /* True if the signature is a revokation signature. */ + /* True if the signature is a revocation signature. */ unsigned int revoked : 1; /* True if the signature is expired. */ -- 2.26.2