From a46bb9c8a1663ea609ce4180d059b5467e860c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20G=C3=A4hwiler?= Date: Fri, 29 Sep 2017 15:45:21 +0200 Subject: [PATCH] fixed missing int uint32_t conversions --- include/lwmqtt.h | 2 +- include/lwmqtt/unix.h | 2 +- src/client.c | 4 ++-- src/os/unix.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/lwmqtt.h b/include/lwmqtt.h index 886354a..5b4302c 100644 --- a/include/lwmqtt.h +++ b/include/lwmqtt.h @@ -108,7 +108,7 @@ typedef void (*lwmqtt_timer_set_t)(lwmqtt_client_t *client, void *ref, uint32_t /** * The callback used to get a timers value. */ -typedef int (*lwmqtt_timer_get_t)(lwmqtt_client_t *client, void *ref); +typedef uint32_t (*lwmqtt_timer_get_t)(lwmqtt_client_t *client, void *ref); /** * The callback used to forward incoming messages. diff --git a/include/lwmqtt/unix.h b/include/lwmqtt/unix.h index d4be7e5..099071a 100644 --- a/include/lwmqtt/unix.h +++ b/include/lwmqtt/unix.h @@ -18,7 +18,7 @@ void lwmqtt_unix_timer_set(lwmqtt_client_t *client, void *ref, uint32_t timeout) /** * Callback to read the UNIX timer object. */ -int lwmqtt_unix_timer_get(lwmqtt_client_t *client, void *ref); +uint32_t lwmqtt_unix_timer_get(lwmqtt_client_t *client, void *ref); /** * The UNIX network object. diff --git a/src/client.c b/src/client.c index e140a51..0bf3022 100644 --- a/src/client.c +++ b/src/client.c @@ -69,7 +69,7 @@ static lwmqtt_err_t lwmqtt_read_from_network(lwmqtt_client_t *client, size_t off // read while data is missing while (read < len) { // get remaining time - int remaining_time = client->timer_get(client, client->command_timer); + uint32_t remaining_time = client->timer_get(client, client->command_timer); // check timeout if (remaining_time <= 0) { @@ -98,7 +98,7 @@ static lwmqtt_err_t lwmqtt_write_to_network(lwmqtt_client_t *client, size_t offs // write while data is left while (written < len) { // get remaining time - int remaining_time = client->timer_get(client, client->command_timer); + uint32_t remaining_time = client->timer_get(client, client->command_timer); // check timeout if (remaining_time <= 0) { diff --git a/src/os/unix.c b/src/os/unix.c index e101824..1f4949d 100644 --- a/src/os/unix.c +++ b/src/os/unix.c @@ -24,7 +24,7 @@ void lwmqtt_unix_timer_set(lwmqtt_client_t *client, void *ref, uint32_t timeout) timeradd(&now, &interval, &t->end); } -int lwmqtt_unix_timer_get(lwmqtt_client_t *client, void *ref) { +uint32_t lwmqtt_unix_timer_get(lwmqtt_client_t *client, void *ref) { // cast timer reference lwmqtt_unix_timer_t *t = (lwmqtt_unix_timer_t *)ref; @@ -37,7 +37,7 @@ int lwmqtt_unix_timer_get(lwmqtt_client_t *client, void *ref) { timersub(&t->end, &now, &res); // convert to ms - return res.tv_sec < 0 ? 0 : (int)(res.tv_sec * 1000 + res.tv_usec / 1000); + return res.tv_sec < 0 ? 0 : (uint32_t)(res.tv_sec * 1000 + res.tv_usec / 1000); } lwmqtt_err_t lwmqtt_unix_network_connect(lwmqtt_unix_network_t *network, char *host, int port) {