MCPcopy Create free account
hub / github.com/cuberite/cuberite / GetReadableSpace

Method GetReadableSpace

src/ByteBuffer.cpp:256–269  ·  view source on GitHub ↗

Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)

Source from the content-addressed store, hash-verified

254
255/// Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)
256size_t cByteBuffer::GetReadableSpace(void) const
257{
258 CHECK_THREAD;
259 CheckValid();
260 if (m_ReadPos > m_WritePos)
261 {
262 // Wrap around the buffer end:
263 ASSERT(m_BufferSize >= m_ReadPos);
264 return m_BufferSize - m_ReadPos + m_WritePos;
265 }
266 // Single readable space partition:
267 ASSERT(m_WritePos >= m_ReadPos);
268 return m_WritePos - m_ReadPos ;
269}
270
271
272

Callers 9

TestWrapMethod · 0.80
TryRecognizeProtocolMethod · 0.80
AddReceivedDataMethod · 0.80
DecodeClientsPacketsMethod · 0.80
DecodeServersPacketsMethod · 0.80
ParseMetadataMethod · 0.80
LogMetadataMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestWrapMethod · 0.64