summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-05 09:10:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-05 09:10:58 +0000
commitbc17dba00f667520e8af3b1bd72ff59882f81751 (patch)
tree50e10ef53935d3a8e5b9fd1312ced3f151835a41 /transcode.c
parent179cf473c203826e65d401cfdf17d56133ed0164 (diff)
* transcode.c (rb_econv_binmode): newline decorators are
exclusive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/transcode.c b/transcode.c
index 5f7f856a33..2c188b67f7 100644
--- a/transcode.c
+++ b/transcode.c
@@ -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;
}