msvcr110: Copy utf16 strings in _Gettnames.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50409
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit b3fcb0f2c8
)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
parent
66e06267c0
commit
b1b8412f96
|
@ -171,6 +171,7 @@ static int (__cdecl *p__dpcomp)(double x, double y);
|
|||
static wchar_t** (CDECL *p____lc_locale_name_func)(void);
|
||||
static unsigned int (CDECL *p__GetConcurrency)(void);
|
||||
static void* (CDECL *p__W_Gettnames)(void);
|
||||
static void* (CDECL *p__Gettnames)(void);
|
||||
static void (CDECL *p_free)(void*);
|
||||
static float (CDECL *p_strtof)(const char *, char **);
|
||||
static int (CDECL *p__finite)(double);
|
||||
|
@ -242,6 +243,7 @@ static BOOL init(void)
|
|||
p____lc_locale_name_func = (void*)GetProcAddress(module, "___lc_locale_name_func");
|
||||
p__GetConcurrency = (void*)GetProcAddress(module,"?_GetConcurrency@details@Concurrency@@YAIXZ");
|
||||
p__W_Gettnames = (void*)GetProcAddress(module, "_W_Gettnames");
|
||||
p__Gettnames = (void*)GetProcAddress(module, "_Gettnames");
|
||||
p_free = (void*)GetProcAddress(module, "free");
|
||||
p_strtof = (void*)GetProcAddress(module, "strtof");
|
||||
p__finite = (void*)GetProcAddress(module, "_finite");
|
||||
|
@ -531,7 +533,7 @@ static void test__GetConcurrency(void)
|
|||
ok(c == si.dwNumberOfProcessors, "expected %u, got %u\n", si.dwNumberOfProcessors, c);
|
||||
}
|
||||
|
||||
static void test__W_Gettnames(void)
|
||||
static void test_gettnames(void* (CDECL *p_gettnames)(void))
|
||||
{
|
||||
static const char *str[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
|
||||
|
@ -557,7 +559,7 @@ static void test__W_Gettnames(void)
|
|||
if(!p_setlocale(LC_ALL, "english"))
|
||||
return;
|
||||
|
||||
ret = p__W_Gettnames();
|
||||
ret = p_gettnames();
|
||||
size = ret->str[0]-(char*)ret;
|
||||
if(sizeof(void*) == 8)
|
||||
ok(size==0x2c0, "structure size: %x\n", size);
|
||||
|
@ -572,6 +574,10 @@ static void test__W_Gettnames(void)
|
|||
ok(!lstrcmpW(ret->wstr[i], buf), "ret->wstr[%d] = %s, expected %s\n",
|
||||
i, wine_dbgstr_w(ret->wstr[i]), wine_dbgstr_w(buf));
|
||||
}
|
||||
|
||||
ok(ret->str[42] + strlen(ret->str[42])+1 == (char*)ret->wstr[0],
|
||||
"ret->str[42] = %p len = %d, ret->wstr[0] = %p\n",
|
||||
ret->str[42], strlen(ret->str[42]), ret->wstr[0]);
|
||||
p_free(ret);
|
||||
|
||||
p_setlocale(LC_ALL, "C");
|
||||
|
@ -1111,7 +1117,8 @@ START_TEST(msvcr120)
|
|||
test__dpcomp();
|
||||
test____lc_locale_name_func();
|
||||
test__GetConcurrency();
|
||||
test__W_Gettnames();
|
||||
test_gettnames(p__W_Gettnames);
|
||||
test_gettnames(p__Gettnames);
|
||||
test__strtof();
|
||||
test_remainder();
|
||||
test_critical_section();
|
||||
|
|
|
@ -802,6 +802,10 @@ void* CDECL _Gettnames(void)
|
|||
|
||||
for(i=0; i<ARRAY_SIZE(cur->str.str); i++)
|
||||
size += strlen(cur->str.str[i])+1;
|
||||
#if _MSVCR_VER >= 110
|
||||
for(i=0; i<ARRAY_SIZE(cur->wstr.wstr); i++)
|
||||
size += (wcslen(cur->wstr.wstr[i]) + 1) * sizeof(wchar_t);
|
||||
#endif
|
||||
|
||||
ret = malloc(size);
|
||||
if(!ret)
|
||||
|
@ -815,6 +819,14 @@ void* CDECL _Gettnames(void)
|
|||
ret->str.str[i] = &ret->data[size];
|
||||
size += len;
|
||||
}
|
||||
#if _MSVCR_VER >= 110
|
||||
for(i=0; i<ARRAY_SIZE(cur->wstr.wstr); i++) {
|
||||
len = (wcslen(cur->wstr.wstr[i]) + 1) * sizeof(wchar_t);
|
||||
memcpy(&ret->data[size], cur->wstr.wstr[i], len);
|
||||
ret->wstr.wstr[i] = (wchar_t*)&ret->data[size];
|
||||
size += len;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -733,6 +733,10 @@ static void test__Gettnames(void)
|
|||
ok(!strcmp(ret->str[i], buf), "ret->str[%i] = %s, expected %s\n", i, ret->str[i], buf);
|
||||
}
|
||||
|
||||
ok(ret->wstr[0] != NULL, "ret->wstr[0] = NULL\n");
|
||||
ok(ret->str[42] + strlen(ret->str[42])+1 != (char*)ret->wstr[0],
|
||||
"ret->str[42] = %p len = %d, ret->wstr[0] = %p\n",
|
||||
ret->str[42], strlen(ret->str[42]), ret->wstr[0]);
|
||||
free(ret);
|
||||
|
||||
if(!setlocale(LC_TIME, "german"))
|
||||
|
|
Loading…
Reference in New Issue