Commit d5b49f7e authored by Ian Craggs's avatar Ian Craggs

Add remaining interops tests to sync_client_test.c

parent 86dcb196
......@@ -1246,6 +1246,14 @@ int MQTTClient_subscribeMany(MQTTClient handle, int count, char** topic, int* qo
Thread_lock_mutex(mqttclient_mutex);
if (pack != NULL)
{
Suback* sub = (Suback*)pack;
ListElement* current = NULL;
i = 0;
while (ListNextElement(sub->qoss, &current))
{
int* reqqos = (int*)(current->content);
qos[i++] = *reqqos;
}
rc = MQTTProtocol_handleSubacks(pack, m->c->net.socket);
m->pack = NULL;
}
......
......@@ -384,9 +384,9 @@ char* readUTF(char** pptr, char* enddata)
* @param pptr pointer to the input buffer - incremented by the number of bytes used & returned
* @return the character read
*/
char readChar(char** pptr)
unsigned char readChar(char** pptr)
{
char c = **pptr;
unsigned char c = **pptr;
(*pptr)++;
return c;
}
......@@ -533,8 +533,8 @@ int MQTTPacket_send_ack(int type, int msgid, int dup, networkHandles *net)
header.byte = 0;
header.bits.type = type;
header.bits.dup = dup;
if (type == PUBREL)
header.bits.qos = 1;
if (type == PUBREL)
header.bits.qos = 1;
writeInt(&ptr, msgid);
if ((rc = MQTTPacket_send(net, header, buf, 2, 1)) != TCPSOCKET_INTERRUPTED)
free(buf);
......
......@@ -202,7 +202,7 @@ int MQTTPacket_encode(char* buf, int length);
int MQTTPacket_decode(networkHandles* net, int* value);
int readInt(char** pptr);
char* readUTF(char** pptr, char* enddata);
char readChar(char** pptr);
unsigned char readChar(char** pptr);
void writeChar(char** pptr, char c);
void writeInt(char** pptr, int anInt);
void writeUTF(char** pptr, char* string);
......
......@@ -127,11 +127,17 @@ int UTF8_validate(int len, char* data)
int rc = 0;
FUNC_ENTRY;
if (len == 0)
{
rc = 1;
goto exit;
}
curdata = UTF8_char_validate(len, data);
while (curdata && (curdata < data + len))
curdata = UTF8_char_validate(len, curdata);
rc = curdata != NULL;
exit:
FUNC_EXIT_RC(rc);
return rc;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment