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

* encoding.c (rb_enc_mbclen): return 1 if underlying implementation

returns a length longer than e-p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-08 18:41:47 +00:00
parent 6c6cf008cd
commit cde5b2a9cf
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sun Dec 9 03:29:02 2007 Tanaka Akira <akr@fsij.org>
* encoding.c (rb_enc_mbclen): return 1 if underlying implementation
returns a length longer than e-p.
Sat Dec 8 17:59:40 2007 Tanaka Akira <akr@fsij.org>
* signal.c (posix_signal): return value.

View file

@ -486,7 +486,8 @@ int
rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc)
{
int n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
if (MBCLEN_CHARFOUND(n))
n = MBCLEN_CHARFOUND(n);
if (0 < n && n <= e-p)
return n;
else
return 1;