2 * COPYRIGHT: See COPYING in the top level directory
4 * PURPOSE: Implementation of _mbstrnlen
5 * FILE: lib/sdk/crt/string/_mbstrnlen.c
6 * PROGRAMMER: Timo Kreuzer
11 #include <specstrings.h>
19 _In_z_
const char *pmbstr
,
23 unsigned char jMbsByte
;
25 /* Check parameters */
26 if (!MSVCRT_CHECK_PMT((pmbstr
!= 0)) && (cjMaxLen
<= INT_MAX
))
32 /* Loop while we have bytes to process */
33 while (cjMaxLen
-- > 0)
35 /* Get next mb byte */
38 /* If this is 0, we're done */
39 if (jMbsByte
== 0) break;
41 /* if this is a lead byte, continue with next char */
42 if (_ismbblead(jMbsByte
))
44 // FIXME: check if this is a valid char.
48 /* Count this character */