Skip to content

Commit

Permalink
Reduce compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviermartin committed Mar 7, 2024
1 parent e26e9f0 commit 24ab0ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bluez/gattlib_discover.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static void characteristic_cb(uint8_t status, GSList *characteristics, void *use
data->discovered = TRUE;
}

int gattlib_discover_char_range(gatt_connection_t* connection, int start, int end, gattlib_characteristic_t** characteristics, int* characteristics_count) {
int gattlib_discover_char_range(gatt_connection_t* connection, uint16_t start, uint16_t end, gattlib_characteristic_t** characteristics, int* characteristics_count) {
struct characteristic_cb_t user_data;
guint ret;

Expand Down
12 changes: 6 additions & 6 deletions dbus/gattlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ int gattlib_discover_primary(gatt_connection_t* connection, gattlib_primary_serv
if (org_bluez_gatt_service1_get_primary(service_proxy)) {
// Object path is in the form '/org/bluez/hci0/dev_DE_79_A2_A1_E9_FA/service0024
// We convert the last 4 hex characters into the handle
int service_handle = 0xFFFF; // Initialize with an invalid value.
unsigned int service_handle = 0xFFFF; // Initialize with an invalid value.
sscanf(object_path + strlen(object_path) - 4, "%x", &service_handle);
primary_services[count].attr_handle_start = service_handle;
primary_services[count].attr_handle_end = service_handle;
Expand All @@ -522,7 +522,7 @@ int gattlib_discover_primary(gatt_connection_t* connection, gattlib_primary_serv

// Object path is in the form '/org/bluez/hci0/dev_DE_79_A2_A1_E9_FA/service0024/char0029'.
// We convert the last 4 hex characters into the handle
int char_handle = primary_services[count].attr_handle_end; // Initialize with existing good value for safety.
unsigned int char_handle = primary_services[count].attr_handle_end; // Initialize with existing good value for safety.
sscanf(characteristic_path + strlen(characteristic_path) - 4, "%x", &char_handle);

// Once here, update the end handle of the service
Expand Down Expand Up @@ -556,7 +556,7 @@ int gattlib_discover_primary(gatt_connection_t* connection, gattlib_primary_serv

// Bluez was using org.bluez.Device1.GattServices until 5.37 to expose the list of available GATT Services
#if BLUEZ_VERSION < BLUEZ_VERSIONS(5, 38)
int gattlib_discover_char_range(gatt_connection_t* connection, int start, int end, gattlib_characteristic_t** characteristics, int* characteristics_count) {
int gattlib_discover_char_range(gatt_connection_t* connection, uint16_t start, uint16_t end, gattlib_characteristic_t** characteristics, int* characteristics_count) {
gattlib_context_t* conn_context = connection->context;
OrgBluezDevice1* device = conn_context->device;
GError *error = NULL;
Expand Down Expand Up @@ -710,7 +710,7 @@ int gattlib_discover_char_range(gatt_connection_t* connection, int start, int en
#else
static void add_characteristics_from_service(gattlib_context_t* conn_context, GDBusObjectManager *device_manager,
const char* service_object_path,
int start, int end,
unsigned int start, unsigned int end,
gattlib_characteristic_t* characteristic_list, int* count)
{
GError *error = NULL;
Expand Down Expand Up @@ -756,7 +756,7 @@ static void add_characteristics_from_service(gattlib_context_t* conn_context, GD
g_object_unref(characteristic);
continue;
} else {
int handle;
unsigned int handle;

// Object path is in the form '/org/bluez/hci0/dev_DE_79_A2_A1_E9_FA/service0024/char0029'.
// We convert the last 4 hex characters into the handle
Expand Down Expand Up @@ -799,7 +799,7 @@ static void add_characteristics_from_service(gattlib_context_t* conn_context, GD
}
}

int gattlib_discover_char_range(gatt_connection_t* connection, int start, int end, gattlib_characteristic_t** characteristics, int* characteristics_count) {
int gattlib_discover_char_range(gatt_connection_t* connection, uint16_t start, uint16_t end, gattlib_characteristic_t** characteristics, int* characteristics_count) {
gattlib_context_t* conn_context = connection->context;
GError *error = NULL;
GDBusObjectManager *device_manager = get_device_manager_from_adapter(conn_context->adapter, &error);
Expand Down
6 changes: 3 additions & 3 deletions dbus/gattlib_char.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 2016-2021, Olivier Martin <olivier@labapart.org>
* Copyright (c) 2016-2024, Olivier Martin <olivier@labapart.org>
*/

#include <stdlib.h>
Expand Down Expand Up @@ -166,11 +166,11 @@ struct dbus_characteristic get_characteristic_from_uuid(gatt_connection_t* conne
return dbus_characteristic;
}

static struct dbus_characteristic get_characteristic_from_handle(gatt_connection_t* connection, int handle) {
static struct dbus_characteristic get_characteristic_from_handle(gatt_connection_t* connection, unsigned int handle) {
gattlib_context_t* conn_context = connection->context;
GError *error = NULL;
GDBusObjectManager *device_manager = get_device_manager_from_adapter(conn_context->adapter, &error);
int char_handle;
unsigned int char_handle;

struct dbus_characteristic dbus_characteristic = {
.type = TYPE_NONE
Expand Down
2 changes: 1 addition & 1 deletion include/gattlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ int gattlib_discover_primary(gatt_connection_t* connection, gattlib_primary_serv
*
* @return GATTLIB_SUCCESS on success or GATTLIB_* error code
*/
int gattlib_discover_char_range(gatt_connection_t* connection, int start, int end, gattlib_characteristic_t** characteristics, int* characteristics_count);
int gattlib_discover_char_range(gatt_connection_t* connection, uint16_t start, uint16_t end, gattlib_characteristic_t** characteristics, int* characteristics_count);

/**
* @brief Function to discover GATT Characteristic
Expand Down

0 comments on commit 24ab0ea

Please sign in to comment.