diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-07-11 14:39:04 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-07-11 14:39:10 +0200 |
commit | 3fe41567a6159a00656aab6319f6a744b33b85da (patch) | |
tree | 347bc65baf56e198cdca252bb9427550ed308edb /src/json/json_helper.c | |
parent | 097d7e3c2cc0534486332733fe291d11a332609c (diff) | |
download | gnunet-3fe41567a6159a00656aab6319f6a744b33b85da.tar.gz gnunet-3fe41567a6159a00656aab6319f6a744b33b85da.zip |
-code cleanup, better error reporting
Diffstat (limited to 'src/json/json_helper.c')
-rw-r--r-- | src/json/json_helper.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 32b262a87..6189b7596 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c | |||
@@ -614,8 +614,10 @@ parse_abs_time (void *cls, | |||
614 | { | 614 | { |
615 | tval = json_integer_value (json_t_ms); | 615 | tval = json_integer_value (json_t_ms); |
616 | /* Time is in milliseconds in JSON, but in microseconds in GNUNET_TIME_Absolute */ | 616 | /* Time is in milliseconds in JSON, but in microseconds in GNUNET_TIME_Absolute */ |
617 | abs->abs_value_us = tval * 1000LL; | 617 | abs->abs_value_us = tval * GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us; |
618 | if ((abs->abs_value_us) / 1000LL != tval) | 618 | if ((abs->abs_value_us) |
619 | / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us | ||
620 | != tval) | ||
619 | { | 621 | { |
620 | /* Integer overflow */ | 622 | /* Integer overflow */ |
621 | GNUNET_break_op (0); | 623 | GNUNET_break_op (0); |
@@ -626,6 +628,7 @@ parse_abs_time (void *cls, | |||
626 | if (json_is_string (json_t_ms)) | 628 | if (json_is_string (json_t_ms)) |
627 | { | 629 | { |
628 | const char *val; | 630 | const char *val; |
631 | |||
629 | val = json_string_value (json_t_ms); | 632 | val = json_string_value (json_t_ms); |
630 | if ((0 == strcasecmp (val, "never"))) | 633 | if ((0 == strcasecmp (val, "never"))) |
631 | { | 634 | { |