donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 5ce8696d3eafd2858fc769a82cb3a2b602deb58c
parent 2370cf84e255533315d6be3635a1cc722fcb009c
Author: Bohdan Potuzhnyi <potub1@bfh.ch>
Date:   Sun, 13 Oct 2024 10:28:20 +0000

update of the DONAU_keys_to_json to work with missing currency_spec

Diffstat:
Maclocal.m4 | 4++--
Msrc/lib/donau_api_handle.c | 18+++++++++++++++---
Mtaler_config.h.in | 12++++++------
3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4 @@ -14,8 +14,8 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],, -[m4_warning([this file was generated for autoconf 2.72. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) diff --git a/src/lib/donau_api_handle.c b/src/lib/donau_api_handle.c @@ -813,19 +813,31 @@ DONAU_keys_to_json (const struct DONAU_Keys *kd) GNUNET_CONTAINER_multihashmap_destroy (dbg); } + json_t *currency_spec = NULL; + if (NULL != kd->currency_specification.name) + { + currency_spec = TALER_CONFIG_currency_specs_to_json ( + &kd->currency_specification); + } + keys = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("version", kd->version), GNUNET_JSON_pack_string ("currency", kd->currency), - GNUNET_JSON_pack_object_steal ("currency_specification", - TALER_CONFIG_currency_specs_to_json ( - &kd->currency_specification)), GNUNET_JSON_pack_array_steal ("sign_keys", signkeys), GNUNET_JSON_pack_array_steal ("donation_units_group", donation_units_by_group) ); + + if (NULL != currency_spec) + { + json_object_set_new (keys, + "currency_specification", + currency_spec); + } + return GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("version", DONAU_SERIALIZATION_FORMAT_VERSION), diff --git a/taler_config.h.in b/taler_config.h.in @@ -26,7 +26,7 @@ */ #undef HAVE_DCGETTEXT -/* Define to 1 if you have the declaration of 'CURLINFO_TLS_SESSION', and to 0 +/* Define to 1 if you have the declaration of `CURLINFO_TLS_SESSION', and to 0 if you don't. */ #undef HAVE_DECL_CURLINFO_TLS_SESSION @@ -60,7 +60,7 @@ /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV -/* Define to 1 if the system has the type 'intmax_t'. */ +/* Define to 1 if the system has the type `intmax_t'. */ #undef HAVE_INTMAX_T /* Define to 1 if you have the <inttypes.h> header file. */ @@ -96,7 +96,7 @@ /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H -/* Define to 1 if you have the 'strdup' function. */ +/* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the <strings.h> header file. */ @@ -117,7 +117,7 @@ /* Define to 1 if you have the <sys/un.h> header file. */ #undef HAVE_SYS_UN_H -/* Define to 1 if the system has the type 'uintmax_t'. */ +/* Define to 1 if the system has the type `uintmax_t'. */ #undef HAVE_UINTMAX_T /* Define to 1 if you have the <unistd.h> header file. */ @@ -279,7 +279,7 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if all of the C89 standard headers exist (not just the ones +/* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ #undef STDC_HEADERS @@ -310,7 +310,7 @@ /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t -/* Define as 'unsigned int' if <stddef.h> doesn't define. */ +/* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t /* Define to the type of an unsigned integer type of width exactly 16 bits if