diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-15 07:54:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-02-15 07:54:38 +0000 |
commit | 66c1e7960ccd1320e2121ed356538a674493e083 (patch) | |
tree | 43318cc7f58bc082f8236d0802eb8a3a8e4152cf /ext/socket/socket.c | |
parent | a60e2e58206c779929a29fe0dd6d73cab4031487 (diff) | |
download | ruby-66c1e7960ccd1320e2121ed356538a674493e083.tar.gz |
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
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index be3f8cc4f1..495cae19e4 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -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) |