- Now NetBuffer and DynamicBuffer agree and the smallest buffer size posible.
- This means that buffers with a initial size of 0 work now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29006 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
class DynamicBuffer {
|
class DynamicBuffer {
|
||||||
public:
|
public:
|
||||||
DynamicBuffer(size_t initialSize = 1);
|
DynamicBuffer(size_t initialSize = 0);
|
||||||
~DynamicBuffer();
|
~DynamicBuffer();
|
||||||
|
|
||||||
DynamicBuffer(const DynamicBuffer& buffer);
|
DynamicBuffer(const DynamicBuffer& buffer);
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ DynamicBuffer::DynamicBuffer(size_t initialSize) :
|
|||||||
fDataEnd(0),
|
fDataEnd(0),
|
||||||
fInit(B_NO_INIT)
|
fInit(B_NO_INIT)
|
||||||
{
|
{
|
||||||
if (initialSize > 0) {
|
if (initialSize >= 0) {
|
||||||
fBuffer = new (std::nothrow) unsigned char[initialSize];
|
fBuffer = new (std::nothrow) unsigned char[initialSize];
|
||||||
if (fBuffer != NULL) {
|
if (fBuffer != NULL) {
|
||||||
fBufferSize = initialSize;
|
fBufferSize = initialSize;
|
||||||
fInit = B_OK;
|
fInit = B_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ status_t
|
|||||||
DynamicBuffer::Insert(const void* data, size_t size)
|
DynamicBuffer::Insert(const void* data, size_t size)
|
||||||
{
|
{
|
||||||
if (fInit != B_OK)
|
if (fInit != B_OK)
|
||||||
return fInit;
|
return fInit;
|
||||||
|
|
||||||
status_t result = _GrowToFit(size);
|
status_t result = _GrowToFit(size);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user