mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-14 18:10:30 +01:00
lang/c/msgpack: msgpack::unpacker: fix buffer reallocation algorithm
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@76 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
This commit is contained in:
parent
c3021d3236
commit
ccdb39ac60
@ -198,7 +198,7 @@ void unpacker::expand_buffer(size_t len)
|
||||
{
|
||||
if(m_off == 0) {
|
||||
size_t next_size;
|
||||
if(m_free != 0) { next_size = m_free * 2; }
|
||||
if(m_used != 0) { next_size = (m_used + m_free) * 2; }
|
||||
else { next_size = UNPACKER_INITIAL_BUFFER_SIZE; }
|
||||
while(next_size < len + m_used) { next_size *= 2; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user