Added BDebugEventInputStream::Seek() to seek in the stream. Works for data
buffer based stream only ATM. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31855 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5c7514c317
commit
86e89f1207
@ -44,6 +44,8 @@ public:
|
||||
bool takeOverOwnership);
|
||||
void Unset();
|
||||
|
||||
status_t Seek(off_t streamOffset);
|
||||
|
||||
ssize_t ReadNextEvent(uint32* _event, uint32* _cpu,
|
||||
const void** _buffer,
|
||||
off_t* _streamOffset = NULL);
|
||||
|
@ -116,6 +116,24 @@ BDebugEventInputStream::Unset()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BDebugEventInputStream::Seek(off_t streamOffset)
|
||||
{
|
||||
// TODO: Support for streams, at least for BPositionIOs.
|
||||
if (fStream != NULL)
|
||||
return B_UNSUPPORTED;
|
||||
|
||||
if (streamOffset < 0 || streamOffset > fBufferCapacity)
|
||||
return B_BUFFER_OVERFLOW;
|
||||
|
||||
fStreamPosition = 0;
|
||||
fBufferPosition = streamOffset;
|
||||
fBufferSize = fBufferCapacity - streamOffset;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns the next event in the stream.
|
||||
|
||||
At the end of the stream \c 0 is returned and \c *_buffer is set to \c NULL.
|
||||
@ -254,7 +272,7 @@ BDebugEventInputStream::_GetData(size_t size)
|
||||
fBufferCapacity - fBufferSize);
|
||||
if (bytesRead < 0)
|
||||
return bytesRead;
|
||||
|
||||
|
||||
fBufferSize += bytesRead;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user