[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[paho-dev] MQTT-SN and MQTT embedded C client updates
|
I've been tidying up the embedded MQTT and MQTT-SN C embedded clients.
Part of this tidying has been to change the data types of the parameters
to more closely match the MQTT and MQTT-SN data types. For anyone using
the MQTT embedded C client this might mean having to change your
applications somewhat.
The catalyst for this was finding a bug in the C++ MQTTClient layer when
using a boolean C++ type. The MQTTPacket C layer was using an int
type. When the C pointer was used to update the data, it was using the
4-byte integer rather than the 1-byte size of the boolean type, so
memory was overwritten. So I've changed the data type for boolean flags
in the C layer to be "unsigned char" to match sizes.
Packet ids have been changed to "unsigned short", and data buffers to
"unsigned char". Now the data types are also consistent between the
MQTT and MQTT-SN libraries, which was another motivation.
I'm not expecting any further data type changes unless a good reason
appears. I started using size_t for buffer sizes, but have stuck with
ints to reduce dependencies on any headers - just in case some
esoteric/old embedded compiler didn't like size_t.
--
Ian Craggs
icraggs@xxxxxxxxxx IBM United Kingdom
Committer on Paho, Mosquitto