diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2015-11-03 17:32:29 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2015-11-03 17:32:29 +0100 |
commit | 6e80a32260f1edc4c36e758749dedaf1622cae62 (patch) | |
tree | 368100094ff1d8961c86ba1ee6717ac178c318d8 /src/backend/taler-mint-httpd_parsing.c | |
parent | 2d198327bc71954ff4d78042f67612a3a3b40361 (diff) | |
download | merchant-6e80a32260f1edc4c36e758749dedaf1622cae62.tar.gz merchant-6e80a32260f1edc4c36e758749dedaf1622cae62.tar.bz2 merchant-6e80a32260f1edc4c36e758749dedaf1622cae62.zip |
Adding:
- new JNC for fetching strings within JSONs (tested, and presumably
to be included into the mint codebase).
- error handling if the the wallet gives (inside a deposit permission)
a wrong denomination key for a right mint
Fixing minor issues.
Diffstat (limited to 'src/backend/taler-mint-httpd_parsing.c')
-rw-r--r-- | src/backend/taler-mint-httpd_parsing.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/backend/taler-mint-httpd_parsing.c b/src/backend/taler-mint-httpd_parsing.c index 5c71e813..9efd6c23 100644 --- a/src/backend/taler-mint-httpd_parsing.c +++ b/src/backend/taler-mint-httpd_parsing.c @@ -184,6 +184,9 @@ release_data (struct TMH_PARSE_FieldSpecification *spec, case TMH_PARSE_JNC_FIELD: GNUNET_break (0); return; + case TMH_PARSE_JNC_RET_STRING: + GNUNET_break (0); + return; case TMH_PARSE_JNC_INDEX: GNUNET_break (0); return; @@ -351,7 +354,7 @@ TMH_PARSE_post_json (struct MHD_Connection *connection, * Generate line in parser specification for string. The returned * string is already nul-terminated internally by JSON, so no length * information is provided. The string will live as long as the containg - * JSON will, and mut not be freed by the user + * JSON will, and must not be freed by the user * @param field name of the field * @param[out] pointer to the string * @return corresponding field spec @@ -363,8 +366,6 @@ TMH_PARSE_member_string (const char *field, struct TMH_PARSE_FieldSpecification ret = {field, (void **) out, 0, NULL, TMH_PARSE_JNC_RET_STRING, 0}; return ret; - - } /** @@ -632,12 +633,12 @@ TMH_PARSE_navigate_json (struct MHD_Connection *connection, break; case TMH_PARSE_JNC_RET_STRING: - { - void **where = va_arg (argp, void **); - *where = json_string_value (root); - ret = GNUNET_OK; - - } + { + void **where = va_arg (argp, void **); + *where = (void*) json_string_value (root); + ret = GNUNET_OK; + } + break; case TMH_PARSE_JNC_RET_DATA_VAR: { void **where = va_arg (argp, void **); @@ -985,6 +986,14 @@ TMH_PARSE_json_data (struct MHD_Connection *connection, (void **) spec[i].destination, spec[i].destination_size_out); break; + case TMH_PARSE_JNC_RET_STRING: + ret = TMH_PARSE_navigate_json (connection, + root, + TMH_PARSE_JNC_FIELD, + spec[i].field_name, + TMH_PARSE_JNC_RET_STRING, + spec[i].destination); + break; case TMH_PARSE_JNC_RET_TYPED_JSON: ret = TMH_PARSE_navigate_json (connection, root, |