msvcrt: Added mbsrtowcs implementation.
This commit is contained in:
parent
f20a85a5da
commit
5e50ec3df2
|
@ -2077,7 +2077,7 @@ MSVCRT_size_t CDECL MSVCRT__mbstowcs_l(MSVCRT_wchar_t *wcstr, const char *mbstr,
|
|||
if(mbstr[size] == '\0')
|
||||
break;
|
||||
|
||||
size += (MSVCRT__isleadbyte_l(mbstr[size], locale) ? 2 : 1);
|
||||
size += (MSVCRT__isleadbyte_l((unsigned char)mbstr[size], locale) ? 2 : 1);
|
||||
}
|
||||
|
||||
size = MultiByteToWideChar(locinfo->lc_codepage, 0,
|
||||
|
@ -2150,3 +2150,35 @@ int CDECL MSVCRT__mbstowcs_s(MSVCRT_size_t *ret, MSVCRT_wchar_t *wcstr,
|
|||
{
|
||||
return MSVCRT__mbstowcs_s_l(ret, wcstr, size, mbstr, count, NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* mbsrtowcs(MSVCRT.@)
|
||||
*/
|
||||
MSVCRT_size_t CDECL MSVCRT_mbsrtowcs(MSVCRT_wchar_t *wcstr,
|
||||
const char **pmbstr, MSVCRT_size_t count, MSVCRT_mbstate_t *state)
|
||||
{
|
||||
MSVCRT_mbstate_t s = (state ? *state : 0);
|
||||
MSVCRT_wchar_t tmpdst;
|
||||
MSVCRT_size_t ret = 0;
|
||||
|
||||
if(!MSVCRT_CHECK_PMT(pmbstr != NULL))
|
||||
return -1;
|
||||
|
||||
while(!wcstr || count>ret) {
|
||||
int ch_len = MSVCRT_mbrtowc(&tmpdst, *pmbstr, 2, &s);
|
||||
if(wcstr)
|
||||
wcstr[ret] = tmpdst;
|
||||
|
||||
if(ch_len < 0) {
|
||||
return -1;
|
||||
}else if(ch_len == 0) {
|
||||
*pmbstr = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
*pmbstr += ch_len;
|
||||
ret++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1331,7 +1331,7 @@
|
|||
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
|
||||
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
|
||||
# stub mbsdup_dbg(wstr long ptr long)
|
||||
# stub mbsrtowcs(ptr ptr long ptr)
|
||||
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
|
||||
# stub mbsrtowcs_s(ptr ptr long ptr long ptr)
|
||||
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
|
||||
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
|
||||
|
|
Loading…
Reference in New Issue