* string.c (rb_str_coderange_scan_restartable): should not return

offset in the middle of a character.

* string.c (rb_str_coderange_scan_restartable): should not return
  invalid cr value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-03-01 01:02:30 +00:00
Родитель 18e70b266f
Коммит d5fec27d8e
2 изменённых файлов: 11 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sat Mar 1 10:01:30 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_coderange_scan_restartable): should not return
offset in the middle of a character.
* string.c (rb_str_coderange_scan_restartable): should not return
invalid cr value.
Sat Mar 1 09:36:08 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* sprintf.c (rb_str_format): "%#.0o" should keep prefix where

Просмотреть файл

@ -224,8 +224,8 @@ rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc
while (p < e) {
int ret = rb_enc_precise_mbclen(p, e, enc);
if (!MBCLEN_CHARFOUND_P(ret)) {
*cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ret;
return e - s;
*cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_UNKNOWN;
return p - s;
}
p += MBCLEN_CHARFOUND_LEN(ret);
if (p < e) {
@ -243,7 +243,7 @@ rb_str_coderange_scan_restartable(const char *s, const char *e, rb_encoding *enc
while (p < e) {
int ret = rb_enc_precise_mbclen(p, e, enc);
if (!MBCLEN_CHARFOUND_P(ret)) {
*cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ret;
*cr = MBCLEN_INVALID_P(ret) ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_UNKNOWN;
return p - s;
}
p += MBCLEN_CHARFOUND_LEN(ret);