ruby-changes:21144
From: nobu <ko1@a...>
Date: Mon, 5 Sep 2011 18:11:52 +0900 (JST)
Subject: [ruby-changes:21144] nobu:r33193 (trunk): * transcode.c (rb_econv_binmode): newline decorators are
nobu 2011-09-05 18:10:58 +0900 (Mon, 05 Sep 2011) New Revision: 33193 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33193 Log: * transcode.c (rb_econv_binmode): newline decorators are exclusive. Modified files: trunk/ChangeLog trunk/transcode.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33192) +++ ChangeLog (revision 33193) @@ -1,3 +1,8 @@ +Mon Sep 5 18:10:56 2011 Nobuyoshi Nakada <nobu@r...> + + * transcode.c (rb_econv_binmode): newline decorators are + exclusive. + Mon Sep 5 15:03:37 2011 NARUSE, Yui <naruse@r...> * test/rubygems/test_gem_security.rb Index: transcode.c =================================================================== --- transcode.c (revision 33192) +++ transcode.c (revision 33193) @@ -1935,23 +1935,25 @@ int n, i, j; transcoder_entry_t *entry; int num_trans; + const char *dname = 0; n = 0; - if (ec->flags & ECONV_UNIVERSAL_NEWLINE_DECORATOR) { - entry = get_transcoder_entry("", "universal_newline"); - if (entry->transcoder) - trs[n++] = entry->transcoder; + switch (ec->flags & ECONV_NEWLINE_DECORATOR_MASK) { + case ECONV_UNIVERSAL_NEWLINE_DECORATOR: + dname = "universal_newline"; + break; + case ECONV_CRLF_NEWLINE_DECORATOR: + dname = "crlf_newline"; + break; + case ECONV_CR_NEWLINE_DECORATOR: + dname = "cr_newline"; + break; } - if (ec->flags & ECONV_CRLF_NEWLINE_DECORATOR) { - entry = get_transcoder_entry("", "crlf_newline"); + if (dname) { + entry = get_transcoder_entry("", dname); if (entry->transcoder) trs[n++] = entry->transcoder; } - if (ec->flags & ECONV_CR_NEWLINE_DECORATOR) { - entry = get_transcoder_entry("", "cr_newline"); - if (entry->transcoder) - trs[n++] = entry->transcoder; - } num_trans = ec->num_trans; j = 0; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/