|[paho-dev] MQTT-SN and MQTT embedded C client updates|
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
Back to the top