mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (rb_file_join): check encoding compatibility before joining
strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0667541894
commit
3432474c90
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 13 14:02:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* file.c (rb_file_join): check encoding compatibility before joining
|
||||
strings.
|
||||
|
||||
Thu Dec 13 13:06:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* proc.c (umethod_bind): allow another form of method transplanting
|
||||
|
|
5
file.c
5
file.c
|
@ -3940,6 +3940,7 @@ rb_file_join(VALUE ary, VALUE sep)
|
|||
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)
|
|||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue