diff options
author | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2019-09-09 17:43:12 +0800 |
---|---|---|
committer | Li Xiaoming <lixm.fnst@cn.fujitsu.com> | 2019-09-09 17:43:12 +0800 |
commit | 7436b20b66bf0d0b1c3c3c2d30011186b5f80d8c (patch) | |
tree | 18c1298b9c50ddce6d89850d1bc787b897d7b11b | |
parent | a974f96ac49bc4d354280d8352cb0d6afb68d9dc (diff) |
fix(bluetooth-util.c): Remove -Wformat & -Woverflow warning
/work/agl-service-bluetooth/binding/bluetooth-util.c:170:14: warning:
integer overflow in expression ‘-2147483648’ of type ‘long int’
results in ‘-2147483648’ [-Woverflow]
if (i64 >= -(1L << 31) && i64 < (1L << 31))
^
In file included from /xdt/sdk/sysroots/
armv7vet2hf-neon-vfpv4-agl-linux-gnueabi/usr/include/afb/afb-binding.h:
116,
from /work/agl-service-bluetooth/binding/
bluetooth-util.c:36:
/work/agl-service-bluetooth/binding/bluetooth-util.c:291:16: warning:
format ‘%lu’ expects argument of type ‘long unsigned int’, but argument
7 has type ‘gsize’ {aka ‘unsigned int’} [-Wformat=]
AFB_WARNING("Can't handle variants with more than one children
(%lu)", nitems);
Bug-AGL: SPEC-2422
Change-Id: Ic0f1a9f20c8bbe17040c3c9727922bc930b6f786
Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
-rw-r--r-- | binding/bluetooth-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/binding/bluetooth-util.c b/binding/bluetooth-util.c index a70de5d..8a50731 100644 --- a/binding/bluetooth-util.c +++ b/binding/bluetooth-util.c @@ -167,7 +167,7 @@ json_object *simple_gvariant_to_json(GVariant *var, json_object *parent, break; case G_VARIANT_CLASS_INT64: i64 = g_variant_get_int64(var); - if (i64 >= -(1L << 31) && i64 < (1L << 31)) + if (i64 >= -(1LL << 31) && i64 < (1LL << 31)) obj = json_object_new_int((int)i64); else obj = json_object_new_int64(i64); @@ -288,7 +288,7 @@ json_object *simple_gvariant_to_json(GVariant *var, json_object *parent, g_variant_iter_init(&iter, var); nitems = g_variant_iter_n_children(&iter); if (nitems != 1) { - AFB_WARNING("Can't handle variants with more than one children (%lu)", nitems); + AFB_WARNING("Can't handle variants with more than one children (%zu)", nitems); break; } |