blob: fbea20ce82d33b635692f907cb37be157e095fff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/***
*mbslen.c - Find length of MBCS string
*
* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Find length of MBCS string
*
*Revision History:
* 11-19-92 KRS Ported from 16-bit sources.
*
*******************************************************************************/
#ifdef _MBCS
#include <cruntime.h>
#include <mbdata.h>
#include <mbctype.h>
#include <mbstring.h>
/***
* _mbslen - Find length of MBCS string
*
*Purpose:
* Find the length of the MBCS string (in characters).
*
*Entry:
* unsigned char *s = string
*
*Exit:
* Returns the number of MBCS chars in the string
*
*Exceptions:
*
*******************************************************************************/
size_t _CRTAPI1 _mbslen(s)
const unsigned char *s;
{
int n;
for (n = 0; *s; n++, s++) {
if (_ISLEADBYTE(*s)) {
if (*++s == '\0')
break;
}
}
return(n);
}
#endif /* _MBCS */
|