msvcrt: Add _wcsxfrm_l implementation.

This commit is contained in:
Piotr Caban 2014-06-12 17:52:56 +02:00 committed by Alexandre Julliard
parent 00bce25143
commit b540277cc7
8 changed files with 70 additions and 12 deletions

View File

@ -1518,7 +1518,7 @@
@ cdecl _wcsupr_l(wstr ptr) MSVCRT__wcsupr_l
@ cdecl _wcsupr_s(wstr long) MSVCRT__wcsupr_s
@ cdecl _wcsupr_s_l(wstr long ptr) MSVCRT__wcsupr_s_l
@ stub _wcsxfrm_l
@ cdecl _wcsxfrm_l(ptr wstr long ptr) MSVCRT__wcsxfrm_l
@ cdecl _wctime32(ptr) MSVCRT__wctime32
@ stub _wctime32_s
@ cdecl _wctime64(ptr) MSVCRT__wctime64
@ -1877,7 +1877,7 @@
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctob(long) MSVCRT_wctob
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s

View File

@ -1877,7 +1877,7 @@
@ cdecl _wcsupr_l(wstr ptr) MSVCRT__wcsupr_l
@ cdecl _wcsupr_s(wstr long) MSVCRT__wcsupr_s
@ cdecl _wcsupr_s_l(wstr long ptr) MSVCRT__wcsupr_s_l
@ stub _wcsxfrm_l
@ cdecl _wcsxfrm_l(ptr wstr long ptr) MSVCRT__wcsxfrm_l
@ cdecl _wctime32(ptr) MSVCRT__wctime32
@ stub _wctime32_s
@ cdecl _wctime64(ptr) MSVCRT__wctime64
@ -2236,7 +2236,7 @@
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctob(long) MSVCRT_wctob
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s

View File

@ -870,7 +870,7 @@
@ cdecl wcstol(wstr ptr long) ntdll.wcstol
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ varargs wprintf(wstr) MSVCRT_wprintf
@ varargs wscanf(wstr) MSVCRT_wscanf

View File

@ -866,7 +866,7 @@
@ cdecl wcstol(wstr ptr long) ntdll.wcstol
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ varargs wprintf(wstr) MSVCRT_wprintf
@ varargs wscanf(wstr) MSVCRT_wscanf

View File

@ -1197,7 +1197,7 @@
@ cdecl _wcsupr_l(wstr ptr) MSVCRT__wcsupr_l
@ cdecl _wcsupr_s(wstr long) MSVCRT__wcsupr_s
@ cdecl _wcsupr_s_l(wstr long ptr) MSVCRT__wcsupr_s_l
@ stub _wcsxfrm_l
@ cdecl _wcsxfrm_l(ptr wstr long ptr) MSVCRT__wcsxfrm_l
@ cdecl _wctime32(ptr) MSVCRT__wctime32
@ stub _wctime32_s
@ cdecl _wctime64(ptr) MSVCRT__wctime64
@ -1557,7 +1557,7 @@
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctob(long) MSVCRT_wctob
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s

View File

@ -1173,7 +1173,7 @@
@ cdecl _wcsupr_l(wstr ptr) MSVCRT__wcsupr_l
@ cdecl _wcsupr_s(wstr long) MSVCRT__wcsupr_s
@ cdecl _wcsupr_s_l(wstr long ptr) MSVCRT__wcsupr_s_l
@ stub _wcsxfrm_l
@ cdecl _wcsxfrm_l(ptr wstr long ptr) MSVCRT__wcsxfrm_l
@ cdecl _wctime32(ptr) MSVCRT__wctime32
@ stub _wctime32_s
@ cdecl _wctime64(ptr) MSVCRT__wctime64
@ -1530,7 +1530,7 @@
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctob(long) MSVCRT_wctob
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s

View File

@ -1134,7 +1134,7 @@
@ cdecl _wcsupr_l(wstr ptr) MSVCRT__wcsupr_l
@ cdecl _wcsupr_s(wstr long) MSVCRT__wcsupr_s
@ cdecl _wcsupr_s_l(wstr long ptr) MSVCRT__wcsupr_s_l
# stub _wcsxfrm_l(ptr wstr long ptr)
@ cdecl _wcsxfrm_l(ptr wstr long ptr) MSVCRT__wcsxfrm_l
@ cdecl _wctime(ptr) MSVCRT__wctime
@ cdecl _wctime32(ptr) MSVCRT__wctime32
# stub _wctime32_s(ptr long ptr)
@ -1509,7 +1509,7 @@
@ cdecl wcstombs(ptr ptr long) MSVCRT_wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s
@ cdecl wcstoul(wstr ptr long) MSVCRT_wcstoul
@ stub wcsxfrm(ptr wstr long)
@ cdecl wcsxfrm(ptr wstr long) MSVCRT_wcsxfrm
@ cdecl wctob(long) MSVCRT_wctob
@ cdecl wctomb(ptr long) MSVCRT_wctomb
@ cdecl wctomb_s(ptr ptr long long) MSVCRT_wctomb_s

View File

@ -2056,3 +2056,61 @@ int CDECL MSVCRT_wcsncmp(const MSVCRT_wchar_t *str1, const MSVCRT_wchar_t *str2,
{
return strncmpW(str1, str2, n);
}
/*********************************************************************
* _wcsxfrm_l (MSVCRT.@)
*/
MSVCRT_size_t CDECL MSVCRT__wcsxfrm_l(MSVCRT_wchar_t *dest, const MSVCRT_wchar_t *src,
MSVCRT_size_t len, MSVCRT__locale_t locale)
{
MSVCRT_pthreadlocinfo locinfo;
int i, ret;
if(!MSVCRT_CHECK_PMT(src)) return INT_MAX;
if(!MSVCRT_CHECK_PMT(dest || !len)) return INT_MAX;
if(len > INT_MAX) {
FIXME("len > INT_MAX not supported\n");
len = INT_MAX;
}
if(!locale)
locinfo = get_locinfo();
else
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) {
MSVCRT_wcsncpy(dest, src, len);
return strlenW(src);
}
ret = LCMapStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE],
LCMAP_SORTKEY, src, -1, NULL, 0);
if(!ret) {
if(len) dest[0] = 0;
*MSVCRT__errno() = MSVCRT_EILSEQ;
return INT_MAX;
}
if(!len) return ret-1;
if(ret > len) {
dest[0] = 0;
*MSVCRT__errno() = MSVCRT_ERANGE;
return ret-1;
}
ret = LCMapStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE],
LCMAP_SORTKEY, src, -1, dest, len) - 1;
for(i=ret; i>=0; i--)
dest[i] = ((unsigned char*)dest)[i];
return ret;
}
/*********************************************************************
* wcsxfrm (MSVCRT.@)
*/
MSVCRT_size_t CDECL MSVCRT_wcsxfrm(MSVCRT_wchar_t *dest,
const MSVCRT_wchar_t *src, MSVCRT_size_t len)
{
return MSVCRT__wcsxfrm_l(dest, src, len, NULL);
}