Skip to content

Commit

Permalink
Update Socket from CPAN to 2.032
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Maischein committed Jun 13, 2021
1 parent 7db2b62 commit d94230f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Porting/Maintainers.pl
Expand Up @@ -994,7 +994,7 @@ package Maintainers;
},

'Socket' => {
'DISTRIBUTION' => 'PEVANS/Socket-2.031.tar.gz',
'DISTRIBUTION' => 'PEVANS/Socket-2.032.tar.gz',
'FILES' => q[cpan/Socket],
},

Expand Down
2 changes: 2 additions & 0 deletions cpan/Socket/Makefile.PL
Expand Up @@ -192,6 +192,8 @@ my @names = (
IPV6_MULTICAST_IF IPV6_MULTICAST_LOOP IPV6_RECVERR IPV6_ROUTER_ALERT
IPV6_UNICAST_HOPS IPV6_V6ONLY
LOCAL_CONNWAIT LOCAL_CREDS LOCAL_OCREDS LOCAL_PEEREID
MSG_BCAST MSG_BTAG MSG_CTLFLAGS MSG_CTLIGNORE MSG_DONTWAIT MSG_EOF
MSG_EOR MSG_ERRQUEUE MSG_ETAG MSG_FASTOPEN MSG_FIN MSG_MAXIOVLEN
MSG_MCAST MSG_NOSIGNAL MSG_RST MSG_SYN MSG_TRUNC MSG_URG MSG_WAITALL
Expand Down
2 changes: 1 addition & 1 deletion cpan/Socket/Socket.pm
Expand Up @@ -3,7 +3,7 @@ package Socket;
use strict;
{ use v5.6.1; }

our $VERSION = '2.031';
our $VERSION = '2.032';

=head1 NAME
Expand Down
28 changes: 16 additions & 12 deletions cpan/Socket/Socket.xs
Expand Up @@ -228,9 +228,9 @@ static SV *my_newSVpvn_flags(pTHX_ const char *s, STRLEN len, U32 flags)
# define SvRV_set(sv, val) (SvRV(sv) = (val))
#endif /* !SvRV_set */

#ifndef SvPV_nomg
# define SvPV_nomg SvPV
#endif /* !SvPV_nomg */
#ifndef SvPVbyte_nomg
# define SvPVbyte_nomg SvPV
#endif /* !SvPVbyte_nomg */

#ifndef HEK_FLAGS
# define HEK_FLAGS(hek) 0
Expand Down Expand Up @@ -297,6 +297,10 @@ static void *my_hv_common_key_len(pTHX_ HV *hv, const char *key, I32 kl,
# define mPUSHs(s) PUSHs(sv_2mortal(s))
#endif /* !mPUSHs */

#ifndef G_LIST
# define G_LIST G_ARRAY
#endif /* !G_LIST */

#ifndef CvCONST_on
# undef newCONSTSUB
# define newCONSTSUB(stash, name, val) my_newCONSTSUB(aTHX_ stash, name, val)
Expand Down Expand Up @@ -610,14 +614,14 @@ static void xs_getaddrinfo(pTHX_ CV *cv)

SvGETMAGIC(host);
if(SvOK(host)) {
hostname = SvPV_nomg(host, len);
hostname = SvPVbyte_nomg(host, len);
if (!len)
hostname = NULL;
}

SvGETMAGIC(service);
if(SvOK(service)) {
servicename = SvPV_nomg(service, len);
servicename = SvPVbyte_nomg(service, len);
if (!len)
servicename = NULL;
}
Expand Down Expand Up @@ -856,7 +860,7 @@ pack_sockaddr_un(pathname)

Zero(&sun_ad, sizeof(sun_ad), char);
sun_ad.sun_family = AF_UNIX;
pathname_pv = SvPV(pathname,len);
pathname_pv = SvPVbyte(pathname,len);
if (len > sizeof(sun_ad.sun_path)) {
warn("Path length (%" UVuf ") is longer than maximum supported length"
" (%" UVuf ") and will be truncated",
Expand Down Expand Up @@ -923,9 +927,9 @@ unpack_sockaddr_un(sun_sv)
if (!SvOK(sun_sv))
croak("Undefined address for %s", "Socket::unpack_sockaddr_un");
sun_ad = SvPVbyte(sun_sv,sockaddrlen);
# if defined(__linux__) || defined(HAS_SOCKADDR_SA_LEN)
/* On Linux or *BSD sockaddrlen on sockets returned by accept, recvfrom,
getpeername and getsockname is not equal to sizeof(addr). */
# if defined(__linux__) || defined(__CYGWIN__) || defined(HAS_SOCKADDR_SA_LEN)
/* On Linux, Cygwin or *BSD sockaddrlen on sockets returned by accept,
* recvfrom, getpeername and getsockname is not equal to sizeof(addr). */
if (sockaddrlen < sizeof(addr)) {
Copy(sun_ad, &addr, sockaddrlen, char);
Zero(((char*)&addr) + sockaddrlen, sizeof(addr) - sockaddrlen, char);
Expand Down Expand Up @@ -1043,7 +1047,7 @@ unpack_sockaddr_in(sin_sv)
}
ip_address_sv = newSVpvn((char *)&addr.sin_addr, sizeof(addr.sin_addr));

if(GIMME_V == G_ARRAY) {
if(GIMME_V == G_LIST) {
EXTEND(SP, 2);
mPUSHi(ntohs(addr.sin_port));
mPUSHs(ip_address_sv);
Expand Down Expand Up @@ -1127,7 +1131,7 @@ unpack_sockaddr_in6(sin6_sv)
"Socket::unpack_sockaddr_in6", sin6.sin6_family, AF_INET6);
ip_address_sv = newSVpvn((char *)&sin6.sin6_addr, sizeof(sin6.sin6_addr));

if(GIMME_V == G_ARRAY) {
if(GIMME_V == G_LIST) {
EXTEND(SP, 4);
mPUSHi(ntohs(sin6.sin6_port));
mPUSHs(ip_address_sv);
Expand Down Expand Up @@ -1166,7 +1170,7 @@ inet_ntop(af, ip_address_sv)
if (DO_UTF8(ip_address_sv) && !sv_utf8_downgrade(ip_address_sv, 1))
croak("Wide character in %s", "Socket::inet_ntop");

ip_address = SvPV(ip_address_sv, addrlen);
ip_address = SvPVbyte(ip_address_sv, addrlen);

switch(af) {
case AF_INET:
Expand Down

0 comments on commit d94230f

Please sign in to comment.