diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-23 02:03:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-23 02:03:43 +0000 |
commit | 2c14872b9f32a6ed06aaf1711c92a70cb19aa3e0 (patch) | |
tree | 3534dd852ccc9e5651a55a3b7c41c3d5f640f827 /ext | |
parent | 3ec18aa23a9e6e94f53e8c4540342d1fe83896b0 (diff) | |
download | ruby-2c14872b9f32a6ed06aaf1711c92a70cb19aa3e0.tar.gz |
stringio.c: use rb_str_append other than ASCII-8BIT
* ext/stringio/stringio.c (strio_write): use rb_str_append to
reuse coderange bits other than ASCII-8BIT, and keep
taintedness. [ruby-dev:48118] [Bug #9769]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/stringio/stringio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index f44bdc602f..2964adab40 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -1185,7 +1185,13 @@ strio_write(VALUE self, VALUE str) ptr->pos = olen; } if (ptr->pos == olen) { - rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc); + if (enc2 == rb_ascii8bit_encoding()) { + rb_enc_str_buf_cat(ptr->string, RSTRING_PTR(str), len, enc); + OBJ_INFECT(ptr->string, str); + } + else { + rb_str_buf_append(ptr->string, str); + } } else { strio_extend(ptr, ptr->pos, len); |