1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/paho-mqtt/patches/0004-MQTTPacket-fix-printf-formatters.patch
Oleg Hahm 0b46e1c0e2 pkg: paho-mqtt: use fixed sized integers
This fix will let Paho build for architectures with less than 32 bit.
2022-12-02 19:18:12 +01:00

72 lines
3.5 KiB
Diff

From c57b997f04b672a698941c7876bf4ac00c3ab5df Mon Sep 17 00:00:00 2001
From: Oleg Hahm <oleg+eclipse@riot-os.org>
Date: Thu, 1 Dec 2022 22:08:58 +0100
Subject: [PATCH 4/4] MQTTPacket: fix printf formatters
---
MQTTPacket/src/MQTTFormat.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/MQTTPacket/src/MQTTFormat.c b/MQTTPacket/src/MQTTFormat.c
index 6fb8312..f0ff873 100644
--- a/MQTTPacket/src/MQTTFormat.c
+++ b/MQTTPacket/src/MQTTFormat.c
@@ -40,20 +40,20 @@ int MQTTStringFormat_connect(char* strbuf, int strbuflen, MQTTPacket_connectData
strindex = snprintf(strbuf, strbuflen,
"CONNECT MQTT version %d, client id %.*s, clean session %d, keep alive %d",
- (int)data->MQTTVersion, data->clientID.lenstring.len, data->clientID.lenstring.data,
+ (int)data->MQTTVersion, (int) data->clientID.lenstring.len, data->clientID.lenstring.data,
(int)data->cleansession, data->keepAliveInterval);
if (data->willFlag)
strindex += snprintf(&strbuf[strindex], strbuflen - strindex,
", will QoS %d, will retain %d, will topic %.*s, will message %.*s",
data->will.qos, data->will.retained,
- data->will.topicName.lenstring.len, data->will.topicName.lenstring.data,
- data->will.message.lenstring.len, data->will.message.lenstring.data);
+ (int) data->will.topicName.lenstring.len, data->will.topicName.lenstring.data,
+ (int) data->will.message.lenstring.len, data->will.message.lenstring.data);
if (data->username.lenstring.data && data->username.lenstring.len > 0)
strindex += snprintf(&strbuf[strindex], strbuflen - strindex,
- ", user name %.*s", data->username.lenstring.len, data->username.lenstring.data);
+ ", user name %.*s", (int) data->username.lenstring.len, data->username.lenstring.data);
if (data->password.lenstring.data && data->password.lenstring.len > 0)
strindex += snprintf(&strbuf[strindex], strbuflen - strindex,
- ", password %.*s", data->password.lenstring.len, data->password.lenstring.data);
+ ", password %.*s", (int) data->password.lenstring.len, data->password.lenstring.data);
return strindex;
}
@@ -71,8 +71,8 @@ int MQTTStringFormat_publish(char* strbuf, int strbuflen, unsigned char dup, int
int strindex = snprintf(strbuf, strbuflen,
"PUBLISH dup %d, QoS %d, retained %d, packet id %d, topic %.*s, payload length %d, payload %.*s",
dup, qos, retained, packetid,
- (topicName.lenstring.len < 20) ? topicName.lenstring.len : 20, topicName.lenstring.data,
- payloadlen, (payloadlen < 20) ? payloadlen : 20, payload);
+ (topicName.lenstring.len < 20) ? (int) topicName.lenstring.len : 20, topicName.lenstring.data,
+ (int) payloadlen, (payloadlen < 20) ? (int) payloadlen : 20, payload);
return strindex;
}
@@ -92,7 +92,7 @@ int MQTTStringFormat_subscribe(char* strbuf, int strbuflen, unsigned char dup, u
return snprintf(strbuf, strbuflen,
"SUBSCRIBE dup %d, packet id %d count %d topic %.*s qos %d",
dup, packetid, count,
- topicFilters[0].lenstring.len, topicFilters[0].lenstring.data,
+ (int) topicFilters[0].lenstring.len, topicFilters[0].lenstring.data,
requestedQoSs[0]);
}
@@ -110,7 +110,7 @@ int MQTTStringFormat_unsubscribe(char* strbuf, int strbuflen, unsigned char dup,
return snprintf(strbuf, strbuflen,
"UNSUBSCRIBE dup %d, packet id %d count %d topic %.*s",
dup, packetid, count,
- topicFilters[0].lenstring.len, topicFilters[0].lenstring.data);
+ (int) topicFilters[0].lenstring.len, topicFilters[0].lenstring.data);
}
--
2.38.1