diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 18:08:08 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 18:08:08 +0000 |
commit | aa8923aee36bf21b2262cdca931cff4a4fd5c3da (patch) | |
tree | 3d1203725d436dce09014fb19c3af2c70f40148b | |
parent | 5e63f15c92880819273f01d26cad236e1bb9c948 (diff) | |
download | ruby-aa8923aee36bf21b2262cdca931cff4a4fd5c3da.tar.gz ruby-aa8923aee36bf21b2262cdca931cff4a4fd5c3da.tar.xz ruby-aa8923aee36bf21b2262cdca931cff4a4fd5c3da.zip |
* io.c (make_writeconv): copy invalid/undef flags.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | io.c | 17 |
2 files changed, 12 insertions, 9 deletions
@@ -1,3 +1,7 @@ +Tue Aug 26 03:06:48 2008 Tanaka Akira <akr@fsij.org> + + * io.c (make_writeconv): copy invalid/undef flags. + Tue Aug 26 02:47:08 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp> * common.mk (dist): tool/make-snapshot is executable. @@ -696,21 +696,24 @@ make_writeconv(rb_io_t *fptr) fptr->writeconv_initialized = 1; - rb_econv_opts(Qnil, &fptr->writeconv_pre_opts); - + /* ECONV_INVALID_XXX and ECONV_UNDEF_XXX should be set both. + * But ECONV_CRLF_NEWLINE_ENCODER should be set only for the first. */ + fptr->writeconv_pre_opts = fptr->encs.opts; ecopts = fptr->encs.opts; #ifdef TEXTMODE_NEWLINE_ENCODER - if (NEED_NEWLINE_ENCODER(fptr)) - ecopts.flags |= TEXTMODE_NEWLINE_ENCODER; - if (!fptr->encs.enc) { + if (NEED_NEWLINE_ENCODER(fptr)) + ecopts.flags |= TEXTMODE_NEWLINE_ENCODER; fptr->writeconv = rb_econv_open("", "", &ecopts); if (!fptr->writeconv) rb_exc_raise(rb_econv_open_exc("", "", &ecopts)); fptr->writeconv_stateless = Qnil; return; } + + if (NEED_NEWLINE_ENCODER(fptr)) + fptr->writeconv_pre_opts.flags |= TEXTMODE_NEWLINE_ENCODER; #endif enc = fptr->encs.enc2 ? fptr->encs.enc2 : fptr->encs.enc; @@ -726,10 +729,6 @@ make_writeconv(rb_io_t *fptr) denc = NULL; fptr->writeconv_stateless = Qnil; fptr->writeconv = NULL; -#ifdef TEXTMODE_NEWLINE_ENCODER - if (NEED_NEWLINE_ENCODER(fptr)) - fptr->writeconv_pre_opts.flags |= TEXTMODE_NEWLINE_ENCODER; -#endif } } } |