* bignum.c (bignorm): fixed a bug in normalizing negative numbers

reported from Honda Hiroki <hhonda@ipflex.com>.  normalizing
  should not trim preceding zeros from negative numbers.

* ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from
  KUBO Takehiro <kubo@jiubao.org> to support AIX.  [ruby-list:40832]

* lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from
  Tilman Sauerbeck <tilman@code-monkey.de>.  [ruby-core:05055]

* lib/yaml/rubytypes.rb (Hash::to_yaml): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-06-07 16:33:01 +00:00
Родитель 3ec9537664
Коммит db128e1b31
6 изменённых файлов: 61 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,21 @@
Wed Jun 8 01:27:06 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (bignorm): fixed a bug in normalizing negative numbers
reported from Honda Hiroki <hhonda@ipflex.com>. normalizing
should not trim preceding zeros from negative numbers.
Wed Jun 8 00:15:08 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/socket/socket.c (ruby_getaddrinfo__aix): merged a patch from
KUBO Takehiro <kubo@jiubao.org> to support AIX. [ruby-list:40832]
Wed Jun 8 00:09:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/yaml/rubytypes.rb (Array::to_yaml): merged a patch from
Tilman Sauerbeck <tilman@code-monkey.de>. [ruby-core:05055]
* lib/yaml/rubytypes.rb (Hash::to_yaml): ditto.
Wed Jun 8 00:00:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org> Wed Jun 8 00:00:01 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/curses/curses.c (curses_insertln): merged a patch from * ext/curses/curses.c (curses_insertln): merged a patch from

Просмотреть файл

@ -105,9 +105,15 @@ bignorm(x)
BDIGIT *ds = BDIGITS(x); BDIGIT *ds = BDIGITS(x);
while (len-- && !ds[len]) ; while (len-- && !ds[len]) ;
RBIGNUM(x)->len = ++len; len++;
if (RBIGNUM(x)->sign) {
RBIGNUM(x)->len = len;
}
else if (len == 0) {
return x;
}
if (len*SIZEOF_BDIGITS <= sizeof(VALUE)) { if (RBIGNUM(x)->len*SIZEOF_BDIGITS <= sizeof(VALUE)) {
long num = 0; long num = 0;
while (len--) { while (len--) {
num = BIGUP(num) + ds[len]; num = BIGUP(num) + ds[len];

Просмотреть файл

@ -1172,7 +1172,6 @@ void
rb_sys_fail(mesg) rb_sys_fail(mesg)
const char *mesg; const char *mesg;
{ {
extern int errno;
int n = errno; int n = errno;
VALUE arg; VALUE arg;

Просмотреть файл

@ -155,8 +155,13 @@ main()
} }
for (ai = aitop; ai; ai = ai->ai_next) { for (ai = aitop; ai; ai = ai->ai_next) {
if (ai->ai_family == AF_LOCAL) continue; if (ai->ai_family == AF_LOCAL) continue;
if (ai->ai_addr == NULL || if (ai->ai_addr == NULL)
ai->ai_addrlen == 0 || goto bad;
#if defined(_AIX)
ai->ai_addr->sa_len = ai->ai_addrlen;
ai->ai_addr->sa_family = ai->ai_family;
#endif
if (ai->ai_addrlen == 0 ||
getnameinfo(ai->ai_addr, ai->ai_addrlen, getnameinfo(ai->ai_addr, ai->ai_addrlen,
straddr, sizeof(straddr), strport, sizeof(strport), straddr, sizeof(straddr), strport, sizeof(strport),
NI_NUMERICHOST|NI_NUMERICSERV) != 0) { NI_NUMERICHOST|NI_NUMERICSERV) != 0) {

Просмотреть файл

@ -169,6 +169,30 @@ ruby_getaddrinfo(nodename, servname, hints, res)
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res)) #define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo((node),(serv),(hints),(res))
#endif #endif
#if defined(_AIX)
static int
ruby_getaddrinfo__aix(nodename, servname, hints, res)
char *nodename;
char *servname;
struct addrinfo *hints;
struct addrinfo **res;
{
int error = getaddrinfo(nodename, servname, hints, res);
struct addrinfo *r;
if (error)
return error;
for (r = *res; r != NULL; r = r->ai_next) {
if (r->ai_addr->sa_family == 0)
r->ai_addr->sa_family = r->ai_family;
if (r->ai_addr->sa_len == 0)
r->ai_addr->sa_len = r->ai_addrlen;
}
return 0;
}
#undef getaddrinfo
#define getaddrinfo(node,serv,hints,res) ruby_getaddrinfo__aix((node),(serv),(hints),(res))
#endif
#ifdef HAVE_CLOSESOCKET #ifdef HAVE_CLOSESOCKET
#undef close #undef close
#define close closesocket #define close closesocket
@ -2504,7 +2528,9 @@ sock_s_getnameinfo(argc, argv)
* 4th element holds numeric form, don't resolve. * 4th element holds numeric form, don't resolve.
* see ipaddr(). * see ipaddr().
*/ */
#ifdef AI_NUMERICHOST /* AIX 4.3.3 doesn't have AI_NUMERICHOST. */
hints.ai_flags |= AI_NUMERICHOST; hints.ai_flags |= AI_NUMERICHOST;
#endif
} }
} }
else { else {

Просмотреть файл

@ -77,7 +77,7 @@ hash_proc = Proc.new { |type, val|
elsif Hash === val elsif Hash === val
type, obj_class = YAML.read_type_class( type, Hash ) type, obj_class = YAML.read_type_class( type, Hash )
if obj_class != Hash if obj_class != Hash
o = obj_class.new o = obj_class.allocate
o.update( val ) o.update( val )
val = o val = o
end end
@ -236,7 +236,7 @@ array_proc = Proc.new { |type, val|
if Array === val if Array === val
type, obj_class = YAML.read_type_class( type, Array ) type, obj_class = YAML.read_type_class( type, Array )
if obj_class != Array if obj_class != Array
o = obj_class.new o = obj_class.allocate
o.concat( val ) o.concat( val )
val = o val = o
end end