From 0d1eced630f4ed05ad95fdbb4354fd428c9cdbf6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 19 Mar 2016 15:23:11 +0100 Subject: first refactoring of JSON logic to address #4150 and #4237 --- src/exchange/taler-exchange-httpd_parsing.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/exchange/taler-exchange-httpd_parsing.c') diff --git a/src/exchange/taler-exchange-httpd_parsing.c b/src/exchange/taler-exchange-httpd_parsing.c index 25539aeb7..3fd69ae50 100644 --- a/src/exchange/taler-exchange-httpd_parsing.c +++ b/src/exchange/taler-exchange-httpd_parsing.c @@ -24,6 +24,7 @@ #include "platform.h" #include +#include "taler_json_lib.h" #include "taler-exchange-httpd_parsing.h" #include "taler-exchange-httpd_responses.h" @@ -786,10 +787,15 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, case TMH_PARSE_JNC_RET_AMOUNT: { struct TALER_Amount *where = va_arg (argp, void *); + struct GNUNET_JSON_Specification spec[] = { + TALER_JSON_spec_amount (NULL, where), + GNUNET_JSON_spec_end () + }; if (GNUNET_OK != - TALER_json_to_amount ((json_t *) root, - where)) + GNUNET_JSON_parse ((json_t *) root, + spec, + NULL, NULL)) { GNUNET_break_op (0); ret = (MHD_YES != @@ -823,10 +829,15 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, case TMH_PARSE_JNC_RET_TIME_ABSOLUTE: { struct GNUNET_TIME_Absolute *where = va_arg (argp, void *); + struct GNUNET_JSON_Specification spec[] = { + GNUNET_JSON_spec_absolute_time (NULL, where), + GNUNET_JSON_spec_end () + }; if (GNUNET_OK != - TALER_json_to_abs ((json_t *) root, - where)) + GNUNET_JSON_parse ((json_t *) root, + spec, + NULL, NULL)) { GNUNET_break_op (0); ret = (MHD_YES != -- cgit v1.2.3