* io.c (open_key_args): should adjust argc, argv in struct
foreach_arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
42a6550027
commit
c5377c2bcc
@ -1,3 +1,8 @@
|
|||||||
|
Tue Oct 21 22:38:58 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (open_key_args): should adjust argc, argv in struct
|
||||||
|
foreach_arg.
|
||||||
|
|
||||||
Tue Oct 21 21:52:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Oct 21 21:52:00 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* ext/zlib/zlib.c (rb_gzwriter_write): conversion should be done
|
* ext/zlib/zlib.c (rb_gzwriter_write): conversion should be done
|
||||||
|
2
hash.c
2
hash.c
@ -79,7 +79,7 @@ rb_any_hash(VALUE a)
|
|||||||
default:
|
default:
|
||||||
hval = rb_funcall(a, id_hash, 0);
|
hval = rb_funcall(a, id_hash, 0);
|
||||||
if (!FIXNUM_P(hval)) {
|
if (!FIXNUM_P(hval)) {
|
||||||
hval = rb_funcall(hval, '%', 1, INT2FIX(536870923));
|
hval = rb_funcall(hval, '%', 1, INT2FIX(5368709231));
|
||||||
}
|
}
|
||||||
hnum = (int)FIX2LONG(hval);
|
hnum = (int)FIX2LONG(hval);
|
||||||
}
|
}
|
||||||
|
16
io.c
16
io.c
@ -4597,12 +4597,12 @@ pipe_open_s(VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
pop_last_hash(int *argc_p, VALUE **argv_p)
|
pop_last_hash(int *argc_p, VALUE *argv)
|
||||||
{
|
{
|
||||||
VALUE last, tmp;
|
VALUE last, tmp;
|
||||||
if (*argc_p == 0)
|
if (*argc_p == 0)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
last = (*argv_p)[*argc_p-1];
|
last = argv[*argc_p-1];
|
||||||
tmp = rb_check_convert_type(last, T_HASH, "Hash", "to_hash");
|
tmp = rb_check_convert_type(last, T_HASH, "Hash", "to_hash");
|
||||||
if (NIL_P(tmp))
|
if (NIL_P(tmp))
|
||||||
return Qnil;
|
return Qnil;
|
||||||
@ -4673,7 +4673,7 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
|
|||||||
int oflags, fmode;
|
int oflags, fmode;
|
||||||
convconfig_t convconfig;
|
convconfig_t convconfig;
|
||||||
|
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&argc, argv);
|
||||||
rb_scan_args(argc, argv, "11", &pname, &pmode);
|
rb_scan_args(argc, argv, "11", &pname, &pmode);
|
||||||
|
|
||||||
rb_io_extract_modeenc(&pmode, 0, opt, &oflags, &fmode, &convconfig);
|
rb_io_extract_modeenc(&pmode, 0, opt, &oflags, &fmode, &convconfig);
|
||||||
@ -4716,7 +4716,7 @@ rb_scan_open_args(int argc, VALUE *argv,
|
|||||||
int oflags, fmode;
|
int oflags, fmode;
|
||||||
mode_t perm;
|
mode_t perm;
|
||||||
|
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&argc, argv);
|
||||||
rb_scan_args(argc, argv, "12", &fname, &vmode, &vperm);
|
rb_scan_args(argc, argv, "12", &fname, &vmode, &vperm);
|
||||||
FilePathValue(fname);
|
FilePathValue(fname);
|
||||||
#if defined _WIN32 || defined __APPLE__
|
#if defined _WIN32 || defined __APPLE__
|
||||||
@ -5688,7 +5688,7 @@ rb_io_initialize(int argc, VALUE *argv, VALUE io)
|
|||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
|
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&argc, argv);
|
||||||
rb_scan_args(argc, argv, "11", &fnum, &vmode);
|
rb_scan_args(argc, argv, "11", &fnum, &vmode);
|
||||||
rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &fmode, &convconfig);
|
rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &fmode, &convconfig);
|
||||||
|
|
||||||
@ -6828,7 +6828,7 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
|
|||||||
VALUE opt;
|
VALUE opt;
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
|
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&argc, argv);
|
||||||
rb_scan_args(argc, argv, "02", &v1, &v2);
|
rb_scan_args(argc, argv, "02", &v1, &v2);
|
||||||
if (rb_pipe(pipes) == -1)
|
if (rb_pipe(pipes) == -1)
|
||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
@ -6877,7 +6877,7 @@ open_key_args(int argc, VALUE *argv, struct foreach_arg *arg)
|
|||||||
arg->io = rb_io_open(argv[0], INT2NUM(O_RDONLY), INT2FIX(0666), Qnil);
|
arg->io = rb_io_open(argv[0], INT2NUM(O_RDONLY), INT2FIX(0666), Qnil);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&arg->argc, arg->argv);
|
||||||
if (NIL_P(opt)) goto no_key;
|
if (NIL_P(opt)) goto no_key;
|
||||||
|
|
||||||
v = rb_hash_aref(opt, sym_open_args);
|
v = rb_hash_aref(opt, sym_open_args);
|
||||||
@ -7684,7 +7684,7 @@ rb_io_set_encoding(int argc, VALUE *argv, VALUE io)
|
|||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
VALUE v1, v2, opt;
|
VALUE v1, v2, opt;
|
||||||
|
|
||||||
opt = pop_last_hash(&argc, &argv);
|
opt = pop_last_hash(&argc, argv);
|
||||||
rb_scan_args(argc, argv, "11", &v1, &v2);
|
rb_scan_args(argc, argv, "11", &v1, &v2);
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
io_encoding_set(fptr, v1, v2, opt);
|
io_encoding_set(fptr, v1, v2, opt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user