Remove implicit type conversions from (un)pack_template.h

This commit is contained in:
Nobuyuki Kubota 2014-06-01 19:06:40 +09:00
parent 8e0137e1d2
commit eef2036c36
2 changed files with 4 additions and 4 deletions

View File

@ -713,7 +713,7 @@ msgpack_pack_inline_func(_false)(msgpack_pack_user x)
msgpack_pack_inline_func(_array)(msgpack_pack_user x, size_t n) msgpack_pack_inline_func(_array)(msgpack_pack_user x, size_t n)
{ {
if(n < 16) { if(n < 16) {
unsigned char d = 0x90 | n; unsigned char d = 0x90 | (uint8_t)n;
msgpack_pack_append_buffer(x, &d, 1); msgpack_pack_append_buffer(x, &d, 1);
} else if(n < 65536) { } else if(n < 65536) {
unsigned char buf[3]; unsigned char buf[3];
@ -734,7 +734,7 @@ msgpack_pack_inline_func(_array)(msgpack_pack_user x, size_t n)
msgpack_pack_inline_func(_map)(msgpack_pack_user x, size_t n) msgpack_pack_inline_func(_map)(msgpack_pack_user x, size_t n)
{ {
if(n < 16) { if(n < 16) {
unsigned char d = 0x80 | n; unsigned char d = 0x80 | (uint8_t)n;
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1); msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
} else if(n < 65536) { } else if(n < 65536) {
unsigned char buf[3]; unsigned char buf[3];

View File

@ -232,7 +232,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
case 0xdd: // array 32 case 0xdd: // array 32
case 0xde: // map 16 case 0xde: // map 16
case 0xdf: // map 32 case 0xdf: // map 32
again_fixed_trail(NEXT_CS(p), 2 << (((unsigned int)*p) & 0x01)); again_fixed_trail(NEXT_CS(p), 2u << (((unsigned int)*p) & 0x01));
default: default:
goto _failed; goto _failed;
} }
@ -397,7 +397,7 @@ _end:
ctx->cs = cs; ctx->cs = cs;
ctx->trail = trail; ctx->trail = trail;
ctx->top = top; ctx->top = top;
*off = p - (const unsigned char*)data; *off = (size_t)(p - (const unsigned char*)data);
return ret; return ret;
} }