History

include the number of keys with data-server get

Stephen Birarda committed 13 years ago

Commit d37ae7d1 parent fb39ad01 file · +4 −1Browse files

Showing the changes to interface/src/DataServerClient.cpp (1 of 1 file). Show all

Unified · Split

interface/src/DataServerClient.cpp+4−1
@@ -68,7 +68,7 @@ void DataServerClient::getValuesForKeysAndUUID(const QStringList& keys, const QU · 67 unmodified lines
6868 }
6969
7070 void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, const QString& userString) {
71− if (!userString.isEmpty()) {
71+ if (!userString.isEmpty() && keys.size() <= UCHAR_MAX) {
7272 unsigned char* getPacket = new unsigned char[MAX_PACKET_SIZE];
7373
7474 // setup the header for this packet
@@ -79,6 +79,9 @@ void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, co · 4 unmodified lines
7979 numPacketBytes += userString.toLocal8Bit().size();
8080 getPacket[numPacketBytes++] = '\0';
8181
82+ // pack one byte to designate the number of keys
83+ getPacket[numPacketBytes++] = keys.size();
84+
8285 for (int i = 0; i < keys.size(); ++i) {
8386 // pack the keys, null terminated
8487 strcpy((char*) getPacket + numPacketBytes, keys[i].toLocal8Bit().constData());