Skip to content

Commit

Permalink
* transcode.c (rb_econv_binmode): newline decorators are
Browse files Browse the repository at this point in the history
  exclusive.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Sep 5, 2011
1 parent 179cf47 commit bc17dba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Mon Sep 5 18:10:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>

* transcode.c (rb_econv_binmode): newline decorators are
exclusive.

Mon Sep 5 15:03:37 2011 NARUSE, Yui <naruse@ruby-lang.org>

* test/rubygems/test_gem_security.rb
Expand Down
24 changes: 13 additions & 11 deletions transcode.c
Expand Up @@ -1935,20 +1935,22 @@ rb_econv_binmode(rb_econv_t *ec)
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;
}
if (ec->flags & ECONV_CRLF_NEWLINE_DECORATOR) {
entry = get_transcoder_entry("", "crlf_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_CR_NEWLINE_DECORATOR) {
entry = get_transcoder_entry("", "cr_newline");
if (dname) {
entry = get_transcoder_entry("", dname);
if (entry->transcoder)
trs[n++] = entry->transcoder;
}
Expand Down

0 comments on commit bc17dba

Please sign in to comment.