- Got it to actually compile.

- Default buffer size is now set to 1 instead of 0, which would cause the
  construction without a given size to fail.
- Added copy constructor.
- Changed _GrowToFit() to have a boolean parameter to indicate if we want
  to resize the buffer to an exact size. Used by the copy constructor. 



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28924 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Bruno G. Albuquerque
2009-01-17 15:56:40 +00:00
parent 4e034d2ab3
commit a12096e5c7
2 changed files with 34 additions and 5 deletions
+4 -2
View File
@@ -14,8 +14,10 @@
class DynamicBuffer {
public:
DynamicBuffer(size_t initialSize = 0);
DynamicBuffer(size_t initialSize = 1);
~DynamicBuffer();
DynamicBuffer(const DynamicBuffer& buffer);
// InitCheck() should be called to guarantee the object initialization
// didn't fail. If it does not return B_OK, the initialization failed.
@@ -47,7 +49,7 @@ public:
void PrintToStream();
private:
status_t _GrowToFit(size_t size);
status_t _GrowToFit(size_t size, bool exact = false);
unsigned char* fBuffer;
size_t fBufferSize;