зеркало из https://github.com/github/ruby.git
* io.c (make_writeconv): use rb_enc_name.
(make_readconv): ditto. * transcode.c (rb_econv_open_opts): ditto. (econv_args): ditto. (decorate_convpath): ditto. (econv_set_replacement): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
158284ac24
Коммит
8d7e774f5f
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sat Sep 13 18:05:37 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c (make_writeconv): use rb_enc_name.
|
||||
(make_readconv): ditto.
|
||||
|
||||
* transcode.c (rb_econv_open_opts): ditto.
|
||||
(econv_args): ditto.
|
||||
(decorate_convpath): ditto.
|
||||
(econv_set_replacement): ditto.
|
||||
|
||||
Sat Sep 13 11:15:38 2008 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* lib/rexml/document.rb: fixed typo.
|
||||
|
|
10
io.c
10
io.c
|
@ -713,7 +713,7 @@ make_writeconv(rb_io_t *fptr)
|
|||
}
|
||||
else {
|
||||
enc = fptr->encs.enc2 ? fptr->encs.enc2 : fptr->encs.enc;
|
||||
senc = rb_econv_asciicompat_encoding(enc->name);
|
||||
senc = rb_econv_asciicompat_encoding(rb_enc_name(enc));
|
||||
if (!senc && !(fptr->encs.ecflags & ECONV_STATEFUL_DECORATOR_MASK)) {
|
||||
/* single conversion */
|
||||
fptr->writeconv_pre_ecflags = ecflags;
|
||||
|
@ -726,12 +726,12 @@ make_writeconv(rb_io_t *fptr)
|
|||
fptr->writeconv_pre_ecflags = ecflags & ~ECONV_STATEFUL_DECORATOR_MASK;
|
||||
fptr->writeconv_pre_ecopts = ecopts;
|
||||
if (senc) {
|
||||
denc = enc->name;
|
||||
denc = rb_enc_name(enc);
|
||||
fptr->writeconv_asciicompat = rb_str_new2(senc);
|
||||
}
|
||||
else {
|
||||
senc = denc = "";
|
||||
fptr->writeconv_asciicompat = rb_str_new2(enc->name);
|
||||
fptr->writeconv_asciicompat = rb_str_new2(rb_enc_name(enc));
|
||||
}
|
||||
ecflags = fptr->encs.ecflags & (ECONV_ERROR_HANDLER_MASK|ECONV_STATEFUL_DECORATOR_MASK);
|
||||
ecopts = fptr->encs.ecopts;
|
||||
|
@ -1469,8 +1469,8 @@ make_readconv(rb_io_t *fptr)
|
|||
if (NEED_NEWLINE_DECORATOR_ON_READ(fptr))
|
||||
ecflags |= ECONV_UNIVERSAL_NEWLINE_DECORATOR;
|
||||
if (fptr->encs.enc2) {
|
||||
sname = fptr->encs.enc2->name;
|
||||
dname = fptr->encs.enc->name;
|
||||
sname = rb_enc_name(fptr->encs.enc2);
|
||||
dname = rb_enc_name(fptr->encs.enc);
|
||||
}
|
||||
else {
|
||||
sname = dname = "";
|
||||
|
|
12
transcode.c
12
transcode.c
|
@ -2358,7 +2358,7 @@ rb_econv_open_opts(const char *source_encoding, const char *destination_encoding
|
|||
ret = rb_econv_set_replacement(ec,
|
||||
(const unsigned char *)RSTRING_PTR(replacement),
|
||||
RSTRING_LEN(replacement),
|
||||
enc->name);
|
||||
rb_enc_name(enc));
|
||||
if (ret == -1) {
|
||||
rb_econv_close(ec);
|
||||
return NULL;
|
||||
|
@ -2706,8 +2706,8 @@ econv_args(int argc, VALUE *argv,
|
|||
StringValue(*dnamev_p);
|
||||
}
|
||||
|
||||
sname = senc ? senc->name : StringValueCStr(*snamev_p);
|
||||
dname = denc ? denc->name : StringValueCStr(*dnamev_p);
|
||||
sname = senc ? rb_enc_name(senc) : StringValueCStr(*snamev_p);
|
||||
dname = denc ? rb_enc_name(denc) : StringValueCStr(*dnamev_p);
|
||||
|
||||
*sname_p = sname;
|
||||
*dname_p = dname;
|
||||
|
@ -2732,8 +2732,8 @@ decorate_convpath(VALUE convpath, int ecflags)
|
|||
len = n = RARRAY_LEN(convpath);
|
||||
if (n != 0) {
|
||||
VALUE pair = RARRAY_PTR(convpath)[n-1];
|
||||
const char *sname = rb_to_encoding(RARRAY_PTR(pair)[0])->name;
|
||||
const char *dname = rb_to_encoding(RARRAY_PTR(pair)[1])->name;
|
||||
const char *sname = rb_enc_name(rb_to_encoding(RARRAY_PTR(pair)[0]));
|
||||
const char *dname = rb_enc_name(rb_to_encoding(RARRAY_PTR(pair)[1]));
|
||||
transcoder_entry_t *entry = get_transcoder_entry(sname, dname);
|
||||
const rb_transcoder *tr = load_transcoder_entry(entry);
|
||||
if (!tr)
|
||||
|
@ -3736,7 +3736,7 @@ econv_set_replacement(VALUE self, VALUE arg)
|
|||
ret = rb_econv_set_replacement(ec,
|
||||
(const unsigned char *)RSTRING_PTR(string),
|
||||
RSTRING_LEN(string),
|
||||
enc->name);
|
||||
rb_enc_name(enc));
|
||||
|
||||
if (ret == -1) {
|
||||
/* xxx: rb_eInvalidByteSequence? */
|
||||
|
|
Загрузка…
Ссылка в новой задаче