Skip to content

Commit

Permalink
fix -Wformat warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Dec 9, 2023
1 parent 2b30139 commit 114b8b4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/server/mqttd.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static int connack(FILE *dump, curl_socket_t fd)

rc = swrite(fd, (char *)packet, sizeof(packet));
if(rc > 0) {
logmsg("WROTE %d bytes [CONNACK]", rc);
logmsg("WROTE %zd bytes [CONNACK]", rc);
loghex(packet, rc);
logprotocol(FROM_SERVER, "CONNACK", 2, dump, packet, sizeof(packet));
}
Expand All @@ -270,7 +270,7 @@ static int suback(FILE *dump, curl_socket_t fd, unsigned short packetid)

rc = swrite(fd, (char *)packet, sizeof(packet));
if(rc == sizeof(packet)) {
logmsg("WROTE %d bytes [SUBACK]", rc);
logmsg("WROTE %zd bytes [SUBACK]", rc);
loghex(packet, rc);
logprotocol(FROM_SERVER, "SUBACK", 3, dump, packet, rc);
return 0;
Expand All @@ -292,7 +292,7 @@ static int puback(FILE *dump, curl_socket_t fd, unsigned short packetid)

rc = swrite(fd, (char *)packet, sizeof(packet));
if(rc == sizeof(packet)) {
logmsg("WROTE %d bytes [PUBACK]", rc);
logmsg("WROTE %zd bytes [PUBACK]", rc);
loghex(packet, rc);
logprotocol(FROM_SERVER, dump, packet, rc);
return 0;
Expand All @@ -310,7 +310,7 @@ static int disconnect(FILE *dump, curl_socket_t fd)
};
ssize_t rc = swrite(fd, (char *)packet, sizeof(packet));
if(rc == sizeof(packet)) {
logmsg("WROTE %d bytes [DISCONNECT]", rc);
logmsg("WROTE %zd bytes [DISCONNECT]", rc);
loghex(packet, rc);
logprotocol(FROM_SERVER, "DISCONNECT", 0, dump, packet, rc);
return 0;
Expand Down Expand Up @@ -439,7 +439,7 @@ static int publish(FILE *dump,

rc = swrite(fd, (char *)packet, sendamount);
if(rc > 0) {
logmsg("WROTE %d bytes [PUBLISH]", rc);
logmsg("WROTE %zd bytes [PUBLISH]", rc);
loghex(packet, rc);
logprotocol(FROM_SERVER, "PUBLISH", remaininglength, dump, packet, rc);
}
Expand All @@ -465,10 +465,10 @@ static int fixedheader(curl_socket_t fd,
ssize_t rc = sread(fd, (char *)buffer, 2);
int i;
if(rc < 2) {
logmsg("READ %d bytes [SHORT!]", rc);
logmsg("READ %zd bytes [SHORT!]", rc);
return 1; /* fail */
}
logmsg("READ %d bytes", rc);
logmsg("READ %zd bytes", rc);
loghex(buffer, rc);
*bytep = buffer[0];

Expand Down Expand Up @@ -555,7 +555,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
/* reading variable header and payload into buffer */
rc = sread(fd, (char *)buffer, remaining_length);
if(rc > 0) {
logmsg("READ %d bytes", rc);
logmsg("READ %zd bytes", rc);
loghex(buffer, rc);
}
}
Expand Down Expand Up @@ -592,7 +592,7 @@ static curl_socket_t mqttit(curl_socket_t fd)

/* check the length of the payload */
if((ssize_t)payload_len != (rc - 12)) {
logmsg("Payload length mismatch, expected %x got %x",
logmsg("Payload length mismatch, expected %zx got %zx",
rc - 12, payload_len);
goto end;
}
Expand Down Expand Up @@ -633,7 +633,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
/* two bytes topic length */
topic_len = (buffer[2] << 8) | buffer[3];
if(topic_len != (remaining_length - 5)) {
logmsg("Wrong topic length, got %d expected %d",
logmsg("Wrong topic length, got %d expected %zu",
topic_len, remaining_length - 5);
goto end;
}
Expand Down Expand Up @@ -677,7 +677,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
dump, buffer, rc);

topiclen = (buffer[1 + bytes] << 8) | buffer[2 + bytes];
logmsg("Got %d bytes topic", topiclen);
logmsg("Got %zu bytes topic", topiclen);
/* TODO: verify topiclen */

#ifdef QOS
Expand All @@ -688,7 +688,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
/* get the request */
rc = sread(fd, (char *)&buffer[0], 2);

logmsg("READ %d bytes [DISCONNECT]", rc);
logmsg("READ %zd bytes [DISCONNECT]", rc);
loghex(buffer, rc);
logprotocol(FROM_CLIENT, "DISCONNECT", 0, dump, buffer, rc);
goto end;
Expand Down

0 comments on commit 114b8b4

Please sign in to comment.