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

* string.c (rb_enc_cr_str_buf_cat): fix self appending.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-01-09 08:00:26 +00:00
parent d036633dcb
commit 8786b8a282
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Wed Jan 9 16:59:54 2008 Tanaka Akira <akr@fsij.org>
* string.c (rb_enc_cr_str_buf_cat): fix self appending.
Wed Jan 9 15:54:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby.c (process_options): give priority command line encoding option

View file

@ -1132,9 +1132,6 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
off = ptr - RSTRING_PTR(str);
}
rb_str_modify(str);
if (off != -1) {
ptr = RSTRING_PTR(str) + off;
}
if (len == 0) {
ENCODING_CODERANGE_SET(str, res_encindex, res_cr);
return str;
@ -1156,6 +1153,9 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
}
RESIZE_CAPA(str, capa);
}
if (off != -1) {
ptr = RSTRING_PTR(str) + off;
}
memcpy(RSTRING_PTR(str) + RSTRING_LEN(str), ptr, len);
STR_SET_LEN(str, total);
RSTRING_PTR(str)[total] = '\0'; // sentinel