encoding.c: new termlen not oldtermlen

* encoding.c (rb_enc_associate_index): fill new terminator length, not
  old one.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-07-13 03:27:37 +00:00
parent 771d31ace2
commit 1ae7e6b654
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Sat Jul 13 12:27:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (rb_enc_associate_index): fill new terminator length, not
old one.
Sat Jul 13 12:24:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/win32: move from ext/dl and ext/fiddle. since ext/extmk.rb

View File

@ -795,7 +795,7 @@ rb_enc_associate_index(VALUE obj, int idx)
termlen = rb_enc_mbminlen(enc);
oldtermlen = rb_enc_mbminlen(rb_enc_from_index(oldidx));
if (oldtermlen < termlen && RB_TYPE_P(obj, T_STRING)) {
rb_str_fill_terminator(obj, oldtermlen);
rb_str_fill_terminator(obj, termlen);
}
enc_set_index(obj, idx);
return obj;