ruby-changes:26304
From: usa <ko1@a...>
Date: Thu, 13 Dec 2012 14:03:14 +0900 (JST)
Subject: [ruby-changes:26304] usa:r38355 (trunk): * file.c (rb_file_join): check encoding compatibility before joining
usa 2012-12-13 14:02:55 +0900 (Thu, 13 Dec 2012) New Revision: 38355 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38355 Log: * file.c (rb_file_join): check encoding compatibility before joining strings. Modified files: trunk/ChangeLog trunk/file.c Index: ChangeLog =================================================================== --- ChangeLog (revision 38354) +++ ChangeLog (revision 38355) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Dec 13 14:02:15 2012 NAKAMURA Usaku <usa@r...> + + * file.c (rb_file_join): check encoding compatibility before joining + strings. + Thu Dec 13 13:06:27 2012 Nobuyoshi Nakada <nobu@r...> * proc.c (umethod_bind): allow another form of method transplanting Index: file.c =================================================================== --- file.c (revision 38354) +++ file.c (revision 38355) @@ -3940,6 +3940,7 @@ rb_file_join(VALUE ary, VALUE sep) https://github.com/ruby/ruby/blob/trunk/file.c#L3940 VALUE result, tmp; const char *name, *tail; int checked = TRUE; + rb_encoding *enc; if (RARRAY_LEN(ary) == 0) return rb_str_new(0, 0); @@ -3994,10 +3995,14 @@ rb_file_join(VALUE ary, VALUE sep) https://github.com/ruby/ruby/blob/trunk/file.c#L3995 rb_str_set_len(result, tail - name); } else if (!*tail) { + enc = rb_enc_check(result, sep); rb_str_buf_append(result, sep); + rb_enc_associate(result, enc); } } + enc = rb_enc_check(result, tmp); rb_str_buf_append(result, tmp); + rb_enc_associate(result, enc); } RBASIC(result)->klass = rb_cString; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/