mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* encoding.c (rb_enc_precise_mbclen): return needmore if underlying
implementation returns a length longer than e-p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4db4d80357
commit
78eae5da62
2 changed files with 8 additions and 2 deletions
|
@ -1,7 +1,9 @@
|
|||
Sun Dec 9 03:29:02 2007 Tanaka Akira <akr@fsij.org>
|
||||
Sun Dec 9 04:01:28 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* encoding.c (rb_enc_mbclen): return 1 if underlying implementation
|
||||
returns a length longer than e-p.
|
||||
(rb_enc_precise_mbclen): return needmore if underlying
|
||||
implementation returns a length longer than e-p.
|
||||
|
||||
Sat Dec 8 17:59:40 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
|
|
|
@ -496,9 +496,13 @@ rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc)
|
|||
int
|
||||
rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc)
|
||||
{
|
||||
int n;
|
||||
if (e <= p)
|
||||
return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(1);
|
||||
return ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
|
||||
n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
|
||||
if (e-p < n)
|
||||
return ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n-(e-p));
|
||||
return n;
|
||||
}
|
||||
|
||||
int rb_enc_get_ascii(const char *p, const char *e, rb_encoding *enc)
|
||||
|
|
Loading…
Add table
Reference in a new issue