зеркало из https://github.com/github/ruby.git
* encoding.c (rb_enc_set_default_internal): defines internal
encoding as nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
84b5d04bed
Коммит
31c163e4c8
|
@ -1,4 +1,7 @@
|
|||
Thu Dec 11 11:51:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Thu Dec 11 13:17:04 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* encoding.c (rb_enc_set_default_internal): defines internal
|
||||
encoding as nil.
|
||||
|
||||
* encoding.c (rb_locale_encoding): removed Encoding::LOCALE.
|
||||
|
||||
|
@ -6,6 +9,9 @@ Thu Dec 11 11:51:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
|
||||
* encoding.c (rb_enc_set_default_internal): ditto.
|
||||
|
||||
* encoding.c (rb_enc_set_default_internal): defines internal
|
||||
encoding as nil.
|
||||
|
||||
Thu Dec 11 11:11:03 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* include/ruby/st.h (size_t): needs stddef.h or stdlib.h.
|
||||
|
|
10
encoding.c
10
encoding.c
|
@ -38,6 +38,7 @@ static struct {
|
|||
void rb_enc_init(void);
|
||||
|
||||
#define ENCODING_COUNT ENCINDEX_BUILTIN_MAX
|
||||
#define UNSPECIFIED_ENCODING INT_MAX
|
||||
|
||||
#define enc_autoload_p(enc) (!rb_enc_mbmaxlen(enc))
|
||||
|
||||
|
@ -507,7 +508,12 @@ rb_enc_find_index(const char *name)
|
|||
if (i < 0) {
|
||||
i = load_encoding(name);
|
||||
}
|
||||
else if (enc_autoload_p(enc = rb_enc_from_index(i))) {
|
||||
else if (!(enc = rb_enc_from_index(i))) {
|
||||
if (i != UNSPECIFIED_ENCODING) {
|
||||
rb_raise(rb_eArgError, "encoding %s is not registered", name);
|
||||
}
|
||||
}
|
||||
else if (enc_autoload_p(enc)) {
|
||||
if (enc_autoload(enc) < 0) {
|
||||
rb_warn("failed to load encoding (%s); use ASCII-8BIT instead",
|
||||
name);
|
||||
|
@ -1111,6 +1117,8 @@ rb_enc_set_default_internal(VALUE encoding)
|
|||
if (NIL_P(encoding)) {
|
||||
default_internal_index = -1;
|
||||
default_internal = 0;
|
||||
st_insert(enc_table.names, (st_data_t)strdup("internal"),
|
||||
(st_data_t)UNSPECIFIED_ENCODING);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче