[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: -fix new JSON parsers
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: -fix new JSON parsers |
Date: |
Mon, 27 Nov 2023 04:15:16 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
The following commit(s) were added to refs/heads/master by this push:
new 152c0f1e -fix new JSON parsers
152c0f1e is described below
commit 152c0f1edc1ac0a7a82982bda4e4e844c7964315
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Mon Nov 27 12:15:08 2023 +0900
-fix new JSON parsers
---
src/json/json_helper.c | 54 ++++++++++++++------------------------------------
1 file changed, 15 insertions(+), 39 deletions(-)
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 19dec217..0628282c 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -1440,21 +1440,16 @@ parse_ec (void *cls,
struct GNUNET_JSON_Specification *spec)
{
enum TALER_ErrorCode *ec = spec->ptr;
- uint32_t num;
- struct GNUNET_JSON_Specification dspec[] = {
- GNUNET_JSON_spec_uint32 (spec->field,
- &num),
- GNUNET_JSON_spec_end ()
- };
- const char *emsg;
- unsigned int eline;
+ json_int_t num;
(void) cls;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (root,
- dspec,
- &emsg,
- &eline))
+ if (! json_is_integer (root))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ num = json_integer_value (root);
+ if (num < 0)
{
GNUNET_break_op (0);
*ec = TALER_EC_INVALID;
@@ -1494,26 +1489,17 @@ parse_aml_decision (void *cls,
struct GNUNET_JSON_Specification *spec)
{
enum TALER_AmlDecisionState *aml = spec->ptr;
- uint32_t num;
- struct GNUNET_JSON_Specification dspec[] = {
- GNUNET_JSON_spec_uint32 (spec->field,
- &num),
- GNUNET_JSON_spec_end ()
- };
- const char *emsg;
- unsigned int eline;
+ json_int_t num;
(void) cls;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (root,
- dspec,
- &emsg,
- &eline))
+ if (! json_is_integer (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (num > TALER_AML_MAX)
+ num = json_integer_value (root);
+ if ( (num > TALER_AML_MAX) ||
+ (num < 0) )
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -1649,25 +1635,15 @@ parse_protocol_version (void *cls,
{
struct TALER_JSON_ProtocolVersion *pv = spec->ptr;
const char *ver;
- struct GNUNET_JSON_Specification dspec[] = {
- GNUNET_JSON_spec_string (spec->field,
- &ver),
- GNUNET_JSON_spec_end ()
- };
- const char *emsg;
- unsigned int eline;
char dummy;
(void) cls;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (root,
- dspec,
- &emsg,
- &eline))
+ if (! json_is_string (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ ver = json_string_value (root);
if (3 != sscanf (ver,
"%u:%u:%u%c",
&pv->current,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: -fix new JSON parsers,
gnunet <=