ME910 support
Dependents: 5_Dragonfly_Cayenne_Sprint_IKS01A1
Fork of Cayenne-MQTT-mbed-MTSAS by
Diff: src/MQTTCommon/MQTTSubscribeClient.c
- Branch:
- feature/multivalue
- Revision:
- 22:0dbabcc6e7b2
- Parent:
- 0:09ef59d2d0f7
diff -r e46b1f93c011 -r 0dbabcc6e7b2 src/MQTTCommon/MQTTSubscribeClient.c --- a/src/MQTTCommon/MQTTSubscribeClient.c Tue Nov 08 18:48:37 2016 -0700 +++ b/src/MQTTCommon/MQTTSubscribeClient.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_subscribeLength(int count, MQTTString topicFilters[]) +size_t MQTTSerialize_subscribeLength(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]) + 1; /* length + topic + req_qos */ @@ -46,12 +46,12 @@ * @param requestedQoSs - array of requested QoS * @return the length of the serialized data. <= 0 indicates error */ -int MQTTSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid, int count, +int MQTTSerialize_subscribe(unsigned char* buf, size_t buflen, unsigned char dup, unsigned short packetid, int count, MQTTString topicFilters[], int requestedQoSs[]) { unsigned char *ptr = buf; MQTTHeader header = {0}; - int rem_len = 0; + size_t rem_len = 0; int rc = 0; int i = 0; @@ -77,7 +77,7 @@ writeChar(&ptr, requestedQoSs[i]); } - rc = ptr - buf; + rc = (int)(ptr - buf); exit: return rc; } @@ -94,7 +94,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_suback(unsigned short* packetid, int maxcount, int* count, int grantedQoSs[], unsigned char* buf, int buflen) +int MQTTDeserialize_suback(unsigned short* packetid, int maxcount, int* count, int grantedQoSs[], unsigned char* buf, size_t buflen) { MQTTHeader header = {0}; unsigned char* curdata = buf;