Skip to content

Commit

Permalink
fixed missing int uint32_t conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
256dpi committed Sep 29, 2017
1 parent de29279 commit a46bb9c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/lwmqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/lwmqtt/unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/os/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down

0 comments on commit a46bb9c

Please sign in to comment.