diff options
Diffstat (limited to 'common/memstream.h')
-rw-r--r-- | common/memstream.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/memstream.h b/common/memstream.h index 5ecc553454..94407f5cc9 100644 --- a/common/memstream.h +++ b/common/memstream.h @@ -25,6 +25,7 @@ #include "common/stream.h" #include "common/types.h" +#include "common/util.h" namespace Common { @@ -156,7 +157,7 @@ public: * that grows as it's written to. */ class MemoryWriteStreamDynamic : public WriteStream { -private: +protected: uint32 _capacity; uint32 _size; byte *_ptr; @@ -170,7 +171,7 @@ private: byte *old_data = _data; - _capacity = new_len + 32; + _capacity = MAX(new_len + 32, _capacity * 2); _data = (byte *)malloc(_capacity); _ptr = _data + _pos; |