mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
socket: ai_addrlen is socklen_t
* ext/socket/raddrinfo.c (rsock_make_hostent): ai_addrlen is not size_t but socklen_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a60e2e5820
commit
66c1e7960c
4 changed files with 11 additions and 11 deletions
|
@ -465,7 +465,7 @@ rsock_unix_sockaddr_len(VALUE path)
|
|||
struct hostent_arg {
|
||||
VALUE host;
|
||||
struct addrinfo* addr;
|
||||
VALUE (*ipaddr)(struct sockaddr*, size_t);
|
||||
VALUE (*ipaddr)(struct sockaddr*, socklen_t);
|
||||
};
|
||||
|
||||
static VALUE
|
||||
|
@ -473,7 +473,7 @@ make_hostent_internal(struct hostent_arg *arg)
|
|||
{
|
||||
VALUE host = arg->host;
|
||||
struct addrinfo* addr = arg->addr;
|
||||
VALUE (*ipaddr)(struct sockaddr*, size_t) = arg->ipaddr;
|
||||
VALUE (*ipaddr)(struct sockaddr*, socklen_t) = arg->ipaddr;
|
||||
|
||||
struct addrinfo *ai;
|
||||
struct hostent *h;
|
||||
|
@ -519,7 +519,7 @@ rsock_freeaddrinfo(struct addrinfo *addr)
|
|||
}
|
||||
|
||||
VALUE
|
||||
rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, size_t))
|
||||
rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t))
|
||||
{
|
||||
struct hostent_arg arg;
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ VALUE rsock_addrinfo_new(struct sockaddr *addr, socklen_t len, int family, int s
|
|||
|
||||
VALUE rsock_make_ipaddr(struct sockaddr *addr, socklen_t addrlen);
|
||||
VALUE rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup);
|
||||
VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, size_t));
|
||||
VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t));
|
||||
|
||||
int rsock_revlookup_flag(VALUE revlookup, int *norevlookup);
|
||||
|
||||
|
|
|
@ -950,19 +950,19 @@ make_addrinfo(struct addrinfo *res0, int norevlookup)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
sock_sockaddr(struct sockaddr *addr, size_t len)
|
||||
sock_sockaddr(struct sockaddr *addr, socklen_t len)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
switch (addr->sa_family) {
|
||||
case AF_INET:
|
||||
ptr = (char*)&((struct sockaddr_in*)addr)->sin_addr.s_addr;
|
||||
len = sizeof(((struct sockaddr_in*)addr)->sin_addr.s_addr);
|
||||
len = (socklen_t)sizeof(((struct sockaddr_in*)addr)->sin_addr.s_addr);
|
||||
break;
|
||||
#ifdef AF_INET6
|
||||
case AF_INET6:
|
||||
ptr = (char*)&((struct sockaddr_in6*)addr)->sin6_addr.s6_addr;
|
||||
len = sizeof(((struct sockaddr_in6*)addr)->sin6_addr.s6_addr);
|
||||
len = (socklen_t)sizeof(((struct sockaddr_in6*)addr)->sin6_addr.s6_addr);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -1239,7 +1239,7 @@ sock_s_getnameinfo(int argc, VALUE *argv)
|
|||
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
|
||||
}
|
||||
sap = (struct sockaddr*)&ss;
|
||||
salen = RSTRING_LEN(sa);
|
||||
salen = RSTRING_LENINT(sa);
|
||||
goto call_nameinfo;
|
||||
}
|
||||
tmp = rb_check_array_type(sa);
|
||||
|
@ -1403,7 +1403,7 @@ sock_s_unpack_sockaddr_in(VALUE self, VALUE addr)
|
|||
rb_raise(rb_eArgError, "not an AF_INET sockaddr");
|
||||
#endif
|
||||
}
|
||||
host = rsock_make_ipaddr((struct sockaddr*)sockaddr, RSTRING_LEN(addr));
|
||||
host = rsock_make_ipaddr((struct sockaddr*)sockaddr, RSTRING_LENINT(addr));
|
||||
OBJ_INFECT(host, addr);
|
||||
return rb_assoc_new(INT2NUM(ntohs(sockaddr->sin_port)), host);
|
||||
}
|
||||
|
@ -1518,7 +1518,7 @@ sockaddr_obj(struct sockaddr *addr, socklen_t len)
|
|||
|
||||
if (addr == NULL)
|
||||
return Qnil;
|
||||
|
||||
|
||||
len = sockaddr_len(addr);
|
||||
|
||||
#if defined(__KAME__) && defined(AF_INET6)
|
||||
|
|
|
@ -32,7 +32,7 @@ tcp_init(int argc, VALUE *argv, VALUE sock)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
tcp_sockaddr(struct sockaddr *addr, size_t len)
|
||||
tcp_sockaddr(struct sockaddr *addr, socklen_t len)
|
||||
{
|
||||
return rsock_make_ipaddr(addr, len);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue