From 6404213457fbb9ddd089d556d95d841e21754ff8 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 13 Mar 2015 10:01:57 +0100 Subject: use wire validation routine --- src/util/json.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/util') diff --git a/src/util/json.c b/src/util/json.c index 88d9cd0c9..a9d6dc5cc 100644 --- a/src/util/json.c +++ b/src/util/json.c @@ -505,13 +505,15 @@ validate_iban (const char *iban) * * @param type the type of the wire format * @param wire the JSON wire format object - * @return 1 if correctly formatted; 0 if not + * @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not */ int -TALER_JSON_validate_wireformat (const char *type, json_t *wire) +TALER_JSON_validate_wireformat (const char *type, + const json_t *wire) { json_error_t error; - if (0 == strcmp ("SEPA", type)) + + if (0 == strcasecmp ("SEPA", type)) { const char *type; const char *iban; @@ -521,7 +523,8 @@ TALER_JSON_validate_wireformat (const char *type, json_t *wire) uint64_t r; const char *address; UNPACK_EXITIF (0 != json_unpack_ex - (wire, &error, JSON_STRICT, + ((json_t *) wire, + &error, JSON_STRICT, "{" "s:s " /* type: "SEPA" */ "s:s " /* IBAN: iban */ @@ -540,11 +543,11 @@ TALER_JSON_validate_wireformat (const char *type, json_t *wire) "address", &address)); EXITIF (0 != strcmp (type, "SEPA")); EXITIF (1 != validate_iban (iban)); - return 1; + return GNUNET_YES; } EXITIF_exit: - return 0; + return GNUNET_NO; } /* End of util/json.c */ -- cgit v1.2.3