mirror of
https://github.com/overte-org/overte.git
synced 2025-07-19 08:48:39 +02:00
include the number of keys with data-server get
This commit is contained in:
parent
fb39ad0a55
commit
d37ae7da1b
1 changed files with 4 additions and 1 deletions
|
@ -68,7 +68,7 @@ void DataServerClient::getValuesForKeysAndUUID(const QStringList& keys, const QU
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, const QString& userString) {
|
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];
|
unsigned char* getPacket = new unsigned char[MAX_PACKET_SIZE];
|
||||||
|
|
||||||
// setup the header for this packet
|
// setup the header for this packet
|
||||||
|
@ -79,6 +79,9 @@ void DataServerClient::getValuesForKeysAndUserString(const QStringList& keys, co
|
||||||
numPacketBytes += userString.toLocal8Bit().size();
|
numPacketBytes += userString.toLocal8Bit().size();
|
||||||
getPacket[numPacketBytes++] = '\0';
|
getPacket[numPacketBytes++] = '\0';
|
||||||
|
|
||||||
|
// pack one byte to designate the number of keys
|
||||||
|
getPacket[numPacketBytes++] = keys.size();
|
||||||
|
|
||||||
for (int i = 0; i < keys.size(); ++i) {
|
for (int i = 0; i < keys.size(); ++i) {
|
||||||
// pack the keys, null terminated
|
// pack the keys, null terminated
|
||||||
strcpy((char*) getPacket + numPacketBytes, keys[i].toLocal8Bit().constData());
|
strcpy((char*) getPacket + numPacketBytes, keys[i].toLocal8Bit().constData());
|
||||||
|
|
Loading…
Reference in a new issue