Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)
| 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) |
| 256 | size_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 |
no outgoing calls