* io.c (io_encoding_set): should honor already set ecflags since it
might be set by mode option. fixed #4804 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
10c0604a34
commit
fcc86b0f4c
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jun 1 01:15:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (io_encoding_set): should honor already set ecflags since it
|
||||||
|
might be set by mode option. fixed #4804
|
||||||
|
|
||||||
Wed Jun 1 00:34:04 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
Wed Jun 1 00:34:04 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): remove unused
|
* ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): remove unused
|
||||||
|
8
io.c
8
io.c
@ -7959,7 +7959,7 @@ static void
|
|||||||
io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
|
io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
|
||||||
{
|
{
|
||||||
rb_encoding *enc, *enc2;
|
rb_encoding *enc, *enc2;
|
||||||
int ecflags;
|
int ecflags = fptr->encs.ecflags;
|
||||||
VALUE ecopts, tmp;
|
VALUE ecopts, tmp;
|
||||||
|
|
||||||
if (!NIL_P(v2)) {
|
if (!NIL_P(v2)) {
|
||||||
@ -7980,24 +7980,22 @@ io_encoding_set(rb_io_t *fptr, VALUE v1, VALUE v2, VALUE opt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
enc = rb_to_encoding(v2);
|
enc = rb_to_encoding(v2);
|
||||||
ecflags = rb_econv_prepare_opts(opt, &ecopts);
|
ecflags = rb_econv_prepare_options(opt, &ecopts, ecflags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (NIL_P(v1)) {
|
if (NIL_P(v1)) {
|
||||||
/* Set to default encodings */
|
/* Set to default encodings */
|
||||||
rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2);
|
rb_io_ext_int_to_encs(NULL, NULL, &enc, &enc2);
|
||||||
ecflags = 0;
|
|
||||||
ecopts = Qnil;
|
ecopts = Qnil;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tmp = rb_check_string_type(v1);
|
tmp = rb_check_string_type(v1);
|
||||||
if (!NIL_P(tmp) && rb_enc_asciicompat(rb_enc_get(tmp))) {
|
if (!NIL_P(tmp) && rb_enc_asciicompat(rb_enc_get(tmp))) {
|
||||||
parse_mode_enc(RSTRING_PTR(tmp), &enc, &enc2, NULL);
|
parse_mode_enc(RSTRING_PTR(tmp), &enc, &enc2, NULL);
|
||||||
ecflags = rb_econv_prepare_opts(opt, &ecopts);
|
ecflags = rb_econv_prepare_options(opt, &ecopts, ecflags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_io_ext_int_to_encs(rb_to_encoding(v1), NULL, &enc, &enc2);
|
rb_io_ext_int_to_encs(rb_to_encoding(v1), NULL, &enc, &enc2);
|
||||||
ecflags = 0;
|
|
||||||
ecopts = Qnil;
|
ecopts = Qnil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user