summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-18 16:04:03 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-18 16:04:03 +0200
commitbe6d4a5912abcfe36a1f0fcee9d76e050a58c0ce (patch)
treed7fd1870df73509f7f0508e33edced7685e953de
parentUse xofts ReadPosition() code. (diff)
downloadcuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.tar
cuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.tar.gz
cuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.tar.bz2
cuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.tar.lz
cuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.tar.xz
cuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.tar.zst
cuberite-be6d4a5912abcfe36a1f0fcee9d76e050a58c0ce.zip
-rw-r--r--src/ByteBuffer.cpp17
-rw-r--r--src/ByteBuffer.h3
-rw-r--r--src/Protocol/Protocol18x.cpp10
3 files changed, 3 insertions, 27 deletions
diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp
index 262e0e3b5..17e8091c7 100644
--- a/src/ByteBuffer.cpp
+++ b/src/ByteBuffer.cpp
@@ -822,23 +822,6 @@ bool cByteBuffer::SkipRead(size_t a_Count)
-bool cByteBuffer::ReverseRead(size_t a_Count)
-{
- CHECK_THREAD;
- CheckValid();
- if (m_ReadPos < a_Count)
- {
- return false;
- }
-
- m_ReadPos -= a_Count;
- return true;
-}
-
-
-
-
-
void cByteBuffer::ReadAll(AString & a_Data)
{
CHECK_THREAD;
diff --git a/src/ByteBuffer.h b/src/ByteBuffer.h
index e200d2a7b..c1c71d8c4 100644
--- a/src/ByteBuffer.h
+++ b/src/ByteBuffer.h
@@ -107,9 +107,6 @@ public:
/** Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer */
bool SkipRead(size_t a_Count);
-
- /** Reverse reading by a_Count bytes; returns false if not enough readed bytes in the ringbuffer */
- bool ReverseRead(size_t a_Count);
/** Reads all available data into a_Data */
void ReadAll(AString & a_Data);
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 837c8ec99..a258d9585 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -2497,17 +2497,13 @@ bool cProtocol180::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item)
a_Item.Empty();
}
- HANDLE_PACKET_READ(a_ByteBuffer, ReadChar, char, FirstChar);
- if (FirstChar == 0)
+ AString Metadata;
+ a_ByteBuffer.ReadAll(Metadata);
+ if ((Metadata.size() == 0) || (Metadata[0] == 0))
{
// No metadata
return true;
}
- a_ByteBuffer.ReverseRead(1);
-
- // Read the metadata
- AString Metadata;
- a_ByteBuffer.ReadAll(Metadata);
ParseItemMetadata(a_Item, Metadata);
return true;