From eb99e8c483a70764408868602ef322602e9e72ce Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 9 Nov 2020 11:48:42 +0100 Subject: [PATCH] Require at least libgpg-error 1.36 * configure.ac (NEED_GPG_ERROR_VERSION): Require 1.36. * src/cJSON.c: Remove code for older version. * src/engine.c (gpgme_get_engine_info): Ditto. * src/gpgme-json.c: Ditto. * src/op-support.c: Ditto. * src/util.h: Ditto. -- Libgpg-error 1.36 has been released more than 18 months ago so it is time to avoid hacks and require this verion. This will for example help Kleopatra to support PIV cards and improves the gpgme-json. Signed-off-by: Werner Koch --- NEWS | 4 +++- configure.ac | 2 +- src/cJSON.c | 27 ++++++++------------------- src/engine.c | 4 ---- src/gpgme-json.c | 24 ------------------------ src/op-support.c | 4 ---- src/util.h | 9 --------- 7 files changed, 12 insertions(+), 62 deletions(-) diff --git a/NEWS b/NEWS index cc734987..a27781d5 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Noteworthy changes in version 1.14.1 (unreleased) +Noteworthy changes in version 1.15.0 (unreleased) ------------------------------------------------- * New function gpgme_op_setexpire to make changing the expiration @@ -18,6 +18,8 @@ Noteworthy changes in version 1.14.1 (unreleased) * qt: Added QDebug stream operator for GpgME::Error. + * Require a somewhat newer version of libgpg-error (1.36). + * Interface changes relative to the 1.14.0 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgme_op_setexpire_start NEW. diff --git a/configure.ac b/configure.ac index 03c260cd..96c5b491 100644 --- a/configure.ac +++ b/configure.ac @@ -85,7 +85,7 @@ AC_SUBST(LIBQGPGME_LT_REVISION) GPGME_CONFIG_API_VERSION=1 ############################################## -NEED_GPG_ERROR_VERSION=1.24 +NEED_GPG_ERROR_VERSION=1.36 NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_VERSION=2.4.2 diff --git a/src/cJSON.c b/src/cJSON.c index f233848e..7769b0eb 100644 --- a/src/cJSON.c +++ b/src/cJSON.c @@ -66,25 +66,14 @@ #define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) /* We use malloc function wrappers from gpgrt (aka libgpg-error). */ -#if GPGRT_VERSION_NUMBER >= 0x011c00 /* 1.28 */ -# include -# define xtrycalloc(a,b) gpgrt_calloc ((a), (b)) -# define xtrystrdup(a) gpgrt_strdup ((a)) -# define xfree(a) gpgrt_free ((a)) -# if CALLOC_ONLY -# define xtrymalloc(a) gpgrt_calloc (1, (a)) -# else -# define xtrymalloc(a) gpgrt_malloc ((a)) -# endif -#else /* Without gpgrt (aka libgpg-error). */ -# define xtrycalloc(a,b) calloc ((a), (b)) -# define xtrystrdup(a) strdup ((a)) -# define xfree(a) free ((a)) -# if CALLOC_ONLY -# define xtrymalloc(a) calloc (1, (a)) -# else -# define xtrymalloc(a) malloc ((a)) -# endif +#include +#define xtrycalloc(a,b) gpgrt_calloc ((a), (b)) +#define xtrystrdup(a) gpgrt_strdup ((a)) +#define xfree(a) gpgrt_free ((a)) +#if CALLOC_ONLY +# define xtrymalloc(a) gpgrt_calloc (1, (a)) +#else +# define xtrymalloc(a) gpgrt_malloc ((a)) #endif diff --git a/src/engine.c b/src/engine.c index 8280c520..96b8d3a8 100644 --- a/src/engine.c +++ b/src/engine.c @@ -258,11 +258,7 @@ gpgme_get_engine_info (gpgme_engine_info_t *info) if (!err && version && engine_minimal_version && !_gpgme_compare_versions (version, engine_minimal_version)) { -#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */ - err = gpg_error (GPG_ERR_NO_ENGINE); -#else err = gpg_error (GPG_ERR_ENGINE_TOO_OLD); -#endif } /* Now set the dummy version for pseudo engines. */ diff --git a/src/gpgme-json.c b/src/gpgme-json.c index bcaa1fc0..d3b8035a 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -41,10 +41,6 @@ #include "cJSON.h" -#if GPGRT_VERSION_NUMBER < 0x011c00 /* 1.28 */ -int main (void){fputs ("Build with Libgpg-error >= 1.28!\n", stderr);return 1;} -#else /* libgpg-error >= 1.28 */ - /* We don't allow a request with more than 64 MiB. */ #define MAX_REQUEST_SIZE (64 * 1024 * 1024) @@ -246,9 +242,6 @@ static gpg_error_t add_base64_to_object (cjson_t object, const char *name, const void *data, size_t datalen) { -#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */ - return gpg_error (GPG_ERR_NOT_SUPPORTED); -#else gpg_err_code_t err; estream_t fp = NULL; gpgrt_b64state_t state = NULL; @@ -309,7 +302,6 @@ add_base64_to_object (cjson_t object, const char *name, gpgrt_b64enc_finish (state); es_fclose (fp); return err; -#endif } @@ -629,10 +621,6 @@ release_onetime_context (gpgme_ctx_t ctx) static gpg_error_t data_from_base64_string (gpgme_data_t *r_data, cjson_t json) { -#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */ - *r_data = NULL; - return gpg_error (GPG_ERR_NOT_SUPPORTED); -#else gpg_error_t err; size_t len; char *buf = NULL; @@ -685,7 +673,6 @@ data_from_base64_string (gpgme_data_t *r_data, cjson_t json) xfree (buf); gpgrt_b64dec_finish (state); return err; -#endif } @@ -3553,10 +3540,8 @@ interactive_repl (void) int first; es_setvbuf (es_stdin, NULL, _IONBF, 0); -#if GPGRT_VERSION_NUMBER >= 0x011d00 /* 1.29 */ es_fprintf (es_stderr, "%s %s ready (enter \",help\" for help)\n", gpgrt_strusage (11), gpgrt_strusage (13)); -#endif do { es_fputs ("> ", es_stderr); @@ -3828,13 +3813,6 @@ my_strusage( int level ) int main (int argc, char *argv[]) { -#if GPGRT_VERSION_NUMBER < 0x011d00 /* 1.29 */ - - fprintf (stderr, "WARNING: Old libgpg-error - using limited mode\n"); - native_messaging_repl (); - -#else /* This is a modern libgp-error. */ - enum { CMD_DEFAULT = 0, CMD_INTERACTIVE = 'i', CMD_SINGLE = 's', @@ -3950,7 +3928,5 @@ main (int argc, char *argv[]) if (opt_debug) log_debug ("ready"); -#endif /* This is a modern libgp-error. */ return 0; } -#endif /* libgpg-error >= 1.28 */ diff --git a/src/op-support.c b/src/op-support.c index 6affb5e4..88a133be 100644 --- a/src/op-support.c +++ b/src/op-support.c @@ -34,10 +34,6 @@ #include "util.h" #include "debug.h" -#if GPG_ERROR_VERSION_NUMBER < 0x011700 /* 1.23 */ -# define GPG_ERR_SUBKEYS_EXP_OR_REV 217 -#endif - gpgme_error_t diff --git a/src/util.h b/src/util.h index cea5e1fe..bc78c9b8 100644 --- a/src/util.h +++ b/src/util.h @@ -41,15 +41,6 @@ #define DIM(v) (sizeof(v)/sizeof((v)[0])) -#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */ -# define GPG_ERR_ENGINE_TOO_OLD 300 -# define GPG_ERR_TOO_OLD 308 -#endif - -#ifndef GPGRT_ATTR_SENTINEL -# define GPGRT_ATTR_SENTINEL(a) /* */ -#endif - /*-- {posix,w32}-util.c --*/