summaryrefslogtreecommitdiffstats
path: root/src/ByteBuffer.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-01-11 17:39:43 +0100
committerGitHub <noreply@github.com>2021-01-11 17:39:43 +0100
commiteeb63b8901a9c049f1bb594abb9ce9b4a9c47620 (patch)
treeb07daae788f918b83eeb0bdbd51e49292f1c8d88 /src/ByteBuffer.h
parentFixed switch-ups regarding some slab and stair recipes (#5099) (diff)
downloadcuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.gz
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.bz2
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.lz
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.xz
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.zst
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.zip
Diffstat (limited to '')
-rw-r--r--src/ByteBuffer.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index 1116de08c..cbf215f38 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -11,6 +11,8 @@
+
+
// fwd:
class cUUID;
@@ -87,6 +89,7 @@ public:
// Write the specified datatype; return true if successfully written
bool WriteBEInt8 (Int8 a_Value);
+ bool WriteBEInt8 (std::byte a_Value);
bool WriteBEInt16 (Int16 a_Value);
bool WriteBEInt32 (Int32 a_Value);
bool WriteBEInt64 (Int64 a_Value);
@@ -111,13 +114,13 @@ public:
bool WriteBuf(const void * a_Buffer, size_t a_Count);
/** Reads a_Count bytes into a_String; returns true if successful */
- bool ReadString(AString & a_String, size_t a_Count);
+ bool ReadSome(ContiguousByteBuffer & a_String, size_t a_Count);
/** Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer */
bool SkipRead(size_t a_Count);
/** Reads all available data into a_Data */
- void ReadAll(AString & a_Data);
+ void ReadAll(ContiguousByteBuffer & a_Data);
/** Reads the specified number of bytes and writes it into the destinatio bytebuffer. Returns true on success. */
bool ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes);
@@ -129,7 +132,7 @@ public:
void ResetRead(void);
/** Re-reads the data that has been read since the last commit to the current readpos. Used by ProtoProxy to duplicate communication */
- void ReadAgain(AString & a_Out);
+ void ReadAgain(ContiguousByteBuffer & a_Out);
/** Checks if the internal state is valid (read and write positions in the correct bounds) using ASSERTs */
void CheckValid(void) const;
@@ -138,7 +141,8 @@ public:
static size_t GetVarIntSize(UInt32 a_Value);
protected:
- char * m_Buffer;
+
+ std::byte * m_Buffer;
size_t m_BufferSize; // Total size of the ringbuffer
size_t m_DataStart; // Where the data starts in the ringbuffer
@@ -154,7 +158,3 @@ protected:
/** Advances the m_ReadPos by a_Count bytes */
void AdvanceReadPos(size_t a_Count);
} ;
-
-
-
-