mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-06-18 21:52:06 +00:00
fix: check return code in unpack_callback_int64 (#665)
This commit is contained in:
parent
5d465bdb77
commit
95c8be516d
1 changed files with 4 additions and 12 deletions
|
|
@ -70,12 +70,7 @@ static inline int unpack_callback_uint32(unpack_user* u, uint32_t d, msgpack_unp
|
|||
|
||||
static inline int unpack_callback_uint64(unpack_user* u, uint64_t d, msgpack_unpack_object* o)
|
||||
{
|
||||
PyObject *p;
|
||||
if (d > LONG_MAX) {
|
||||
p = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)d);
|
||||
} else {
|
||||
p = PyLong_FromLong((long)d);
|
||||
}
|
||||
PyObject *p = PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)d);
|
||||
if (!p)
|
||||
return -1;
|
||||
*o = p;
|
||||
|
|
@ -103,12 +98,9 @@ static inline int unpack_callback_int8(unpack_user* u, int8_t d, msgpack_unpack_
|
|||
|
||||
static inline int unpack_callback_int64(unpack_user* u, int64_t d, msgpack_unpack_object* o)
|
||||
{
|
||||
PyObject *p;
|
||||
if (d > LONG_MAX || d < LONG_MIN) {
|
||||
p = PyLong_FromLongLong((PY_LONG_LONG)d);
|
||||
} else {
|
||||
p = PyLong_FromLong((long)d);
|
||||
}
|
||||
PyObject *p = PyLong_FromLongLong((PY_LONG_LONG)d);
|
||||
if (!p)
|
||||
return -1;
|
||||
*o = p;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue