Skip to content

Commit

Permalink
* enc/trans/newline.trans (rb_universal_newline): swap src_encoding
Browse files Browse the repository at this point in the history
  and dst_encoding.

* transcode.c (rb_econv_decorate_at): call get_transcoder_entry only
  once.
  (rb_econv_binmode): follow universal_newline change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Sep 9, 2008
1 parent 1a9887a commit 817a623
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Wed Sep 10 01:05:00 2008 Tanaka Akira <[email protected]>

* enc/trans/newline.trans (rb_universal_newline): swap src_encoding
and dst_encoding.

* transcode.c (rb_econv_decorate_at): call get_transcoder_entry only
once.
(rb_econv_binmode): follow universal_newline change.

Wed Sep 10 00:01:36 2008 Tanaka Akira <[email protected]>

* include/ruby/io.h (rb_io_t): rename field: writeconv_stateless to
Expand Down
3 changes: 1 addition & 2 deletions enc/trans/newline.trans
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ universal_newline_finish(void *statep, unsigned char *o)

static const rb_transcoder
rb_universal_newline = {
"universal_newline", "", universal_newline,
"", "universal_newline", universal_newline,
TRANSCODE_TABLE_INFO,
1, /* input_unit_length */
1, /* max_input */
Expand Down Expand Up @@ -129,4 +129,3 @@ Init_newline(void)
rb_register_transcoder(&rb_crlf_newline);
rb_register_transcoder(&rb_cr_newline);
}

6 changes: 2 additions & 4 deletions transcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ struct rb_econv_t {
* Dispatch data and logic
*/

#define SUPPLEMENTAL_CONVERSION(sname, dname) (*(sname) == '\0' || *(dname) == '\0')
#define SUPPLEMENTAL_CONVERSION(sname, dname) (*(sname) == '\0')

typedef struct {
const char *sname;
Expand Down Expand Up @@ -1761,8 +1761,6 @@ rb_econv_decorate_at(rb_econv_t *ec, const char *decorator_name, int n)
return -1;

entry = get_transcoder_entry("", decorator_name);
if (!entry)
entry = get_transcoder_entry(decorator_name, "");
if (!entry)
return -1;

Expand Down Expand Up @@ -1833,7 +1831,7 @@ rb_econv_binmode(rb_econv_t *ec)

n = 0;
if (ec->flags & ECONV_UNIVERSAL_NEWLINE_DECORATOR) {
entry = get_transcoder_entry("universal_newline", "");
entry = get_transcoder_entry("", "universal_newline");
if (entry->transcoder)
trs[n++] = entry->transcoder;
}
Expand Down

0 comments on commit 817a623

Please sign in to comment.