mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-19 04:52:59 +01:00
Merge branch 'philix-Wconversion'
This commit is contained in:
commit
7491348d40
@ -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)
|
||||
{
|
||||
if(n < 16) {
|
||||
unsigned char d = 0x90 | n;
|
||||
unsigned char d = 0x90 | (uint8_t)n;
|
||||
msgpack_pack_append_buffer(x, &d, 1);
|
||||
} else if(n < 65536) {
|
||||
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)
|
||||
{
|
||||
if(n < 16) {
|
||||
unsigned char d = 0x80 | n;
|
||||
unsigned char d = 0x80 | (uint8_t)n;
|
||||
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
|
||||
} else if(n < 65536) {
|
||||
unsigned char buf[3];
|
||||
|
@ -131,7 +131,7 @@ static inline const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffe
|
||||
|
||||
static inline size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref)
|
||||
{
|
||||
return vref->tail - vref->array;
|
||||
return (size_t)(vref->tail - vref->array);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,19 +71,19 @@ static inline int template_callback_uint64(unpack_user* u, uint64_t d, msgpack_o
|
||||
{ o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = d; return 0; }
|
||||
|
||||
static inline int template_callback_int8(unpack_user* u, int8_t d, msgpack_object* o)
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = d; return 0; }
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = (uint64_t)d; return 0; }
|
||||
else { o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER; o->via.i64 = d; return 0; } }
|
||||
|
||||
static inline int template_callback_int16(unpack_user* u, int16_t d, msgpack_object* o)
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = d; return 0; }
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = (uint64_t)d; return 0; }
|
||||
else { o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER; o->via.i64 = d; return 0; } }
|
||||
|
||||
static inline int template_callback_int32(unpack_user* u, int32_t d, msgpack_object* o)
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = d; return 0; }
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = (uint64_t)d; return 0; }
|
||||
else { o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER; o->via.i64 = d; return 0; } }
|
||||
|
||||
static inline int template_callback_int64(unpack_user* u, int64_t d, msgpack_object* o)
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = d; return 0; }
|
||||
{ if(d >= 0) { o->type = MSGPACK_OBJECT_POSITIVE_INTEGER; o->via.u64 = (uint64_t)d; return 0; }
|
||||
else { o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER; o->via.i64 = d; return 0; } }
|
||||
|
||||
static inline int template_callback_float(unpack_user* u, float d, msgpack_object* o)
|
||||
|
@ -98,7 +98,7 @@ int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
|
||||
const char* buf, size_t len)
|
||||
{
|
||||
if(vbuf->tail == vbuf->end) {
|
||||
const size_t nused = vbuf->tail - vbuf->array;
|
||||
const size_t nused = (size_t)(vbuf->tail - vbuf->array);
|
||||
const size_t nnext = nused * 2;
|
||||
|
||||
struct iovec* nvec = (struct iovec*)realloc(
|
||||
@ -169,11 +169,11 @@ int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to)
|
||||
empty->next = NULL;
|
||||
|
||||
|
||||
const size_t nused = vbuf->tail - vbuf->array;
|
||||
const size_t nused = (size_t)(vbuf->tail - vbuf->array);
|
||||
if(to->tail + nused < vbuf->end) {
|
||||
const size_t tosize = to->tail - to->array;
|
||||
const size_t tosize = (size_t)(to->tail - to->array);
|
||||
const size_t reqsize = nused + tosize;
|
||||
size_t nnext = (to->end - to->array) * 2;
|
||||
size_t nnext = (size_t)(to->end - to->array) * 2;
|
||||
while(nnext < reqsize) {
|
||||
nnext *= 2;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ bool msgpack_zone_push_finalizer_expand(msgpack_zone* zone,
|
||||
{
|
||||
msgpack_zone_finalizer_array* const fa = &zone->finalizer_array;
|
||||
|
||||
const size_t nused = fa->end - fa->array;
|
||||
const size_t nused = (size_t)(fa->end - fa->array);
|
||||
|
||||
size_t nnext;
|
||||
if(nused == 0) {
|
||||
|
@ -232,7 +232,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
|
||||
case 0xdd: // array 32
|
||||
case 0xde: // map 16
|
||||
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:
|
||||
goto _failed;
|
||||
}
|
||||
@ -397,7 +397,7 @@ _end:
|
||||
ctx->cs = cs;
|
||||
ctx->trail = trail;
|
||||
ctx->top = top;
|
||||
*off = p - (const unsigned char*)data;
|
||||
*off = (size_t)(p - (const unsigned char*)data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user