* configure.in: add check for negative time_t for gmtime(3).
* time.c (time_new_internal): no positive check if gmtime(3) can handle negative time_t. * time.c (time_timeval): ditto. * bignum.c (rb_big2long): should not raise RangeError for Bignum LONG_MIN value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
86833594ff
commit
88eef2d7fe
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
Tue Feb 20 16:37:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* configure.in: add check for negative time_t for gmtime(3).
|
||||||
|
|
||||||
|
* time.c (time_new_internal): no positive check if gmtime(3) can
|
||||||
|
handle negative time_t.
|
||||||
|
|
||||||
|
* time.c (time_timeval): ditto.
|
||||||
|
|
||||||
|
* bignum.c (rb_big2long): should not raise RangeError for Bignum
|
||||||
|
LONG_MIN value.
|
||||||
|
|
||||||
Mon Feb 19 17:46:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Feb 19 17:46:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_substr): "a"[1,2] should return ""; need
|
* string.c (rb_str_substr): "a"[1,2] should return ""; need
|
||||||
|
10
README
10
README
@ -22,14 +22,14 @@ Perl). It is simple, straight-forward, and extensible.
|
|||||||
|
|
||||||
The Ruby distribution can be found on:
|
The Ruby distribution can be found on:
|
||||||
|
|
||||||
ftp://ftp.netlab.co.jp/pub/lang/ruby/
|
ftp://ftp.ruby-lang.org/pub/lang/ruby/
|
||||||
|
|
||||||
You can get it by anonymous CVS. How to check out is:
|
You can get it by anonymous CVS. How to check out is:
|
||||||
|
|
||||||
$ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs login
|
$ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/home/cvs login
|
||||||
(Logging in to anonymous@cvs.netlab.co.jp)
|
(Logging in to anonymous@cvs.ruby-lang.org)
|
||||||
CVS password: guest
|
CVS password: guest
|
||||||
$ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs checkout ruby
|
$ cvs -d :pserver:anonymous@cvs.ruby-lang.org:/home/cvs checkout ruby
|
||||||
|
|
||||||
* Mailing list
|
* Mailing list
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ To subscribe this list, please send the following phrase
|
|||||||
e.g.
|
e.g.
|
||||||
subscribe Joseph Smith
|
subscribe Joseph Smith
|
||||||
|
|
||||||
in the mail body (not subject) to the address <ruby-talk-ctl@netlab.co.jp>.
|
in the mail body (not subject) to the address <ruby-talk-ctl@ruby-lang.org>.
|
||||||
|
|
||||||
* How to compile and install
|
* How to compile and install
|
||||||
|
|
||||||
|
2
bignum.c
2
bignum.c
@ -467,7 +467,7 @@ rb_big2long(x)
|
|||||||
{
|
{
|
||||||
unsigned long num = big2ulong(x, "int");
|
unsigned long num = big2ulong(x, "int");
|
||||||
|
|
||||||
if ((long)num < 0) {
|
if ((long)num < 0 && (long)num != LONG_MIN) {
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `int'");
|
rb_raise(rb_eRangeError, "bignum too big to convert into `int'");
|
||||||
}
|
}
|
||||||
if (!RBIGNUM(x)->sign) return -(long)num;
|
if (!RBIGNUM(x)->sign) return -(long)num;
|
||||||
|
36
configure.in
36
configure.in
@ -261,6 +261,42 @@ AC_CACHE_CHECK(for external int daylight, rb_cv_have_daylight,
|
|||||||
if test "$rb_cv_have_daylight" = yes; then
|
if test "$rb_cv_have_daylight" = yes; then
|
||||||
AC_DEFINE(HAVE_DAYLIGHT)
|
AC_DEFINE(HAVE_DAYLIGHT)
|
||||||
fi
|
fi
|
||||||
|
AC_CACHE_CHECK(for negative time_t for gmtime(3), rb_cv_negative_time_t,
|
||||||
|
[AC_TRY_RUN([
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
check(tm, y, m, d, h, s)
|
||||||
|
struct tm *tm;
|
||||||
|
int y, m, d, h, s;
|
||||||
|
{
|
||||||
|
if (tm->tm_year != y ||
|
||||||
|
tm->tm_mon != m-1 ||
|
||||||
|
tm->tm_mday != d ||
|
||||||
|
tm->tm_hour != h ||
|
||||||
|
tm->tm_sec != s) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
time_t t = -1;
|
||||||
|
struct tm *tm;
|
||||||
|
|
||||||
|
check(gmtime(&t), 69, 12, 31, 23, 59);
|
||||||
|
t = -0x80000000;
|
||||||
|
check(gmtime(&t), 1, 12, 13, 20, 52);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
rb_cv_negative_time_t=yes,
|
||||||
|
rb_cv_negative_time_t=no,
|
||||||
|
rb_cv_negative_time_t=yes)])
|
||||||
|
if test "$rb_cv_negative_time_t" = yes; then
|
||||||
|
AC_DEFINE(NEGATIVE_TIME_T)
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
|
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
|
||||||
AC_DEFINE(POSIX_SIGNAL)
|
AC_DEFINE(POSIX_SIGNAL)
|
||||||
|
2
signal.c
2
signal.c
@ -387,7 +387,7 @@ sigsegv(sig)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIGPIPE
|
#ifdef SIGPIPE
|
||||||
static RETSIGTYPE sigsegv _((int));
|
static RETSIGTYPE sigpipe _((int));
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
sigpipe(sig)
|
sigpipe(sig)
|
||||||
int sig;
|
int sig;
|
||||||
|
8
time.c
8
time.c
@ -80,8 +80,10 @@ time_new_internal(klass, sec, usec)
|
|||||||
VALUE obj;
|
VALUE obj;
|
||||||
struct time_object *tobj;
|
struct time_object *tobj;
|
||||||
|
|
||||||
|
#ifndef NEGATIVE_TIME_T
|
||||||
if (sec < 0 || (sec == 0 && usec < 0))
|
if (sec < 0 || (sec == 0 && usec < 0))
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
rb_raise(rb_eArgError, "time must be positive");
|
||||||
|
#endif
|
||||||
|
|
||||||
obj = Data_Make_Struct(klass, struct time_object, 0, free, tobj);
|
obj = Data_Make_Struct(klass, struct time_object, 0, free, tobj);
|
||||||
tobj->tm_got = 0;
|
tobj->tm_got = 0;
|
||||||
@ -108,22 +110,28 @@ time_timeval(time, interval)
|
|||||||
switch (TYPE(time)) {
|
switch (TYPE(time)) {
|
||||||
case T_FIXNUM:
|
case T_FIXNUM:
|
||||||
t.tv_sec = FIX2LONG(time);
|
t.tv_sec = FIX2LONG(time);
|
||||||
|
#ifndef NEGATIVE_TIME_T
|
||||||
if (t.tv_sec < 0)
|
if (t.tv_sec < 0)
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
rb_raise(rb_eArgError, "time must be positive");
|
||||||
|
#endif
|
||||||
t.tv_usec = 0;
|
t.tv_usec = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_FLOAT:
|
case T_FLOAT:
|
||||||
|
#ifndef NEGATIVE_TIME_T
|
||||||
if (RFLOAT(time)->value < 0.0)
|
if (RFLOAT(time)->value < 0.0)
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
rb_raise(rb_eArgError, "time must be positive");
|
||||||
|
#endif
|
||||||
t.tv_sec = (time_t)RFLOAT(time)->value;
|
t.tv_sec = (time_t)RFLOAT(time)->value;
|
||||||
t.tv_usec = (time_t)((RFLOAT(time)->value - (double)t.tv_sec)*1e6);
|
t.tv_usec = (time_t)((RFLOAT(time)->value - (double)t.tv_sec)*1e6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_BIGNUM:
|
case T_BIGNUM:
|
||||||
t.tv_sec = NUM2LONG(time);
|
t.tv_sec = NUM2LONG(time);
|
||||||
|
#ifndef NEGATIVE_TIME_T
|
||||||
if (t.tv_sec < 0)
|
if (t.tv_sec < 0)
|
||||||
rb_raise(rb_eArgError, "time must be positive");
|
rb_raise(rb_eArgError, "time must be positive");
|
||||||
|
#endif
|
||||||
t.tv_usec = 0;
|
t.tv_usec = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define RUBY_VERSION "1.7.0"
|
#define RUBY_VERSION "1.7.0"
|
||||||
#define RUBY_RELEASE_DATE "2001-02-19"
|
#define RUBY_RELEASE_DATE "2001-02-20"
|
||||||
#define RUBY_VERSION_CODE 170
|
#define RUBY_VERSION_CODE 170
|
||||||
#define RUBY_RELEASE_CODE 20010219
|
#define RUBY_RELEASE_CODE 20010220
|
||||||
|
Loading…
x
Reference in New Issue
Block a user