Skip to content

Commit 27777dc

Browse files
committed
Merge pull request #46 from redboltz/fixed_size_type
Fixed size types based on snej's pull request.
2 parents bdb397e + cb4d851 commit 27777dc

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

example/protocol.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace myprotocol {
1717

1818
struct Put : define< tuple<uint32_t, std::string, raw_ref> > {
1919
Put() { }
20-
Put(uint32_t f, const std::string& k, const char* valref, size_t vallen) :
20+
Put(uint32_t f, const std::string& k, const char* valref, uint32_t vallen) :
2121
define_type(msgpack_type( f, k, raw_ref(valref,vallen) )) { }
2222
uint32_t& flags() { return get<0>(); }
2323
std::string& key() { return get<1>(); }

pack_template.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ msgpack_pack_inline_func(_false)(msgpack_pack_user x)
710710
* Array
711711
*/
712712

713-
msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
713+
msgpack_pack_inline_func(_array)(msgpack_pack_user x, size_t n)
714714
{
715715
if(n < 16) {
716716
unsigned char d = 0x90 | n;
@@ -731,7 +731,7 @@ msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
731731
* Map
732732
*/
733733

734-
msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
734+
msgpack_pack_inline_func(_map)(msgpack_pack_user x, size_t n)
735735
{
736736
if(n < 16) {
737737
unsigned char d = 0x80 | n;

src/msgpack/pack.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ static int msgpack_pack_nil(msgpack_packer* pk);
9090
static int msgpack_pack_true(msgpack_packer* pk);
9191
static int msgpack_pack_false(msgpack_packer* pk);
9292

93-
static int msgpack_pack_array(msgpack_packer* pk, unsigned int n);
93+
static int msgpack_pack_array(msgpack_packer* pk, size_t n);
9494

95-
static int msgpack_pack_map(msgpack_packer* pk, unsigned int n);
95+
static int msgpack_pack_map(msgpack_packer* pk, size_t n);
9696

9797
static int msgpack_pack_raw(msgpack_packer* pk, size_t l);
9898
static int msgpack_pack_raw_body(msgpack_packer* pk, const void* b, size_t l);

src/msgpack/pack.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ class packer {
7373
packer<Stream>& pack_true();
7474
packer<Stream>& pack_false();
7575

76-
packer<Stream>& pack_array(unsigned int n);
76+
packer<Stream>& pack_array(size_t n);
7777

78-
packer<Stream>& pack_map(unsigned int n);
78+
packer<Stream>& pack_map(size_t n);
7979

8080
packer<Stream>& pack_raw(size_t l);
8181
packer<Stream>& pack_raw_body(const char* b, size_t l);
@@ -119,14 +119,14 @@ class packer {
119119
static void _pack_true(Stream& x);
120120
static void _pack_false(Stream& x);
121121

122-
static void _pack_array(Stream& x, unsigned int n);
122+
static void _pack_array(Stream& x, size_t n);
123123

124-
static void _pack_map(Stream& x, unsigned int n);
124+
static void _pack_map(Stream& x, size_t n);
125125

126126
static void _pack_raw(Stream& x, size_t l);
127127
static void _pack_raw_body(Stream& x, const void* b, size_t l);
128128

129-
static void append_buffer(Stream& x, const unsigned char* buf, unsigned int len)
129+
static void append_buffer(Stream& x, const unsigned char* buf, size_t len)
130130
{ x.write((const char*)buf, len); }
131131

132132
private:
@@ -313,12 +313,12 @@ inline packer<Stream>& packer<Stream>::pack_false()
313313

314314

315315
template <typename Stream>
316-
inline packer<Stream>& packer<Stream>::pack_array(unsigned int n)
316+
inline packer<Stream>& packer<Stream>::pack_array(size_t n)
317317
{ _pack_array(m_stream, n); return *this; }
318318

319319

320320
template <typename Stream>
321-
inline packer<Stream>& packer<Stream>::pack_map(unsigned int n)
321+
inline packer<Stream>& packer<Stream>::pack_map(size_t n)
322322
{ _pack_map(m_stream, n); return *this; }
323323

324324

src/msgpack/vrefbuffer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ void msgpack_vrefbuffer_destroy(msgpack_vrefbuffer* vbuf);
7777
static inline msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size);
7878
static inline void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf);
7979

80-
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len);
80+
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, size_t len);
8181

8282
static inline const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffer* vref);
8383
static inline size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref);
8484

8585
int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
86-
const char* buf, unsigned int len);
86+
const char* buf, size_t len);
8787

8888
int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
89-
const char* buf, unsigned int len);
89+
const char* buf, size_t len);
9090

9191
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to);
9292

@@ -112,7 +112,7 @@ static inline void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf)
112112
free(vbuf);
113113
}
114114

115-
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
115+
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, size_t len)
116116
{
117117
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)data;
118118

src/msgpack/vrefbuffer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class vrefbuffer : public msgpack_vrefbuffer {
4040
}
4141

4242
public:
43-
void write(const char* buf, unsigned int len)
43+
void write(const char* buf, size_t len)
4444
{
4545
if(len < base::ref_size) {
4646
append_copy(buf, len);

src/vrefbuffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void msgpack_vrefbuffer_clear(msgpack_vrefbuffer* vbuf)
9595
}
9696

9797
int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
98-
const char* buf, unsigned int len)
98+
const char* buf, size_t len)
9999
{
100100
if(vbuf->tail == vbuf->end) {
101101
const size_t nused = vbuf->tail - vbuf->array;
@@ -120,7 +120,7 @@ int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
120120
}
121121

122122
int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
123-
const char* buf, unsigned int len)
123+
const char* buf, size_t len)
124124
{
125125
msgpack_vrefbuffer_inner_buffer* const ib = &vbuf->inner_buffer;
126126

0 commit comments

Comments
 (0)