diff options
| author | Christian Grothoff <christian@grothoff.org> | 2015-03-13 10:01:57 +0100 | 
|---|---|---|
| committer | Christian Grothoff <christian@grothoff.org> | 2015-03-13 10:01:57 +0100 | 
| commit | 6404213457fbb9ddd089d556d95d841e21754ff8 (patch) | |
| tree | 5bdeb05297016b09b5e769a60f5f5211d4710e58 /src/util | |
| parent | 968e4aa68f4185d24466bb3ba8bfaba8d9c27ef1 (diff) | |
use wire validation routine
Diffstat (limited to 'src/util')
| -rw-r--r-- | src/util/json.c | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/src/util/json.c b/src/util/json.c index 88d9cd0c..a9d6dc5c 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 */ | 
