diff options
author | frsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731> | 2009-02-15 09:09:57 +0000 |
---|---|---|
committer | frsyuki <frsyuki@5a5092ae-2292-43ba-b2d5-dcab9c1a2731> | 2009-02-15 09:09:57 +0000 |
commit | a0a798d79e5c11bae1b0b6a94b25e0dee0c19b77 (patch) | |
tree | dc97e295b067ddbc7a8e25cbd569997ac0cd2738 /cpp/unpack.cpp | |
parent | 4d13f614b6839ac4ca78f5526ab79e911f33ea65 (diff) | |
download | msgpack-python-a0a798d79e5c11bae1b0b6a94b25e0dee0c19b77.tar.gz |
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
Diffstat (limited to 'cpp/unpack.cpp')
-rw-r--r-- | cpp/unpack.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cpp/unpack.cpp b/cpp/unpack.cpp index 7a0cd78..de33051 100644 --- a/cpp/unpack.cpp +++ b/cpp/unpack.cpp @@ -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); |