mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 03:48:30 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
48
sdk/lib/crt/stdlib/mbtowc.c
Normal file
48
sdk/lib/crt/stdlib/mbtowc.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/stdlib/mbtowc.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*********************************************************************
|
||||
* _mbtowc_l(MSVCRT.@)
|
||||
*/
|
||||
int CDECL _mbtowc_l(wchar_t *dst, const char* str, size_t n, _locale_t locale)
|
||||
{
|
||||
MSVCRT_pthreadlocinfo locinfo;
|
||||
wchar_t tmpdst = '\0';
|
||||
|
||||
if(!locale)
|
||||
locinfo = get_locinfo();
|
||||
else
|
||||
locinfo = (MSVCRT_pthreadlocinfo)(locale->locinfo);
|
||||
|
||||
if(n <= 0 || !str)
|
||||
return 0;
|
||||
if(!locinfo->lc_codepage)
|
||||
tmpdst = (unsigned char)*str;
|
||||
else if(!MultiByteToWideChar(locinfo->lc_codepage, 0, str, n, &tmpdst, 1))
|
||||
return -1;
|
||||
if(dst)
|
||||
*dst = tmpdst;
|
||||
/* return the number of bytes from src that have been used */
|
||||
if(!*str)
|
||||
return 0;
|
||||
if(n >= 2 && _isleadbyte_l((unsigned char)*str, locale) && str[1])
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* mbtowc(MSVCRT.@)
|
||||
*/
|
||||
int CDECL mbtowc(wchar_t *dst, const char* str, size_t n)
|
||||
{
|
||||
return _mbtowc_l(dst, str, n, NULL);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue