mirror of
https://github.com/msgpack/msgpack-c.git
synced 2026-01-13 02:52:42 +01:00
lang/c/msgpack: C++ binding: changed calback function of packer from Stream& append(const char*, size_t) to SomeType write(SomePointerType, SomeSizeType)
git-svn-id: file:///Users/frsyuki/project/msgpack-git/svn/x@62 5a5092ae-2292-43ba-b2d5-dcab9c1a2731
This commit is contained in:
@@ -99,10 +99,10 @@ void unpacker::expand_buffer(size_t len)
|
||||
else { next_size = UNPACKER_INITIAL_BUFFER_SIZE; }
|
||||
while(next_size < len + m_used) { next_size *= 2; }
|
||||
|
||||
void* tmp = realloc(m_buffer, next_size);
|
||||
char* tmp = (char*)realloc(m_buffer, next_size);
|
||||
if(!tmp) { throw std::bad_alloc(); }
|
||||
m_buffer = tmp;
|
||||
//void* tmp = malloc(next_size);
|
||||
//char* tmp = (char*)malloc(next_size);
|
||||
//if(!tmp) { throw std::bad_alloc(); }
|
||||
//memcpy(tmp, m_buffer, m_used);
|
||||
//free(m_buffer);
|
||||
@@ -114,9 +114,9 @@ void unpacker::expand_buffer(size_t len)
|
||||
size_t next_size = UNPACKER_INITIAL_BUFFER_SIZE;
|
||||
while(next_size < len + m_used - m_off) { next_size *= 2; }
|
||||
|
||||
void* tmp = malloc(next_size);
|
||||
char* tmp = (char*)malloc(next_size);
|
||||
if(!tmp) { throw std::bad_alloc(); }
|
||||
memcpy(tmp, ((char*)m_buffer)+m_off, m_used-m_off);
|
||||
memcpy(tmp, m_buffer+m_off, m_used-m_off);
|
||||
|
||||
try {
|
||||
m_zone->push_finalizer<void>(&zone::finalize_free, NULL, m_buffer);
|
||||
|
||||
Reference in New Issue
Block a user