Skip to content

Commit 449739e

Browse files
committed
Corrected the return type for send() and recvfrom()
1 parent 8d311bf commit 449739e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mqtt-sn.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ int mqtt_sn_create_socket(const char* host, const char* port)
160160

161161
void mqtt_sn_send_packet(int sock, const void* data)
162162
{
163-
size_t sent, len = ((uint8_t*)data)[0];
163+
ssize_t sent = 0;
164+
size_t len = ((uint8_t*)data)[0];
164165

165166
// If forwarder encapsulation enabled, wrap packet
166167
if (forwarder_encapsulation) {
@@ -183,7 +184,8 @@ void mqtt_sn_send_packet(int sock, const void* data)
183184

184185
void mqtt_sn_send_frwdencap_packet(int sock, const void* data, const uint8_t *wireless_node_id, uint8_t wireless_node_id_len)
185186
{
186-
size_t sent, len = ((uint8_t*)data)[0];
187+
ssize_t sent = 0;
188+
size_t len = ((uint8_t*)data)[0];
187189
uint8_t orig_packet_type = ((uint8_t*)data)[1];
188190
frwdencap_packet_t *packet;
189191

@@ -251,7 +253,7 @@ void* mqtt_sn_receive_frwdencap_packet(int sock, uint8_t **wireless_node_id, uin
251253
struct sockaddr_storage addr;
252254
socklen_t slen = sizeof(addr);
253255
uint8_t *packet = buffer;
254-
int bytes_read;
256+
ssize_t bytes_read;
255257

256258
*wireless_node_id = NULL;
257259
*wireless_node_id_len = 0;

0 commit comments

Comments
 (0)