Commit 1ad48d1b authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp: Add _Strxfrm implementation.

parent 1c5b5ce2
...@@ -2958,7 +2958,7 @@ ...@@ -2958,7 +2958,7 @@
@ cdecl -ret64 _Stoullx(ptr ptr long ptr) @ cdecl -ret64 _Stoullx(ptr ptr long ptr)
@ cdecl _Stoulx(ptr ptr long ptr) @ cdecl _Stoulx(ptr ptr long ptr)
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Tolower(long ptr) @ cdecl _Tolower(long ptr)
@ cdecl _Toupper(long ptr) @ cdecl _Toupper(long ptr)
@ cdecl _Towlower(long ptr) @ cdecl _Towlower(long ptr)
......
...@@ -3854,7 +3854,7 @@ ...@@ -3854,7 +3854,7 @@
@ cdecl _Stoulx(ptr ptr long ptr) @ cdecl _Stoulx(ptr ptr long ptr)
@ stub _Stoxflt @ stub _Stoxflt
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ stub _Thrd_abort @ stub _Thrd_abort
@ cdecl _Thrd_create(ptr ptr ptr) @ cdecl _Thrd_create(ptr ptr ptr)
@ cdecl -norelay _Thrd_current() @ cdecl -norelay _Thrd_current()
......
...@@ -3801,7 +3801,7 @@ ...@@ -3801,7 +3801,7 @@
@ cdecl _Stoulx(ptr ptr long ptr) @ cdecl _Stoulx(ptr ptr long ptr)
@ stub _Stoxflt @ stub _Stoxflt
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ stub _Thrd_abort @ stub _Thrd_abort
@ cdecl _Thrd_create(ptr ptr ptr) @ cdecl _Thrd_create(ptr ptr ptr)
@ cdecl -norelay _Thrd_current() @ cdecl -norelay _Thrd_current()
......
...@@ -3801,7 +3801,7 @@ ...@@ -3801,7 +3801,7 @@
@ cdecl _Stoulx(ptr ptr long ptr) msvcp120._Stoulx @ cdecl _Stoulx(ptr ptr long ptr) msvcp120._Stoulx
@ stub _Stoxflt @ stub _Stoxflt
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) msvcp120._Strcoll @ cdecl _Strcoll(ptr ptr ptr ptr ptr) msvcp120._Strcoll
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr) msvcp120._Strxfrm
@ stub _Thrd_abort @ stub _Thrd_abort
@ cdecl _Thrd_create(ptr ptr ptr) msvcp120._Thrd_create @ cdecl _Thrd_create(ptr ptr ptr) msvcp120._Thrd_create
@ cdecl -norelay _Thrd_current() msvcp120._Thrd_current @ cdecl -norelay _Thrd_current() msvcp120._Thrd_current
......
...@@ -3715,7 +3715,7 @@ ...@@ -3715,7 +3715,7 @@
@ cdecl -ret64 _Stoullx(ptr ptr long ptr) _Stoullx @ cdecl -ret64 _Stoullx(ptr ptr long ptr) _Stoullx
@ cdecl _Stoulx(ptr ptr long ptr) _Stoulx @ cdecl _Stoulx(ptr ptr long ptr) _Stoulx
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) _Strcoll @ cdecl _Strcoll(ptr ptr ptr ptr ptr) _Strcoll
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Symlink(wstr wstr) tr2_sys__Symlink_wchar @ cdecl _Symlink(wstr wstr) tr2_sys__Symlink_wchar
@ stub _Symlink_get @ stub _Symlink_get
@ cdecl _Temp_get(ptr) @ cdecl _Temp_get(ptr)
......
...@@ -4302,7 +4302,7 @@ ...@@ -4302,7 +4302,7 @@
@ cdecl _Stof(ptr ptr long) @ cdecl _Stof(ptr ptr long)
@ cdecl _Stold(ptr ptr long) _Stod @ cdecl _Stold(ptr ptr long) _Stod
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Tolower(long ptr) @ cdecl _Tolower(long ptr)
@ cdecl _Toupper(long ptr) @ cdecl _Toupper(long ptr)
@ cdecl _Wcrtomb(ptr long ptr ptr) @ cdecl _Wcrtomb(ptr long ptr ptr)
......
...@@ -5090,7 +5090,7 @@ ...@@ -5090,7 +5090,7 @@
@ cdecl _Stof(ptr ptr long) @ cdecl _Stof(ptr ptr long)
@ cdecl _Stold(ptr ptr long) _Stod @ cdecl _Stold(ptr ptr long) _Stod
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Tolower(long ptr) @ cdecl _Tolower(long ptr)
@ cdecl _Toupper(long ptr) @ cdecl _Toupper(long ptr)
@ cdecl _Wcrtomb(ptr long ptr ptr) @ cdecl _Wcrtomb(ptr long ptr ptr)
......
...@@ -5146,7 +5146,7 @@ ...@@ -5146,7 +5146,7 @@
@ cdecl _Stof(ptr ptr long) @ cdecl _Stof(ptr ptr long)
@ cdecl _Stold(ptr ptr long) _Stod @ cdecl _Stold(ptr ptr long) _Stod
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Tolower(long ptr) @ cdecl _Tolower(long ptr)
@ cdecl _Toupper(long ptr) @ cdecl _Toupper(long ptr)
@ cdecl _Towlower(long ptr) @ cdecl _Towlower(long ptr)
......
...@@ -5772,7 +5772,7 @@ ...@@ -5772,7 +5772,7 @@
@ cdecl _Stoulx(ptr ptr long ptr) @ cdecl _Stoulx(ptr ptr long ptr)
@ stub _Stoxflt @ stub _Stoxflt
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Tolower(long ptr) @ cdecl _Tolower(long ptr)
@ cdecl _Toupper(long ptr) @ cdecl _Toupper(long ptr)
@ cdecl _Towlower(long ptr) @ cdecl _Towlower(long ptr)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
#include "msvcp90.h" #include "msvcp90.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -12664,6 +12665,44 @@ int __cdecl _To_wide(const char *src, wchar_t *dst) ...@@ -12664,6 +12665,44 @@ int __cdecl _To_wide(const char *src, wchar_t *dst)
return MultiByteToWideChar(CP_ACP, 0, src, -1, dst, MAX_PATH); return MultiByteToWideChar(CP_ACP, 0, src, -1, dst, MAX_PATH);
} }
MSVCP_size_t __cdecl _Strxfrm(char *dest, char *dest_end, const char *src, const char *src_end, _Collvec *coll)
{
MSVCP_size_t dest_len = dest_end - dest;
MSVCP_size_t src_len = src_end - src;
_Collvec cv;
WCHAR *buf;
LCID lcid;
int 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 && !cv.page)
{
if (src_len > dest_len) return src_len;
memcpy(dest, src, src_len);
return src_len;
}
len = MultiByteToWideChar(cv.page, MB_ERR_INVALID_CHARS, src, src_len, NULL, 0);
if (!len) return 0;
buf = heap_alloc(len * sizeof(WCHAR));
if (!buf) return 0;
MultiByteToWideChar(cv.page, MB_ERR_INVALID_CHARS, src, src_len, buf, len);
len = LCMapStringW(lcid, LCMAP_SORTKEY, buf, len, (WCHAR*)dest, dest_len);
heap_free(buf);
return len;
}
DEFINE_RTTI_DATA0(_Facet_base, 0, ".?AV_Facet_base@std@@") DEFINE_RTTI_DATA0(_Facet_base, 0, ".?AV_Facet_base@std@@")
DEFINE_RTTI_DATA0(locale_facet, 0, ".?AVfacet@locale@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@@") DEFINE_RTTI_DATA1(locale__Locimp, 0, &locale_facet_rtti_base_descriptor, ".?AV_Locimp@locale@std@@")
......
...@@ -6547,7 +6547,7 @@ ...@@ -6547,7 +6547,7 @@
@ cdecl -ret64 _Stoullx(ptr ptr long ptr) @ cdecl -ret64 _Stoullx(ptr ptr long ptr)
@ cdecl _Stoulx(ptr ptr long ptr) @ cdecl _Stoulx(ptr ptr long ptr)
@ cdecl _Strcoll(ptr ptr ptr ptr ptr) @ cdecl _Strcoll(ptr ptr ptr ptr ptr)
@ stub _Strxfrm @ cdecl _Strxfrm(ptr ptr ptr ptr ptr)
@ cdecl _Tolower(long ptr) @ cdecl _Tolower(long ptr)
@ cdecl _Toupper(long ptr) @ cdecl _Toupper(long ptr)
@ cdecl _Towlower(long ptr) @ cdecl _Towlower(long ptr)
......
...@@ -105,6 +105,7 @@ static /*MSVCP__Collvec*/ULONGLONG (__cdecl *p__Getcoll)(void); ...@@ -105,6 +105,7 @@ static /*MSVCP__Collvec*/ULONGLONG (__cdecl *p__Getcoll)(void);
static wctrans_t (__cdecl *p_wctrans)(const char*); static wctrans_t (__cdecl *p_wctrans)(const char*);
static wint_t (__cdecl *p_towctrans)(wint_t, wctrans_t); 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 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*);
#undef __thiscall #undef __thiscall
#ifdef __i386__ #ifdef __i386__
...@@ -248,6 +249,7 @@ static BOOL init(void) ...@@ -248,6 +249,7 @@ static BOOL init(void)
SET(p__Getcoll, "_Getcoll"); SET(p__Getcoll, "_Getcoll");
SET(p_wctrans, "wctrans"); SET(p_wctrans, "wctrans");
SET(p_towctrans, "towctrans"); SET(p_towctrans, "towctrans");
SET(p__Strxfrm, "_Strxfrm");
SET(basic_ostringstream_char_vbtable, "??_8?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@"); 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"); SET(p_std_Ctraits_float__Isnan, "?_Isnan@?$_Ctraits@M@std@@SA_NM@Z");
...@@ -1088,6 +1090,26 @@ static void test_raise_handler(void) ...@@ -1088,6 +1090,26 @@ static void test_raise_handler(void)
*p_Raise_handler = NULL; *p_Raise_handler = NULL;
} }
static void test__Strxfrm(void)
{
const char in[] = "abc";
MSVCP__Collvec coll;
char out[64];
size_t ret;
memset(&coll, 0, sizeof(coll));
out[0] = 'z';
ret = p__Strxfrm(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__Strxfrm(out, out + sizeof(out), in, in + 4, &coll);
ok(ret == 4, "ret = %d\n", (int)ret);
ok(!strcmp(in, out), "out = %s\n", out);
}
START_TEST(misc) START_TEST(misc)
{ {
if(!init()) if(!init())
...@@ -1108,6 +1130,7 @@ START_TEST(misc) ...@@ -1108,6 +1130,7 @@ START_TEST(misc)
test_vbtable_size_exports(); test_vbtable_size_exports();
test_locale__Locimp__Locimp_Addfac(); test_locale__Locimp__Locimp_Addfac();
test_raise_handler(); test_raise_handler();
test__Strxfrm();
ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n"); 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