mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-23 09:14:00 +01:00
perl: make error messages compatible with XS
This commit is contained in:
parent
c320e44a23
commit
f1c294ca50
@ -305,10 +305,10 @@ foreach my $pair(
|
|||||||
sub _unpack {
|
sub _unpack {
|
||||||
my ( $value ) = @_;
|
my ( $value ) = @_;
|
||||||
# get a header byte
|
# get a header byte
|
||||||
my $byte = unpack "x$p C", $value; # "x$p" is faster than substr()
|
defined(my $byte = unpack "x$p C", $value)
|
||||||
|
or Carp::confess("Data::MessagePack->unpack: insufficient bytes");
|
||||||
$p++;
|
$p++;
|
||||||
|
|
||||||
Carp::croak("invalid data") unless defined $byte;
|
|
||||||
|
|
||||||
# +/- fixnum, nil, true, false
|
# +/- fixnum, nil, true, false
|
||||||
return $byte2value[$byte] if $typemap[$byte] & $T_DIRECT;
|
return $byte2value[$byte] if $typemap[$byte] & $T_DIRECT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user