From 2562004338bc2694a7d8da75f4effcb9aa889641 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 29 Jul 1998 09:50:58 +0000 Subject: sync ev git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 7f5bf6ae72..2436171777 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; } -- cgit v1.2.3