diff --git a/util/json.c b/util/json.c index 1d5c6bc7..ba9daa35 100644 --- a/util/json.c +++ b/util/json.c @@ -75,7 +75,7 @@ static int display_size(struct json_object *jobj, struct printbuf *pbuf, static int display_hex(struct json_object *jobj, struct printbuf *pbuf, int level, int flags) { - unsigned long long val = json_object_get_int64(jobj); + unsigned long long val = util_json_get_u64(jobj); static char buf[32]; snprintf(buf, sizeof(buf), "\"%#llx\"", val); diff --git a/util/json.h b/util/json.h index ea370df4..a8d02838 100644 --- a/util/json.h +++ b/util/json.h @@ -34,10 +34,18 @@ static inline struct json_object *util_json_new_u64(unsigned long long val) { return json_object_new_uint64(val); } +static inline unsigned long long util_json_get_u64(struct json_object *jobj) +{ + return json_object_get_uint64(jobj); +} #else /* fallback to signed */ static inline struct json_object *util_json_new_u64(unsigned long long val) { return json_object_new_int64(val); } +static inline unsigned long long util_json_get_u64(struct json_object *jobj) +{ + return json_object_get_int64(jobj); +} #endif /* HAVE_JSON_U64 */ #endif /* __UTIL_JSON_H__ */