MQTTPacket fixes
Fork of MQTTPacket by
Diff: MQTTSubscribeClient.c
- Revision:
- 14:c2052aee81de
- Parent:
- 9:3893bc7343f4
- Child:
- 16:d0b3886ada32
--- a/MQTTSubscribeClient.c Fri Aug 01 13:08:46 2014 +0100 +++ b/MQTTSubscribeClient.c Fri Aug 01 15:34:04 2014 +0100 @@ -47,9 +47,10 @@ * @param requestedQoSs - array of requested QoS * @return the length of the serialized data. <= 0 indicates error */ -int MQTTSerialize_subscribe(char* buf, int buflen, int dup, int packetid, int count, MQTTString topicFilters[], int requestedQoSs[]) +int MQTTSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid, int count, + MQTTString topicFilters[], int requestedQoSs[]) { - char *ptr = buf; + unsigned char *ptr = buf; MQTTHeader header; int rem_len = 0; int rc = 0; @@ -96,17 +97,16 @@ * @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(int* packetid, int maxcount, int* count, int grantedQoSs[], char* buf, int buflen) +int MQTTDeserialize_suback(unsigned short* packetid, int maxcount, int* count, int grantedQoSs[], unsigned char* buf, int buflen) { MQTTHeader header; - char* curdata = buf; - char* enddata = NULL; + unsigned char* curdata = buf; + unsigned char* enddata = NULL; int rc = 0; int mylen; FUNC_ENTRY; header.byte = readChar(&curdata); - header.byte = header.byte; // hush compiler warnings curdata += (rc = MQTTPacket_decodeBuf(curdata, &mylen)); /* read remaining length */ enddata = curdata + mylen;