3 /*********************************************************************
6 size_t CDECL
_mbstowcs_l(wchar_t *wcstr
, const char *mbstr
,
7 size_t count
, _locale_t locale
)
9 MSVCRT_pthreadlocinfo locinfo
;
13 locinfo
= get_locinfo();
15 locinfo
= ((MSVCRT__locale_t
)locale
)->locinfo
;
17 /* Ignore count parameter */
19 return MultiByteToWideChar(locinfo
->lc_codepage
, 0, mbstr
, -1, NULL
, 0)-1;
21 for(i
=0, size
=0; i
<count
; i
++) {
22 if(mbstr
[size
] == '\0')
25 size
+= (_isleadbyte_l((unsigned char)mbstr
[size
], locale
) ? 2 : 1);
28 size
= MultiByteToWideChar(locinfo
->lc_codepage
, 0,
29 mbstr
, size
, wcstr
, count
);
31 if(size
<count
&& wcstr
)
40 size_t mbstowcs (wchar_t *widechar
, const char *multibyte
, size_t number
)
42 return _mbstowcs_l(widechar
, multibyte
, number
, NULL
);