1.8: Simplified item metadata reading.
This commit is contained in:
parent
3ee211bbba
commit
be6d4a5912
@ -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)
|
void cByteBuffer::ReadAll(AString & a_Data)
|
||||||
{
|
{
|
||||||
CHECK_THREAD;
|
CHECK_THREAD;
|
||||||
|
@ -107,9 +107,6 @@ public:
|
|||||||
|
|
||||||
/** Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer */
|
/** Skips reading by a_Count bytes; returns false if not enough bytes in the ringbuffer */
|
||||||
bool SkipRead(size_t a_Count);
|
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 */
|
/** Reads all available data into a_Data */
|
||||||
void ReadAll(AString & a_Data);
|
void ReadAll(AString & a_Data);
|
||||||
|
@ -2497,17 +2497,13 @@ bool cProtocol180::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item)
|
|||||||
a_Item.Empty();
|
a_Item.Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE_PACKET_READ(a_ByteBuffer, ReadChar, char, FirstChar);
|
AString Metadata;
|
||||||
if (FirstChar == 0)
|
a_ByteBuffer.ReadAll(Metadata);
|
||||||
|
if ((Metadata.size() == 0) || (Metadata[0] == 0))
|
||||||
{
|
{
|
||||||
// No metadata
|
// No metadata
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
a_ByteBuffer.ReverseRead(1);
|
|
||||||
|
|
||||||
// Read the metadata
|
|
||||||
AString Metadata;
|
|
||||||
a_ByteBuffer.ReadAll(Metadata);
|
|
||||||
|
|
||||||
ParseItemMetadata(a_Item, Metadata);
|
ParseItemMetadata(a_Item, Metadata);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user