1
0
Fork 0

Simplified WriteUUID()

This commit is contained in:
Howaner 2014-09-14 20:08:18 +02:00
parent 382a42b3d6
commit 63142a7eb1
1 changed files with 9 additions and 9 deletions

View File

@ -1573,6 +1573,7 @@ int cProtocol180::GetParticleID(const AString & a_ParticleName)
if (ParticleMap.find(ParticleName) == ParticleMap.end())
{
LOGWARNING("Unknown particle: %s", a_ParticleName.c_str());
ASSERT(!"Unknown particle");
return 0;
}
@ -2672,20 +2673,19 @@ cProtocol180::cPacketizer::~cPacketizer()
void cProtocol180::cPacketizer::WriteUUID(const AString & a_UUID)
{
AString UUID_1 = a_UUID.substr(0, a_UUID.length() / 2);
AString UUID_2 = a_UUID.substr(a_UUID.length() / 2);
if (a_UUID.length() != 32)
{
LOGWARNING("Attempt to send a bad uuid (length isn't 32): %s", a_UUID.c_str());
ASSERT(!"Wrong uuid length!");
return;
}
AString UUID_1 = a_UUID.substr(0, 16);
AString UUID_2 = a_UUID.substr(16);
Int64 Value_1, Value_2;
sscanf(UUID_1.c_str(), "%llx", &Value_1);
sscanf(UUID_2.c_str(), "%llx", &Value_2);
AString SValue_1, SValue_2;
Printf(SValue_1, "%lld", Value_1);
Printf(SValue_2, "%lld", Value_2);
StringToInteger<Int64>(SValue_1.c_str(), Value_1);
StringToInteger<Int64>(SValue_2.c_str(), Value_2);
WriteInt64(Value_1);
WriteInt64(Value_2);
}