Fixed size types based on snej's pull request.

1784e7a3f3
This commit is contained in:
Takatoshi Kondo 2013-12-22 15:13:48 +00:00
parent bf7fece440
commit cb4d851761
7 changed files with 19 additions and 19 deletions

View File

@ -17,7 +17,7 @@ namespace myprotocol {
struct Put : define< tuple<uint32_t, std::string, raw_ref> > {
Put() { }
Put(uint32_t f, const std::string& k, const char* valref, size_t vallen) :
Put(uint32_t f, const std::string& k, const char* valref, uint32_t vallen) :
define_type(msgpack_type( f, k, raw_ref(valref,vallen) )) { }
uint32_t& flags() { return get<0>(); }
std::string& key() { return get<1>(); }

View File

@ -688,7 +688,7 @@ msgpack_pack_inline_func(_false)(msgpack_pack_user x)
* Array
*/
msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
msgpack_pack_inline_func(_array)(msgpack_pack_user x, size_t n)
{
if(n < 16) {
unsigned char d = 0x90 | n;
@ -709,7 +709,7 @@ msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
* Map
*/
msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
msgpack_pack_inline_func(_map)(msgpack_pack_user x, size_t n)
{
if(n < 16) {
unsigned char d = 0x80 | n;

View File

@ -86,9 +86,9 @@ static int msgpack_pack_nil(msgpack_packer* pk);
static int msgpack_pack_true(msgpack_packer* pk);
static int msgpack_pack_false(msgpack_packer* pk);
static int msgpack_pack_array(msgpack_packer* pk, unsigned int n);
static int msgpack_pack_array(msgpack_packer* pk, size_t n);
static int msgpack_pack_map(msgpack_packer* pk, unsigned int n);
static int msgpack_pack_map(msgpack_packer* pk, size_t n);
static int msgpack_pack_raw(msgpack_packer* pk, size_t l);
static int msgpack_pack_raw_body(msgpack_packer* pk, const void* b, size_t l);

View File

@ -70,9 +70,9 @@ public:
packer<Stream>& pack_true();
packer<Stream>& pack_false();
packer<Stream>& pack_array(unsigned int n);
packer<Stream>& pack_array(size_t n);
packer<Stream>& pack_map(unsigned int n);
packer<Stream>& pack_map(size_t n);
packer<Stream>& pack_raw(size_t l);
packer<Stream>& pack_raw_body(const char* b, size_t l);
@ -112,14 +112,14 @@ private:
static void _pack_true(Stream& x);
static void _pack_false(Stream& x);
static void _pack_array(Stream& x, unsigned int n);
static void _pack_array(Stream& x, size_t n);
static void _pack_map(Stream& x, unsigned int n);
static void _pack_map(Stream& x, size_t n);
static void _pack_raw(Stream& x, size_t l);
static void _pack_raw_body(Stream& x, const void* b, size_t l);
static void append_buffer(Stream& x, const unsigned char* buf, unsigned int len)
static void append_buffer(Stream& x, const unsigned char* buf, size_t len)
{ x.write((const char*)buf, len); }
private:
@ -294,12 +294,12 @@ inline packer<Stream>& packer<Stream>::pack_false()
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_array(unsigned int n)
inline packer<Stream>& packer<Stream>::pack_array(size_t n)
{ _pack_array(m_stream, n); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_map(unsigned int n)
inline packer<Stream>& packer<Stream>::pack_map(size_t n)
{ _pack_map(m_stream, n); return *this; }

View File

@ -77,16 +77,16 @@ void msgpack_vrefbuffer_destroy(msgpack_vrefbuffer* vbuf);
static inline msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size);
static inline void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf);
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len);
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, size_t len);
static inline const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffer* vref);
static inline size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref);
int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
const char* buf, unsigned int len);
const char* buf, size_t len);
int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
const char* buf, unsigned int len);
const char* buf, size_t len);
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to);
@ -112,7 +112,7 @@ static inline void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf)
free(vbuf);
}
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, size_t len)
{
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)data;

View File

@ -40,7 +40,7 @@ public:
}
public:
void write(const char* buf, unsigned int len)
void write(const char* buf, size_t len)
{
if(len < base::ref_size) {
append_copy(buf, len);

View File

@ -95,7 +95,7 @@ void msgpack_vrefbuffer_clear(msgpack_vrefbuffer* vbuf)
}
int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
const char* buf, unsigned int len)
const char* buf, size_t len)
{
if(vbuf->tail == vbuf->end) {
const size_t nused = vbuf->tail - vbuf->array;
@ -120,7 +120,7 @@ int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
}
int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
const char* buf, unsigned int len)
const char* buf, size_t len)
{
msgpack_vrefbuffer_inner_buffer* const ib = &vbuf->inner_buffer;