ME910 support
Dependents: 5_Dragonfly_Cayenne_Sprint_IKS01A1
Fork of Cayenne-MQTT-mbed-MTSAS by
Diff: src/MQTTCommon/MQTTUnsubscribeClient.c
- Branch:
- feature/multivalue
- Revision:
- 22:0dbabcc6e7b2
- Parent:
- 0:09ef59d2d0f7
--- a/src/MQTTCommon/MQTTUnsubscribeClient.c Tue Nov 08 18:48:37 2016 -0700 +++ b/src/MQTTCommon/MQTTUnsubscribeClient.c Wed Jan 25 10:34:16 2017 -0700 @@ -24,10 +24,10 @@ * @param topicFilters the array of topic filter strings to be used in the publish * @return the length of buffer needed to contain the serialized version of the packet */ -int MQTTSerialize_unsubscribeLength(int count, MQTTString topicFilters[]) +size_t MQTTSerialize_unsubscribeLength(int count, MQTTString topicFilters[]) { int i; - int len = 2; /* packetid */ + size_t len = 2; /* packetid */ for (i = 0; i < count; ++i) len += 2 + MQTTstrlen(topicFilters[i]); /* length + topic*/ @@ -45,12 +45,12 @@ * @param topicFilters - array of topic filter names * @return the length of the serialized data. <= 0 indicates error */ -int MQTTSerialize_unsubscribe(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid, +int MQTTSerialize_unsubscribe(unsigned char* buf, size_t buflen, unsigned char dup, unsigned short packetid, int count, MQTTString topicFilters[]) { unsigned char *ptr = buf; MQTTHeader header = {0}; - int rem_len = 0; + size_t rem_len = 0; int rc = -1; int i = 0; @@ -73,7 +73,7 @@ for (i = 0; i < count; ++i) writeMQTTString(&ptr, topicFilters[i]); - rc = ptr - buf; + rc = (int)(ptr - buf); exit: return rc; } @@ -86,7 +86,7 @@ * @param buflen the length in bytes of the data in the supplied buffer * @return error code. 1 is success, 0 is failure */ -int MQTTDeserialize_unsuback(unsigned short* packetid, unsigned char* buf, int buflen) +int MQTTDeserialize_unsuback(unsigned short* packetid, unsigned char* buf, size_t buflen) { unsigned char type = 0; unsigned char dup = 0;