ReactOS 0.4.16-dev-2104-gb84fa49
wcs.c File Reference
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <assert.h>
#include <wchar.h>
#include <wctype.h>
#include "msvcrt.h"
#include "winnls.h"
#include "wtypes.h"
#include "wine/debug.h"
#include "printf.h"
Include dependency graph for wcs.c:

Go to the source code of this file.

Classes

struct  pf_flags
 

Macros

#define _NO_CRT_STDIO_INLINE
 
#define PRINTF_WIDE
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msvcrt)
 
wchar_t *CDECL _wcsdup (const wchar_t *str)
 
wint_t CDECL _towlower_l (wint_t c, _locale_t locale)
 
wint_t CDECL towlower (wint_t c)
 
INT CDECL _wcsicmp_l (const wchar_t *str1, const wchar_t *str2, _locale_t locale)
 
wint_t CDECL towctrans (wint_t c, wctrans_t category)
 
INT CDECL _wcsicmp (const wchar_t *str1, const wchar_t *str2)
 
INT CDECL _wcsnicmp_l (const wchar_t *str1, const wchar_t *str2, size_t n, _locale_t locale)
 
INT CDECL _wcsnicmp (const wchar_t *str1, const wchar_t *str2, size_t n)
 
int CDECL _wcsicoll_l (const wchar_t *str1, const wchar_t *str2, _locale_t locale)
 
INT CDECL _wcsicoll (const wchar_t *str1, const wchar_t *str2)
 
int CDECL _wcsnicoll_l (const wchar_t *str1, const wchar_t *str2, size_t count, _locale_t locale)
 
INT CDECL _wcsnicoll (const wchar_t *str1, const wchar_t *str2, size_t count)
 
wchar_t *CDECL _wcsnset (wchar_t *str, wchar_t c, size_t n)
 
int CDECL _wcsnset_s (wchar_t *str, size_t size, wchar_t c, size_t count)
 
wchar_t *CDECL _wcsrev (wchar_t *str)
 
int CDECL _wcsset_s (wchar_t *str, size_t n, wchar_t c)
 
wchar_t *CDECL _wcsset (wchar_t *str, wchar_t c)
 
int CDECL _wcsupr_s_l (wchar_t *str, size_t n, _locale_t locale)
 
INT CDECL _wcsupr_s (wchar_t *str, size_t n)
 
wchar_t *CDECL _wcsupr_l (wchar_t *str, _locale_t locale)
 
wchar_t *CDECL _wcsupr (wchar_t *str)
 
int CDECL _wcslwr_s_l (wchar_t *str, size_t n, _locale_t locale)
 
int CDECL _wcslwr_s (wchar_t *str, size_t n)
 
wchar_t *CDECL _wcslwr_l (wchar_t *str, _locale_t locale)
 
wchar_t *CDECL _wcslwr (wchar_t *str)
 
size_t __cdecl wcscspn (const wchar_t *str, const wchar_t *reject)
 
size_t __cdecl wcsspn (const wchar_t *str, const wchar_t *accept)
 
int CDECL wcsncmp (const wchar_t *str1, const wchar_t *str2, size_t n)
 
int CDECL _wcsncoll_l (const wchar_t *str1, const wchar_t *str2, size_t count, _locale_t locale)
 
int CDECL _wcsncoll (const wchar_t *str1, const wchar_t *str2, size_t count)
 
static wchar_t strtod_wstr_get (void *ctx)
 
static void strtod_wstr_unget (void *ctx)
 
double CDECL _wcstod_l (const wchar_t *str, wchar_t **end, _locale_t locale)
 
static size_t wcsrtombs_l (char *mbstr, const wchar_t **wcstr, size_t count, _locale_t locale)
 
size_t CDECL _wcstombs_l (char *mbstr, const wchar_t *wcstr, size_t count, _locale_t locale)
 
size_t CDECL wcstombs (char *mbstr, const wchar_t *wcstr, size_t count)
 
size_t CDECL wcsrtombs (char *mbstr, const wchar_t **wcstr, size_t count, mbstate_t *mbstate)
 
static int wcsrtombs_s_l (size_t *ret, char *mbstr, size_t size, const wchar_t **wcstr, size_t count, _locale_t locale)
 
int CDECL _wcstombs_s_l (size_t *ret, char *mbstr, size_t size, const wchar_t *wcstr, size_t count, _locale_t locale)
 
int CDECL wcstombs_s (size_t *ret, char *mbstr, size_t size, const wchar_t *wcstr, size_t count)
 
int CDECL wcsrtombs_s (size_t *ret, char *mbstr, size_t size, const wchar_t **wcstr, size_t count, mbstate_t *mbstate)
 
double CDECL wcstod (const wchar_t *lpszStr, wchar_t **end)
 
double CDECL _wtof (const wchar_t *str)
 
double CDECL _wtof_l (const wchar_t *str, _locale_t locale)
 
printf_arg arg_clbk_valist (void *ctx, int arg_pos, int type, va_list *valist)
 
printf_arg arg_clbk_positional (void *ctx, int pos, int type, va_list *valist)
 
int CDECL _vsnprintf (char *str, size_t len, const char *format, va_list valist)
 
int CDECL _vsnprintf_l (char *str, size_t len, const char *format, _locale_t locale, va_list valist)
 
int CDECL _vsprintf_l (char *str, const char *format, _locale_t locale, va_list valist)
 
int WINAPIV _sprintf_l (char *str, const char *format, _locale_t locale,...)
 
static int CDECL vsnprintf_s_l_opt (char *str, size_t sizeOfBuffer, size_t count, const char *format, DWORD options, _locale_t locale, va_list valist)
 
static int vsnwprintf_s_l_opt (wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, DWORD options, _locale_t locale, va_list valist)
 
int CDECL _vsnprintf_s_l (char *str, size_t sizeOfBuffer, size_t count, const char *format, _locale_t locale, va_list valist)
 
int CDECL _vsprintf_s_l (char *str, size_t count, const char *format, _locale_t locale, va_list valist)
 
int WINAPIV _sprintf_s_l (char *str, size_t count, const char *format, _locale_t locale,...)
 
int CDECL _vsnprintf_s (char *str, size_t sizeOfBuffer, size_t count, const char *format, va_list valist)
 
int CDECL _vsnprintf_c_l (char *str, size_t len, const char *format, _locale_t locale, va_list valist)
 
int CDECL _vsnprintf_c (char *str, size_t len, const char *format, va_list valist)
 
int CDECL vsprintf (char *str, const char *format, va_list valist)
 
int CDECL vsprintf_s (char *str, size_t num, const char *format, va_list valist)
 
int CDECL _vscprintf (const char *format, va_list valist)
 
int CDECL _vscprintf_l (const char *format, _locale_t locale, va_list valist)
 
int CDECL _vscprintf_p_l (const char *format, _locale_t locale, va_list args)
 
int CDECL _vscprintf_p (const char *format, va_list argptr)
 
int WINAPIV _snprintf (char *str, size_t len, const char *format,...)
 
int WINAPIV _snprintf_l (char *str, size_t count, const char *format, _locale_t locale,...)
 
int WINAPIV _snprintf_c_l (char *str, size_t count, const char *format, _locale_t locale,...)
 
int WINAPIV _snprintf_c (char *str, size_t count, const char *format,...)
 
int WINAPIV _snprintf_s_l (char *str, size_t len, size_t count, const char *format, _locale_t locale,...)
 
int WINAPIV _snprintf_s (char *str, size_t len, size_t count, const char *format,...)
 
int WINAPIV _scprintf (const char *format,...)
 
int WINAPIV _scprintf_l (const char *format, _locale_t locale,...)
 
int WINAPIV _scprintf_p (const char *format,...)
 
int WINAPIV _scprintf_p_l (const char *format, _locale_t locale,...)
 
int CDECL _vsnwprintf (wchar_t *str, size_t len, const wchar_t *format, va_list valist)
 
int CDECL _vsnwprintf_l (wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist)
 
int CDECL _vswprintf_c_l (wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist)
 
int CDECL _vswprintf_c (wchar_t *str, size_t len, const wchar_t *format, va_list valist)
 
static int vswprintf_p_l_opt (wchar_t *buffer, size_t length, const wchar_t *format, DWORD options, _locale_t locale, va_list args)
 
int CDECL _vswprintf_p_l (wchar_t *buffer, size_t length, const wchar_t *format, _locale_t locale, va_list args)
 
int CDECL _vsnwprintf_s_l (wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, _locale_t locale, va_list valist)
 
int CDECL _vsnwprintf_s (wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, va_list valist)
 
int WINAPIV _snwprintf (wchar_t *str, size_t len, const wchar_t *format,...)
 
int WINAPIV _snwprintf_l (wchar_t *str, size_t len, const wchar_t *format, _locale_t locale,...)
 
int WINAPIV _snwprintf_s (wchar_t *str, size_t len, size_t count, const wchar_t *format,...)
 
int WINAPIV _snwprintf_s_l (wchar_t *str, size_t len, size_t count, const wchar_t *format, _locale_t locale,...)
 
int WINAPIV sprintf (char *str, const char *format,...)
 
int WINAPIV sprintf_s (char *str, size_t num, const char *format,...)
 
int WINAPIV _scwprintf_l (const wchar_t *format, _locale_t locale,...)
 
int WINAPIV _scwprintf_p_l (const wchar_t *format, _locale_t locale,...)
 
int WINAPIV _scwprintf (const wchar_t *format,...)
 
int WINAPIV _swprintf (wchar_t *str, const wchar_t *format,...)
 
int WINAPIV swprintf_s (wchar_t *str, size_t numberOfElements, const wchar_t *format,...)
 
int WINAPIV _swprintf_s_l (wchar_t *str, size_t numberOfElements, const wchar_t *format, _locale_t locale,...)
 
int WINAPIV _swprintf_c_l (wchar_t *str, size_t len, const wchar_t *format, _locale_t locale,...)
 
int WINAPIV _swprintf_c (wchar_t *str, size_t len, const wchar_t *format,...)
 
int CDECL _vswprintf (wchar_t *str, const wchar_t *format, va_list args)
 
int CDECL _vswprintf_l (wchar_t *str, const wchar_t *format, _locale_t locale, va_list args)
 
int CDECL _vscwprintf (const wchar_t *format, va_list args)
 
int CDECL _vscwprintf_l (const wchar_t *format, _locale_t locale, va_list args)
 
int CDECL _vscwprintf_p_l (const wchar_t *format, _locale_t locale, va_list args)
 
int CDECL vswprintf_s (wchar_t *str, size_t numberOfElements, const wchar_t *format, va_list args)
 
int CDECL _vswprintf_s_l (wchar_t *str, size_t numberOfElements, const wchar_t *format, _locale_t locale, va_list args)
 
static int vsprintf_p_l_opt (char *buffer, size_t length, const char *format, DWORD options, _locale_t locale, va_list args)
 
int CDECL _vsprintf_p_l (char *buffer, size_t length, const char *format, _locale_t locale, va_list args)
 
int CDECL _vsprintf_p (char *buffer, size_t length, const char *format, va_list args)
 
int WINAPIV _sprintf_p_l (char *buffer, size_t length, const char *format, _locale_t locale,...)
 
int WINAPIV __swprintf_l (wchar_t *str, const wchar_t *format, _locale_t locale,...)
 
int WINAPIV _swprintf_p (wchar_t *buffer, size_t length, const wchar_t *format,...)
 
int WINAPIV _swprintf_p_l (wchar_t *buffer, size_t length, const wchar_t *format, _locale_t locale,...)
 
int CDECL wcscmp (const wchar_t *str1, const wchar_t *str2)
 
int CDECL _wcscoll_l (const wchar_t *str1, const wchar_t *str2, _locale_t locale)
 
int CDECL wcscoll (const wchar_t *str1, const wchar_t *str2)
 
wchar_t *CDECL wcspbrk (const wchar_t *str, const wchar_t *accept)
 
wchar_t *CDECL wcstok_s (wchar_t *str, const wchar_t *delim, wchar_t **next_token)
 
wchar_t *CDECL wcstok (wchar_t *str, const wchar_t *delim)
 
int CDECL _wctomb_s_l (int *len, char *mbchar, size_t size, wchar_t wch, _locale_t locale)
 
int CDECL wctomb_s (int *len, char *mbchar, size_t size, wchar_t wch)
 
int CDECL _wctomb_l (char *dst, wchar_t ch, _locale_t locale)
 
INT CDECL wctomb (char *dst, wchar_t ch)
 
INT CDECL wctob (wint_t wchar)
 
INT CDECL wcrtomb_s (size_t *len, char *mbchar, size_t size, wchar_t wch, mbstate_t *s)
 
size_t CDECL wcrtomb (char *dst, wchar_t ch, mbstate_t *s)
 
INT CDECL _iswctype_l (wchar_t wc, wctype_t type, _locale_t locale)
 
INT CDECL iswctype (wchar_t wc, wctype_t type)
 
int CDECL _iswalnum_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswalnum (wchar_t wc)
 
INT CDECL _iswalpha_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswalpha (wchar_t wc)
 
int CDECL _iswcntrl_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswcntrl (wchar_t wc)
 
INT CDECL _iswdigit_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswdigit (wchar_t wc)
 
int CDECL _iswgraph_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswgraph (wchar_t wc)
 
int CDECL _iswlower_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswlower (wchar_t wc)
 
int CDECL _iswprint_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswprint (wchar_t wc)
 
INT CDECL _iswpunct_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswpunct (wchar_t wc)
 
