xref: /reactos/sdk/lib/crt/mbstring/mbslen.c (revision c2c66aff)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS system libraries
4  * FILE:        lib/sdk/crt/mbstring/mbslen.c
5  * PURPOSE:      Determines the length of a multi byte string
6  * PROGRAMERS:
7  *              Copyright 1999 Alexandre Julliard
8  *              Copyright 2000 Jon Griffths
9  *
10  */
11 
12 #include <mbstring.h>
13 
14 /*
15  * @implemented
16  */
_mbslen(const unsigned char * str)17 size_t _mbslen(const unsigned char *str)
18 {
19   size_t len = 0;
20   while(*str)
21   {
22     if (_ismbblead(*str))
23     {
24       str++;
25       if (!*str)  /* count only full chars */
26         break;
27     }
28     str++;
29     len++;
30   }
31   return len;
32 }
33