int16_t iv16;
int32_t iv32;
int64_t iv64;
+ uint16_t uiv16;
+ uint32_t uiv32;
+ uint64_t uiv64;
+
if (len > remain) {
return -1;
len = 2;
break;
case msgpack_uint16:
- obj->value.iv = FROM_BE16 (*(uint16_t *)pos);
+ memcpy (&uiv16, pos, sizeof (uiv16));
+ uiv16 = FROM_BE16 (uiv16);
+ obj->value.iv = uiv16;
len = 2;
break;
case msgpack_int32:
len = 4;
break;
case msgpack_uint32:
- obj->value.iv = FROM_BE32 (*(uint32_t *)pos);
+ memcpy(&uiv32, pos, sizeof(uiv32));
+ uiv32 = FROM_BE32(uiv32);
+ obj->value.iv = uiv32;
len = 4;
break;
case msgpack_int64:
len = 8;
break;
case msgpack_uint64:
- obj->value.iv = FROM_BE64 (*(uint64_t *)pos);
+ memcpy(&uiv64, pos, sizeof(uiv64));
+ uiv64 = FROM_BE64(uiv64);
+ obj->value.iv = uiv64;
len = 8;
break;
default:
uint32_t i;
float f;
} d;
+ uint64_t uiv64;
if (len > remain) {
return -1;
switch (fmt) {
case msgpack_float32:
- d.i = FROM_BE32 (*(uint32_t *)pos);
+ memcpy(&d.i, pos, sizeof(d.i));
+ d.i = FROM_BE32(d.i);
/* XXX: can be slow */
obj->value.dv = d.f;
len = 4;
break;
case msgpack_float64:
- obj->value.iv = FROM_BE64 (*(uint64_t *)pos);
+ memcpy(&uiv64, pos, sizeof(uiv64));
+ uiv64 = FROM_BE64(uiv64);
+ obj->value.iv = uiv64;
len = 8;
break;
default: