Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix type for 64bit build #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MessagePackPacker.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ + (void)packObject:(id)obj into:(msgpack_packer*)pk {
}
} else if ([obj isKindOfClass:[NSString class]]) {
const char *str = ((NSString*)obj).UTF8String;
int len = strlen(str);
size_t len = strlen(str);
msgpack_pack_raw(pk, len);
msgpack_pack_raw_body(pk, str, len);
} else if ([obj isKindOfClass:[NSNumber class]]) {
Expand Down
4 changes: 2 additions & 2 deletions msgpack_src/msgpack/pack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 8 additions & 3 deletions msgpack_src/msgpack/pack_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,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;
Expand All @@ -704,7 +704,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;
Expand Down Expand Up @@ -743,7 +743,12 @@ msgpack_pack_inline_func(_raw)(msgpack_pack_user x, size_t l)

msgpack_pack_inline_func(_raw_body)(msgpack_pack_user x, const void* b, size_t l)
{
msgpack_pack_append_buffer(x, (const unsigned char*)b, l);
if(l < 65536) {
msgpack_pack_append_buffer(x, (const unsigned char*)b, (uint16_t)l);
} else {
msgpack_pack_append_buffer(x, (const unsigned char*)b, (uint32_t)l);
}

}

#undef msgpack_pack_inline_func
Expand Down