* Added a "reserved" field to the debug event file header to align it to 8
bytes. * strlcpy() isn't a particularly good string compare function. * BDebugEventInputStream::_GetData(): - Also need to reset fBufferPosition to 0 when the buffer is empty. - Fixed read position. BDebugEventInputStream does now actually read the files written by BDebugEventOutputStream. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30273 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
1cdc2fb608
commit
4d8d8c1f38
@ -16,6 +16,7 @@ struct debug_event_stream_header {
|
||||
uint32 version;
|
||||
uint32 flags;
|
||||
uint32 event_mask;
|
||||
uint32 reserved;
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ BDebugEventInputStream::SetTo(BDataIO* stream)
|
||||
}
|
||||
|
||||
// check the header
|
||||
if (strlcpy(header.signature, B_DEBUG_EVENT_STREAM_SIGNATURE,
|
||||
if (strncmp(header.signature, B_DEBUG_EVENT_STREAM_SIGNATURE,
|
||||
sizeof(header.signature)) != 0
|
||||
|| header.version != B_DEBUG_EVENT_STREAM_VERSION
|
||||
|| (header.flags & B_DEBUG_EVENT_STREAM_FLAG_HOST_ENDIAN) == 0) {
|
||||
@ -185,13 +185,12 @@ BDebugEventInputStream::_GetData(size_t size)
|
||||
return B_BUFFER_OVERFLOW;
|
||||
|
||||
// move remaining data to the start of the buffer
|
||||
if (fBufferSize > 0 && fBufferPosition > 0) {
|
||||
if (fBufferSize > 0 && fBufferPosition > 0)
|
||||
memmove(fBuffer, fBuffer + fBufferPosition, fBufferSize);
|
||||
fBufferPosition = 0;
|
||||
}
|
||||
fBufferPosition = 0;
|
||||
|
||||
// read more data
|
||||
ssize_t bytesRead = _Read(fBuffer + fBufferPosition,
|
||||
ssize_t bytesRead = _Read(fBuffer + fBufferSize,
|
||||
fBufferCapacity - fBufferSize);
|
||||
if (bytesRead < 0)
|
||||
return bytesRead;
|
||||
|
Loading…
Reference in New Issue
Block a user