mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-23 00:08:01 +02:00
perl: fix int64_t unpacking in both XS and PP
This commit is contained in:
@@ -102,13 +102,6 @@ STATIC_INLINE int template_callback_UV(unpack_user* u PERL_UNUSED_DECL, UV const
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC_INLINE int template_callback_uint64(unpack_user* u PERL_UNUSED_DECL, uint64_t const d, SV** o)
|
||||
{
|
||||
dTHX;
|
||||
*o = newSVnv((NV)d);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC_INLINE int template_callback_IV(unpack_user* u PERL_UNUSED_DECL, IV const d, SV** o)
|
||||
{
|
||||
dTHX;
|
||||
@@ -116,10 +109,31 @@ STATIC_INLINE int template_callback_IV(unpack_user* u PERL_UNUSED_DECL, IV const
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC_INLINE int template_callback_int64(unpack_user* u PERL_UNUSED_DECL, int64_t const d, SV** o)
|
||||
static int template_callback_uint64(unpack_user* u PERL_UNUSED_DECL, uint64_t const d, SV** o)
|
||||
{
|
||||
dTHX;
|
||||
*o = newSVnv((NV)d);
|
||||
if((uint64_t)(NV)d == d) {
|
||||
*o = newSVnv((NV)d);
|
||||
}
|
||||
else {
|
||||
char tbuf[64];
|
||||
STRLEN const len = my_snprintf(tbuf, sizeof(tbuf), "%llu", d);
|
||||
*o = newSVpvn(tbuf, len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int template_callback_int64(unpack_user* u PERL_UNUSED_DECL, int64_t const d, SV** o)
|
||||
{
|
||||
dTHX;
|
||||
if((uint64_t)(NV)d == (uint64_t)d) {
|
||||
*o = newSVnv((NV)d);
|
||||
}
|
||||
else {
|
||||
char tbuf[64];
|
||||
STRLEN const len = my_snprintf(tbuf, sizeof(tbuf), "%lld", d);
|
||||
*o = newSVpvn(tbuf, len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user