diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-14 20:08:18 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-14 20:08:18 +0200 |
commit | 63142a7eb151ef8ae3842406366f65ec67d3d0d2 (patch) | |
tree | 7114aa931b86853370b076738fdf94fa26dd5b99 /src | |
parent | Fixed warnings. (diff) | |
download | cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.tar cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.tar.gz cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.tar.bz2 cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.tar.lz cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.tar.xz cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.tar.zst cuberite-63142a7eb151ef8ae3842406366f65ec67d3d0d2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Protocol18x.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index 54dea049b..837c8ec99 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -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); } |