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

* 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
This commit is contained in:
nobu 2007-12-21 11:09:19 +00:00
parent 5f2e5c07a7
commit 977eea57a3
2 changed files with 7 additions and 3 deletions

View file

@ -1,3 +1,7 @@
Fri Dec 21 20:09:18 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_succ): retry increasing until valid char is found.
Fri Dec 21 20:00:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Dec 21 20:00:02 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (rb_enc_replicate): now creates first class encoding. * encoding.c (rb_enc_replicate): now creates first class encoding.

View file

@ -1872,9 +1872,9 @@ rb_str_succ(VALUE orig)
c = '\001'; c = '\001';
s = e; s = e;
while ((s = rb_enc_prev_char(sbeg, s, enc)) != 0) { while ((s = rb_enc_prev_char(sbeg, s, enc)) != 0) {
int limit = 256;
if (cc == 0) cc = rb_enc_codepoint(s, e, enc); if (cc == 0) cc = rb_enc_codepoint(s, e, enc);
cc += 1; while ((l = rb_enc_mbcput(++cc, carry, enc)) < 0 && --limit);
l = rb_enc_mbcput(cc, carry, enc);
if (l > 0) { if (l > 0) {
if (l == (o = e - s)) goto overlay; if (l == (o = e - s)) goto overlay;
n = s - sbeg; n = s - sbeg;
@ -4538,7 +4538,7 @@ rb_str_chomp_bang(int argc, VALUE *argv, VALUE str)
if (p[len-1] == newline && if (p[len-1] == newline &&
(rslen <= 1 || (rslen <= 1 ||
memcmp(RSTRING_PTR(rs), pp, rslen) == 0)) { 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; return Qnil;
rb_str_modify(str); rb_str_modify(str);
STR_SET_LEN(str, RSTRING_LEN(str) - rslen); STR_SET_LEN(str, RSTRING_LEN(str) - rslen);