Cast input argument for json_object_add_value_int to long long
authorPuthikorn Voravootivat <puthik@chromium.org>
Tue, 24 Jun 2014 22:59:53 +0000 (15:59 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 25 Jun 2014 01:31:22 +0000 (19:31 -0600)
The latency related (and some other) variables type is uint32_t
but the JSON integer type is long long. So we need to cast
the numbers to long long type to make JSON output correctly.

Signed-off-by: Puthikorn Voravootivat <puthik@chromium.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
json.h

diff --git a/json.h b/json.h
index 081afd6c6f0b4adfe929648b0f4d5b60639d1ee1..962c11c24e30673b1230ebbec91139b528e17bf2 100644 (file)
--- a/json.h
+++ b/json.h
@@ -52,7 +52,7 @@ void json_free_object(struct json_object *obj);
 
 int json_object_add_value_type(struct json_object *obj, const char *name, int type, ...);
 #define json_object_add_value_int(obj, name, val) \
-       json_object_add_value_type((obj), name, JSON_TYPE_INTEGER, (val))
+       json_object_add_value_type((obj), name, JSON_TYPE_INTEGER, (long long) (val))
 #define json_object_add_value_float(obj, name, val) \
        json_object_add_value_type((obj), name, JSON_TYPE_FLOAT, (val))
 #define json_object_add_value_string(obj, name, val) \