Commit 3657c8b8 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp90: Add _Wcsxfrm implementation.

parent 7c5b40ed
......@@ -2969,7 +2969,7 @@
@ cdecl _Towupper(long ptr)
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
# extern _Xbig
@ stub __Wcrtomb_lk
@ cdecl towctrans(long long)
......
......@@ -3877,7 +3877,7 @@
@ cdecl _Unlock_shared_ptr_spin_lock()
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
# extern _Xbig
@ stub _Xp_addh
@ stub _Xp_addx
......
......@@ -3824,7 +3824,7 @@
@ cdecl _Unlock_shared_ptr_spin_lock()
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
# extern _Xbig
@ stub _Xp_addh
@ stub _Xp_addx
......
......@@ -3824,7 +3824,7 @@
@ cdecl _Unlock_shared_ptr_spin_lock() msvcp120._Unlock_shared_ptr_spin_lock
@ cdecl _Wcrtomb(ptr long ptr ptr) msvcp120._Wcrtomb
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr) msvcp120._Wcscoll
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr) msvcp120._Wcsxfrm
# extern _Xbig
@ stub _Xp_addh
@ stub _Xp_addx
......
......@@ -3747,7 +3747,7 @@
@ stub _WStoldx
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Xtime_diff_to_millis(ptr) _Xtime_diff_to_millis
@ cdecl _Xtime_diff_to_millis2(ptr ptr) _Xtime_diff_to_millis2
@ cdecl -ret64 _Xtime_get_ticks() _Xtime_get_ticks
......
......@@ -5153,7 +5153,7 @@
@ cdecl _Towupper(long ptr)
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
# extern _Xbig
# extern _Zero
@ stub __Wcrtomb_lk
......
......@@ -5779,7 +5779,7 @@
@ cdecl _Towupper(long ptr)
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
# extern _Xbig
@ stub __Stodx
@ stub __Stofx
......
......@@ -12704,6 +12704,43 @@ size_t __cdecl _Strxfrm(char *dest, char *dest_end,
return len;
}
size_t __cdecl _Wcsxfrm(wchar_t *dest, wchar_t *dest_end,
const wchar_t *src, const wchar_t *src_end, _Collvec *coll)
{
size_t dest_len = dest_end - dest;
size_t src_len = src_end - src;
_Collvec cv;
LCID lcid;
int i, len;
TRACE("(%p %p %p %p %p)\n", dest, dest_end, src, src_end, coll);
if (coll) cv = *coll;
else getcoll(&cv);
#if _MSVCP_VER < 110
lcid = cv.handle;
#else
lcid = LocaleNameToLCID(cv.lc_name, 0);
#endif
if (!lcid)
{
if (src_len > dest_len) return src_len;
memcpy(dest, src, src_len * sizeof(wchar_t));
return src_len;
}
len = LCMapStringW(lcid, LCMAP_SORTKEY, src, src_len, NULL, 0);
if (!len) return INT_MAX;
if (len > dest_len) return len;
LCMapStringW(lcid, LCMAP_SORTKEY, src, src_len, dest, dest_len);
for (i = len - 1; i >= 0; i--)
dest[i] = ((BYTE*)dest)[i];
return len;
}
DEFINE_RTTI_DATA0(_Facet_base, 0, ".?AV_Facet_base@std@@")
DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@std@@")
DEFINE_RTTI_DATA1(locale__Locimp, 0, &locale_facet_rtti_base_descriptor, ".?AV_Locimp@locale@std@@")
......
......@@ -6554,7 +6554,7 @@
@ cdecl _Towupper(long ptr)
@ cdecl _Wcrtomb(ptr long ptr ptr)
@ cdecl _Wcscoll(ptr ptr ptr ptr ptr)
@ stub _Wcsxfrm
@ cdecl _Wcsxfrm(ptr ptr ptr ptr ptr)
# extern _Xbig
@ stub __Wcrtomb_lk
@ cdecl towctrans(long long)
......
......@@ -106,6 +106,8 @@ static wctrans_t (__cdecl *p_wctrans)(const char*);
static wint_t (__cdecl *p_towctrans)(wint_t, wctrans_t);
static void (__cdecl *p_locale__Locimp__Locimp_Addfac)(locale__Locimp*,locale_facet*,size_t);
static size_t (__cdecl *p__Strxfrm)(char*, char*, const char*, const char*, const MSVCP__Collvec*);
static size_t (__cdecl *p__Wcsxfrm)(wchar_t*, wchar_t*, const wchar_t*,
const wchar_t*, const MSVCP__Collvec*);
#undef __thiscall
#ifdef __i386__
......@@ -250,6 +252,7 @@ static BOOL init(void)
SET(p_wctrans, "wctrans");
SET(p_towctrans, "towctrans");
SET(p__Strxfrm, "_Strxfrm");
SET(p__Wcsxfrm, "_Wcsxfrm");
SET(basic_ostringstream_char_vbtable, "??_8?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@");
SET(p_std_Ctraits_float__Isnan, "?_Isnan@?$_Ctraits@M@std@@SA_NM@Z");
......@@ -1110,6 +1113,26 @@ static void test__Strxfrm(void)
ok(!strcmp(in, out), "out = %s\n", out);
}
static void test__Wcsxfrm(void)
{
const wchar_t in[] = L"abc";
MSVCP__Collvec coll;
wchar_t out[64];
size_t ret;
memset(&coll, 0, sizeof(coll));
out[0] = 'z';
ret = p__Wcsxfrm(out, out + 1, in, in + 2, &coll);
ok(ret == 2, "ret = %d\n", (int)ret);
ok(out[0] == 'z', "out[0] = %x\n", out[0]);
ret = p__Wcsxfrm(out, out + ARRAY_SIZE(out), in, in + 4, &coll);
ok(ret == 4, "ret = %d\n", (int)ret);
ok(!wcscmp(in, out), "out = %s\n", wine_dbgstr_w(out));
}
START_TEST(misc)
{
if(!init())
......@@ -1131,6 +1154,7 @@ START_TEST(misc)
test_locale__Locimp__Locimp_Addfac();
test_raise_handler();
test__Strxfrm();
test__Wcsxfrm();
ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n");
......
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