History

pack string representation of UUID for data server communication

Stephen Birarda committed 13 years ago

Commit fea3ca81 parent 5a7d21f1 file · +7 −6Browse files

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

Unified · Split

interface/src/DataServerClient.cpp+7−6
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#include <NodeList.h>9#include <NodeList.h>
10#include <PacketHeaders.h>10#include <PacketHeaders.h>
11#include <UDPSocket.h>11#include <UDPSocket.h>
12#include <UUID.h>
12 13
13#include "DataServerClient.h"14#include "DataServerClient.h"
14 15
@@ -26,9 +27,9 @@ void DataServerClient::putValueForKey(const char* key, const char* value) { · 11 unmodified lines
26 int numPacketBytes = populateTypeAndVersion(putPacket, PACKET_TYPE_DATA_SERVER_PUT);27 int numPacketBytes = populateTypeAndVersion(putPacket, PACKET_TYPE_DATA_SERVER_PUT);
27 28
28 // pack the client UUID29 // pack the client UUID
29 QByteArray rfcUUID = _clientUUID.toRfc4122();30 QString uuidString = uuidStringWithoutCurlyBraces(_clientUUID);
30 memcpy(putPacket + numPacketBytes, rfcUUID.constData(), rfcUUID.size());31 memcpy(putPacket + numPacketBytes, uuidString.toLocal8Bit().constData(), uuidString.toLocal8Bit().size());
31 numPacketBytes += rfcUUID.size();32 numPacketBytes += uuidString.toLocal8Bit().size();
32 33
33 // pack the key, null terminated34 // pack the key, null terminated
34 strcpy((char*) putPacket + numPacketBytes, key);35 strcpy((char*) putPacket + numPacketBytes, key);
@@ -54,9 +55,9 @@ void DataServerClient::getValueForKeyAndUUID(const char* key, QUuid &uuid) { · 19 unmodified lines
54 int numPacketBytes = populateTypeAndVersion(getPacket, PACKET_TYPE_DATA_SERVER_GET);55 int numPacketBytes = populateTypeAndVersion(getPacket, PACKET_TYPE_DATA_SERVER_GET);
55 56
56 // pack the UUID we're asking for data for57 // pack the UUID we're asking for data for
57 QByteArray rfcUUID = uuid.toRfc4122();58 QString uuidString = uuidStringWithoutCurlyBraces(uuid);
58 memcpy(getPacket + numPacketBytes, rfcUUID, rfcUUID.size());59 memcpy(getPacket + numPacketBytes, uuidString.toLocal8Bit().constData(), uuidString.toLocal8Bit().size());
59 numPacketBytes += rfcUUID.size();60 numPacketBytes += uuidString.toLocal8Bit().size();
60 61
61 // pack the key, null terminated62 // pack the key, null terminated
62 strcpy((char*) getPacket + numPacketBytes, key);63 strcpy((char*) getPacket + numPacketBytes, key);