1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/raddrinfo.c: suppress warnings.

* ext/socket/socket.c: ditto.

* ext/socket/unixsocket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-03-01 14:00:48 +00:00
parent 4ca8057c3e
commit d79dc0f6a0
4 changed files with 14 additions and 6 deletions

View file

@ -1,3 +1,11 @@
Sun Mar 1 22:59:41 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/raddrinfo.c: suppress warnings.
* ext/socket/socket.c: ditto.
* ext/socket/unixsocket.c: ditto.
Sun Mar 1 20:57:41 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/ (rsock_getfamily): renamed from rb_sock_getfamily.

View file

@ -725,7 +725,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
StringValue(path);
if (sizeof(un.sun_path) <= RSTRING_LEN(path))
if (sizeof(un.sun_path) <= (size_t)RSTRING_LEN(path))
rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
(int)sizeof(un.sun_path)-1);
@ -1260,7 +1260,7 @@ addrinfo_mload(VALUE self, VALUE ary)
sun.sun_family = AF_UNIX;
StringValue(v);
if (sizeof(sun.sun_path) <= RSTRING_LEN(v))
if (sizeof(sun.sun_path) <= (size_t)RSTRING_LEN(v))
rb_raise(rb_eSocket, "too long AF_UNIX path");
memcpy(sun.sun_path, RSTRING_PTR(v), RSTRING_LEN(v));
len = sizeof(sun);

View file

@ -1153,11 +1153,11 @@ sock_s_getnameinfo(int argc, VALUE *argv)
tmp = rb_check_sockaddr_string_type(sa);
if (!NIL_P(tmp)) {
sa = tmp;
if (sizeof(ss) < RSTRING_LEN(sa)) {
if (sizeof(ss) < (size_t)RSTRING_LEN(sa)) {
rb_raise(rb_eTypeError, "sockaddr length too big");
}
memcpy(&ss, RSTRING_PTR(sa), RSTRING_LEN(sa));
if (RSTRING_LEN(sa) != SS_LEN(&ss)) {
if ((size_t)RSTRING_LEN(sa) != SS_LEN(&ss)) {
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
}
sap = (struct sockaddr*)&ss;
@ -1386,7 +1386,7 @@ sock_s_unpack_sockaddr_un(VALUE self, VALUE addr)
if (((struct sockaddr *)sockaddr)->sa_family != AF_UNIX) {
rb_raise(rb_eArgError, "not an AF_UNIX sockaddr");
}
if (sizeof(struct sockaddr_un) < RSTRING_LEN(addr)) {
if (sizeof(struct sockaddr_un) < (size_t)RSTRING_LEN(addr)) {
rb_raise(rb_eTypeError, "too long sockaddr_un - %ld longer than %d",
RSTRING_LEN(addr), (int)sizeof(struct sockaddr_un));
}

View file

@ -38,7 +38,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
if (sizeof(sockaddr.sun_path) <= RSTRING_LEN(path)) {
if (sizeof(sockaddr.sun_path) <= (size_t)RSTRING_LEN(path)) {
rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
(int)sizeof(sockaddr.sun_path)-1);
}