ReactOS 0.4.15-dev-7942-gd23573b
_mbsnlen.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS CRT
4 * PURPOSE: Implementation of _mbsnlen
5 * FILE: lib/sdk/crt/string/_mbsnlen.c
6 * PROGRAMMER: Timo Kreuzer
7 */
8
9#include <mbstring.h>
10
13size_t
16 _In_z_ const unsigned char *pmbstr,
17 _In_ size_t cjMaxLen)
18{
19 size_t cchCount = 0;
20 unsigned char jMbsByte;
21
22 /* Loop while we have bytes to process */
23 while (cjMaxLen-- > 0)
24 {
25 /* Get next mb byte */
26 jMbsByte = *pmbstr++;
27
28 /* If this is 0, we're done */
29 if (jMbsByte == 0) break;
30
31 /* Don't count lead bytes */
32 if (!_ismbblead(jMbsByte)) cchCount++;
33 }
34
35 return cchCount;
36}
_Check_return_ _CRTIMP size_t __cdecl _mbsnlen(_In_z_ const unsigned char *pmbstr, _In_ size_t cjMaxLen)
Definition: _mbsnlen.c:15
#define __cdecl
Definition: accygwin.h:79
#define _CRTIMP
Definition: crtdefs.h:72
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20
#define _In_z_
Definition: ms_sal.h:313
#define _Check_return_
Definition: ms_sal.h:557
#define _In_
Definition: ms_sal.h:308