Commit ffa7ac73 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcrt: Return value from MSVCRT____mb_cur_max_func instead of pointer.

parent 2cefbaab
......@@ -174,13 +174,21 @@ unsigned char* CDECL __p__mbctype(void)
}
/*********************************************************************
* ___mb_cur_max_func(MSVCRT.@)
* __p___mb_cur_max(MSVCRT.@)
*/
int* CDECL MSVCRT____mb_cur_max_func(void)
int* CDECL __p___mb_cur_max(void)
{
return &get_locinfo()->mb_cur_max;
}
/*********************************************************************
* ___mb_cur_max_func(MSVCRT.@)
*/
int CDECL MSVCRT____mb_cur_max_func(void)
{
return get_locinfo()->mb_cur_max;
}
/* ___mb_cur_max_l_func - not exported in native msvcrt */
int* CDECL ___mb_cur_max_l_func(MSVCRT__locale_t locale)
{
......
......@@ -221,7 +221,7 @@
@ cdecl __p___argc()
@ cdecl __p___argv()
@ cdecl __p___initenv()
@ cdecl __p___mb_cur_max() MSVCRT____mb_cur_max_func
@ cdecl __p___mb_cur_max()
@ cdecl __p___wargv()
@ cdecl __p___winitenv()
@ cdecl __p__acmdln()
......
......@@ -25,6 +25,8 @@
static BOOL (__cdecl *p__crtGetStringTypeW)(DWORD, DWORD, const wchar_t*, int, WORD*);
static int (__cdecl *pmemcpy_s)(void *, size_t, void*, size_t);
static int (__cdecl *p___mb_cur_max_func)(void);
static int *(__cdecl *p__p___mb_cur_max)(void);
void* __cdecl _Gettnames(void);
static void init(void)
......@@ -33,6 +35,8 @@ static void init(void)
p__crtGetStringTypeW = (void*)GetProcAddress(hmod, "__crtGetStringTypeW");
pmemcpy_s = (void*)GetProcAddress(hmod, "memcpy_s");
p___mb_cur_max_func = (void*)GetProcAddress(hmod, "___mb_cur_max_func");
p__p___mb_cur_max = (void*)GetProcAddress(hmod, "__p___mb_cur_max");
}
static void test_setlocale(void)
......@@ -738,6 +742,45 @@ static void test__Gettnames(void)
setlocale(LC_ALL, "C");
}
static void test___mb_cur_max_func(void)
{
int mb_cur_max;
/* for newer Windows */
if(!p___mb_cur_max_func)
win_skip("Skipping ___mb_cur_max_func tests\n");
else {
mb_cur_max = p___mb_cur_max_func();
ok(mb_cur_max == 1, "mb_cur_max = %d, expected 1\n", mb_cur_max);
/* some old Windows don't set chinese */
if (!setlocale(LC_ALL, "chinese"))
win_skip("Skipping test with chinese locale\n");
else {
mb_cur_max = p___mb_cur_max_func();
ok(mb_cur_max == 2, "mb_cur_max = %d, expected 2\n", mb_cur_max);
setlocale(LC_ALL, "C");
}
}
/* for older Windows */
if (!p__p___mb_cur_max)
win_skip("Skipping __p___mb_cur_max tests\n");
else {
mb_cur_max = *p__p___mb_cur_max();
ok(mb_cur_max == 1, "mb_cur_max = %d, expected 1\n", mb_cur_max);
/* some old Windows don't set chinese */
if (!setlocale(LC_ALL, "chinese"))
win_skip("Skipping test with chinese locale\n");
else {
mb_cur_max = *p__p___mb_cur_max();
ok(mb_cur_max == 2, "mb_cur_max = %d, expected 2\n", mb_cur_max);
setlocale(LC_ALL, "C");
}
}
}
START_TEST(locale)
{
init();
......@@ -745,4 +788,5 @@ START_TEST(locale)
test_crtGetStringTypeW();
test_setlocale();
test__Gettnames();
test___mb_cur_max_func();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment