* 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-09 16:06:54 +00:00
Родитель 1a9887acc0
Коммит 817a623d13
3 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Wed Sep 10 01:05:00 2008 Tanaka Akira <akr@fsij.org>
* 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 <akr@fsij.org>
* include/ruby/io.h (rb_io_t): rename field: writeconv_stateless to

Просмотреть файл

@ -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 */
@ -129,4 +129,3 @@ Init_newline(void)
rb_register_transcoder(&rb_crlf_newline);
rb_register_transcoder(&rb_cr_newline);
}

Просмотреть файл

@ -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;
@ -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;
@ -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;
}