ReactOS 0.4.15-dev-5667-ged97270
strxfrm.c File Reference
#include <precomp.h>
#include <locale.h>
#include <internal/wine/msvcrt.h>
Include dependency graph for strxfrm.c:

Go to the source code of this file.

Functions

size_t CDECL _strxfrm_l (char *dest, const char *src, size_t len, _locale_t locale)
 
size_t CDECL strxfrm (char *dest, const char *src, size_t len)
 

Function Documentation

◆ _strxfrm_l()

size_t CDECL _strxfrm_l ( char dest,
const char src,
size_t  len,
_locale_t  locale 
)

Definition at line 6 of file strxfrm.c.

8{
10 int ret;
11
12 if(!MSVCRT_CHECK_PMT(src)) return INT_MAX;
13 if(!MSVCRT_CHECK_PMT(dest || !len)) return INT_MAX;
14
15 if(len > INT_MAX) {
16 FIXME("len > INT_MAX not supported\n");
17 len = INT_MAX;
18 }
19
20 if(!locale)
22 else
23 locinfo = ((MSVCRT__locale_t)locale)->locinfo;
24
25 if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) {
27 return strlen(src);
28 }
29
31 LCMAP_SORTKEY, src, -1, NULL, 0);
32 if(!ret) {
33 if(len) dest[0] = 0;
34 *_errno() = EILSEQ;
35 return INT_MAX;
36 }
37 if(!len) return ret-1;
38
39 if(ret > len) {
40 dest[0] = 0;
41 *_errno() = ERANGE;
42 return ret-1;
43 }
44
45 return LCMapStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE],
46 LCMAP_SORTKEY, src, -1, dest, len) - 1;
47}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ERANGE
Definition: acclib.h:92
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: _locale.h:75
#define NULL
Definition: types.h:112
GLenum src
Definition: glext.h:6340
GLenum GLsizei len
Definition: glext.h:6722
#define INT_MAX
Definition: limits.h:40
INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
Definition: lang.c:2051
#define MSVCRT_CHECK_PMT(x)
Definition: mbstowcs_s.c:26
#define MSVCRT_LC_COLLATE
Definition: msvcrt.h:651
struct MSVCRT_localeinfo_struct * MSVCRT__locale_t
static char * dest
Definition: rtl.c:135
else locinfo
Definition: scanf.h:159
_CRTIMP int *__cdecl _errno(void)
Definition: errno.c:19
#define EILSEQ
Definition: errno.h:109
int ret
#define get_locinfo()
Definition: winesup.h:25
#define LCMAP_SORTKEY
Definition: winnls.h:186

Referenced by strxfrm().

◆ strxfrm()

size_t CDECL strxfrm ( char dest,
const char src,
size_t  len 
)

Definition at line 52 of file strxfrm.c.

53{
54 return _strxfrm_l(dest, src, len, NULL);
55}
size_t CDECL _strxfrm_l(char *dest, const char *src, size_t len, _locale_t locale)
Definition: strxfrm.c:6