mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* wince/stdlib.c: add mblen().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b1937a53e6
commit
b5d717afda
2 changed files with 21 additions and 0 deletions
|
|
@ -20,3 +20,20 @@ char *_fullpath(char *absPath, const char *relPath,
|
|||
return absPath;
|
||||
}
|
||||
|
||||
int mblen(const char *mbstr, size_t count)
|
||||
{
|
||||
const char *p = mbstr;
|
||||
size_t i;
|
||||
int n=0;
|
||||
|
||||
for( i=0; i<count; i++ )
|
||||
{
|
||||
if( *p=='\0' ) break;
|
||||
if( IsDBCSLeadByteEx( CP_ACP, *p ) )
|
||||
n+=2;
|
||||
else
|
||||
n+=1;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue