include the number of keys with data-server get

This commit is contained in:
Stephen Birarda 2013-10-10 11:49:14 -07:00
parent fb39ad0a55
commit d37ae7da1b

View file

@ -68,7 +68,7 @@ void DataServerClient::getValuesForKeysAndUUID(const QStringList& keys, const QU
}
void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, const QString& userString) {
if (!userString.isEmpty()) {
if (!userString.isEmpty() && keys.size() <= UCHAR_MAX) {
unsigned char* getPacket = new unsigned char[MAX_PACKET_SIZE];
// setup the header for this packet
@ -79,6 +79,9 @@ void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, co
numPacketBytes += userString.toLocal8Bit().size();
getPacket[numPacketBytes++] = '\0';
// pack one byte to designate the number of keys
getPacket[numPacketBytes++] = keys.size();
for (int i = 0; i < keys.size(); ++i) {
// pack the keys, null terminated
strcpy((char*) getPacket + numPacketBytes, keys[i].toLocal8Bit().constData());