INT CDECL _iswspace_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswspace (wchar_t wc)
 
int CDECL _iswupper_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswupper (wchar_t wc)
 
int CDECL _iswxdigit_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswxdigit (wchar_t wc)
 
INT CDECL _iswblank_l (wchar_t wc, _locale_t locale)
 
INT CDECL iswblank (wchar_t wc)
 
INT CDECL wcscpy_s (wchar_t *wcDest, size_t numElement, const wchar_t *wcSrc)
 
wchar_t *__cdecl wcscpy (wchar_t *dst, const wchar_t *src)
 
wchar_t *__cdecl wcsncpy (wchar_t *s1, const wchar_t *s2, size_t n)
 
INT CDECL wcsncpy_s (wchar_t *dst, size_t elem, const wchar_t *src, size_t count)
 
INT CDECL wcscat_s (wchar_t *dst, size_t elem, const wchar_t *src)
 
wchar_t *__cdecl wcscat (wchar_t *dst, const wchar_t *src)
 
errno_t CDECL wcsncat_s (wchar_t *dst, size_t elem, const wchar_t *src, size_t count)
 
wchar_t *__cdecl wcsncat (wchar_t *s1, const wchar_t *s2, size_t n)
 
static int wctoint (WCHAR c, int base)
 
__int64 CDECL _wcstoi64_l (const wchar_t *nptr, wchar_t **endptr, int base, _locale_t locale)
 
__int64 CDECL _wcstoi64 (const wchar_t *nptr, wchar_t **endptr, int base)
 
__msvcrt_long CDECL _wcstol_l (const wchar_t *s, wchar_t **end, int base, _locale_t locale)
 
__msvcrt_long CDECL wcstol (const wchar_t *s, wchar_t **end, int base)
 
int __cdecl _wtoi_l (const wchar_t *str, _locale_t locale)
 
int __cdecl _wtoi (const wchar_t *str)
 
__msvcrt_long __cdecl _wtol_l (const wchar_t *str, _locale_t locale)
 
__msvcrt_long __cdecl _wtol (const wchar_t *str)
 
unsigned __int64 CDECL _wcstoui64_l (const wchar_t *nptr, wchar_t **endptr, int base, _locale_t locale)
 
unsigned __int64 CDECL _wcstoui64 (const wchar_t *nptr, wchar_t **endptr, int base)
 
__msvcrt_ulong __cdecl _wcstoul_l (const wchar_t *s, wchar_t **end, int base, _locale_t locale)
 
__msvcrt_ulong __cdecl wcstoul (const wchar_t *s, wchar_t **end, int base)
 
size_t CDECL wcsnlen (const wchar_t *s, size_t maxlen)
 
wint_t CDECL _towupper_l (wint_t c, _locale_t locale)
 
wint_t CDECL towupper (wint_t c)
 
wchar_t *CDECL wcschr (const wchar_t *str, wchar_t ch)
 
wchar_t *CDECL wcsrchr (const wchar_t *str, wchar_t ch)
 
size_t CDECL wcslen (const wchar_t *str)
 
wchar_t *CDECL wcsstr (const wchar_t *str, const wchar_t *sub)
 
__int64 CDECL _wtoi64_l (const wchar_t *str, _locale_t locale)
 
__int64 CDECL _wtoi64 (const wchar_t *str)
 
size_t CDECL _wcsxfrm_l (wchar_t *dest, const wchar_t *src, size_t len, _locale_t locale)
 
size_t CDECL wcsxfrm (wchar_t *dest, const wchar_t *src, size_t len)
 

Variables

static BOOL n_format_enabled = TRUE
 

Macro Definition Documentation

◆ _NO_CRT_STDIO_INLINE

#define _NO_CRT_STDIO_INLINE

Definition at line 22 of file wcs.c.

◆ PRINTF_WIDE

#define PRINTF_WIDE

Definition at line 52 of file wcs.c.

Function Documentation

◆ __swprintf_l()

