[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: flo forgot to update the NBO parser
From: |
gnunet |
Subject: |
[gnunet] branch master updated: flo forgot to update the NBO parser |
Date: |
Sun, 22 Dec 2019 13:17:06 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new fddbcfc58 flo forgot to update the NBO parser
fddbcfc58 is described below
commit fddbcfc58514509e00b4b7f72d97f344233fde51
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Dec 22 13:13:56 2019 +0100
flo forgot to update the NBO parser
---
src/json/json_helper.c | 44 ++++++++++----------------------------------
1 file changed, 10 insertions(+), 34 deletions(-)
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index e7711a03e..a405b8c3b 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -564,7 +564,7 @@ parse_abs_time (void *cls,
json_t *json_t_ms;
unsigned long long int tval;
- if (!json_is_object (root))
+ if (! json_is_object (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -638,41 +638,17 @@ parse_abs_time_nbo (void *cls,
struct GNUNET_JSON_Specification *spec)
{
struct GNUNET_TIME_AbsoluteNBO *abs = spec->ptr;
- const char *val;
- unsigned long long int tval;
struct GNUNET_TIME_Absolute a;
+ struct GNUNET_JSON_Specification ispec;
- val = json_string_value (root);
- if (NULL == val)
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- if ((0 == strcasecmp (val,
- "/forever/")) ||
- (0 == strcasecmp (val,
- "/end of time/")) ||
- (0 == strcasecmp (val,
- "/never/")))
- {
- *abs = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS);
- return GNUNET_OK;
- }
- if (1 != sscanf (val,
- "/Date(%llu)/",
- &tval))
- {
- GNUNET_break_op (0);
- return GNUNET_SYSERR;
- }
- /* Time is in seconds in JSON, but in microseconds in GNUNET_TIME_Absolute */
- a.abs_value_us = tval * 1000LL * 1000LL;
- if ((a.abs_value_us) / 1000LL / 1000LL != tval)
- {
- /* Integer overflow */
- GNUNET_break_op (0);
+ ispec = *spec;
+ ispec.parser = &parse_abs_time;
+ ispec.ptr = &a;
+ if (GNUNET_OK !=
+ parse_abs_time (NULL,
+ root,
+ &ispec))
return GNUNET_SYSERR;
- }
*abs = GNUNET_TIME_absolute_hton (a);
return GNUNET_OK;
}
@@ -719,7 +695,7 @@ parse_rel_time (void *cls,
json_t *json_d_ms;
unsigned long long int tval;
- if (!json_is_object (root))
+ if (! json_is_object (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: flo forgot to update the NBO parser,
gnunet <=