mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
19991206
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cb4d9ccf03
commit
0ca799d43c
14 changed files with 73 additions and 35 deletions
27
ChangeLog
27
ChangeLog
|
|
@ -1,3 +1,30 @@
|
|||
Mon Dec 6 15:55:30 1999 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
|
||||
|
||||
* numeric.c (fix_rshift): Fix -1 >> 32 returned 0. (-1 is true)
|
||||
|
||||
* numeric.c (fix_rshift): Fix 1 >> -1 returned 0. (2 is true)
|
||||
|
||||
Mon Dec 6 11:47:23 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* sprintf.c (rb_f_sprintf): formatted string must be tainted if
|
||||
any of parameters is tainted.
|
||||
|
||||
* file.c (rb_file_s_expand_path): expanded file path need not to
|
||||
be tainted always.
|
||||
|
||||
Sat Dec 4 01:40:22 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* bignum.c (rb_big_rand): should not use rand/random where drand48
|
||||
may be available. RANDOM_NUMBER should be provided from outside.
|
||||
|
||||
Fri Dec 3 09:54:59 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* eval.c (rb_f_require): should check require 'feature.o' too.
|
||||
|
||||
Thu Dec 2 11:58:15 1999 Koji Arai <JCA02266@nifty.ne.jp>
|
||||
|
||||
* eval.c (rb_thread_loading): should maintain loading_tbl.
|
||||
|
||||
Thu Dec 2 10:21:43 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* eval.c (rb_thread_loading_done): wrong parameter to st_delete().
|
||||
|
|
|
|||
15
bignum.c
15
bignum.c
|
|
@ -1255,20 +1255,17 @@ rb_big_abs(x)
|
|||
*/
|
||||
|
||||
VALUE
|
||||
rb_big_rand(max)
|
||||
rb_big_rand(max, rand)
|
||||
VALUE max;
|
||||
double rand;
|
||||
{
|
||||
struct RBignum *v;
|
||||
VALUE v;
|
||||
long len;
|
||||
|
||||
len = RBIGNUM(max)->len;
|
||||
v = RBIGNUM(bignew(len,1));
|
||||
len = RBIGNUM(v)->len;
|
||||
v = bignew(len,1);
|
||||
while (len--) {
|
||||
#ifdef HAVE_RANDOM
|
||||
BDIGITS(v)[len] = random();
|
||||
#else
|
||||
BDIGITS(v)[len] = rand();
|
||||
#endif
|
||||
BDIGITS(v)[len] = ((USHORT)~0) * rand;
|
||||
}
|
||||
|
||||
return rb_big_mod((VALUE)v, max);
|
||||
|
|
|
|||
4
configure
vendored
4
configure
vendored
|
|
@ -3641,7 +3641,7 @@ else
|
|||
int main() {
|
||||
|
||||
/* Ultrix mips cc rejects this. */
|
||||
typedef int charset[2]; const charset x;
|
||||
typedef int charset[2]; const charset x = {0,0};
|
||||
/* SunOS 4.1.1 cc rejects this. */
|
||||
char const *const *ccp;
|
||||
char **p;
|
||||
|
|
@ -3783,7 +3783,7 @@ else
|
|||
int
|
||||
main()
|
||||
{
|
||||
if (-1==(-1>>1))
|
||||
if (-1==(-1>>(unsigned)1))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
|
|||
int
|
||||
main()
|
||||
{
|
||||
if (-1==(-1>>1))
|
||||
if (-1==(-1>>(unsigned)1))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
12
eval.c
12
eval.c
|
|
@ -4834,6 +4834,7 @@ rb_f_require(obj, fname)
|
|||
ext = strrchr(buf, '.');
|
||||
strcpy(ext, DLEXT);
|
||||
file = feature = buf;
|
||||
if (rb_provided(feature)) return Qfalse;
|
||||
}
|
||||
file = find_file(file);
|
||||
if (file) goto load_dyna;
|
||||
|
|
@ -5991,7 +5992,7 @@ Init_Proc()
|
|||
rb_define_global_function("lambda", rb_f_lambda, 0);
|
||||
rb_define_global_function("binding", rb_f_binding, 0);
|
||||
rb_cBinding = rb_define_class("Binding", rb_cObject);
|
||||
rb_undef_method(CLASS_OF(rb_cMethod), "new");
|
||||
rb_undef_method(CLASS_OF(rb_cBinding), "new");
|
||||
rb_define_method(rb_cBinding, "clone", bind_clone, 0);
|
||||
|
||||
rb_cMethod = rb_define_class("Method", rb_cObject);
|
||||
|
|
@ -7332,9 +7333,12 @@ static int
|
|||
rb_thread_loading(feature)
|
||||
const char *feature;
|
||||
{
|
||||
if (!rb_provided(feature)) return Qfalse; /* need to load */
|
||||
if (!loading_tbl) {
|
||||
loading_tbl = st_init_strtable();
|
||||
if (!rb_provided(feature)) {
|
||||
if (!loading_tbl) {
|
||||
loading_tbl = st_init_strtable();
|
||||
}
|
||||
st_insert(loading_tbl, feature, 0);
|
||||
return Qfalse; /* need to load */
|
||||
}
|
||||
while (st_lookup(loading_tbl, feature, 0)) {
|
||||
CHECK_INTS;
|
||||
|
|
|
|||
|
|
@ -2131,6 +2131,8 @@ class TkTextWin<TkWindow
|
|||
end
|
||||
|
||||
class TkListbox<TkTextWin
|
||||
include Scrollable
|
||||
|
||||
WidgetClassNames['Listbox'] = self
|
||||
def TkListbox.to_eval
|
||||
'Listbox'
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ end
|
|||
|
||||
class TkCanvas<TkWindow
|
||||
include TkTreatCItemFont
|
||||
include Scrollable
|
||||
|
||||
WidgetClassName = 'Canvas'.freeze
|
||||
WidgetClassNames[WidgetClassName] = self
|
||||
|
|
|
|||
8
file.c
8
file.c
|
|
@ -1062,12 +1062,14 @@ rb_file_s_expand_path(argc, argv)
|
|||
VALUE fname, dname;
|
||||
char *s, *p;
|
||||
char buf[MAXPATHLEN+2];
|
||||
int tainted = 0;
|
||||
|
||||
rb_scan_args(argc, argv, "11", &fname, &dname);
|
||||
|
||||
s = STR2CSTR(fname);
|
||||
p = buf;
|
||||
if (s[0] == '~') {
|
||||
tainted = 1;
|
||||
if (isdirsep(s[1]) || s[1] == '\0') {
|
||||
char *dir = getenv("HOME");
|
||||
|
||||
|
|
@ -1110,9 +1112,11 @@ rb_file_s_expand_path(argc, argv)
|
|||
else if (!isdirsep(*s)) {
|
||||
if (argc == 2) {
|
||||
dname = rb_file_s_expand_path(1, &dname);
|
||||
if (OBJ_TAINTED(dname)) tainted = 1;
|
||||
strcpy(buf, RSTRING(dname)->ptr);
|
||||
}
|
||||
else {
|
||||
tainted = 1;
|
||||
#ifdef HAVE_GETCWD
|
||||
getcwd(buf, MAXPATHLEN);
|
||||
#else
|
||||
|
|
@ -1172,7 +1176,9 @@ rb_file_s_expand_path(argc, argv)
|
|||
if (p == buf || !isdirsep(*p)) p++;
|
||||
*p = '\0';
|
||||
|
||||
return rb_tainted_str_new2(buf);
|
||||
fname = rb_str_new2(buf);
|
||||
if (tainted) OBJ_TAINT(fname);
|
||||
return fname;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
4
gc.c
4
gc.c
|
|
@ -242,8 +242,8 @@ add_heap()
|
|||
/* Realloc heaps */
|
||||
heaps_length += HEAPS_INCREMENT;
|
||||
heaps = (heaps_used>0)?
|
||||
(RVALUE**)realloc(heaps, heaps_length*sizeof(RVALUE)):
|
||||
(RVALUE**)malloc(heaps_length*sizeof(RVALUE));
|
||||
(RVALUE**)realloc(heaps, heaps_length*sizeof(RVALUE*)):
|
||||
(RVALUE**)malloc(heaps_length*sizeof(RVALUE*));
|
||||
if (heaps == 0) rb_fatal("can't alloc memory");
|
||||
}
|
||||
|
||||
|
|
|
|||
2
intern.h
2
intern.h
|
|
@ -57,7 +57,7 @@ VALUE rb_big_and _((VALUE, VALUE));
|
|||
VALUE rb_big_or _((VALUE, VALUE));
|
||||
VALUE rb_big_xor _((VALUE, VALUE));
|
||||
VALUE rb_big_lshift _((VALUE, VALUE));
|
||||
VALUE rb_big_rand _((VALUE));
|
||||
VALUE rb_big_rand _((VALUE, double));
|
||||
/* class.c */
|
||||
VALUE rb_class_new _((VALUE));
|
||||
VALUE rb_singleton_class_new _((VALUE));
|
||||
|
|
|
|||
10
numeric.c
10
numeric.c
|
|
@ -1169,12 +1169,10 @@ fix_rshift(x, y)
|
|||
long i, val;
|
||||
|
||||
i = NUM2LONG(y);
|
||||
if (i < sizeof(long) * 8) {
|
||||
val = RSHIFT(FIX2LONG(x), i);
|
||||
return INT2FIX(val);
|
||||
}
|
||||
|
||||
return INT2FIX(0);
|
||||
if (i < 0)
|
||||
return fix_lshift(x, INT2FIX(-i));
|
||||
val = RSHIFT(FIX2LONG(x), i);
|
||||
return INT2FIX(val);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
|
|||
11
random.c
11
random.c
|
|
@ -126,13 +126,12 @@ rb_f_rand(obj, vmax)
|
|||
long val, max;
|
||||
|
||||
switch (TYPE(vmax)) {
|
||||
case T_BIGNUM:
|
||||
return rb_big_rand(vmax);
|
||||
|
||||
case T_FLOAT:
|
||||
if (RFLOAT(vmax)->value > LONG_MAX || RFLOAT(vmax)->value < LONG_MIN)
|
||||
return rb_big_rand(rb_dbl2big(RFLOAT(vmax)->value));
|
||||
break;
|
||||
if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN)
|
||||
break;
|
||||
/* fall through */
|
||||
case T_BIGNUM:
|
||||
return rb_big_rand(vmax, RANDOM_NUMBER);
|
||||
}
|
||||
|
||||
max = NUM2LONG(vmax);
|
||||
|
|
|
|||
|
|
@ -147,12 +147,13 @@ rb_f_sprintf(argc, argv)
|
|||
char *buf, *p, *end;
|
||||
int blen, bsiz;
|
||||
VALUE result;
|
||||
|
||||
int width, prec, flags = FNONE;
|
||||
int tainted = 0;
|
||||
VALUE tmp;
|
||||
VALUE str;
|
||||
|
||||
fmt = GETARG();
|
||||
if (OBJ_TAINTED(fmt)) tainted = 1;
|
||||
p = str2cstr(fmt, &blen);
|
||||
end = p + blen;
|
||||
blen = 0;
|
||||
|
|
@ -172,6 +173,7 @@ rb_f_sprintf(argc, argv)
|
|||
p = t + 1; /* skip `%' */
|
||||
|
||||
width = prec = -1;
|
||||
|
||||
retry:
|
||||
switch (*p) {
|
||||
default:
|
||||
|
|
@ -290,6 +292,7 @@ rb_f_sprintf(argc, argv)
|
|||
int len;
|
||||
|
||||
str = rb_obj_as_string(arg);
|
||||
if (OBJ_TAINTED(str)) tainted = 1;
|
||||
len = RSTRING(str)->len;
|
||||
if (flags&FPREC) {
|
||||
if (prec < len) {
|
||||
|
|
@ -618,6 +621,7 @@ rb_f_sprintf(argc, argv)
|
|||
result = rb_str_new(buf, blen);
|
||||
free(buf);
|
||||
|
||||
if (tainted) OBJ_TAINT(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.4.3"
|
||||
#define RUBY_RELEASE_DATE "1999-12-02"
|
||||
#define RUBY_RELEASE_DATE "1999-12-06"
|
||||
#define RUBY_VERSION_CODE 143
|
||||
#define RUBY_RELEASE_CODE 19991202
|
||||
#define RUBY_RELEASE_CODE 19991206
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue