msvcrt: Add _wsetlocale implementation.

This commit is contained in:
Piotr Caban 2013-08-29 12:07:03 +02:00 committed by Alexandre Julliard
parent 4ce3ddedb9
commit 33d697c001
2 changed files with 35 additions and 14 deletions

View File

@ -406,20 +406,6 @@ static inline char* construct_lc_all(MSVCRT_pthreadlocinfo locinfo) {
}
/*********************************************************************
* wsetlocale (MSVCRT.@)
*/
MSVCRT_wchar_t* CDECL MSVCRT__wsetlocale(int category, const MSVCRT_wchar_t* locale)
{
static MSVCRT_wchar_t fake[] = {
'E','n','g','l','i','s','h','_','U','n','i','t','e','d',' ',
'S','t','a','t','e','s','.','1','2','5','2',0 };
FIXME("%d %s\n", category, debugstr_w(locale));
return fake;
}
/*********************************************************************
* _Getdays (MSVCRT.@)
*/
@ -1435,6 +1421,40 @@ char* CDECL MSVCRT_setlocale(int category, const char* locale)
return locinfo->lc_category[category].locale;
}
/*********************************************************************
* _wsetlocale (MSVCRT.@)
*/
MSVCRT_wchar_t* CDECL MSVCRT__wsetlocale(int category, const MSVCRT_wchar_t* wlocale)
{
static MSVCRT_wchar_t current_lc_all[MAX_LOCALE_LENGTH];
char *locale = NULL;
const char *ret;
MSVCRT_size_t len;
if(wlocale) {
len = MSVCRT_wcstombs(NULL, wlocale, 0);
if(len == -1)
return NULL;
locale = MSVCRT_malloc(++len);
if(!locale)
return NULL;
MSVCRT_wcstombs(locale, wlocale, len);
}
LOCK_LOCALE;
ret = MSVCRT_setlocale(category, locale);
MSVCRT_free(locale);
if(ret && MSVCRT_mbstowcs(current_lc_all, ret, MAX_LOCALE_LENGTH)==-1)
ret = NULL;
UNLOCK_LOCALE;
return ret ? current_lc_all : NULL;
}
/* _configthreadlocale - not exported in native msvcrt */
int CDECL _configthreadlocale(int type)
{

View File

@ -953,6 +953,7 @@ int __cdecl _ismbclegal(unsigned int c);
int __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str);
int __cdecl MSVCRT_mbtowc(MSVCRT_wchar_t*,const char*,MSVCRT_size_t);
MSVCRT_size_t __cdecl MSVCRT_mbstowcs(MSVCRT_wchar_t*,const char*,MSVCRT_size_t);
MSVCRT_size_t __cdecl MSVCRT_wcstombs(char*,const MSVCRT_wchar_t*,MSVCRT_size_t);
MSVCRT_intptr_t __cdecl MSVCRT__spawnve(int,const char*,const char* const *,const char* const *);
MSVCRT_intptr_t __cdecl MSVRT__spawnvpe(int,const char*,const char* const *,const char* const *);
MSVCRT_intptr_t __cdecl MSVCRT__wspawnve(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);