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
68}68}
69 69
70void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, const QString& userString) {70void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, const QString& userString) {
71 if (!userString.isEmpty()) {71 if (!userString.isEmpty() && keys.size() <= UCHAR_MAX) {
72 unsigned char* getPacket = new unsigned char[MAX_PACKET_SIZE];72 unsigned char* getPacket = new unsigned char[MAX_PACKET_SIZE];
73 73
74 // setup the header for this packet74 // setup the header for this packet
@@ -79,6 +79,9 @@ void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, co · 4 unmodified lines
79 numPacketBytes += userString.toLocal8Bit().size();79 numPacketBytes += userString.toLocal8Bit().size();
80 getPacket[numPacketBytes++] = '\0';80 getPacket[numPacketBytes++] = '\0';
81 81
82 // pack one byte to designate the number of keys
83 getPacket[numPacketBytes++] = keys.size();
84
82 for (int i = 0; i < keys.size(); ++i) {85 for (int i = 0; i < keys.size(); ++i) {
83 // pack the keys, null terminated86 // pack the keys, null terminated
84 strcpy((char*) getPacket + numPacketBytes, keys[i].toLocal8Bit().constData());87 strcpy((char*) getPacket + numPacketBytes, keys[i].toLocal8Bit().constData());