ReactOS 0.4.16-dev-927-g467dec4
mbslen.cpp
Go to the documentation of this file.
1/***
2*mbslen.c - Find length of MBCS string
3*
4* Copyright (c) Microsoft Corporation. All rights reserved.
5*
6*Purpose:
7* Find length of MBCS string
8*
9*******************************************************************************/
10#ifndef _MBCS
11 #error This file should only be compiled with _MBCS defined
12#endif
13
14#include <corecrt_internal.h>
16#include <locale.h>
17#include <string.h>
18
19/***
20* _mbslen - Find length of MBCS string
21*
22*Purpose:
23* Find the length of the MBCS string (in characters).
24*
25*Entry:
26* unsigned char *s = string
27*
28*Exit:
29* Returns the number of MBCS chars in the string.
30*
31*Exceptions:
32*
33*******************************************************************************/
34
35extern "C" size_t __cdecl _mbslen_l(
36 const unsigned char *s,
38 )
39{
40 int n;
41 _LocaleUpdate _loc_update(plocinfo);
42
43 if (_loc_update.GetLocaleT()->mbcinfo->ismbcodepage == 0)
44 return strlen((const char *)s);
45
46 for (n = 0; *s; n++, s++) {
47 if ( _ismbblead_l(*s, _loc_update.GetLocaleT()) ) {
48 if (*++s == '\0')
49 break;
50 }
51 }
52
53 return(n);
54}
55
56extern "C" size_t (__cdecl _mbslen)(
57 const unsigned char *s
58 )
59{
60 return _mbslen_l(s, nullptr);
61}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __cdecl
Definition: accygwin.h:79
#define _ismbblead_l(_c, p)
__kernel_size_t size_t
Definition: linux.h:237
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
_Check_return_ _CRTIMP size_t __cdecl _mbslen(_In_z_ const unsigned char *_Str)
_locale_t plocinfo
Definition: ismbbyte.cpp:75
size_t __cdecl _mbslen_l(const unsigned char *s, _locale_t plocinfo)
Definition: mbslen.cpp:35