Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f2afec9 authored by Nitin Arora's avatar Nitin Arora Committed by Andre Eisenbach
Browse files

Using generic format specifier for logging pointers

This change uses generic format specifier for logging the
pointers which can be 64 bit or 32 bit depending upon the
system used for compilation.
Also address of operator is used before casting a int variable
to void pointer.

Change-Id: Ie9dec408f3a5f674079f77c047d8192f65a004ca
parent 1880eb60
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -547,7 +547,7 @@ static void hal_says_data_ready(serial_data_type_t type) {
          incoming->buffer = (BT_HDR *)buffer_allocator->alloc(buffer_size);
          incoming->buffer = (BT_HDR *)buffer_allocator->alloc(buffer_size);


          if (!incoming->buffer) {
          if (!incoming->buffer) {
            LOG_ERROR("%s error getting buffer for incoming packet of type %d and size %d", __func__, type, buffer_size);
            LOG_ERROR("%s error getting buffer for incoming packet of type %d and size %zd", __func__, type, buffer_size);
            // Can't read any more of this current packet, so jump out
            // Can't read any more of this current packet, so jump out
            incoming->state = incoming->bytes_remaining == 0 ? BRAND_NEW : IGNORE;
            incoming->state = incoming->bytes_remaining == 0 ? BRAND_NEW : IGNORE;
            break;
            break;
+1 −1
Original line number Original line Diff line number Diff line
@@ -26,7 +26,7 @@
#define DISPATCHER_NAME_MAX 16
#define DISPATCHER_NAME_MAX 16


typedef struct data_dispatcher_t data_dispatcher_t;
typedef struct data_dispatcher_t data_dispatcher_t;
typedef uint32_t data_dispatcher_type_t;
typedef uintptr_t data_dispatcher_type_t;


// Creates a new data dispatcher object, with the given name.
// Creates a new data dispatcher object, with the given name.
// The returned object must be freed by calling |data_dispatcher_free|.
// The returned object must be freed by calling |data_dispatcher_free|.
+1 −1
Original line number Original line Diff line number Diff line
@@ -168,7 +168,7 @@ static bool allocation_entry_freed_checker(hash_map_entry_t *entry, void *contex
  allocation_t *allocation = (allocation_t *)entry->data;
  allocation_t *allocation = (allocation_t *)entry->data;
  if (!allocation->freed) {
  if (!allocation->freed) {
    *((size_t *)context) += allocation->size; // Report back the unfreed byte count
    *((size_t *)context) += allocation->size; // Report back the unfreed byte count
    LOG_ERROR("%s found unfreed allocation. address: 0x%x size: %d bytes", __func__, (uintptr_t)allocation->ptr, allocation->size);
    LOG_ERROR("%s found unfreed allocation. address: 0x%zx size: %zd bytes", __func__, (uintptr_t)allocation->ptr, allocation->size);
  }
  }


  return true;
  return true;
+1 −1
Original line number Original line Diff line number Diff line
@@ -100,7 +100,7 @@ bool data_dispatcher_dispatch(data_dispatcher_t *dispatcher, data_dispatcher_typ
  if (queue)
  if (queue)
    fixed_queue_enqueue(queue, data);
    fixed_queue_enqueue(queue, data);
  else
  else
    LOG_WARN("%s has no handler for type (%d) in data dispatcher named: %s", __func__, type, dispatcher->name);
    LOG_WARN("%s has no handler for type (%zd) in data dispatcher named: %s", __func__, type, dispatcher->name);


  return queue != NULL;
  return queue != NULL;
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -230,7 +230,7 @@ static void parse_properties(int num_properties, bt_property_t *property) {
          const bt_uuid_t *uuid = property_as_uuids(property, &num_uuid);
          const bt_uuid_t *uuid = property_as_uuids(property, &num_uuid);
          if (uuid) {
          if (uuid) {
            for (size_t i = 0; i < num_uuid; i++) {
            for (size_t i = 0; i < num_uuid; i++) {
              fprintf(stdout, " uuid:%d: ", i);
              fprintf(stdout, " uuid:%zd: ", i);
              for (size_t j = 0; j < sizeof(uuid); j++) {
              for (size_t j = 0; j < sizeof(uuid); j++) {
                fprintf(stdout, "%02x", uuid->uu[j]);
                fprintf(stdout, "%02x", uuid->uu[j]);
              }
              }