diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-08-25 14:43:18 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-08-25 14:43:18 +0200 |
commit | f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7 (patch) | |
tree | 70139b1ad7ed221e4b75c3a9e247b337de68eb07 /src/ByteBuffer.cpp | |
parent | compile.sh update. Fixed -d and -n, intelligent thread choice (#3960) (diff) | |
download | cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.gz cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.bz2 cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.lz cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.xz cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.tar.zst cuberite-f4f2fc7c3d76eb3dc5a91c5eefb36c10597d6cb7.zip |
Diffstat (limited to 'src/ByteBuffer.cpp')
-rw-r--r-- | src/ByteBuffer.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 1a4dc8bb8..5b4cdb745 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -7,6 +7,7 @@ #include "ByteBuffer.h" #include "Endianness.h" +#include "UUID.h" #include "OSSupport/IsThread.h" @@ -32,16 +33,6 @@ Unfortunately it is very slow, so it is disabled even for regular DEBUG builds. -static char ValueToHexDigit(UInt8 digit) -{ - ASSERT(digit < 16); - return "0123456789abcdef"[digit]; -} - - - - - #ifdef DEBUG_SINGLE_THREAD_ACCESS /** Simple RAII class that is used for checking that no two threads are using an object simultanously. @@ -506,22 +497,17 @@ bool cByteBuffer::ReadPosition64(int & a_BlockX, int & a_BlockY, int & a_BlockZ) -bool cByteBuffer::ReadUUID(AString & a_Value) +bool cByteBuffer::ReadUUID(cUUID & a_Value) { CHECK_THREAD - if (!ReadString(a_Value, 16)) + std::array<Byte, 16> UUIDBuf; + if (!ReadBuf(UUIDBuf.data(), UUIDBuf.size())) { return false; } - a_Value.resize(32); - for (unsigned int i = 15; i < 16; i--) - { - a_Value[i * 2 + 1] = ValueToHexDigit(a_Value[i] & 0xf); - a_Value[i * 2] = ValueToHexDigit(static_cast<UInt8>(a_Value[i]) >> 4); - } - + a_Value.FromRaw(UUIDBuf); return true; } |