summaryrefslogtreecommitdiff
path: root/cpp/unpack.cpp
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:59 +0000
committerfrsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731>2009-02-15 09:09:59 +0000
commitccdb39ac60f256db36a9a82b3792182f3b339d13 (patch)
tree67c0084f40f1dabb3d9db995b1086f06b7c86e7a /cpp/unpack.cpp
parentc3021d3236e1276bb575802597bfaf8279fced72 (diff)
downloadmsgpack-python-ccdb39ac60f256db36a9a82b3792182f3b339d13.tar.gz
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
Diffstat (limited to 'cpp/unpack.cpp')
-rw-r--r--cpp/unpack.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpp/unpack.cpp b/cpp/unpack.cpp
index cbf1356..ea4d414 100644
--- a/cpp/unpack.cpp
+++ b/cpp/unpack.cpp
@@ -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; }