DynamicBuffer::Write(): Fix return type and semantics

This commit is contained in:
Ingo Weinhold
2014-07-03 17:39:58 +02:00
parent 7616c39db6
commit 6926863e37
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -26,11 +26,11 @@ public:
// Insert data at the end of the buffer. The buffer will be increased to // Insert data at the end of the buffer. The buffer will be increased to
// accomodate the data if needed. // accomodate the data if needed.
status_t Write(const void* data, size_t size); virtual ssize_t Write(const void* data, size_t size);
// Remove data from the start of the buffer. Move the buffer start // Remove data from the start of the buffer. Move the buffer start
// pointer to point to the data following it. // pointer to point to the data following it.
ssize_t Read(void* data, size_t size); virtual ssize_t Read(void* data, size_t size);
// Return a pointer to the underlying buffer. Note this will not // Return a pointer to the underlying buffer. Note this will not
// necessarily be a pointer to the start of the allocated memory as the // necessarily be a pointer to the start of the allocated memory as the
+2 -2
View File
@@ -67,7 +67,7 @@ DynamicBuffer::InitCheck() const
} }
status_t ssize_t
DynamicBuffer::Write(const void* data, size_t size) DynamicBuffer::Write(const void* data, size_t size)
{ {
if (fInit != B_OK) if (fInit != B_OK)
@@ -80,7 +80,7 @@ DynamicBuffer::Write(const void* data, size_t size)
memcpy(fBuffer + fDataEnd, data, size); memcpy(fBuffer + fDataEnd, data, size);
fDataEnd += size; fDataEnd += size;
return B_OK; return (ssize_t)size;
} }