From b1e91f779f41e1e74520ac6d1be898cf846a778f Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 4 Jul 2014 16:43:53 +0300 Subject: [PATCH] android/gatt: Fix warning by rearranging allocation We need to allocate array of uint8_t so fix allocation parameter, this also removes unneeded type conversion. This fixes clang warnings: ... android/gatt.c:5967:29: warning: Result of 'calloc' is converted to a pointer of type 'uint8_t', which is incompatible with sizeof operand type 'uint16_t' entry->value = (uint8_t *) new0(uint16_t, 1); ~~~~~~~~~ ^~~~~~~~~~~~~~~~~ ./src/shared/util.h:81:26: note: expanded from macro 'new0' ^~~~~~ ~~~~~~~~~ ... --- android/gatt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gatt.c b/android/gatt.c index ae0a2c7d9..3019cd567 100644 --- a/android/gatt.c +++ b/android/gatt.c @@ -6062,7 +6062,7 @@ static void gatt_srvc_change_read_cb(uint16_t handle, uint16_t offset, ccc = bt_get_gatt_ccc(&dev->bdaddr); entry->state = REQUEST_DONE; - entry->value = (uint8_t *) new0(uint16_t, 1); + entry->value = new0(uint8_t, 2); if (!entry->value) { entry->error = ATT_ECODE_INSUFF_RESOURCES; -- 2.47.3