diff --git a/ChangeLog b/ChangeLog index f0ecd1c982..eee2aae77c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Jun 29 07:45:33 2000 Yukihiro Matsumoto + + * ext/socket/socket.c (udp_send): destination may be packed + struct sockaddr. + + * object.c (rb_Integer): Integer(nil) should be invalid, on the + other hand, nil.to_i is OK. + Wed Jun 28 17:26:06 2000 Yukihiro Matsumoto * ext/socket/socket.c (ip_recvfrom): udp_recvfrom and tcp_recvfrom diff --git a/ext/socket/socket.c b/ext/socket/socket.c index d46092f119..bd39d7eb7c 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -104,7 +104,7 @@ struct sockaddr_storage { }; #endif -#if defined(INET6) && (defined(LOOKUP_ORDER_HACK_INET) || defined(LOOKUP_ORDER_HACK_INET)) +#if defined(INET6) && (defined(LOOKUP_ORDER_HACK_INET) || defined(LOOKUP_ORDER_HACK_INET6)) #define LOOKUP_ORDERS 3 static int lookup_order_table[LOOKUP_ORDERS] = { #if defined(LOOKUP_ORDER_HACK_INET) @@ -381,7 +381,7 @@ bsock_send(argc, argv, sock) retry: rb_thread_fd_writable(fd); m = rb_str2cstr(msg, &mlen); - if (RTEST(to)) { + if (!NIL_P(to)) { t = rb_str2cstr(to, &tlen); n = sendto(fd, m, mlen, NUM2INT(flags), (struct sockaddr*)t, tlen); @@ -611,15 +611,6 @@ ip_addrsetup(host, port) return res; } -static VALUE -ip_recvfrom(argc, argv, sock) - int argc; - VALUE *argv; - VALUE sock; -{ - return s_recvfrom(sock, argc, argv, RECV_IP); -} - static void setipaddr(name, addr) VALUE name; @@ -1167,6 +1158,15 @@ ip_peeraddr(sock) return ipaddr((struct sockaddr *)&addr); } +static VALUE +ip_recvfrom(argc, argv, sock) + int argc; + VALUE *argv; + VALUE sock; +{ + return s_recvfrom(sock, argc, argv, RECV_IP); +} + static VALUE ip_s_getaddress(obj, host) VALUE obj, host; @@ -1259,7 +1259,7 @@ udp_send(argc, argv, sock) int mlen; struct addrinfo *res0, *res; - if (argc == 2) { + if (argc == 2 || argc == 3) { return bsock_send(argc, argv, sock); } rb_secure(4); diff --git a/object.c b/object.c index b9333f75d8..0a764cc75f 100644 --- a/object.c +++ b/object.c @@ -893,8 +893,8 @@ rb_Integer(val) case T_STRING: return rb_str2inum(val, 0); - case T_NIL: - return INT2FIX(0); + case T_FIXNUM: + return val; default: break; diff --git a/version.h b/version.h index be4a459d20..5a88524413 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.5.4" -#define RUBY_RELEASE_DATE "2000-06-28" +#define RUBY_RELEASE_DATE "2000-06-29" #define RUBY_VERSION_CODE 154 -#define RUBY_RELEASE_CODE 20000628 +#define RUBY_RELEASE_CODE 20000629