mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 00:31:27 +00:00
[CRT] sync strxfrm.c to wine-1.9.16
svn path=/trunk/; revision=72633
This commit is contained in:
parent
77685fe543
commit
a9a1a8f8bd
2 changed files with 51 additions and 28 deletions
|
@ -297,6 +297,7 @@ msvcrt -
|
||||||
reactos/sdk/lib/crt/string/strtok.c # Synced to WineStaging-1.9.16
|
reactos/sdk/lib/crt/string/strtok.c # Synced to WineStaging-1.9.16
|
||||||
reactos/sdk/lib/crt/string/strtok_s.c # Synced to WineStaging-1.9.16
|
reactos/sdk/lib/crt/string/strtok_s.c # Synced to WineStaging-1.9.16
|
||||||
reactos/sdk/lib/crt/string/strtoul.c # Synced to WineStaging-1.9.9
|
reactos/sdk/lib/crt/string/strtoul.c # Synced to WineStaging-1.9.9
|
||||||
|
reactos/sdk/lib/crt/string/strxfrm.c # Synced to Wine-1.9.16
|
||||||
reactos/sdk/lib/crt/string/wcs.c # Synced at 20080611
|
reactos/sdk/lib/crt/string/wcs.c # Synced at 20080611
|
||||||
reactos/sdk/lib/crt/string/wctype.c # Synced at WineStaging-1.9.16
|
reactos/sdk/lib/crt/string/wctype.c # Synced at WineStaging-1.9.16
|
||||||
reactos/sdk/lib/crt/wine/heap.c # Synced at 20080529
|
reactos/sdk/lib/crt/wine/heap.c # Synced at 20080529
|
||||||
|
|
|
@ -1,33 +1,55 @@
|
||||||
/*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS system libraries
|
|
||||||
* FILE: lib/sdk/crt/string/strxfrm.c
|
|
||||||
* PURPOSE: Unknown
|
|
||||||
* PROGRAMER: Unknown
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* 25/11/05: Added license header
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <precomp.h>
|
#include <precomp.h>
|
||||||
|
|
||||||
#if 1
|
#include <locale.h>
|
||||||
/*
|
#include <internal/wine/msvcrt.h>
|
||||||
* @implemented
|
|
||||||
|
size_t CDECL _strxfrm_l( char *dest, const char *src,
|
||||||
|
size_t len, _locale_t locale )
|
||||||
|
{
|
||||||
|
MSVCRT_pthreadlocinfo locinfo;
|
||||||
|
int 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 = ((MSVCRT__locale_t)locale)->locinfo;
|
||||||
|
|
||||||
|
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) {
|
||||||
|
strncpy(dest, src, len);
|
||||||
|
return strlen(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = LCMapStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE],
|
||||||
|
LCMAP_SORTKEY, src, -1, NULL, 0);
|
||||||
|
if(!ret) {
|
||||||
|
if(len) dest[0] = 0;
|
||||||
|
*_errno() = EILSEQ;
|
||||||
|
return INT_MAX;
|
||||||
|
}
|
||||||
|
if(!len) return ret-1;
|
||||||
|
|
||||||
|
if(ret > len) {
|
||||||
|
dest[0] = 0;
|
||||||
|
*_errno() = ERANGE;
|
||||||
|
return ret-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LCMapStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE],
|
||||||
|
LCMAP_SORTKEY, src, -1, dest, len) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
* strxfrm (MSVCRT.@)
|
||||||
*/
|
*/
|
||||||
size_t strxfrm( char *dest, const char *src, size_t n )
|
size_t CDECL strxfrm( char *dest, const char *src, size_t len )
|
||||||
{
|
{
|
||||||
strncpy(dest, src, n);
|
return _strxfrm_l(dest, src, len, NULL);
|
||||||
return strnlen(src, n);
|
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
size_t strxfrm( char *dest, const char *src, size_t n )
|
|
||||||
{
|
|
||||||
int ret = LCMapStringA(LOCALE_USER_DEFAULT,LCMAP_LOWERCASE,
|
|
||||||
src, strlen(src), dest, strlen(dest));
|
|
||||||
|
|
||||||
if ( ret == 0 )
|
|
||||||
return -1;
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in a new issue