ruby-changes:7169
From: akr <ko1@a...>
Date: Mon, 18 Aug 2008 16:55:19 +0900 (JST)
Subject: [ruby-changes:7169] Ruby:r18688 (trunk): * io.c (mode_enc): modify enc and enc2 consistently.
akr 2008-08-18 16:55:04 +0900 (Mon, 18 Aug 2008) New Revision: 18688 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18688 Log: * io.c (mode_enc): modify enc and enc2 consistently. (io_set_encoding): ditto. (io_encoding_set): ditto. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 18687) +++ ChangeLog (revision 18688) @@ -1,3 +1,9 @@ +Mon Aug 18 16:54:06 2008 Tanaka Akira <akr@f...> + + * io.c (mode_enc): modify enc and enc2 consistently. + (io_set_encoding): ditto. + (io_encoding_set): ditto. + Mon Aug 18 13:21:38 2008 Tanaka Akira <akr@f...> * transcode.c (transcode_search_path): prevent infinite loop by Index: io.c =================================================================== --- io.c (revision 18687) +++ io.c (revision 18688) @@ -3527,6 +3527,9 @@ /* parse estr as "enc" or "enc2:enc" */ + fptr->enc = 0; + fptr->enc2 = 0; + p0 = strrchr(estr, ':'); if (!p0) p1 = estr; else p1 = p0 + 1; @@ -3538,7 +3541,7 @@ rb_warn("Unsupported encoding %s ignored", p1); } - if (p0) { + if (fptr->enc && p0) { int n = p0 - estr; if (n > ENCODING_MAXNAMELEN) { idx2 = -1; @@ -4253,6 +4256,8 @@ if (!NIL_P(extenc)) { rb_encoding *extencoding = rb_to_encoding(extenc); GetOpenFile(io, fptr); + fptr->enc = 0; + fptr->enc2 = 0; if (!NIL_P(encoding)) { rb_warn("Ignoring encoding parameter '%s': external_encoding is used", RSTRING_PTR(encoding)); @@ -6330,6 +6335,7 @@ else if (argc == 1) { if (NIL_P(v1)) { fptr->enc = 0; + fptr->enc2 = 0; } else { VALUE tmp = rb_check_string_type(v1); @@ -6338,6 +6344,7 @@ } else { fptr->enc = rb_to_encoding(v1); + fptr->enc2 = 0; } } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/