1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (rb_enc_associate_index): cannot set encoding on

special constants.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-08-06 07:36:29 +00:00
parent a2393c3e53
commit a809077956
2 changed files with 7 additions and 1 deletions

View file

@ -1,4 +1,4 @@
Thu Aug 6 16:26:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
Thu Aug 6 16:36:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (valid_encoding_name_p): rejects too long encoding
names.
@ -8,6 +8,9 @@ Thu Aug 6 16:26:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_capable, rb_enc_get_index): Symbol is encoding
capable.
* encoding.c (rb_enc_associate_index): cannot set encoding on
special constants.
Thu Aug 6 15:44:04 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_method.c (rb_method_entry_eq): deals with optimized method

View file

@ -640,6 +640,9 @@ rb_enc_associate_index(VALUE obj, int idx)
/* enc_check_capable(obj);*/
if (rb_enc_get_index(obj) == idx)
return obj;
if (SPECIAL_CONST_P(obj)) {
rb_raise(rb_eArgError, "cannot set encoding");
}
if (!ENC_CODERANGE_ASCIIONLY(obj) ||
!rb_enc_asciicompat(rb_enc_from_index(idx))) {
ENC_CODERANGE_CLEAR(obj);