From: Steven Seungcheol Lee Date: Mon, 2 Aug 2021 07:00:35 +0000 (+0900) Subject: Bug fix unsigned int and int should use 64bit api for json-c X-Git-Tag: v1.15~8 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d127537;p=users%2Fsagi%2Fnvme-cli.git Bug fix unsigned int and int should use 64bit api for json-c unsigned int should use json_object_new_uint64(json-c >= 0.14-20200419) Error examples nsze : 0xe8e088b0 { "nsze":-387938128 } After fix this { "nsze":3907029168 } json_object_add_value_int also should use json_object_new_int64 since util/json.h support long long type, and other codes are using it for 64bit values Signed-off-by: Steven Seungcheol Lee --- diff --git a/nvme.h b/nvme.h index 5150c8db..16c493d6 100644 --- a/nvme.h +++ b/nvme.h @@ -30,9 +30,9 @@ #define json_free_object(o) json_object_put(o) #define json_free_array(a) json_object_put(a) #define json_object_add_value_uint(o, k, v) \ - json_object_object_add(o, k, json_object_new_int(v)) + json_object_object_add(o, k, json_object_new_uint64(v)) #define json_object_add_value_int(o, k, v) \ - json_object_object_add(o, k, json_object_new_int(v)) + json_object_object_add(o, k, json_object_new_int64(v)) #define json_object_add_value_float(o, k, v) \ json_object_object_add(o, k, json_object_new_double(v)) #define json_object_add_value_string(o, k, v) \