summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-07-29 09:50:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-07-29 09:50:58 +0000
commit2562004338bc2694a7d8da75f4effcb9aa889641 (patch)
tree0af9582deace7d436b411552640555f90d7cd9fa /string.c
parent3b0fec9a5f966fd7ae26bc7b84877fa7209d8605 (diff)
sync ev
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index 7f5bf6ae729..24361717776 100644
--- a/string.c
+++ b/string.c
@@ -851,6 +851,9 @@ str_replace(str, beg, len, val)
RSTRING(str)->ptr+beg+len,
RSTRING(str)->len-(beg+len));
}
+ if (RSTRING(str)->len < beg && len < 0) {
+ MEMZERO(RSTRING(str)->ptr+RSTRING(str)->len, char, -len);
+ }
memcpy(RSTRING(str)->ptr+beg, RSTRING(val)->ptr, RSTRING(val)->len);
RSTRING(str)->len += RSTRING(val)->len - len;
RSTRING(str)->ptr[RSTRING(str)->len] = '\0';
@@ -1407,7 +1410,7 @@ str_inspect(str)
*b++ = c;
*b++ = *p++;
}
- else if (c & 0x80) {
+ else if ((c & 0x80) && current_mbctype != MBCTYPE_EUC) {
CHECK(1);
*b++ = c;
}