[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated (1e762cdf7 -> dcbad92e1)
From: |
gnunet |
Subject: |
[gnunet] branch master updated (1e762cdf7 -> dcbad92e1) |
Date: |
Thu, 16 Dec 2021 12:53:42 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a change to branch master
in repository gnunet.
from 1e762cdf7 -fix messenger client-side contact initialization for new
messages
new a062e1241 tolerate old style values (for now)
new dcbad92e1 -fix ftbfs
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/json/json_helper.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 73f5fc00c..c0513c529 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -593,6 +593,7 @@ parse_timestamp (void *cls,
{
struct GNUNET_TIME_Timestamp *ts = spec->ptr;
json_t *json_t_s;
+ json_t *json_t_ms;
unsigned long long int tval;
if (! json_is_object (root))
@@ -632,6 +633,40 @@ parse_timestamp (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ json_t_ms = json_object_get (root,
+ "t_ms");
+ if (json_is_integer (json_t_ms))
+ {
+ tval = json_integer_value (json_t_ms);
+ GNUNET_break_op (0 == tval % 1000);
+ tval -= tval % 1000;
+ /* Time is in seconds in JSON, but in microseconds in GNUNET_TIME_Absolute
*/
+ ts->abs_time.abs_value_us
+ = tval * GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
+ if (ts->abs_time.abs_value_us
+ / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us
+ != tval)
+ {
+ /* Integer overflow */
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ return GNUNET_OK;
+ }
+ if (json_is_string (json_t_ms))
+ {
+ const char *val;
+
+ val = json_string_value (json_t_ms);
+ if ((0 == strcasecmp (val,
+ "never")))
+ {
+ ts->abs_time = GNUNET_TIME_UNIT_FOREVER_ABS;
+ return GNUNET_OK;
+ }
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
@@ -712,6 +747,7 @@ parse_rel_time (void *cls,
{
struct GNUNET_TIME_Relative *rel = spec->ptr;
json_t *json_d_us;
+ json_t *json_d_ms;
unsigned long long int tval;
if (! json_is_object (root))
@@ -747,6 +783,31 @@ parse_rel_time (void *cls,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+
+ json_d_ms = json_object_get (root,
+ "d_ms");
+ if (json_is_integer (json_d_ms))
+ {
+ tval = json_integer_value (json_d_ms);
+ *rel = GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_MILLISECONDS,
+ tval);
+ return GNUNET_OK;
+ }
+ if (json_is_string (json_d_ms))
+ {
+ const char *val;
+
+ val = json_string_value (json_d_ms);
+ if ((0 == strcasecmp (val,
+ "forever")))
+ {
+ *rel = GNUNET_TIME_UNIT_FOREVER_REL;
+ return GNUNET_OK;
+ }
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (1e762cdf7 -> dcbad92e1),
gnunet <=