diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-21 11:09:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-21 11:09:19 +0000 |
commit | 977eea57a3e9a3513c60a9dae48092db4c1a6f2e (patch) | |
tree | ec65db6c4532dc662470893af3a9f139f42a4688 /string.c | |
parent | 5f2e5c07a7d03641c038a484c7913d7ae4d66e6c (diff) | |
download | ruby-977eea57a3e9a3513c60a9dae48092db4c1a6f2e.tar.gz |
* string.c (rb_str_succ): retry increasing until valid char is found.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1872,9 +1872,9 @@ rb_str_succ(VALUE orig) c = '\001'; s = e; while ((s = rb_enc_prev_char(sbeg, s, enc)) != 0) { + int limit = 256; if (cc == 0) cc = rb_enc_codepoint(s, e, enc); - cc += 1; - l = rb_enc_mbcput(cc, carry, enc); + while ((l = rb_enc_mbcput(++cc, carry, enc)) < 0 && --limit); if (l > 0) { if (l == (o = e - s)) goto overlay; n = s - sbeg; @@ -4538,7 +4538,7 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str) if (p[len-1] == newline && (rslen <= 1 || memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) { - if (ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,p,pp) != (const UChar*)pp) + if (ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc, (UChar *)p, (UChar *)pp) != (const UChar*)pp) return Qnil; rb_str_modify(str); STR_SET_LEN(str, RSTRING_LEN(str) - rslen); |