Sync to trunk r38200
[reactos.git] / reactos / lib / sdk / crt / mbstring / mbstrlen.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/sdk/crt/mbstring/mbstrlen.c
5 * PURPOSE: Determines the length of a multi byte string, current locale
6 * PROGRAMERS:
7 * Copyright 1999 Alexandre Julliard
8 * Copyright 2000 Jon Griffths
9 *
10 */
11
12 #include <mbstring.h>
13 #include <stdlib.h>
14
15 int isleadbyte(int byte);
16
17 /*
18 * @implemented
19 */
20 size_t _mbstrlen( const char *str )
21 {
22 size_t len = 0;
23 while(*str)
24 {
25 /* FIXME: According to the documentation we are supposed to test for
26 * multi-byte character validity. Whatever that means
27 */
28 str += isleadbyte(*str) ? 2 : 1;
29 len++;
30 }
31 return len;
32 }