summaryrefslogtreecommitdiffstats
path: root/src/ByteBuffer.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-03-24 13:09:41 +0100
committerMattes D <github@xoft.cz>2015-03-24 13:09:41 +0100
commite5a7a730ed4f26eae896c56391bf3d2b5fecb852 (patch)
tree0209c1567f60af60999f3aeeb513a72f9eab2743 /src/ByteBuffer.h
parentMerge pull request #1775 from tommysanterre/terrainheightfix (diff)
parentAdded VarInt64, normalized cPacketizer datatype names. (diff)
downloadcuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.gz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.bz2
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.lz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.xz
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.tar.zst
cuberite-e5a7a730ed4f26eae896c56391bf3d2b5fecb852.zip
Diffstat (limited to 'src/ByteBuffer.h')
-rw-r--r--src/ByteBuffer.h43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index f480ad557..0a4935327 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -52,48 +52,53 @@ public:
bool CanWriteBytes(size_t a_Count) const;
// Read the specified datatype and advance the read pointer; return true if successfully read:
- bool ReadChar (char & a_Value);
- bool ReadByte (unsigned char & a_Value);
- bool ReadBEShort (short & a_Value);
+ bool ReadBEInt8 (Int8 & a_Value);
+ bool ReadBEInt16 (Int16 & a_Value);
+ bool ReadBEInt32 (Int32 & a_Value);
+ bool ReadBEInt64 (Int64 & a_Value);
+ bool ReadBEUInt8 (UInt8 & a_Value);
bool ReadBEUInt16 (UInt16 & a_Value);
- bool ReadBEInt (int & a_Value);
bool ReadBEUInt32 (UInt32 & a_Value);
- bool ReadBEInt64 (Int64 & a_Value);
+ bool ReadBEUInt64 (UInt64 & a_Value);
bool ReadBEFloat (float & a_Value);
bool ReadBEDouble (double & a_Value);
bool ReadBool (bool & a_Value);
bool ReadBEUTF16String16(AString & a_Value); // string length as BE short, then string as UTF-16BE
- bool ReadVarInt (UInt32 & a_Value);
+ bool ReadVarInt32 (UInt32 & a_Value);
+ bool ReadVarInt64 (UInt64 & a_Value);
bool ReadVarUTF8String (AString & a_Value); // string length as VarInt, then string as UTF-8
bool ReadLEInt (int & a_Value);
- bool ReadPosition (int & a_BlockX, int & a_BlockY, int & a_BlockZ);
+ bool ReadPosition64 (int & a_BlockX, int & a_BlockY, int & a_BlockZ);
- /** Reads VarInt, assigns it to anything that can be assigned from an UInt32 (unsigned short, char, Byte, double, ...) */
+ /** Reads VarInt, assigns it to anything that can be assigned from an UInt64 (unsigned short, char, Byte, double, ...) */
template <typename T> bool ReadVarInt(T & a_Value)
{
- UInt32 v;
- bool res = ReadVarInt(v);
+ UInt64 v;
+ bool res = ReadVarInt64(v);
if (res)
{
- a_Value = v;
+ a_Value = static_cast<T>(v);
}
return res;
}
// Write the specified datatype; return true if successfully written
- bool WriteChar (char a_Value);
- bool WriteByte (unsigned char a_Value);
- bool WriteBEShort (short a_Value);
- bool WriteBEUShort (unsigned short a_Value);
- bool WriteBEInt (int a_Value);
+ bool WriteBEInt8 (Int8 a_Value);
+ bool WriteBEInt16 (Int16 a_Value);
+ bool WriteBEInt32 (Int32 a_Value);
bool WriteBEInt64 (Int64 a_Value);
+ bool WriteBEUInt8 (UInt8 a_Value);
+ bool WriteBEUInt16 (UInt16 a_Value);
+ bool WriteBEUInt32 (UInt32 a_Value);
+ bool WriteBEUInt64 (UInt64 a_Value);
bool WriteBEFloat (float a_Value);
bool WriteBEDouble (double a_Value);
bool WriteBool (bool a_Value);
- bool WriteVarInt (UInt32 a_Value);
+ bool WriteVarInt32 (UInt32 a_Value);
+ bool WriteVarInt64 (UInt64 a_Value);
bool WriteVarUTF8String (const AString & a_Value); // string length as VarInt, then string as UTF-8
- bool WriteLEInt (int a_Value);
- bool WritePosition (int a_BlockX, int a_BlockY, int a_BlockZ);
+ bool WriteLEInt32 (Int32 a_Value);
+ bool WritePosition64 (Int32 a_BlockX, Int32 a_BlockY, Int32 a_BlockZ);
/** Reads a_Count bytes into a_Buffer; returns true if successful */
bool ReadBuf(void * a_Buffer, size_t a_Count);