int WINAPIV __swprintf_l ( wchar_t str,
const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1909 of file wcs.c.

1911{
1912 int retval;
1916 va_end(valist);
1917 return retval;
1918}
Definition: _locale.h:75
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
int CDECL _vswprintf_l(wchar_t *str, const wchar_t *format, _locale_t locale, va_list args)
Definition: wcs.c:1773
static va_list valist
Definition: printf.c:46
const WCHAR * str
Definition: format.c:58
int retval
Definition: wcstombs.cpp:91

◆ _iswalnum_l()

int CDECL _iswalnum_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2247 of file wcs.c.

2248{
2249 return _iswctype_l( wc, _ALPHA | _DIGIT, locale );
2250}
#define _ALPHA
#define _DIGIT
INT CDECL _iswctype_l(wchar_t wc, wctype_t type, _locale_t locale)
Definition: wcs.c:2221

◆ _iswalpha_l()

INT CDECL _iswalpha_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2263 of file wcs.c.

2264{
2265 return _iswctype_l( wc, _ALPHA, locale );
2266}

◆ _iswblank_l()

INT CDECL _iswblank_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2423 of file wcs.c.

2424{
2425 return wc == '\t' || _iswctype_l( wc, _BLANK, locale );
2426}
#define _BLANK

◆ _iswcntrl_l()

int CDECL _iswcntrl_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2279 of file wcs.c.

2280{
2281 return _iswctype_l( wc, _CONTROL, locale );
2282}
#define _CONTROL

◆ _iswctype_l()

INT CDECL _iswctype_l ( wchar_t  wc,
wctype_t  type,
_locale_t  locale 
)

Definition at line 2221 of file wcs.c.

2222{
2223 WORD ct;
2224
2225 if (wc == WEOF) return 0;
2226 if (wc < 256) return MSVCRT__pwctype[wc] & type;
2227
2228 if (!GetStringTypeW(CT_CTYPE1, &wc, 1, &ct))
2229 {
2230 ERR("GetStringTypeW failed for %x\n", wc);
2231 return 0;
2232 }
2233 return ct & type;
2234}
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3098
WORD * MSVCRT__pwctype
Definition: ctype.c:128
#define WEOF
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CT_CTYPE1
Definition: winnls.h:255

Referenced by _iswalnum_l(), _iswalpha_l(), _iswblank_l(), _iswcntrl_l(), _iswdigit_l(), _iswgraph_l(), _iswlower_l(), _iswprint_l(), _iswpunct_l(), _iswspace_l(), _iswupper_l(), _iswxdigit_l(), iswblank(), and iswctype().

◆ _iswdigit_l()

INT CDECL _iswdigit_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2295 of file wcs.c.

2296{
2297 return _iswctype_l( wc, _DIGIT, locale );
2298}

◆ _iswgraph_l()

int CDECL _iswgraph_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2311 of file wcs.c.

2312{
2313 return _iswctype_l( wc, _ALPHA | _DIGIT | _PUNCT, locale );
2314}
#define _PUNCT

◆ _iswlower_l()

int CDECL _iswlower_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2327 of file wcs.c.

2328{
2329 return _iswctype_l( wc, _LOWER, locale );
2330}
#define _LOWER

◆ _iswprint_l()

int CDECL _iswprint_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2343 of file wcs.c.

2344{
2345 return _iswctype_l( wc, _ALPHA | _BLANK | _DIGIT | _PUNCT, locale );
2346}

◆ _iswpunct_l()

INT CDECL _iswpunct_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2359 of file wcs.c.

2360{
2361 return _iswctype_l( wc, _PUNCT, locale );
2362}

◆ _iswspace_l()

INT CDECL _iswspace_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2375 of file wcs.c.

2376{
2377 return _iswctype_l( wc, _SPACE, locale );
2378}
#define _SPACE

◆ _iswupper_l()

int CDECL _iswupper_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2391 of file wcs.c.

2392{
2393 return _iswctype_l( wc, _UPPER, locale );
2394}
#define _UPPER

◆ _iswxdigit_l()

int CDECL _iswxdigit_l ( wchar_t  wc,
_locale_t  locale 
)

Definition at line 2407 of file wcs.c.

2408{
2409 return _iswctype_l( wc, _HEX, locale );
2410}
#define _HEX

◆ _scprintf()

int WINAPIV _scprintf ( const char format,
  ... 
)

Definition at line 1313 of file wcs.c.

1314{
1315 int retval;
1319 va_end(valist);
1320 return retval;
1321}
#define _vscprintf
Definition: _vscprintf.c:25

◆ _scprintf_l()

int WINAPIV _scprintf_l ( const char format,
_locale_t  locale,
  ... 
)

Definition at line 1326 of file wcs.c.

1327{
1328 int retval;
1332 va_end(valist);
1333 return retval;
1334}
int CDECL _vscprintf_l(const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1184

◆ _scprintf_p()

int WINAPIV _scprintf_p ( const char format,
  ... 
)

Definition at line 1339 of file wcs.c.

1340{
1341 int retval;
1345 va_end(valist);
1346 return retval;
1347}
#define NULL
Definition: types.h:112
int CDECL _vscprintf_p_l(const char *format, _locale_t locale, va_list args)
Definition: wcs.c:1193

◆ _scprintf_p_l()

int WINAPIV _scprintf_p_l ( const char format,
_locale_t  locale,
  ... 
)

Definition at line 1352 of file wcs.c.

1353{
1354 int retval;
1358 va_end(valist);
1359 return retval;
1360}

◆ _scwprintf()

int WINAPIV _scwprintf ( const wchar_t format,
  ... 
)

Definition at line 1673 of file wcs.c.

1674{
1675 va_list ap;
1676 int r;
1677
1678 va_start( ap, format );
1680 va_end( ap );
1681 return r;
1682}
#define INT_MAX
Definition: limits.h:26
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define _vsnwprintf
Definition: _vsnwprintf.c:28
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36

◆ _scwprintf_l()

int WINAPIV _scwprintf_l ( const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1629 of file wcs.c.

1630{
1631 va_list ap;
1632 int r;
1633
1634 va_start( ap, locale );
1636 va_end( ap );
1637 return r;
1638}
int CDECL _vsnwprintf_l(wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist)
Definition: wcs.c:1380

◆ _scwprintf_p_l()

int WINAPIV _scwprintf_p_l ( const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1643 of file wcs.c.

1644{
1645 va_list ap;
1646 int r;
1647
1648 va_start( ap, locale );
1650 va_end( ap );
1651 return r;
1652}
static int vswprintf_p_l_opt(wchar_t *buffer, size_t length, const wchar_t *format, DWORD options, _locale_t locale, va_list args)
Definition: wcs.c:1410

◆ _snprintf()

int WINAPIV _snprintf ( char str,
size_t  len,
const char format,
  ... 
)

Definition at line 1231 of file wcs.c.

1232{
1233 int retval;
1237 va_end(valist);
1238 return retval;
1239}
GLenum GLsizei len
Definition: glext.h:6722
#define vsnprintf
Definition: tif_win32.c:406

◆ _snprintf_c()

int WINAPIV _snprintf_c ( char str,
size_t  count,
const char format,
  ... 
)

Definition at line 1272 of file wcs.c.

1273{
1274 int retval;
1278 va_end(valist);
1279 return retval;
1280}
int CDECL _vsnprintf_c(char *str, size_t len, const char *format, va_list valist)
Definition: wcs.c:1101
GLuint GLuint GLsizei count
Definition: gl.h:1545

◆ _snprintf_c_l()

int WINAPIV _snprintf_c_l ( char str,
size_t  count,
const char format,
_locale_t  locale,
  ... 
)

Definition at line 1258 of file wcs.c.

1260{
1261 int retval;
1265 va_end(valist);
1266 return retval;
1267}
int CDECL _vsnprintf_c_l(char *str, size_t len, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1092

◆ _snprintf_l()

int WINAPIV _snprintf_l ( char str,
size_t  count,
const char format,
_locale_t  locale,
  ... 
)

Definition at line 1244 of file wcs.c.

1246{
1247 int retval;
1251 va_end(valist);
1252 return retval;
1253}
int CDECL _vsnprintf_l(char *str, size_t len, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:949

◆ _snprintf_s()

int WINAPIV _snprintf_s ( char str,
size_t  len,
size_t  count,
const char format,
  ... 
)

Definition at line 1299 of file wcs.c.

1301{
1302 int retval;
1306 va_end(valist);
1307 return retval;
1308}
int CDECL _vsnprintf_s_l(char *str, size_t sizeOfBuffer, size_t count, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1050

◆ _snprintf_s_l()

int WINAPIV _snprintf_s_l ( char str,
size_t  len,
size_t  count,
const char format,
_locale_t  locale,
  ... 
)

Definition at line 1285 of file wcs.c.

1287{
1288 int retval;
1292 va_end(valist);
1293 return retval;
1294}

◆ _snwprintf()

◆ _snwprintf_l()

int WINAPIV _snwprintf_l ( wchar_t str,
size_t  len,
const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1506 of file wcs.c.

1508{
1509 int retval;
1513 va_end(valist);
1514 return retval;
1515}

◆ _snwprintf_s()

int WINAPIV _snwprintf_s ( wchar_t str,
size_t  len,
size_t  count,
const wchar_t format,
  ... 
)

Definition at line 1520 of file wcs.c.

1522{
1523 int retval;
1527 va_end(valist);
1528 return retval;
1529}
int CDECL _vsnwprintf_s_l(wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, _locale_t locale, va_list valist)
Definition: wcs.c:1473

Referenced by _VCrtDbgReportW(), and common_message_window().

◆ _snwprintf_s_l()

int WINAPIV _snwprintf_s_l ( wchar_t str,
size_t  len,
size_t  count,
const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1534 of file wcs.c.

1536{
1537 int retval;
1541 va_end(valist);
1542 return retval;
1543}

◆ _sprintf_l()

int WINAPIV _sprintf_l ( char str,
const char format,
_locale_t  locale,
  ... 
)

Definition at line 974 of file wcs.c.

976{
977 int retval;
981 va_end(valist);
982 return retval;
983}

◆ _sprintf_p_l()

int WINAPIV _sprintf_p_l ( char buffer,
size_t  length,
const char format,
_locale_t  locale,
  ... 
)

Definition at line 1893 of file wcs.c.

1895{
1897 int r;
1898
1901 va_end(valist);
1902
1903 return r;
1904}
int CDECL _vsprintf_p_l(char *buffer, size_t length, const char *format, _locale_t locale, va_list args)
Definition: wcs.c:1862
GLuint buffer
Definition: glext.h:5915
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

◆ _sprintf_s_l()

int WINAPIV _sprintf_s_l ( char str,
size_t  count,
const char format,
_locale_t  locale,
  ... 
)

Definition at line 1069 of file wcs.c.

1071{
1072 int retval;
1076 va_end(valist);
1077 return retval;
1078}

◆ _swprintf()

int WINAPIV _swprintf ( wchar_t str,
const wchar_t format,
  ... 
)

Definition at line 1687 of file wcs.c.

1688{
1689 va_list ap;
1690 int r;
1691
1692 va_start( ap, format );
1693 r = _vsnwprintf( str, INT_MAX, format, ap );
1694 va_end( ap );
1695 return r;
1696}

Referenced by get_manifest_in_pe_file(), and Test_VerQueryValueW().

◆ _swprintf_c()

int WINAPIV _swprintf_c ( wchar_t str,
size_t  len,
const wchar_t format,
  ... 
)

Definition at line 1749 of file wcs.c.

1751{
1752 va_list ap;
1753 int r;
1754
1755 va_start(ap, format);
1756 r = _vswprintf_c(str, len, format, ap);
1757 va_end(ap);
1758
1759 return r;
1760}
int CDECL _vswprintf_c(wchar_t *str, size_t len, const wchar_t *format, va_list valist)
Definition: wcs.c:1404

◆ _swprintf_c_l()

int WINAPIV _swprintf_c_l ( wchar_t str,
size_t  len,
const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1733 of file wcs.c.

1735{
1736 va_list ap;
1737 int r;
1738
1739 va_start(ap, locale);
1741 va_end(ap);
1742
1743 return r;
1744}
int CDECL _vswprintf_c_l(wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist)
Definition: wcs.c:1395

◆ _swprintf_p()

int WINAPIV _swprintf_p ( wchar_t buffer,
size_t  length,
const wchar_t format,
  ... 
)

Definition at line 1940 of file wcs.c.

1942{
1944 int r;
1945
1948 va_end(valist);
1949
1950 return r;
1951}

◆ _swprintf_p_l()

int WINAPIV _swprintf_p_l ( wchar_t buffer,
size_t  length,
const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1956 of file wcs.c.

1958{
1960 int r;
1961
1964 va_end(valist);
1965
1966 return r;
1967}

◆ _swprintf_s_l()

int WINAPIV _swprintf_s_l ( wchar_t str,
size_t  numberOfElements,
const wchar_t format,
_locale_t  locale,
  ... 
)

Definition at line 1717 of file wcs.c.

1719{
1720 va_list ap;
1721 int r;
1722
1723 va_start(ap, locale);
1725 va_end(ap);
1726
1727 return r;
1728}
static size_t numberOfElements
Definition: string.c:98

◆ _towlower_l()

wint_t CDECL _towlower_l ( wint_t  c,
_locale_t  locale 
)

Definition at line 96 of file wcs.c.

97{
99 wchar_t ret;
100
101 if(!locale)
103 else
104 locinfo = locale->locinfo;
105
106 if(!locinfo->lc_handle[LC_CTYPE]) {
107 if(c >= 'A' && c <= 'Z')
108 return c + 'a' - 'A';
109 return c;
110 }
111
112 if(!LCMapStringW(locinfo->lc_handle[LC_CTYPE], LCMAP_LOWERCASE, &c, 1, &ret, 1))
113 return c;
114 return ret;
115}
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: locale.c:3808
#define LC_CTYPE
Definition: locale.h:27
else locinfo
Definition: scanf.h:225
return ret
Definition: mutex.c:146
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define get_locinfo()
Definition: winesup.h:25
#define LCMAP_LOWERCASE
Definition: winnls.h:197

Referenced by _wcsicmp_l(), _wcslwr_s_l(), _wcsnicmp_l(), towctrans(), and towlower().

◆ _towupper_l()

wint_t CDECL _towupper_l ( wint_t  c,
_locale_t  locale 
)

Definition at line 2932 of file wcs.c.

2933{
2935 wchar_t ret;
2936
2937 if(!locale)
2938 locinfo = get_locinfo();
2939 else
2940 locinfo = locale->locinfo;
2941
2942 if(!locinfo->lc_handle[LC_CTYPE]) {
2943 if(c >= 'a' && c <= 'z')
2944 return c + 'A' - 'a';
2945 return c;
2946 }
2947
2948 if(!LCMapStringW(locinfo->lc_handle[LC_CTYPE], LCMAP_UPPERCASE, &c, 1, &ret, 1))
2949 return c;
2950 return ret;
2951}
#define LCMAP_UPPERCASE
Definition: winnls.h:198

Referenced by _wcsupr_s_l(), towctrans(), and towupper().

◆ _vscprintf()

int CDECL _vscprintf ( const char format,
va_list  valist 
)

Definition at line 1176 of file wcs.c.

1177{
1178 return _vsnprintf_l( NULL, INT_MAX, format, NULL, valist );
1179}

◆ _vscprintf_l()

int CDECL _vscprintf_l ( const char format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1184 of file wcs.c.

1186{
1188}

Referenced by _scprintf_l().

◆ _vscprintf_p()

int CDECL _vscprintf_p ( const char format,
va_list  argptr 
)

Definition at line 1223 of file wcs.c.

1224{
1225 return _vscprintf_p_l(format, NULL, argptr);
1226}

◆ _vscprintf_p_l()

int CDECL _vscprintf_p_l ( const char format,
_locale_t  locale,
va_list  args 
)

Definition at line 1193 of file wcs.c.

1195{
1196 printf_arg args_ctx[_ARGMAX+1];
1197 struct _str_ctx_a puts_ctx = {INT_MAX, NULL};
1198 int ret;
1199
1200 memset(args_ctx, 0, sizeof(args_ctx));
1201
1202 ret = create_positional_ctx_a(args_ctx, format, args);
1203 if(ret < 0) {
1205 *_errno() = EINVAL;
1206 return ret;
1207 } else if(ret == 0) {
1208 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1211 } else {
1212 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1214 arg_clbk_positional, args_ctx, NULL);
1215 }
1216
1217 return ret;
1218}
void __cdecl _invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t arg)
Definition: errno.c:461
int *CDECL _errno(void)
Definition: errno.c:215
#define _ARGMAX
Definition: corecrt.h:157
#define EINVAL
Definition: errno.h:44
int pf_printf_a(puts_clbk_a, void *, const char *, _locale_t, DWORD, args_clbk, void *, va_list *)
#define MSVCRT_PRINTF_POSITIONAL_PARAMS
Definition: msvcrt.h:409
int create_positional_ctx_a(void *, const char *, va_list)
#define MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER
Definition: msvcrt.h:410
printf_arg arg_clbk_valist(void *ctx, int arg_pos, int type, va_list *valist)
Definition: wcs.c:847
printf_arg arg_clbk_positional(void *ctx, int pos, int type, va_list *valist)
Definition: wcs.c:870
#define memset(x, y, z)
Definition: compat.h:39
Definition: match.c:390

Referenced by _scprintf_p(), _scprintf_p_l(), and _vscprintf_p().

◆ _vscwprintf()

int CDECL _vscwprintf ( const wchar_t format,
va_list  args 
)

Definition at line 1782 of file wcs.c.

1783{
1784 return _vsnwprintf( NULL, INT_MAX, format, args );
1785}

◆ _vscwprintf_l()

int CDECL _vscwprintf_l ( const wchar_t format,
_locale_t  locale,
va_list  args 
)

Definition at line 1790 of file wcs.c.

1791{
1793}

◆ _vscwprintf_p_l()

int CDECL _vscwprintf_p_l ( const wchar_t format,
_locale_t  locale,
va_list  args 
)

Definition at line 1798 of file wcs.c.

1799{
1801}

◆ _vsnprintf()

int CDECL _vsnprintf ( char str,
size_t  len,
const char format,
va_list  valist 
)

Definition at line 881 of file wcs.c.

882{
883 static const char nullbyte = '\0';
884 struct _str_ctx_a ctx = {len, str};
885 int ret;
886
887 ret = pf_printf_a(puts_clbk_str_a, &ctx, format, NULL, 0,
889 puts_clbk_str_a(&ctx, 1, &nullbyte);
890 return ret;
891}

◆ _vsnprintf_c()

int CDECL _vsnprintf_c ( char str,
size_t  len,
const char format,
va_list  valist 
)

Definition at line 1101 of file wcs.c.

1103{
1104 return _vsnprintf_c_l(str, len, format, NULL, valist);
1105}

Referenced by _snprintf_c().

◆ _vsnprintf_c_l()

int CDECL _vsnprintf_c_l ( char str,
size_t  len,
const char format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1092 of file wcs.c.

1094{
1096}
static int CDECL vsnprintf_s_l_opt(char *str, size_t sizeOfBuffer, size_t count, const char *format, DWORD options, _locale_t locale, va_list valist)
Definition: wcs.c:985

Referenced by _snprintf_c_l(), and _vsnprintf_c().

◆ _vsnprintf_l()

int CDECL _vsnprintf_l ( char str,
size_t  len,
const char format,
_locale_t  locale,
va_list  valist 
)

Definition at line 949 of file wcs.c.

951{
952 static const char nullbyte = '\0';
953 struct _str_ctx_a ctx = {len, str};
954 int ret;
955
956 ret = pf_printf_a(puts_clbk_str_a, &ctx, format, locale, 0,
958 puts_clbk_str_a(&ctx, 1, &nullbyte);
959 return ret;
960}

Referenced by _snprintf_l(), _sprintf_l(), _vscprintf(), _vscprintf_l(), and _vsprintf_l().

◆ _vsnprintf_s()

int CDECL _vsnprintf_s ( char str,
size_t  sizeOfBuffer,
size_t  count,
const char format,
va_list  valist 
)

Definition at line 1083 of file wcs.c.

1085{
1087}
static size_t sizeOfBuffer
Definition: printf.c:48

◆ _vsnprintf_s_l()

int CDECL _vsnprintf_s_l ( char str,
size_t  sizeOfBuffer,
size_t  count,
const char format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1050 of file wcs.c.

1053{
1055}

Referenced by _snprintf_s(), _snprintf_s_l(), _sprintf_s_l(), _vsnprintf_s(), and _vsprintf_s_l().

◆ _vsnwprintf()

int CDECL _vsnwprintf ( wchar_t str,
size_t  len,
const wchar_t format,
va_list  valist 
)

Definition at line 1365 of file wcs.c.

1367{
1368 struct _str_ctx_w ctx = {len, str};
1369 int ret;
1370
1371 ret = pf_printf_w(puts_clbk_str_w, &ctx, format, NULL, 0,
1373 puts_clbk_str_w(&ctx, 1, L"");
1374 return ret;
1375}
int pf_printf_w(puts_clbk_w, void *, const wchar_t *, _locale_t, DWORD, args_clbk, void *, va_list *)
#define L(x)
Definition: resources.c:13

◆ _vsnwprintf_l()

int CDECL _vsnwprintf_l ( wchar_t str,
size_t  len,
const wchar_t format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1380 of file wcs.c.

1382{
1383 struct _str_ctx_w ctx = {len, str};
1384 int ret;
1385
1386 ret = pf_printf_w(puts_clbk_str_w, &ctx, format, locale, 0,
1388 puts_clbk_str_w(&ctx, 1, L"");
1389 return ret;
1390}

Referenced by _scwprintf_l(), _snwprintf_l(), _vscwprintf_l(), and _vswprintf_l().

◆ _vsnwprintf_s()

int CDECL _vsnwprintf_s ( wchar_t str,
size_t  sizeOfBuffer,
size_t  count,
const wchar_t format,
va_list  valist 
)

Definition at line 1483 of file wcs.c.

1485{
1487 format, NULL, valist);
1488}

Referenced by swprintf_s(), and vswprintf_s().

◆ _vsnwprintf_s_l()

int CDECL _vsnwprintf_s_l ( wchar_t str,
size_t  sizeOfBuffer,
size_t  count,
const wchar_t format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1473 of file wcs.c.

1476{
1478}
static int vsnwprintf_s_l_opt(wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, DWORD options, _locale_t locale, va_list valist)
Definition: wcs.c:1017

Referenced by _snwprintf_s(), _snwprintf_s_l(), _swprintf_s_l(), _vsnwprintf_s(), and _vswprintf_s_l().

◆ _vsprintf_l()

int CDECL _vsprintf_l ( char str,
const char format,
_locale_t  locale,
va_list  valist 
)

Definition at line 965 of file wcs.c.

967{
969}

◆ _vsprintf_p()

int CDECL _vsprintf_p ( char buffer,
size_t  length,
const char format,
va_list  args 
)

Definition at line 1871 of file wcs.c.

1873{
1875}

◆ _vsprintf_p_l()

int CDECL _vsprintf_p_l ( char buffer,
size_t  length,
const char format,
_locale_t  locale,
va_list  args 
)

Definition at line 1862 of file wcs.c.

1864{
1866}
static int vsprintf_p_l_opt(char *buffer, size_t length, const char *format, DWORD options, _locale_t locale, va_list args)
Definition: wcs.c:1832

Referenced by _sprintf_p_l(), and _vsprintf_p().

◆ _vsprintf_s_l()

int CDECL _vsprintf_s_l ( char str,
size_t  count,
const char format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1060 of file wcs.c.

1062{
1064}

◆ _vswprintf()

int CDECL _vswprintf ( wchar_t str,
const wchar_t format,
va_list  args 
)

Definition at line 1765 of file wcs.c.

1766{
1767 return _vsnwprintf( str, INT_MAX, format, args );
1768}

◆ _vswprintf_c()

int CDECL _vswprintf_c ( wchar_t str,
size_t  len,
const wchar_t format,
va_list  valist 
)

Definition at line 1404 of file wcs.c.

1406{
1407 return _vswprintf_c_l(str, len, format, NULL, valist);
1408}

Referenced by _swprintf_c().

◆ _vswprintf_c_l()

int CDECL _vswprintf_c_l ( wchar_t str,
size_t  len,
const wchar_t format,
_locale_t  locale,
va_list  valist 
)

Definition at line 1395 of file wcs.c.

1397{
1399}

Referenced by _swprintf_c_l(), and _vswprintf_c().

◆ _vswprintf_l()

int CDECL _vswprintf_l ( wchar_t str,
const wchar_t format,
_locale_t  locale,
va_list  args 
)

Definition at line 1773 of file wcs.c.

1775{
1776 return _vsnwprintf_l( str, INT_MAX, format, locale, args );
1777}

Referenced by __swprintf_l().

◆ _vswprintf_p_l()

int CDECL _vswprintf_p_l ( wchar_t buffer,
size_t  length,
const wchar_t format,
_locale_t  locale,
va_list  args 
)

Definition at line 1439 of file wcs.c.

1441{
1443}

◆ _vswprintf_s_l()

int CDECL _vswprintf_s_l ( wchar_t str,
size_t  numberOfElements,
const wchar_t format,
_locale_t  locale,
va_list  args 
)

Definition at line 1825 of file wcs.c.

1827{
1829 format, locale, args );
1830}

◆ _wcscoll_l()

int CDECL _wcscoll_l ( const wchar_t str1,
const wchar_t str2,
_locale_t  locale 
)

Definition at line 1990 of file wcs.c.

1991{
1993
1994 if(!locale)
1995 locinfo = get_locinfo();
1996 else
1997 locinfo = locale->locinfo;
1998
1999 if(!locinfo->lc_handle[LC_COLLATE])
2000 return wcscmp(str1, str2);
2002 str1, -1, str2, -1)-CSTR_EQUAL;
2003}
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:4017
#define LC_COLLATE
Definition: locale.h:26
int CDECL wcscmp(const wchar_t *str1, const wchar_t *str2)
Definition: wcs.c:1972
#define SORT_STRINGSORT
Definition: winnls.h:195
#define CSTR_EQUAL
Definition: winnls.h:500

Referenced by wcscoll().

◆ _wcsdup()

wchar_t *CDECL _wcsdup ( const wchar_t str)

Definition at line 81 of file wcs.c.

82{
83 wchar_t* ret = NULL;
84 if (str)
85 {
86 size_t size = (wcslen(str) + 1) * sizeof(wchar_t);
87 ret = malloc( size );
88 if (ret) memcpy( ret, str, size );
89 }
90 return ret;
91}
#define malloc
Definition: debug_ros.c:4
size_t CDECL wcslen(const wchar_t *str)
Definition: wcs.c:2983
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ _wcsicmp()

INT CDECL _wcsicmp ( const wchar_t str1,
const wchar_t str2 
)

Definition at line 159 of file wcs.c.

160{
161 return _wcsicmp_l(str1, str2, NULL);
162}
INT CDECL _wcsicmp_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
Definition: wcs.c:125

◆ _wcsicmp_l()

INT CDECL _wcsicmp_l ( const wchar_t str1,
const wchar_t str2,
_locale_t  locale 
)

Definition at line 125 of file wcs.c.

126{
127 _locale_tstruct tmp = {0};
128 wchar_t c1, c2;
129
130 if(!MSVCRT_CHECK_PMT(str1 != NULL) || !MSVCRT_CHECK_PMT(str2 != NULL))
131 return _NLSCMPERROR;
132
133 if(!locale)
135
136 do
137 {
138 c1 = _towlower_l(*str1++, locale);
139 c2 = _towlower_l(*str2++, locale);
140 } while(c1 && (c1 == c2));
141
143 return c1 - c2;
144}
#define _NLSCMPERROR
Definition: mbstring.h:28
_locale_t CDECL get_current_locale_noalloc(_locale_t locale)
Definition: locale.c:1149
void CDECL free_locale_noalloc(_locale_t locale)
Definition: locale.c:1162
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
wint_t CDECL _towlower_l(wint_t c, _locale_t locale)
Definition: wcs.c:96

Referenced by _wcsicmp().

◆ _wcsicoll()

INT CDECL _wcsicoll ( const wchar_t str1,
const wchar_t str2 
)

Definition at line 236 of file wcs.c.

237{
238 return _wcsicoll_l(str1, str2, NULL);
239}
int CDECL _wcsicoll_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
Definition: wcs.c:203

◆ _wcsicoll_l()

int CDECL _wcsicoll_l ( const wchar_t str1,
const wchar_t str2,
_locale_t  locale 
)

Definition at line 203 of file wcs.c.

204{
206
207 if(!locale)
209 else
210 locinfo = locale->locinfo;
211
212 if(!locinfo->lc_handle[LC_COLLATE])
213 {
214 wchar_t c1, c2;
215
216 do
217 {
218 c1 = *str1++;
219 if (c1 >= 'A' && c1 <= 'Z')
220 c1 += 'a' - 'A';
221
222 c2 = *str2++;
223 if (c2 >= 'A' && c2 <= 'Z')
224 c2 += 'a' - 'A';
225 } while(c1 && (c1 == c2));
226 return c1 - c2;
227 }
228
230 str1, -1, str2, -1)-CSTR_EQUAL;
231}
#define NORM_IGNORECASE
Definition: winnls.h:187

Referenced by _wcsicoll().

◆ _wcslwr()

wchar_t *CDECL _wcslwr ( wchar_t str)

Definition at line 489 of file wcs.c.

490{
491 _wcslwr_s_l(str, -1, NULL);
492 return str;
493}
_wcslwr_s_l

◆ _wcslwr_l()

wchar_t *CDECL _wcslwr_l ( wchar_t str,
_locale_t  locale 
)

Definition at line 480 of file wcs.c.

481{
482 _wcslwr_s_l(str, -1, locale);
483 return str;
484}

◆ _wcslwr_s()

int CDECL _wcslwr_s ( wchar_t str,
size_t  n 
)

Definition at line 472 of file wcs.c.

473{
474 return _wcslwr_s_l(str, n, NULL);
475}
GLdouble n
Definition: glext.h:7729

◆ _wcslwr_s_l()

int CDECL _wcslwr_s_l ( wchar_t str,
size_t  n,
_locale_t  locale 
)

Definition at line 434 of file wcs.c.

435{
436 _locale_tstruct tmp = {0};
437 wchar_t* ptr = str;
438
439 if (!str || !n)
440 {
441 if (str) *str = '\0';
442 *_errno() = EINVAL;
443 return EINVAL;
444 }
445
446 if(!locale)
448
449 while (n--)
450 {
451 if (!*ptr)
452 {
454 return 0;
455 }
457 ptr++;
458 }
459
461
462 /* MSDN claims that the function should return and set errno to
463 * ERANGE, which doesn't seem to be true based on the tests. */
464 *str = '\0';
465 *_errno() = EINVAL;
466 return EINVAL;
467}
static PVOID ptr
Definition: dispmode.c:27

◆ _wcsncoll()

int CDECL _wcsncoll ( const wchar_t str1,
const wchar_t str2,
size_t  count 
)

Definition at line 553 of file wcs.c.

554{
555 return _wcsncoll_l(str1, str2, count, NULL);
556}
int CDECL _wcsncoll_l(const wchar_t *str1, const wchar_t *str2, size_t count, _locale_t locale)
Definition: wcs.c:533

◆ _wcsncoll_l()

int CDECL _wcsncoll_l ( const wchar_t str1,
const wchar_t str2,
size_t  count,
_locale_t  locale 
)

Definition at line 533 of file wcs.c.

535{
537
538 if(!locale)
540 else
541 locinfo = locale->locinfo;
542
543 if(!locinfo->lc_handle[LC_COLLATE])
544 return wcsncmp(str1, str2, count);
546 str1, wcsnlen(str1, count),
547 str2, wcsnlen(str2, count))-CSTR_EQUAL;
548}
size_t CDECL wcsnlen(const wchar_t *s, size_t maxlen)
Definition: wcs.c:2920
int CDECL wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n)
Definition: wcs.c:518

Referenced by _wcsncoll().

◆ _wcsnicmp()

INT CDECL _wcsnicmp ( const wchar_t str1,
const wchar_t str2,
size_t  n 
)

Definition at line 195 of file wcs.c.

196{
197 return _wcsnicmp_l(str1, str2, n, NULL);
198}
INT CDECL _wcsnicmp_l(const wchar_t *str1, const wchar_t *str2, size_t n, _locale_t locale)
Definition: wcs.c:167

◆ _wcsnicmp_l()

INT CDECL _wcsnicmp_l ( const wchar_t str1,
const wchar_t str2,
size_t  n,
_locale_t  locale 
)

Definition at line 167 of file wcs.c.

169{
170 _locale_tstruct tmp = {0};
171 wchar_t c1, c2;
172
173 if (!n)
174 return 0;
175
176 if(!MSVCRT_CHECK_PMT(str1 != NULL) || !MSVCRT_CHECK_PMT(str2 != NULL))
177 return _NLSCMPERROR;
178
179 if(!locale)
181
182 do
183 {
184 c1 = _towlower_l(*str1++, locale);
185 c2 = _towlower_l(*str2++, locale);
186 } while(--n && c1 && (c1 == c2));
187
189 return c1 - c2;
190}

Referenced by _wcsnicmp().

◆ _wcsnicoll()

INT CDECL _wcsnicoll ( const wchar_t str1,
const wchar_t str2,
size_t  count 
)

Definition at line 282 of file wcs.c.

283{
284 return _wcsnicoll_l(str1, str2, count, NULL);
285}
int CDECL _wcsnicoll_l(const wchar_t *str1, const wchar_t *str2, size_t count, _locale_t locale)
Definition: wcs.c:244

◆ _wcsnicoll_l()

int CDECL _wcsnicoll_l ( const wchar_t str1,
const wchar_t str2,
size_t  count,
_locale_t  locale 
)

Definition at line 244 of file wcs.c.

246{
248
249 if(!locale)
251 else
252 locinfo = locale->locinfo;
253
254 if(!locinfo->lc_handle[LC_COLLATE])
255 {
256 wchar_t c1, c2;
257
258 if (!count)
259 return 0;
260
261 do
262 {
263 c1 = *str1++;
264 if (c1 >= 'A' && c1 <= 'Z')
265 c1 += 'a' - 'A';
266
267 c2 = *str2++;
268 if (c2 >= 'A' && c2 <= 'Z')
269 c2 += 'a' - 'A';
270 } while(--count && c1 && (c1 == c2));
271 return c1 - c2;
272 }
273
275 str1, wcsnlen(str1, count),
276 str2, wcsnlen(str2, count))-CSTR_EQUAL;
277}

Referenced by _wcsnicoll().

◆ _wcsnset()

wchar_t *CDECL _wcsnset ( wchar_t str,
wchar_t  c,
size_t  n 
)

Definition at line 290 of file wcs.c.

291{
292 wchar_t* ret = str;
293 while ((n-- > 0) && *str) *str++ = c;
294 return ret;
295}

◆ _wcsnset_s()

int CDECL _wcsnset_s ( wchar_t str,
size_t  size,
wchar_t  c,
size_t  count 
)

Definition at line 300 of file wcs.c.

301{
302 size_t i;
303
304 if(!str && !size && !count) return 0;
305 if(!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
306 if(!MSVCRT_CHECK_PMT(size > 0)) return EINVAL;
307
308 for(i=0; i<size-1 && i<count; i++) {
309 if(!str[i]) return 0;
310 str[i] = c;
311 }
312 for(; i<size; i++)
313 if(!str[i]) return 0;
314
315 str[0] = 0;
317 *_errno() = EINVAL;
318 return EINVAL;
319}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ _wcsrev()

wchar_t *CDECL _wcsrev ( wchar_t str)

Definition at line 324 of file wcs.c.

325{
326 wchar_t* ret = str;
327 wchar_t* end = str + wcslen(str) - 1;
328 while (end > str)
329 {
330 wchar_t t = *end;
331 *end-- = *str;
332 *str++ = t;
333 }
334 return ret;
335}
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble t
Definition: gl.h:2047

◆ _wcsset()

wchar_t *CDECL _wcsset ( wchar_t str,
wchar_t  c 
)

Definition at line 360 of file wcs.c.

361{
362 wchar_t* ret = str;
363 while (*str) *str++ = c;
364 return ret;
365}

◆ _wcsset_s()

int CDECL _wcsset_s ( wchar_t str,
size_t  n,
wchar_t  c 
)

Definition at line 340 of file wcs.c.

341{
342 wchar_t *p = str;
343
344 if(!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
345 if(!MSVCRT_CHECK_PMT(n)) return EINVAL;
346
347 while(*p && --n) *p++ = c;
348 if(!n) {
349 str[0] = 0;
351 *_errno() = EINVAL;
352 return EINVAL;
353 }
354 return 0;
355}
GLfloat GLfloat p
Definition: glext.h:8902

◆ _wcstod_l()

double CDECL _wcstod_l ( const wchar_t str,
wchar_t **  end,
_locale_t  locale 
)

Definition at line 574 of file wcs.c.

576{
578 const wchar_t *beg, *p;
579 struct fpnum fp;
580 double ret;
581 int err;
582
583 if (!MSVCRT_CHECK_PMT(str != NULL)) {
584 if (end) *end = NULL;
585 return 0;
586 }
587
588 if (!locale)
590 else
591 locinfo = locale->locinfo;
592
593 p = str;
594 while(_iswspace_l(*p, locale))
595 p++;
596 beg = p;
597
599 if (end) *end = (p == beg ? (wchar_t*)str : (wchar_t*)p);
600
601 err = fpnum_double(&fp, &ret);
602 if(err) *_errno() = err;
603 return ret;
604}
#define FALSE
Definition: types.h:117
struct fpnum fpnum_parse(wchar_t(*)(void *), void(*)(void *), void *, pthreadlocinfo, BOOL)
int fpnum_double(struct fpnum *, double *)
Definition: string.c:365
static void strtod_wstr_unget(void *ctx)
Definition: wcs.c:565
static wchar_t strtod_wstr_get(void *ctx)
Definition: wcs.c:558
#define err(...)
#define _iswspace_l(_c, _p)
Definition: ctype.h:681
Definition: msvcrt.h:359

Referenced by _wtof(), _wtof_l(), and wcstod().

◆ _wcstoi64()

__int64 CDECL _wcstoi64 ( const wchar_t nptr,
wchar_t **  endptr,
int  base 
)

Definition at line 2720 of file wcs.c.

2722{
2723 return _wcstoi64_l(nptr, endptr, base, NULL);
2724}
__int64 CDECL _wcstoi64_l(const wchar_t *nptr, wchar_t **endptr, int base, _locale_t locale)
Definition: wcs.c:2655

◆ _wcstoi64_l()

__int64 CDECL _wcstoi64_l ( const wchar_t nptr,
wchar_t **  endptr,
int  base,
_locale_t  locale 
)

Definition at line 2655 of file wcs.c.

2657{
2658 BOOL negative = FALSE, empty = TRUE;
2659 __int64 ret = 0;
2660
2661 TRACE("(%s %p %d %p)\n", debugstr_w(nptr), endptr, base, locale);
2662
2663 if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
2664 if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
2665 if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
2666
2667 if(endptr)
2668 *endptr = (wchar_t*)nptr;
2669
2670 while(_iswspace_l(*nptr, locale)) nptr++;
2671
2672 if(*nptr == '-') {
2673 negative = TRUE;
2674 nptr++;
2675 } else if(*nptr == '+')
2676 nptr++;
2677
2678 if((base==0 || base==16) && wctoint(*nptr, 1)==0 && (nptr[1]=='x' || nptr[1]=='X')) {
2679 base = 16;
2680 nptr += 2;
2681 }
2682
2683 if(base == 0) {
2684 if(wctoint(*nptr, 1)==0)
2685 base = 8;
2686 else
2687 base = 10;
2688 }
2689
2690 while(*nptr) {
2691 int v = wctoint(*nptr, base);
2692 if(v<0)
2693 break;
2694
2695 if(negative)
2696 v = -v;
2697
2698 nptr++;
2699 empty = FALSE;
2700
2701 if(!negative && (ret>I64_MAX/base || ret*base>I64_MAX-v)) {
2702 ret = I64_MAX;
2703 *_errno() = ERANGE;
2704 } else if(negative && (ret<I64_MIN/base || ret*base<I64_MIN-v)) {
2705 ret = I64_MIN;
2706 *_errno() = ERANGE;
2707 } else
2708 ret = ret*base + v;
2709 }
2710
2711 if(endptr && !empty)
2712 *endptr = (wchar_t*)nptr;
2713
2714 return ret;
2715}
#define TRUE
Definition: types.h:120
static const WCHAR empty[]
Definition: main.c:47
#define __int64
Definition: corecrt.h:72
#define ERANGE
Definition: errno.h:55
#define I64_MIN
Definition: limits.h:41
#define I64_MAX
Definition: limits.h:42
static int wctoint(WCHAR c, int base)
Definition: wcs.c:2625
unsigned int BOOL
Definition: ntddk_ex.h:94
const GLdouble * v
Definition: gl.h:2040
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by _wcstoi64(), _wcstol_l(), _wcstoul_l(), _wtoi_l(), and _wtol_l().

◆ _wcstol_l()

__msvcrt_long CDECL _wcstol_l ( const wchar_t s,
wchar_t **  end,
int  base,
_locale_t  locale 
)

Definition at line 2729 of file wcs.c.

2731{
2733
2734 if(ret > LONG_MAX) {
2735 ret = LONG_MAX;
2736 *_errno() = ERANGE;
2737 }else if(ret < LONG_MIN) {
2738 ret = LONG_MIN;
2739 *_errno() = ERANGE;
2740 }
2741 return ret;
2742}
#define LONG_MAX
Definition: limits.h:30
#define LONG_MIN
Definition: limits.h:29
GLdouble s
Definition: gl.h:2039

Referenced by wcstol().

◆ _wcstombs_l()

size_t CDECL _wcstombs_l ( char mbstr,
const wchar_t wcstr,
size_t  count,
_locale_t  locale 
)

Definition at line 683 of file wcs.c.

685{
686 return wcsrtombs_l(mbstr, &wcstr, count, locale);
687}
static size_t wcsrtombs_l(char *mbstr, const wchar_t **wcstr, size_t count, _locale_t locale)
Definition: wcs.c:609

◆ _wcstombs_s_l()

int CDECL _wcstombs_s_l ( size_t ret,
char mbstr,
size_t  size,
const wchar_t wcstr,
size_t  count,
_locale_t  locale 
)

Definition at line 767 of file wcs.c.

769{
770 return wcsrtombs_s_l(ret, mbstr, size, &wcstr,count, locale);
771}
static int wcsrtombs_s_l(size_t *ret, char *mbstr, size_t size, const wchar_t **wcstr, size_t count, _locale_t locale)
Definition: wcs.c:713

◆ _wcstoui64()

unsigned __int64 CDECL _wcstoui64 ( const wchar_t nptr,
wchar_t **  endptr,
int  base 
)

Definition at line 2885 of file wcs.c.

2887{
2888 return _wcstoui64_l(nptr, endptr, base, NULL);
2889}
unsigned __int64 CDECL _wcstoui64_l(const wchar_t *nptr, wchar_t **endptr, int base, _locale_t locale)
Definition: wcs.c:2826

◆ _wcstoui64_l()

unsigned __int64 CDECL _wcstoui64_l ( const wchar_t nptr,
wchar_t **  endptr,
int  base,
_locale_t  locale 
)

Definition at line 2826 of file wcs.c.

2828{
2829 BOOL negative = FALSE, empty = TRUE;
2830 unsigned __int64 ret = 0;
2831
2832 TRACE("(%s %p %d %p)\n", debugstr_w(nptr), endptr, base, locale);
2833
2834 if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
2835 if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
2836 if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
2837
2838 if(endptr)
2839 *endptr = (wchar_t*)nptr;
2840
2841 while(_iswspace_l(*nptr, locale)) nptr++;
2842
2843 if(*nptr == '-') {
2844 negative = TRUE;
2845 nptr++;
2846 } else if(*nptr == '+')
2847 nptr++;
2848
2849 if((base==0 || base==16) && wctoint(*nptr, 1)==0 && (nptr[1]=='x' || nptr[1]=='X')) {
2850 base = 16;
2851 nptr += 2;
2852 }
2853
2854 if(base == 0) {
2855 if(wctoint(*nptr, 1)==0)
2856 base = 8;
2857 else
2858 base = 10;
2859 }
2860
2861 while(*nptr) {
2862 int v = wctoint(*nptr, base);
2863 if(v<0)
2864 break;
2865
2866 nptr++;
2867 empty = FALSE;
2868
2869 if(ret>UI64_MAX/base || ret*base>UI64_MAX-v) {
2870 ret = UI64_MAX;
2871 *_errno() = ERANGE;
2872 } else
2873 ret = ret*base + v;
2874 }
2875
2876 if(endptr && !empty)
2877 *endptr = (wchar_t*)nptr;
2878
2879 return negative ? -ret : ret;
2880}
#define UI64_MAX
Definition: limits.h:43

Referenced by _wcstoui64().

◆ _wcstoul_l()

__msvcrt_ulong __cdecl _wcstoul_l ( const wchar_t s,
wchar_t **  end,
int  base,
_locale_t  locale 
)

Definition at line 2894 of file wcs.c.

2896{
2898
2899 if(ret > ULONG_MAX) {
2900 ret = ULONG_MAX;
2901 *_errno() = ERANGE;
2902 }else if(ret < -(__int64)ULONG_MAX) {
2903 ret = 1;
2904 *_errno() = ERANGE;
2905 }
2906 return ret;
2907}
#define ULONG_MAX
Definition: limits.h:31

Referenced by wcstoul().

◆ _wcsupr()

wchar_t *CDECL _wcsupr ( wchar_t str)

Definition at line 426 of file wcs.c.

427{
428 return _wcsupr_l(str, NULL);
429}
_wcsupr_l

◆ _wcsupr_l()

wchar_t *CDECL _wcsupr_l ( wchar_t str,
_locale_t  locale 
)

Definition at line 417 of file wcs.c.

418{
419 _wcsupr_s_l( str, -1, locale);
420 return str;
421}
_wcsupr_s_l

◆ _wcsupr_s()

INT CDECL _wcsupr_s ( wchar_t str,
size_t  n 
)

Definition at line 409 of file wcs.c.

410{
411 return _wcsupr_s_l( str, n, NULL );
412}

◆ _wcsupr_s_l()

int CDECL _wcsupr_s_l ( wchar_t str,
size_t  n,
_locale_t  locale 
)

Definition at line 370 of file wcs.c.

371{
372 _locale_tstruct tmp = {0};
373 wchar_t* ptr = str;
374
375 if (!str || !n)
376 {
377 if (str) *str = '\0';
378 *_errno() = EINVAL;
379 return EINVAL;
380 }
381
382 if(!locale)
384
385 while (n--)
386 {
387 if (!*ptr)
388 {
390 return 0;
391 }
393 ptr++;
394 }
395
397
398 /* MSDN claims that the function should return and set errno to
399 * ERANGE, which doesn't seem to be true based on the tests. */
400 *str = '\0';
401 *_errno() = EINVAL;
402 return EINVAL;
403}
wint_t CDECL _towupper_l(wint_t c, _locale_t locale)
Definition: wcs.c:2932

◆ _wcsxfrm_l()

size_t CDECL _wcsxfrm_l ( wchar_t dest,
const wchar_t src,
size_t  len,
_locale_t  locale 
)

Definition at line 3048 of file wcs.c.

3050{
3052 int i, ret;
3053
3054 if(!MSVCRT_CHECK_PMT(src)) return INT_MAX;
3055 if(!MSVCRT_CHECK_PMT(dest || !len)) return INT_MAX;
3056
3057 if(len > INT_MAX) {
3058 FIXME("len > INT_MAX not supported\n");
3059 len = INT_MAX;
3060 }
3061
3062 if(!locale)
3063 locinfo = get_locinfo();
3064 else
3065 locinfo = locale->locinfo;
3066
3067 if(!locinfo->lc_handle[LC_COLLATE]) {
3068 wcsncpy(dest, src, len);
3069 return wcslen(src);
3070 }
3071
3072 ret = LCMapStringW(locinfo->lc_handle[LC_COLLATE],
3073 LCMAP_SORTKEY, src, -1, NULL, 0);
3074 if(!ret) {
3075 if(len) dest[0] = 0;
3076 *_errno() = EILSEQ;
3077 return INT_MAX;
3078 }
3079 if(!len) return ret-1;
3080
3081 if(ret > len) {
3082 dest[0] = 0;
3083 *_errno() = ERANGE;
3084 return ret-1;
3085 }
3086
3087 ret = LCMapStringW(locinfo->lc_handle[LC_COLLATE],
3088 LCMAP_SORTKEY, src, -1, dest, len) - 1;
3089 for(i=ret; i>=0; i--)
3090 dest[i] = ((unsigned char*)dest)[i];
3091 return ret;
3092}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define EILSEQ
Definition: errno.h:62
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135
wcsncpy
#define LCMAP_SORTKEY
Definition: winnls.h:199

Referenced by wcsxfrm().

◆ _wctomb_l()

int CDECL _wctomb_l ( char dst,
wchar_t  ch,
_locale_t  locale 
)

Definition at line 2147 of file wcs.c.

2148{
2149 int len;
2150#ifdef __REACTOS__
2151 int maxlen;
2152 if (locale)
2153 maxlen = locale->locinfo->mb_cur_max;
2154 else
2155 maxlen = get_locinfo()->mb_cur_max;
2156 if (_wctomb_s_l(&len, dst, maxlen, ch, locale) != 0)
2157 return -1;
2158#else
2160#endif
2161 return len;
2162}
unsigned char ch[4][2]
Definition: console.c:118
#define MB_LEN_MAX
Definition: limits.h:7
int CDECL _wctomb_s_l(int *len, char *mbchar, size_t size, wchar_t wch, _locale_t locale)
Definition: wcs.c:2074
GLenum GLenum dst
Definition: glext.h:6340

Referenced by wctomb().

◆ _wctomb_s_l()

int CDECL _wctomb_s_l ( int len,
char mbchar,
size_t  size,
wchar_t  wch,
_locale_t  locale 
)

Definition at line 2074 of file wcs.c.

2076{
2078 BOOL error = FALSE;
2079 BOOL *perror;
2080 int mblen;
2081
2082 if(!mbchar && size>0) {
2083 if(len)
2084 *len = 0;
2085 return 0;
2086 }
2087
2088 if(len)
2089 *len = -1;
2090
2092 return EINVAL;
2093
2094 if(!locale)
2095 locinfo = get_locinfo();
2096 else
2097 locinfo = locale->locinfo;
2098
2099 if(!locinfo->lc_codepage) {
2100 if(wch > 0xff) {
2101 if(mbchar && size>0)
2102 memset(mbchar, 0, size);
2103 *_errno() = EILSEQ;
2104 return EILSEQ;
2105 }
2106
2107 if(!MSVCRT_CHECK_PMT_ERR(size >= 1, ERANGE))
2108 return ERANGE;
2109
2110 *mbchar = wch;
2111 if(len)
2112 *len = 1;
2113 return 0;
2114 }
2115
2116 perror = (locinfo->lc_codepage != CP_UTF8 ? &error : NULL);
2117 mblen = WideCharToMultiByte(locinfo->lc_codepage, 0, &wch, 1, mbchar, size, NULL, perror);
2118 if(!mblen || error) {
2120 if(mbchar && size>0)
2121 memset(mbchar, 0, size);
2122
2123 MSVCRT_INVALID_PMT("insufficient buffer size", ERANGE);
2124 return ERANGE;
2125 }
2126
2127 *_errno() = EILSEQ;
2128 return EILSEQ;
2129 }
2130
2131 if(len)
2132 *len = mblen;
2133 return 0;
2134}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define WideCharToMultiByte
Definition: compat.h:111
void CDECL perror(const char *str)
Definition: errno.c:337
_ACRTIMP int __cdecl mblen(const char *, size_t)
Definition: mbcs.c:3087
#define MSVCRT_INVALID_PMT(x, err)
Definition: msvcrt.h:376
#define MSVCRT_CHECK_PMT_ERR(x, err)
Definition: msvcrt.h:377
#define error(str)
Definition: mkdosfs.c:1605
#define CP_UTF8
Definition: nls.h:20
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by _wctomb_l(), and wctomb_s().

◆ _wtof()

double CDECL _wtof ( const wchar_t str)

Definition at line 805 of file wcs.c.

806{
807 return _wcstod_l(str, NULL, NULL);
808}
double CDECL _wcstod_l(const wchar_t *str, wchar_t **end, _locale_t locale)
Definition: wcs.c:574

◆ _wtof_l()

double CDECL _wtof_l ( const wchar_t str,
_locale_t  locale 
)

Definition at line 813 of file wcs.c.

814{
815 return _wcstod_l(str, NULL, locale);
816}

◆ _wtoi()

int __cdecl _wtoi ( const wchar_t str)

Definition at line 2773 of file wcs.c.

2774{
2775 return _wtoi_l(str, NULL);
2776}
int __cdecl _wtoi_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:2756

◆ _wtoi64()

__int64 CDECL _wtoi64 ( const wchar_t str)

Definition at line 3040 of file wcs.c.

3041{
3042 return _wtoi64_l(str, NULL);
3043}
__int64 CDECL _wtoi64_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:3013

◆ _wtoi64_l()

__int64 CDECL _wtoi64_l ( const wchar_t str,
_locale_t  locale 
)

Definition at line 3013 of file wcs.c.

3014{
3015 ULONGLONG RunningTotal = 0;
3016 BOOL bMinus = FALSE;
3017
3018 while (_iswspace_l(*str, locale)) {
3019 str++;
3020 } /* while */
3021
3022 if (*str == '+') {
3023 str++;
3024 } else if (*str == '-') {
3025 bMinus = TRUE;
3026 str++;
3027 } /* if */
3028
3029 while (*str >= '0' && *str <= '9') {
3030 RunningTotal = RunningTotal * 10 + *str - '0';
3031 str++;
3032 } /* while */
3033
3034 return bMinus ? -RunningTotal : RunningTotal;
3035}
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by _wtoi64().

◆ _wtoi_l()

int __cdecl _wtoi_l ( const wchar_t str,
_locale_t  locale 
)

Definition at line 2756 of file wcs.c.

2757{
2759
2760 if(ret > INT_MAX) {
2761 ret = INT_MAX;
2762 *_errno() = ERANGE;
2763 } else if(ret < INT_MIN) {
2764 ret = INT_MIN;
2765 *_errno() = ERANGE;
2766 }
2767 return ret;
2768}
#define INT_MIN
Definition: limits.h:25

Referenced by _wtoi().

◆ _wtol()

__msvcrt_long __cdecl _wtol ( const wchar_t str)

Definition at line 2798 of file wcs.c.

2799{
2800 return _wtol_l(str, NULL);
2801}
__msvcrt_long __cdecl _wtol_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:2781

◆ _wtol_l()

__msvcrt_long __cdecl _wtol_l ( const wchar_t str,
_locale_t  locale 
)

Definition at line 2781 of file wcs.c.

2782{
2784
2785 if(ret > LONG_MAX) {
2786 ret = LONG_MAX;
2787 *_errno() = ERANGE;
2788 } else if(ret < LONG_MIN) {
2789 ret = LONG_MIN;
2790 *_errno() = ERANGE;
2791 }
2792 return ret;
2793}

Referenced by _wtol().

◆ arg_clbk_positional()

printf_arg arg_clbk_positional ( void ctx,
int  pos,
int  type,
va_list valist 
)

Definition at line 870 of file wcs.c.

871{
873 return args[pos];
874}

Referenced by _vscprintf_p_l(), vfprintf_helper(), vfwprintf_helper(), vsprintf_p_l_opt(), and vswprintf_p_l_opt().

◆ arg_clbk_valist()

printf_arg arg_clbk_valist ( void ctx,
int  arg_pos,
int  type,
va_list valist 
)

Definition at line 847 of file wcs.c.

848{
850
851 if(type == VT_I8)
852 ret.get_longlong = va_arg(*valist, LONGLONG);
853 else if(type == VT_INT)
854 ret.get_int = va_arg(*valist, int);
855 else if(type == VT_R8)
856 ret.get_double = va_arg(*valist, double);
857 else if(type == VT_PTR)
858 ret.get_ptr = va_arg(*valist, void*);
859 else {
860 ERR("Incorrect type\n");
861 ret.get_int = 0;
862 }
863
864 return ret;
865}
@ VT_INT
Definition: compat.h:2316
@ VT_PTR
Definition: compat.h:2320
@ VT_R8
Definition: compat.h:2300
@ VT_I8
Definition: compat.h:2314
#define va_arg(v, l)
Definition: stdarg.h:27
int64_t LONGLONG
Definition: typedefs.h:68

Referenced by _vcprintf(), _vcprintf_l(), _vcwprintf(), _vcwprintf_l(), _vscprintf_p_l(), _vsnprintf(), _vsnprintf_l(), _vsnwprintf(), _vsnwprintf_l(), vfprintf_helper(), vfwprintf_helper(), vsnprintf_s_l_opt(), vsnwprintf_s_l_opt(), vsprintf_p_l_opt(), and vswprintf_p_l_opt().

◆ iswalnum()

INT CDECL iswalnum ( wchar_t  wc)

Definition at line 2255 of file wcs.c.

2256{
2257 return _iswalnum_l( wc, NULL );
2258}
#define _iswalnum_l(_c, _p)
Definition: ctype.h:683

◆ iswalpha()

INT CDECL iswalpha ( wchar_t  wc)

Definition at line 2271 of file wcs.c.

2272{
2273 return _iswalpha_l( wc, NULL );
2274}
#define _iswalpha_l(_c, _p)
Definition: ctype.h:676

◆ iswblank()

INT CDECL iswblank ( wchar_t  wc)

Definition at line 2431 of file wcs.c.

2432{
2433 return wc == '\t' || _iswctype_l( wc, _BLANK, NULL );
2434}

◆ iswcntrl()

INT CDECL iswcntrl ( wchar_t  wc)

Definition at line 2287 of file wcs.c.

2288{
2289 return _iswcntrl_l( wc, NULL );
2290}
#define _iswcntrl_l(_c, _p)
Definition: ctype.h:686

◆ iswctype()

INT CDECL iswctype ( wchar_t  wc,
wctype_t  type 
)

Definition at line 2239 of file wcs.c.

2240{
2241 return _iswctype_l( wc, type, NULL );
2242}

◆ iswdigit()

INT CDECL iswdigit ( wchar_t  wc)

Definition at line 2303 of file wcs.c.

2304{
2305 return _iswdigit_l( wc, NULL );
2306}
#define _iswdigit_l(_c, _p)
Definition: ctype.h:679

◆ iswgraph()

INT CDECL iswgraph ( wchar_t  wc)

Definition at line 2319 of file wcs.c.

2320{
2321 return _iswgraph_l( wc, NULL );
2322}
#define _iswgraph_l(_c, _p)
Definition: ctype.h:685

◆ iswlower()

INT CDECL iswlower ( wchar_t  wc)

Definition at line 2335 of file wcs.c.

2336{
2337 return _iswlower_l( wc, NULL );
2338}
#define _iswlower_l(_c, _p)
Definition: ctype.h:678

◆ iswprint()

INT CDECL iswprint ( wchar_t  wc)

Definition at line 2351 of file wcs.c.

2352{
2353 return _iswprint_l( wc, NULL );
2354}
#define _iswprint_l(_c, _p)
Definition: ctype.h:684

◆ iswpunct()

INT CDECL iswpunct ( wchar_t  wc)

Definition at line 2367 of file wcs.c.

2368{
2369 return _iswpunct_l( wc, NULL );
2370}
#define _iswpunct_l(_c, _p)
Definition: ctype.h:682

◆ iswspace()

INT CDECL iswspace ( wchar_t  wc)

Definition at line 2383 of file wcs.c.

2384{
2385 return _iswspace_l( wc, NULL );
2386}

◆ iswupper()

INT CDECL iswupper ( wchar_t  wc)

Definition at line 2399 of file wcs.c.

2400{
2401 return _iswupper_l( wc, NULL );
2402}
#define _iswupper_l(_c, _p)
Definition: ctype.h:677

◆ iswxdigit()

INT CDECL iswxdigit ( wchar_t  wc)

Definition at line 2415 of file wcs.c.

2416{
2417 return _iswxdigit_l( wc, NULL );
2418}
#define _iswxdigit_l(_c, _p)
Definition: ctype.h:680

◆ sprintf()

int WINAPIV sprintf ( char str,
const char format,
  ... 
)

Definition at line 1601 of file wcs.c.

1602{
1603 va_list ap;
1604 int r;
1605
1606 va_start( ap, format );
1607 r = vsnprintf( str, INT_MAX, format, ap );
1608 va_end( ap );
1609 return r;
1610}

◆ sprintf_s()

int WINAPIV sprintf_s ( char str,
size_t  num,
const char format,
  ... 
)

Definition at line 1615 of file wcs.c.

1616{
1617 va_list ap;
1618 int r;
1619
1620 va_start( ap, format );
1621 r = vsnprintf( str, num, format, ap );
1622 va_end( ap );
1623 return r;
1624}
GLuint GLuint num
Definition: glext.h:9618

◆ strtod_wstr_get()

static wchar_t strtod_wstr_get ( void ctx)
static

Definition at line 558 of file wcs.c.

559{
560 const wchar_t **p = ctx;
561 if (!**p) return WEOF;
562 return *(*p)++;
563}

Referenced by _wcstod_l().

◆ strtod_wstr_unget()

static void strtod_wstr_unget ( void ctx)
static

Definition at line 565 of file wcs.c.

566{
567 const wchar_t **p = ctx;
568 (*p)--;
569}

Referenced by _wcstod_l().

◆ swprintf_s()

int WINAPIV swprintf_s ( wchar_t str,
size_t  numberOfElements,
const wchar_t format,
  ... 
)

Definition at line 1701 of file wcs.c.

1703{
1704 va_list ap;
1705 int r;
1706
1707 va_start(ap, format);
1709 va_end(ap);
1710
1711 return r;
1712}
int CDECL _vsnwprintf_s(wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, va_list valist)
Definition: wcs.c:1483

Referenced by tirpc_report().

◆ towctrans()

wint_t CDECL towctrans ( wint_t  c,
wctrans_t  category 
)

Definition at line 149 of file wcs.c.

150{
151 if(category == 1)
152 return _towupper_l(c, NULL);
153 return _towlower_l(c, NULL);
154}

◆ towlower()

wint_t CDECL towlower ( wint_t  c)

Definition at line 120 of file wcs.c.

121{
122 return _towlower_l(c, NULL);
123}

◆ towupper()

wint_t CDECL towupper ( wint_t  c)

Definition at line 2956 of file wcs.c.

2957{
2958 return _towupper_l(c, NULL);
2959}

◆ vsnprintf_s_l_opt()

static int CDECL vsnprintf_s_l_opt ( char str,
size_t  sizeOfBuffer,
size_t  count,
const char format,
DWORD  options,
_locale_t  locale,
va_list  valist 
)
static

Definition at line 985 of file wcs.c.

988{
989 static const char nullbyte = '\0';
990 struct _str_ctx_a ctx;
991 int len, ret;
992
993 if(sizeOfBuffer<count+1 || count==-1)
995 else
996 len = count+1;
997
998 ctx.len = len;
999 ctx.buf = str;
1002 puts_clbk_str_a(&ctx, 1, &nullbyte);
1003
1004 if(ret<0 || ret==len) {
1006 MSVCRT_INVALID_PMT("str[sizeOfBuffer] is too small", ERANGE);
1007 memset(str, 0, sizeOfBuffer);
1008 } else
1009 str[len-1] = '\0';
1010
1011 return -1;
1012 }
1013
1014 return ret;
1015}
#define _TRUNCATE
Definition: stdlib.h:45

Referenced by _vsnprintf_c_l(), and _vsnprintf_s_l().

◆ vsnwprintf_s_l_opt()

static int vsnwprintf_s_l_opt ( wchar_t str,
size_t  sizeOfBuffer,
size_t  count,
const wchar_t format,
DWORD  options,
_locale_t  locale,
va_list  valist 
)
static

Definition at line 1017 of file wcs.c.

1020{
1021 struct _str_ctx_w ctx;
1022 int len, ret;
1023
1024 len = sizeOfBuffer;
1025 if(count!=-1 && len>count+1)
1026 len = count+1;
1027
1028 ctx.len = len;
1029 ctx.buf = str;
1032 puts_clbk_str_w(&ctx, 1, L"");
1033
1034 if(ret<0 || ret==len) {
1036 MSVCRT_INVALID_PMT("str[sizeOfBuffer] is too small", ERANGE);
1037 memset(str, 0, sizeOfBuffer*sizeof(wchar_t));
1038 } else
1039 str[len-1] = '\0';
1040
1041 return -1;
1042 }
1043
1044 return ret;
1045}

Referenced by _vsnwprintf_s_l(), and _vswprintf_c_l().

◆ vsprintf()

int CDECL vsprintf ( char str,
const char format,
va_list  valist 
)

Definition at line 1160 of file wcs.c.

1161{
1162 return vsnprintf(str, INT_MAX, format, valist);
1163}

◆ vsprintf_p_l_opt()

static int vsprintf_p_l_opt ( char buffer,
size_t  length,
const char format,
DWORD  options,
_locale_t  locale,
va_list  args 
)
static

Definition at line 1832 of file wcs.c.

1834{
1835 static const char nullbyte = '\0';
1836 printf_arg args_ctx[_ARGMAX+1];
1837 struct _str_ctx_a puts_ctx = {length, buffer};
1838 int ret;
1839
1840 memset(args_ctx, 0, sizeof(args_ctx));
1841
1842 ret = create_positional_ctx_a(args_ctx, format, args);
1843 if(ret < 0) {
1845 *_errno() = EINVAL;
1846 return ret;
1847 } else if(ret == 0)
1848 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1850 else
1851 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1853 arg_clbk_positional, args_ctx, NULL);
1854
1855 puts_clbk_str_a(&puts_ctx, 1, &nullbyte);
1856 return ret;
1857}

Referenced by _vsprintf_p_l().

◆ vsprintf_s()

int CDECL vsprintf_s ( char str,
size_t  num,
const char format,
va_list  valist 
)

Definition at line 1168 of file wcs.c.

1169{
1170 return vsnprintf(str, num, format, valist);
1171}

◆ vswprintf_p_l_opt()

static int vswprintf_p_l_opt ( wchar_t buffer,
size_t  length,
const wchar_t format,
DWORD  options,
_locale_t  locale,
va_list  args 
)
static

Definition at line 1410 of file wcs.c.

1412{
1413 printf_arg args_ctx[_ARGMAX+1];
1414 struct _str_ctx_w puts_ctx = {length, buffer};
1415 int ret;
1416
1417 memset(args_ctx, 0, sizeof(args_ctx));
1418
1419 ret = create_positional_ctx_w(args_ctx, format, args);
1420 if(ret < 0) {
1422 *_errno() = EINVAL;
1423 return ret;
1424 } else if(ret == 0)
1427 else
1428 ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale,
1430 arg_clbk_positional, args_ctx, NULL);
1431
1432 puts_clbk_str_w(&puts_ctx, 1, L"");
1433 return ret;
1434}
int create_positional_ctx_w(void *, const wchar_t *, va_list)

Referenced by _scwprintf_p_l(), _swprintf_p(), _swprintf_p_l(), _vscwprintf_p_l(), and _vswprintf_p_l().

◆ vswprintf_s()

int CDECL vswprintf_s ( wchar_t str,
size_t  numberOfElements,
const wchar_t format,
va_list  args 
)

Definition at line 1816 of file wcs.c.

1818{
1820}

◆ wcrtomb()

size_t CDECL wcrtomb ( char dst,
wchar_t  ch,
mbstate_t s 
)

Definition at line 2211 of file wcs.c.

2212{
2213 if(s)
2214 *s = 0;
2215 return wctomb(dst, ch);
2216}
#define wctomb
Definition: wctomb.c:31

◆ wcrtomb_s()

INT CDECL wcrtomb_s ( size_t len,
char mbchar,
size_t  size,
wchar_t  wch,
mbstate_t s 
)

Definition at line 2197 of file wcs.c.

2199{
2200 int ilen, ret;
2201
2202 if (s) *s = 0;
2203 ret = wctomb_s(&ilen, mbchar, size, wch);
2204 if (len) *len = ilen;
2205 return ret;
2206}
int CDECL wctomb_s(int *len, char *mbchar, size_t size, wchar_t wch)
Definition: wcs.c:2139

◆ wcscat()

wchar_t *__cdecl wcscat ( wchar_t dst,
const wchar_t src 
)

Definition at line 2560 of file wcs.c.

2561{
2562 wcscpy( dst + wcslen(dst), src );
2563 return dst;
2564}
wcscpy

◆ wcscat_s()

INT CDECL wcscat_s ( wchar_t dst,
size_t  elem,
const wchar_t src 
)

Definition at line 2535 of file wcs.c.

2536{
2537 wchar_t* ptr = dst;
2538
2539 if (!dst || elem == 0) return EINVAL;
2540 if (!src)
2541 {
2542 dst[0] = '\0';
2543 return EINVAL;
2544 }
2545
2546 /* seek to end of dst string (or elem if no end of string is found */
2547 while (ptr < dst + elem && *ptr != '\0') ptr++;
2548 while (ptr < dst + elem)
2549 {
2550 if ((*ptr++ = *src++) == '\0') return 0;
2551 }
2552 /* not enough space */
2553 dst[0] = '\0';
2554 return ERANGE;
2555}
static size_t elem
Definition: string.c:71

◆ wcschr()

wchar_t *CDECL wcschr ( const wchar_t str,
wchar_t  ch 
)

Definition at line 2964 of file wcs.c.

2965{
2966 do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
2967 return NULL;
2968}
#define ULONG_PTR
Definition: config.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ wcscmp()

int CDECL wcscmp ( const wchar_t str1,
const wchar_t str2 
)

Definition at line 1972 of file wcs.c.

1973{
1974 while (*str1 && (*str1 == *str2))
1975 {
1976 str1++;
1977 str2++;
1978 }
1979
1980 if (*str1 < *str2)
1981 return -1;
1982 if (*str1 > *str2)
1983 return 1;
1984 return 0;
1985}

Referenced by _wcscoll_l().

◆ wcscoll()

int CDECL wcscoll ( const wchar_t str1,
const wchar_t str2 
)

Definition at line 2008 of file wcs.c.

2009{
2010 return _wcscoll_l(str1, str2, NULL);
2011}
int CDECL _wcscoll_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
Definition: wcs.c:1990

◆ wcscpy()

wchar_t *__cdecl wcscpy ( wchar_t dst,
const wchar_t src 
)

Definition at line 2468 of file wcs.c.

2469{
2470 WCHAR *p = dst;
2471 while ((*p++ = *src++));
2472 return dst;
2473}

◆ wcscpy_s()

INT CDECL wcscpy_s ( wchar_t wcDest,
size_t  numElement,
const wchar_t wcSrc 
)

Definition at line 2439 of file wcs.c.

2440{
2441 size_t size = 0;
2442
2443 if(!MSVCRT_CHECK_PMT(wcDest)) return EINVAL;
2444 if(!MSVCRT_CHECK_PMT(numElement)) return EINVAL;
2445
2447 {
2448 wcDest[0] = 0;
2449 return EINVAL;
2450 }
2451
2452 size = wcslen(wcSrc) + 1;
2453
2454 if(!MSVCRT_CHECK_PMT_ERR(size <= numElement, ERANGE))
2455 {
2456 wcDest[0] = 0;
2457 return ERANGE;
2458 }
2459
2460 memmove( wcDest, wcSrc, size*sizeof(WCHAR) );
2461
2462 return 0;
2463}
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static const unsigned char *static size_t const wchar_t * wcSrc
Definition: string.c:76

◆ wcscspn()

size_t __cdecl wcscspn ( const wchar_t str,
const wchar_t reject 
)

Definition at line 498 of file wcs.c.

499{
500 const wchar_t *ptr;
501 for (ptr = str; *ptr; ptr++) if (wcschr( reject, *ptr )) break;
502 return ptr - str;
503}
#define wcschr
Definition: compat.h:17

◆ wcslen()

size_t CDECL wcslen ( const wchar_t str)

Definition at line 2983 of file wcs.c.

2984{
2985 const wchar_t *s = str;
2986 while (*s) s++;
2987 return s - str;
2988}

Referenced by _wcsdup(), _wcsrev(), _wcsxfrm_l(), wcscat(), wcscpy_s(), and wcsrtombs_l().

◆ wcsncat()

wchar_t *__cdecl wcsncat ( wchar_t s1,
const wchar_t s2,
size_t  n 
)

Definition at line 2613 of file wcs.c.

2614{
2615 wchar_t *ret = s1;
2616 while (*s1) s1++;
2617 while (n-- > 0) if (!(*s1++ = *s2++)) return ret;
2618 *s1 = 0;
2619 return ret;
2620}
struct S1 s1
PCWSTR s2
Definition: shell32_main.h:38

◆ wcsncat_s()

errno_t CDECL wcsncat_s ( wchar_t dst,
size_t  elem,
const wchar_t src,
size_t  count 
)

Definition at line 2569 of file wcs.c.

2570{
2571 size_t i, j;
2572
2573 if (!MSVCRT_CHECK_PMT(dst != NULL)) return EINVAL;
2574 if (!MSVCRT_CHECK_PMT(elem > 0)) return EINVAL;
2575 if (count == 0) return 0;
2576 if (!MSVCRT_CHECK_PMT(src != NULL))
2577 {
2578 *dst = 0;
2579 return EINVAL;
2580 }
2581
2582 for (i = 0; i < elem; i++) if (!dst[i]) break;
2583
2584 if (i == elem)
2585 {
2586 MSVCRT_INVALID_PMT("dst[elem] is not NULL terminated\n", EINVAL);
2587 *dst = 0;
2588 return EINVAL;
2589 }
2590
2591 for (j = 0; (j + i) < elem; j++)
2592 {
2593 if(count == _TRUNCATE && j + i == elem - 1)
2594 {
2595 dst[j + i] = '\0';
2596 return STRUNCATE;
2597 }
2598 if(j == count || (dst[j + i] = src[j]) == '\0')
2599 {
2600 dst[j + i] = '\0';
2601 return 0;
2602 }
2603 }
2604
2605 MSVCRT_INVALID_PMT("dst[elem] is too small", ERANGE);
2606 dst[0] = '\0';
2607 return ERANGE;
2608}
#define STRUNCATE
Definition: errno.h:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

◆ wcsncmp()

int CDECL wcsncmp ( const wchar_t str1,
const wchar_t str2,
size_t  n 
)

Definition at line 518 of file wcs.c.

519{
520 if (!n)
521 return 0;
522 while(--n && *str1 && (*str1 == *str2))
523 {
524 str1++;
525 str2++;
526 }
527 return *str1 - *str2;
528}

Referenced by _wcsncoll_l().

◆ wcsncpy()

wchar_t *__cdecl wcsncpy ( wchar_t s1,
const wchar_t s2,
size_t  n 
)

Definition at line 2478 of file wcs.c.

2479{
2480 size_t i;
2481
2482 for(i=0; i<n; i++)
2483 if(!(s1[i] = s2[i])) break;
2484 for(; i<n; i++)
2485 s1[i] = 0;
2486 return s1;
2487}

◆ wcsncpy_s()

INT CDECL wcsncpy_s ( wchar_t dst,
size_t  elem,
const wchar_t src,
size_t  count 
)

Definition at line 2492 of file wcs.c.

2493{
2494 WCHAR *p = dst;
2495 BOOL truncate = (count == _TRUNCATE);
2496
2497 if (!count)
2498 {
2499 if (dst && elem) *dst = 0;
2500 return 0;
2501 }
2502
2503 if (!MSVCRT_CHECK_PMT(dst != NULL)) return EINVAL;
2504 if (!MSVCRT_CHECK_PMT(elem != 0)) return EINVAL;
2505 if (!MSVCRT_CHECK_PMT(src != NULL))
2506 {
2507 *dst = 0;
2508 return EINVAL;
2509 }
2510
2511 while (elem && count && *src)
2512 {
2513 *p++ = *src++;
2514 elem--;
2515 count--;
2516 }
2517 if (!elem && truncate)
2518 {
2519 *(p-1) = 0;
2520 return STRUNCATE;
2521 }
2522 else if (!elem)
2523 {
2524 *dst = 0;
2525 return ERANGE;
2526 }
2527 *p = 0;
2528 return 0;
2529}

◆ wcsnlen()

size_t CDECL wcsnlen ( const wchar_t s,
size_t  maxlen 
)

Definition at line 2920 of file wcs.c.

2921{
2922 size_t i;
2923
2924 for (i = 0; i < maxlen; i++)
2925 if (!s[i]) break;
2926 return i;
2927}

Referenced by _wcsncoll_l(), and _wcsnicoll_l().

◆ wcspbrk()

wchar_t *CDECL wcspbrk ( const wchar_t str,
const wchar_t accept 
)

Definition at line 2016 of file wcs.c.

2017{
2018 const wchar_t* p;
2019
2020 while (*str)
2021 {
2022 for (p = accept; *p; p++) if (*p == *str) return (wchar_t*)str;
2023 str++;
2024 }
2025 return NULL;
2026}
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23

◆ wcsrchr()

wchar_t *CDECL wcsrchr ( const wchar_t str,
wchar_t  ch 
)

Definition at line 2973 of file wcs.c.

2974{
2975 WCHAR *ret = NULL;
2976 do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
2977 return ret;
2978}
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ wcsrtombs()

size_t CDECL wcsrtombs ( char mbstr,
const wchar_t **  wcstr,
size_t  count,
mbstate_t mbstate 
)

Definition at line 701 of file wcs.c.

703{
704 if(mbstate)
705 *mbstate = 0;
706
707 return wcsrtombs_l(mbstr, wcstr, count, NULL);
708}

◆ wcsrtombs_l()

static size_t wcsrtombs_l ( char mbstr,
const wchar_t **  wcstr,
size_t  count,
_locale_t  locale 
)
static

Definition at line 609 of file wcs.c.

611{
613 size_t tmp = 0;
614 BOOL used_default = FALSE;
615 BOOL *pused_default;
616
617 if(!locale)
619 else
620 locinfo = locale->locinfo;
621
622 if(!locinfo->lc_codepage) {
623 size_t i;
624
625 if(!mbstr)
626 return wcslen(*wcstr);
627
628 for(i=0; i<count; i++) {
629 if((*wcstr)[i] > 255) {
630 *_errno() = EILSEQ;
631 return -1;
632 }
633
634 mbstr[i] = (*wcstr)[i];
635 if(!(*wcstr)[i]) break;
636 }
637
638 if(i < count) *wcstr = NULL;
639 else *wcstr += i;
640 return i;
641 }
642
643 pused_default = (locinfo->lc_codepage != CP_UTF8 ? &used_default : NULL);
644
645 if(!mbstr) {
647 *wcstr, -1, NULL, 0, NULL, pused_default);
648 if(!tmp || used_default) {
649 *_errno() = EILSEQ;
650 return -1;
651 }
652 return tmp-1;
653 }
654
655 while(**wcstr) {
656 char buf[3];
657 size_t i, size;
658
660 *wcstr, 1, buf, 3, NULL, pused_default);
661 if(!size || used_default) {
662 *_errno() = EILSEQ;
663 return -1;
664 }
665 if(tmp+size > count)
666 return tmp;
667
668 for(i=0; i<size; i++)
669 mbstr[tmp++] = buf[i];
670 (*wcstr)++;
671 }
672
673 if(tmp < count) {
674 mbstr[tmp] = '\0';
675 *wcstr = NULL;
676 }
677 return tmp;
678}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46

Referenced by _wcstombs_l(), wcsrtombs(), wcsrtombs_s_l(), and wcstombs().

◆ wcsrtombs_s()

int CDECL wcsrtombs_s ( size_t ret,
char mbstr,
size_t  size,
const wchar_t **  wcstr,
size_t  count,
mbstate_t mbstate 
)

Definition at line 785 of file wcs.c.

787{
788 if(mbstate)
789 *mbstate = 0;
790
791 return wcsrtombs_s_l(ret, mbstr, size, wcstr, count, NULL);
792}

◆ wcsrtombs_s_l()

static int wcsrtombs_s_l ( size_t ret,
char mbstr,
size_t  size,
const wchar_t **  wcstr,
size_t  count,
_locale_t  locale 
)
static

Definition at line 713 of file wcs.c.

715{
716 size_t conv;
717 int err;
718
719 if(!mbstr && !size && wcstr) {
720 conv = wcsrtombs_l(NULL, wcstr, 0, locale);
721 if(ret)
722 *ret = conv+1;
723 if(conv == -1)
724 return *_errno();
725 return 0;
726 }
727
728 if (!MSVCRT_CHECK_PMT(mbstr != NULL)) return EINVAL;
729 if (size) mbstr[0] = '\0';
730 if (!MSVCRT_CHECK_PMT(wcstr != NULL)) return EINVAL;
731 if (!MSVCRT_CHECK_PMT(*wcstr != NULL)) return EINVAL;
732
733 if(count==_TRUNCATE || size<count)
734 conv = size;
735 else
736 conv = count;
737
738 err = 0;
739 conv = wcsrtombs_l(mbstr, wcstr, conv, locale);
740 if(conv == -1) {
741 conv = 0;
742 if(size)
743 mbstr[0] = '\0';
744 err = *_errno();
745 }else if(conv < size)
746 mbstr[conv++] = '\0';
747 else if(conv==size && (count==_TRUNCATE || mbstr[conv-1]=='\0')) {
748 mbstr[conv-1] = '\0';
749 if(count==_TRUNCATE)
750 err = STRUNCATE;
751 }else {
752 MSVCRT_INVALID_PMT("mbstr[size] is too small", ERANGE);
753 conv = 0;
754 if(size)
755 mbstr[0] = '\0';
756 err = ERANGE;
757 }
758
759 if(ret)
760 *ret = conv;
761 return err;
762}

Referenced by _wcstombs_s_l(), wcsrtombs_s(), and wcstombs_s().

◆ wcsspn()

size_t __cdecl wcsspn ( const wchar_t str,
const wchar_t accept 
)

Definition at line 508 of file wcs.c.

509{
510 const wchar_t *ptr;
511 for (ptr = str; *ptr; ptr++) if (!wcschr( accept, *ptr )) break;
512 return ptr - str;
513}

◆ wcsstr()

wchar_t *CDECL wcsstr ( const wchar_t str,
const wchar_t sub 
)

Definition at line 2993 of file wcs.c.

2994{
2995 while(*str)
2996 {
2997 const wchar_t *p1 = str, *p2 = sub;
2998 while(*p1 && *p2 && *p1 == *p2)
2999 {
3000 p1++;
3001 p2++;
3002 }
3003 if(!*p2)
3004 return (wchar_t*)str;
3005 str++;
3006 }
3007 return NULL;
3008}

◆ wcstod()

double CDECL wcstod ( const wchar_t lpszStr,
wchar_t **  end 
)

Definition at line 797 of file wcs.c.

798{
799 return _wcstod_l(lpszStr, end, NULL);
800}

◆ wcstok()

wchar_t *CDECL wcstok ( wchar_t str,
const wchar_t delim 
)

Definition at line 2065 of file wcs.c.

2066{
2067 return wcstok_s(str, delim, &msvcrt_get_thread_data()->wcstok_next);
2068}
thread_data_t *CDECL msvcrt_get_thread_data(void)
Definition: thread.c:45
wchar_t *CDECL wcstok_s(wchar_t *str, const wchar_t *delim, wchar_t **next_token)
Definition: wcs.c:2031

◆ wcstok_s()

wchar_t *CDECL wcstok_s ( wchar_t str,
const wchar_t delim,
wchar_t **  next_token 
)

Definition at line 2031 of file wcs.c.

2033{
2034 wchar_t *ret;
2035
2036 if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL;
2037 if (!MSVCRT_CHECK_PMT(next_token != NULL)) return NULL;
2038 if (!MSVCRT_CHECK_PMT(str != NULL || *next_token != NULL)) return NULL;
2039
2040 if (!str) str = *next_token;
2041
2042 while (*str && wcschr( delim, *str )) str++;
2043 if (!*str) ret = NULL;
2044 else
2045 {
2046 ret = str++;
2047 while (*str && !wcschr( delim, *str )) str++;
2048 if (*str) *str++ = 0;
2049 }
2050 *next_token = str;
2051 return ret;
2052}
int next_token(char **, FILE *)

Referenced by wcstok().

◆ wcstol()

__msvcrt_long CDECL wcstol ( const wchar_t s,
wchar_t **  end,
int  base 
)

Definition at line 2747 of file wcs.c.

2749{
2750 return _wcstol_l(s, end, base, NULL);
2751}
__msvcrt_long CDECL _wcstol_l(const wchar_t *s, wchar_t **end, int base, _locale_t locale)
Definition: wcs.c:2729

◆ wcstombs()

size_t CDECL wcstombs ( char mbstr,
const wchar_t wcstr,
size_t  count 
)

Definition at line 692 of file wcs.c.

694{
695 return wcsrtombs_l(mbstr, &wcstr, count, NULL);
696}

◆ wcstombs_s()

int CDECL wcstombs_s ( size_t ret,
char mbstr,
size_t  size,
const wchar_t wcstr,
size_t  count 
)

Definition at line 776 of file wcs.c.

778{
779 return wcsrtombs_s_l(ret, mbstr, size, &wcstr, count, NULL);
780}

Referenced by _VCrtDbgReportW(), _wperror(), and process_sub().

◆ wcstoul()

__msvcrt_ulong __cdecl wcstoul ( const wchar_t s,
wchar_t **  end,
int  base 
)

Definition at line 2912 of file wcs.c.

2913{
2914 return _wcstoul_l(s, end, base, NULL);
2915}
__msvcrt_ulong __cdecl _wcstoul_l(const wchar_t *s, wchar_t **end, int base, _locale_t locale)
Definition: wcs.c:2894

◆ wcsxfrm()

size_t CDECL wcsxfrm ( wchar_t dest,
const wchar_t src,
size_t  len 
)

Definition at line 3097 of file wcs.c.

3098{
3099 return _wcsxfrm_l(dest, src, len, NULL);
3100}
size_t CDECL _wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t len, _locale_t locale)
Definition: wcs.c:3048

◆ wctob()

INT CDECL wctob ( wint_t  wchar)

Definition at line 2175 of file wcs.c.

2176{
2177 char out;
2178 BOOL error = FALSE;
2179 BOOL *perror;
2180 UINT codepage = get_locinfo()->lc_codepage;
2181
2182 perror = (codepage != CP_UTF8 ? &error : NULL);
2183
2184 if(!codepage) {
2185 if (wchar < 0xff)
2186 return (signed char)wchar;
2187 else
2188 return EOF;
2189 } else if(WideCharToMultiByte( codepage, 0, &wchar, 1, &out, 1, NULL, perror ) && !error)
2190 return (INT)out;
2191 return EOF;
2192}
#define EOF
Definition: stdio.h:33
unsigned int UINT
Definition: ndis.h:50
int32_t INT
Definition: typedefs.h:58
size_t const wchar_t const wchar
Definition: wcrtomb.cpp:53
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int codepage
Definition: win_iconv.c:156

◆ wctoint()

static int wctoint ( WCHAR  c,
int  base 
)
static

Definition at line 2625 of file wcs.c.

2626{
2627 int v = -1;
2628 if ('0' <= c && c <= '9')
2629 v = c - '0';
2630 else if ('A' <= c && c <= 'Z')
2631 v = c - 'A' + 10;
2632 else if ('a' <= c && c <= 'z')
2633 v = c - 'a' + 10;
2634 else {
2635 /* NOTE: MAP_FOLDDIGITS supports too many things. */
2636 /* Unicode points that contain digits 0-9; keep this sorted! */
2637 static const WCHAR zeros[] = {
2638 0x660, 0x6f0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xc66, 0xce6,
2639 0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810, 0xff10
2640 };
2641 int i;
2642 for (i = 0; i < ARRAY_SIZE(zeros) && c >= zeros[i]; ++i) {
2643 if (zeros[i] <= c && c <= zeros[i] + 9) {
2644 v = c - zeros[i];
2645 break;
2646 }
2647 }
2648 }
2649 return v < base ? v : -1;
2650}
#define ARRAY_SIZE(A)
Definition: main.h:20

Referenced by _wcstoi64_l(), and _wcstoui64_l().

◆ wctomb()

INT CDECL wctomb ( char dst,
wchar_t  ch 
)

Definition at line 2167 of file wcs.c.

2168{
2169 return _wctomb_l(dst, ch, NULL);
2170}
int CDECL _wctomb_l(char *dst, wchar_t ch, _locale_t locale)
Definition: wcs.c:2147

◆ wctomb_s()

int CDECL wctomb_s ( int len,
char mbchar,
size_t  size,
wchar_t  wch 
)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msvcrt  )

Variable Documentation

◆ n_format_enabled

BOOL n_format_enabled = TRUE
static

Definition at line 49 of file wcs.c.

Referenced by pf_printf().