Daniel Lehman : msvcrt: Return value from MSVCRT____mb_cur_max_func instead of pointer.
Alexandre Julliard
julliard at winehq.org
Thu Nov 1 14:42:59 CDT 2012
Module: wine
Branch: master
Commit: ffa7ac73317f3e89c05d2a07d8e63cdf037bd17e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ffa7ac73317f3e89c05d2a07d8e63cdf037bd17e
Author: Daniel Lehman <dlehman at esri.com>
Date: Wed Oct 31 16:20:16 2012 -0700
msvcrt: Return value from MSVCRT____mb_cur_max_func instead of pointer.
---
dlls/msvcrt/mbcs.c | 12 ++++++++++--
dlls/msvcrt/msvcrt.spec | 2 +-
dlls/msvcrt/tests/locale.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 9623653..3c575e9 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -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)
{
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 03181c0..f5cad22 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -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()
diff --git a/dlls/msvcrt/tests/locale.c b/dlls/msvcrt/tests/locale.c
index 225cbb9..73eeb91 100644
--- a/dlls/msvcrt/tests/locale.c
+++ b/dlls/msvcrt/tests/locale.c
@@ -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();
}
More information about the wine-cvs
mailing list