diff --git a/c/msgpack/sbuffer.h b/c/msgpack/sbuffer.h index b0fab460..bc0a8fd0 100644 --- a/c/msgpack/sbuffer.h +++ b/c/msgpack/sbuffer.h @@ -22,13 +22,14 @@ #include #ifndef MSGPACK_SBUFFER_INIT_SIZE -#define MSGPACK_SBUFFER_INIT_SIZE 2048 +#define MSGPACK_SBUFFER_INIT_SIZE 8192 #endif #ifdef __cplusplus extern "C" { #endif + typedef struct msgpack_sbuffer { size_t size; char* data; diff --git a/c/msgpack/vrefbuffer.h b/c/msgpack/vrefbuffer.h index ffc52bfa..38ead67b 100644 --- a/c/msgpack/vrefbuffer.h +++ b/c/msgpack/vrefbuffer.h @@ -29,12 +29,6 @@ struct iovec { }; #endif - -#ifdef __cplusplus -extern "C" { -#endif - - #ifndef MSGPACK_VREFBUFFER_REF_SIZE #define MSGPACK_VREFBUFFER_REF_SIZE 32 #endif @@ -43,6 +37,11 @@ extern "C" { #define MSGPACK_VREFBUFFER_CHUNK_SIZE 8192 #endif +#ifdef __cplusplus +extern "C" { +#endif + + struct msgpack_vrefbuffer_chunk; typedef struct msgpack_vrefbuffer_chunk msgpack_vrefbuffer_chunk; @@ -102,6 +101,7 @@ size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref) return vref->tail - vref->array; } + #ifdef __cplusplus } #endif diff --git a/cpp/msgpack/pack.hpp b/cpp/msgpack/pack.hpp index 9c291c1c..b7b3ca12 100644 --- a/cpp/msgpack/pack.hpp +++ b/cpp/msgpack/pack.hpp @@ -28,6 +28,7 @@ namespace msgpack { template class packer { public: + packer(Stream* s); packer(Stream& s); ~packer(); @@ -111,6 +112,12 @@ private: }; +template +inline void pack(Stream* s, const T& v) +{ + packer(s).pack(v); +} + template inline void pack(Stream& s, const T& v) { @@ -133,6 +140,9 @@ inline void pack(Stream& s, const T& v) #include "msgpack/pack_template.h" +template +packer::packer(Stream* s) : m_stream(*s) { } + template packer::packer(Stream& s) : m_stream(s) { }