summaryrefslogtreecommitdiff
path: root/ext/socket/unixsocket.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-28 08:14:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-28 08:14:13 +0000
commit4822d20cc55d54d0c3cb190fdcb343976db64901 (patch)
tree5c6d684e1615f4c0559fff9480ed25f2c3e5c887 /ext/socket/unixsocket.c
parent790d6071c6d0d2c677b01779fecb891d64095ded (diff)
* ext/socket: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r--ext/socket/unixsocket.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 1e3fb07..6bdaa94 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -17,10 +17,11 @@ struct unixsock_arg {
};
static VALUE
-unixsock_connect_internal(struct unixsock_arg *arg)
+unixsock_connect_internal(VALUE a)
{
+ struct unixsock_arg *arg = (struct unixsock_arg *)a;
return (VALUE)rsock_connect(arg->fd, (struct sockaddr*)arg->sockaddr,
- sizeof(*arg->sockaddr), 0);
+ (socklen_t)sizeof(*arg->sockaddr), 0);
}
VALUE
@@ -45,15 +46,14 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
if (server) {
- status = bind(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
+ status = bind(fd, (struct sockaddr*)&sockaddr, (socklen_t)sizeof(sockaddr));
}
else {
int prot;
struct unixsock_arg arg;
arg.sockaddr = &sockaddr;
arg.fd = fd;
- status = rb_protect((VALUE(*)(VALUE))unixsock_connect_internal,
- (VALUE)&arg, &prot);
+ status = (int)rb_protect(unixsock_connect_internal, (VALUE)&arg, &prot);
if (prot) {
close(fd);
rb_jump_tag(prot);
@@ -115,7 +115,7 @@ unix_path(VALUE sock)
GetOpenFile(sock, fptr);
if (NIL_P(fptr->pathv)) {
struct sockaddr_un addr;
- socklen_t len = sizeof(addr);
+ socklen_t len = (socklen_t)sizeof(addr);
if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
rb_sys_fail(0);
fptr->pathv = rb_obj_freeze(rb_str_new_cstr(rsock_unixpath(&addr, len)));
@@ -235,10 +235,10 @@ unix_send_io(VALUE sock, VALUE val)
#if FD_PASSING_BY_MSG_CONTROL
arg.msg.msg_control = (caddr_t)&cmsg;
- arg.msg.msg_controllen = CMSG_LEN(sizeof(int));
+ arg.msg.msg_controllen = (socklen_t)CMSG_LEN(sizeof(int));
arg.msg.msg_flags = 0;
MEMZERO((char*)&cmsg, char, sizeof(cmsg));
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
+ cmsg.hdr.cmsg_len = (socklen_t)CMSG_LEN(sizeof(int));
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_RIGHTS;
memcpy(CMSG_DATA(&cmsg.hdr), &fd, sizeof(int));
@@ -320,9 +320,9 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
#if FD_PASSING_BY_MSG_CONTROL
arg.msg.msg_control = (caddr_t)&cmsg;
- arg.msg.msg_controllen = CMSG_SPACE(sizeof(int));
+ arg.msg.msg_controllen = (socklen_t)CMSG_SPACE(sizeof(int));
arg.msg.msg_flags = 0;
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
+ cmsg.hdr.cmsg_len = (socklen_t)CMSG_LEN(sizeof(int));
cmsg.hdr.cmsg_level = SOL_SOCKET;
cmsg.hdr.cmsg_type = SCM_RIGHTS;
fd = -1;
@@ -415,7 +415,7 @@ unix_addr(VALUE sock)
{
rb_io_t *fptr;
struct sockaddr_un addr;
- socklen_t len = sizeof addr;
+ socklen_t len = (socklen_t)sizeof addr;
GetOpenFile(sock, fptr);
@@ -441,7 +441,7 @@ unix_peeraddr(VALUE sock)
{
rb_io_t *fptr;
struct sockaddr_un addr;
- socklen_t len = sizeof addr;
+ socklen_t len = (socklen_t)sizeof addr;
GetOpenFile(sock, fptr);