ReactOS 0.4.16-dev-2204-g370eb8c
stdlib.h File Reference
#include <corecrt_malloc.h>
#include <corecrt_wstdlib.h>
#include <limits.h>
#include <pshpack8.h>
#include <poppack.h>
Include dependency graph for stdlib.h:

Go to the source code of this file.

Classes

struct  _CRT_FLOAT
 
struct  _CRT_DOUBLE
 
struct  _LDOUBLE
 
struct  _div_t
 
struct  _ldiv_t
 
struct  _lldiv_t
 

Macros

#define EXIT_SUCCESS   0
 
#define EXIT_FAILURE   -1
 
#define RAND_MAX   0x7FFF
 
#define _MAX_DRIVE   3
 
#define _MAX_FNAME   256
 
#define _MAX_DIR   _MAX_FNAME
 
#define _MAX_EXT   _MAX_FNAME
 
#define _MAX_PATH   260
 
#define _TRUNCATE   ((size_t)-1)
 
#define _countof(x)   (sizeof(x)/sizeof((x)[0]))
 
#define __max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define __min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define _OUT_TO_DEFAULT   0
 
#define _OUT_TO_STDERR   1
 
#define _OUT_TO_MSGBOX   2
 
#define _REPORT_ERRMODE   3
 
#define _WRITE_ABORT_MSG   1
 
#define _CALL_REPORTFAULT   2
 
#define __mb_cur_max   ___mb_cur_max_func()
 
#define MB_CUR_MAX   ___mb_cur_max_func()
 
#define _doserrno   (*__doserrno())
 
#define errno   (*_errno())
 
#define _sys_nerr   (*__sys_nerr())
 
#define _CRT_ONEXIT_T_DEFINED
 
#define environ   _environ
 
#define onexit_t   _onexit_t
 

Typedefs

typedef struct _div_t div_t
 
typedef struct _ldiv_t ldiv_t
 
typedef struct _lldiv_t lldiv_t
 
typedef int(__cdecl_onexit_t) (void)
 
typedef void(__cdecl_purecall_handler) (void)
 
typedef void(__cdecl_invalid_parameter_handler) (const wchar_t *, const wchar_t *, const wchar_t *, unsigned, uintptr_t)
 

Functions

_ACRTIMP int __cdecl ___mb_cur_max_func (void)
 
_ACRTIMP int __cdecl ___mb_cur_max_l_func (_locale_t)
 
_ACRTIMP __msvcrt_ulong *__cdecl __doserrno (void)
 
_ACRTIMP int *__cdecl _errno (void)
 
_ACRTIMP int *__cdecl __sys_nerr (void)
 
_ACRTIMP errno_t __cdecl _get_doserrno (int *)
 
_ACRTIMP errno_t __cdecl _get_errno (int *)
 
_ACRTIMP errno_t __cdecl _set_doserrno (int)
 
_ACRTIMP errno_t __cdecl _set_errno (int)
 
_ACRTIMP errno_t __cdecl _set_fmode (int)
 
_ACRTIMP errno_t __cdecl _get_fmode (int *)
 
_ACRTIMP int __cdecl _atodbl (_CRT_DOUBLE *, char *)
 
_ACRTIMP int __cdecl _atodbl_l (_CRT_DOUBLE *, char *, _locale_t)
 
_ACRTIMP int __cdecl _atoflt (_CRT_FLOAT *, char *)
 
_ACRTIMP int __cdecl _atoflt_l (_CRT_FLOAT *, char *, _locale_t)
 
_ACRTIMP __int64 __cdecl _atoi64 (const char *)
 
_ACRTIMP int __cdecl _atoldbl (_LDOUBLE *, char *)
 
_ACRTIMP void __cdecl _beep (unsigned int, unsigned int)
 
_ACRTIMP unsigned short __cdecl _byteswap_ushort (unsigned short)
 
_ACRTIMP __msvcrt_ulong __cdecl _byteswap_ulong (__msvcrt_ulong)
 
_ACRTIMP unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64)
 
_ACRTIMP char *__cdecl _ecvt (double, int, int *, int *)
 
_ACRTIMP char *__cdecl _fcvt (double, int, int *, int *)
 
_ACRTIMP char *__cdecl _fullpath (char *, const char *, size_t)
 
_ACRTIMP char *__cdecl _gcvt (double, int, char *)
 
_ACRTIMP errno_t __cdecl _gcvt_s (char *, size_t, double, int)
 
_ACRTIMP char *__cdecl _i64toa (__int64, char *, int)
 
_ACRTIMP errno_t __cdecl _i64toa_s (__int64, char *, size_t, int)
 
_ACRTIMP char *__cdecl _itoa (int, char *, int)
 
_ACRTIMP errno_t __cdecl _itoa_s (int, char *, size_t, int)
 
_ACRTIMP char *__cdecl _ltoa (__msvcrt_long, char *, int)
 
_ACRTIMP errno_t __cdecl _ltoa_s (__msvcrt_long, char *, size_t, int)
 
_ACRTIMP __msvcrt_ulong __cdecl _lrotl (__msvcrt_ulong, int)
 
_ACRTIMP __msvcrt_ulong __cdecl _lrotr (__msvcrt_ulong, int)
 
_ACRTIMP void __cdecl _makepath (char *, const char *, const char *, const char *, const char *)
 
_ACRTIMP int __cdecl _makepath_s (char *, size_t, const char *, const char *, const char *, const char *)
 
_ACRTIMP size_t __cdecl _mbstrlen (const char *)
 
_ACRTIMP _onexit_t __cdecl _onexit (_onexit_t)
 
_ACRTIMP int __cdecl _putenv (const char *)
 
_ACRTIMP errno_t __cdecl _putenv_s (const char *, const char *)
 
_ACRTIMP unsigned int __cdecl _rotl (unsigned int, int)
 
_ACRTIMP unsigned int __cdecl _rotr (unsigned int, int)
 
_ACRTIMP void __cdecl _searchenv (const char *, const char *, char *)
 
_ACRTIMP int __cdecl _set_error_mode (int)
 
_ACRTIMP void __cdecl _seterrormode (int)
 
_ACRTIMP void __cdecl _sleep (__msvcrt_ulong)
 
_ACRTIMP void __cdecl _splitpath (const char *, char *, char *, char *, char *)
 
_ACRTIMP errno_t __cdecl _splitpath_s (const char *, char *, size_t, char *, size_t, char *, size_t, char *, size_t)
 
_ACRTIMP void __cdecl _swab (char *, char *, int)
 
_ACRTIMP char *__cdecl _ui64toa (unsigned __int64, char *, int)
 
_ACRTIMP errno_t __cdecl _ui64toa_s (unsigned __int64, char *, size_t, int)
 
_ACRTIMP char *__cdecl _ultoa (__msvcrt_ulong, char *, int)
 
_ACRTIMP errno_t __cdecl _ultoa_s (__msvcrt_ulong, char *, size_t, int)
 
_ACRTIMP DECLSPEC_NORETURN void __cdecl _Exit (int)
 
_ACRTIMP DECLSPEC_NORETURN void __cdecl _exit (int)
 
_ACRTIMP DECLSPEC_NORETURN void __cdecl abort (void)
 Aborts the program.
 
_ACRTIMP int __cdecl abs (int)
 
int __cdecl atexit (void(__cdecl *)(void))
 
_ACRTIMP double __cdecl atof (const char *)
 
_ACRTIMP int __cdecl atoi (const char *)
 
_ACRTIMP int __cdecl _atoi_l (const char *, _locale_t)
 
_ACRTIMP __msvcrt_long __cdecl atol (const char *)
 
_ACRTIMP __int64 __cdecl atoll (const char *)
 
_ACRTIMP div_t __cdecl div (int, int)
 
_ACRTIMP ldiv_t __cdecl ldiv (__msvcrt_long, __msvcrt_long)
 
_ACRTIMP lldiv_t __cdecl lldiv (__int64, __int64)
 
_ACRTIMP DECLSPEC_NORETURN void __cdecl exit (int)
 
_ACRTIMP char *__cdecl getenv (const char *)
 
_ACRTIMP errno_t __cdecl getenv_s (size_t *, char *, size_t, const char *)
 
_ACRTIMP __msvcrt_long __cdecl labs (__msvcrt_long)
 
_ACRTIMP __int64 __cdecl llabs (__int64)
 
_ACRTIMP int __cdecl mblen (const char *, size_t)
 
_ACRTIMP void __cdecl perror (const char *)
 
_ACRTIMP int __cdecl rand (void)
 
_ACRTIMP errno_t __cdecl rand_s (unsigned int *)
 
_ACRTIMP void __cdecl srand (unsigned int)
 
_ACRTIMP float __cdecl strtof (const char *, char **)
 
_ACRTIMP float __cdecl _strtof_l (const char *, char **, _locale_t)
 
_ACRTIMP double __cdecl strtod (const char *, char **)
 
_ACRTIMP double __cdecl _strtod_l (const char *, char **, _locale_t)
 
static long double strtold (const char *string, char **endptr)
 
static long double _strtold_l (const char *string, char **endptr, _locale_t locale)
 
_ACRTIMP __msvcrt_long __cdecl strtol (const char *, char **, int)
 
_ACRTIMP __msvcrt_ulong __cdecl strtoul (const char *, char **, int)
 
_ACRTIMP __int64 __cdecl _strtoll_l (const char *, char **, int, _locale_t)
 
_ACRTIMP unsigned __int64 __cdecl _strtoull_l (const char *, char **, int, _locale_t)
 
_ACRTIMP __int64 __cdecl _strtoi64 (const char *, char **, int)
 
_ACRTIMP __int64 __cdecl _strtoi64_l (const char *, char **, int, _locale_t)
 
_ACRTIMP unsigned __int64 __cdecl _strtoui64 (const char *, char **, int)
 
_ACRTIMP unsigned __int64 __cdecl _strtoui64_l (const char *, char **, int, _locale_t)
 
_ACRTIMP int __cdecl system (const char *)
 
_ACRTIMP void *__cdecl bsearch (const void *, const void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
 
_ACRTIMP void __cdecl qsort (void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
 
_ACRTIMP void __cdecl qsort_s (void *, size_t, size_t, int(__cdecl *)(void *, const void *, const void *), void *)
 
_ACRTIMP unsigned int __cdecl _set_abort_behavior (unsigned int flags, unsigned int mask)
 Specifies the behavior of the abort() function.
 
_ACRTIMP _purecall_handler __cdecl _set_purecall_handler (_purecall_handler)
 
_ACRTIMP _purecall_handler __cdecl _get_purecall_handler (void)
 
_ACRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler (_invalid_parameter_handler)
 
_ACRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler (void)
 
_ACRTIMP _invalid_parameter_handler __cdecl _get_thread_local_invalid_parameter_handler (void)
 
_ACRTIMP _invalid_parameter_handler __cdecl _set_thread_local_invalid_parameter_handler (_invalid_parameter_handler)
 
void __cdecl _invalid_parameter (const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t arg)
 
static charecvt (double value, int ndigit, int *decpt, int *sign)
 
static charfcvt (double value, int ndigit, int *decpt, int *sign)
 
static chargcvt (double value, int ndigit, char *buf)
 
static charitoa (int value, char *str, int radix)
 
static charltoa (__msvcrt_long value, char *str, int radix)
 
static _onexit_t onexit (_onexit_t func)
 
static int putenv (const char *str)
 
static __int64 strtoll (const char *ptr, char **endptr, int base)
 
static unsigned __int64 __cdecl strtoull (const char *ptr, char **endptr, int base)
 
static void swab (char *src, char *dst, int len)
 
static charultoa (__msvcrt_ulong value, char *str, int radix)
 

Variables

unsigned int _osver
 
unsigned int _winver
 
unsigned int _winmajor
 
unsigned int _winminor
 
int __argc
 
char ** __argv
 
wchar_t ** __wargv
 
char ** _environ
 
wchar_t ** _wenviron
 
unsigned int _fmode
 

Macro Definition Documentation

◆ __max

#define __max (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 65 of file stdlib.h.

◆ __mb_cur_max

#define __mb_cur_max   ___mb_cur_max_func()

Definition at line 126 of file stdlib.h.

◆ __min

#define __min (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 66 of file stdlib.h.

◆ _CALL_REPORTFAULT

#define _CALL_REPORTFAULT   2

Definition at line 80 of file stdlib.h.

◆ _countof

#define _countof (   x)    (sizeof(x)/sizeof((x)[0]))

Definition at line 63 of file stdlib.h.

◆ _CRT_ONEXIT_T_DEFINED

#define _CRT_ONEXIT_T_DEFINED

Definition at line 149 of file stdlib.h.

◆ _doserrno

#define _doserrno   (*__doserrno())

Definition at line 129 of file stdlib.h.

◆ _MAX_DIR

#define _MAX_DIR   _MAX_FNAME

Definition at line 39 of file stdlib.h.

◆ _MAX_DRIVE

#define _MAX_DRIVE   3

Definition at line 37 of file stdlib.h.

◆ _MAX_EXT

#define _MAX_EXT   _MAX_FNAME

Definition at line 40 of file stdlib.h.

◆ _MAX_FNAME

#define _MAX_FNAME   256

Definition at line 38 of file stdlib.h.

◆ _MAX_PATH

#define _MAX_PATH   260

Definition at line 41 of file stdlib.h.

◆ _OUT_TO_DEFAULT

#define _OUT_TO_DEFAULT   0

Definition at line 73 of file stdlib.h.

◆ _OUT_TO_MSGBOX

#define _OUT_TO_MSGBOX   2

Definition at line 75 of file stdlib.h.

◆ _OUT_TO_STDERR

#define _OUT_TO_STDERR   1

Definition at line 74 of file stdlib.h.

◆ _REPORT_ERRMODE

#define _REPORT_ERRMODE   3

Definition at line 76 of file stdlib.h.

◆ _sys_nerr

#define _sys_nerr   (*__sys_nerr())

Definition at line 133 of file stdlib.h.

◆ _TRUNCATE

#define _TRUNCATE   ((size_t)-1)

Definition at line 45 of file stdlib.h.

◆ _WRITE_ABORT_MSG

#define _WRITE_ABORT_MSG   1

Definition at line 79 of file stdlib.h.

◆ environ

#define environ   _environ

Definition at line 285 of file stdlib.h.

◆ errno

#define errno   (*_errno())

Definition at line 131 of file stdlib.h.

◆ EXIT_FAILURE

#define EXIT_FAILURE   -1

Definition at line 33 of file stdlib.h.

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Definition at line 32 of file stdlib.h.

◆ max

#define max (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 68 of file stdlib.h.

◆ MB_CUR_MAX

#define MB_CUR_MAX   ___mb_cur_max_func()

Definition at line 127 of file stdlib.h.

◆ min

#define min (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 69 of file stdlib.h.

◆ onexit_t

#define onexit_t   _onexit_t

Definition at line 286 of file stdlib.h.

◆ RAND_MAX

#define RAND_MAX   0x7FFF

Definition at line 34 of file stdlib.h.

Typedef Documentation

◆ _invalid_parameter_handler

typedef void(__cdecl * _invalid_parameter_handler) (const wchar_t *, const wchar_t *, const wchar_t *, unsigned, uintptr_t)

Definition at line 259 of file stdlib.h.

◆ _onexit_t

typedef int(__cdecl * _onexit_t) (void)

Definition at line 150 of file stdlib.h.

◆ _purecall_handler

typedef void(__cdecl * _purecall_handler) (void)

Definition at line 255 of file stdlib.h.

◆ div_t

typedef struct _div_t div_t

◆ ldiv_t

◆ lldiv_t

Function Documentation

◆ ___mb_cur_max_func()

_ACRTIMP int __cdecl ___mb_cur_max_func ( void  )

Definition at line 197 of file mbcs.c.

198{
199 return get_locinfo()->mb_cur_max;
200}
#define get_locinfo()
Definition: winesup.h:25

◆ ___mb_cur_max_l_func()

_ACRTIMP int __cdecl ___mb_cur_max_l_func ( _locale_t  locale)

Definition at line 289 of file initctype.cpp.

290{
291 return locale == nullptr
293 : locale->locinfo->_public._locale_mb_cur_max;
294}
Definition: _locale.h:75
else locinfo
Definition: scanf.h:225
int __cdecl ___mb_cur_max_func()
Definition: initctype.cpp:274

◆ __doserrno()

_ACRTIMP __msvcrt_ulong *__cdecl __doserrno ( void  )

Definition at line 223 of file errno.c.

224{
225 return &msvcrt_get_thread_data()->thread_doserrno;
226}
thread_data_t *CDECL msvcrt_get_thread_data(void)
Definition: thread.c:45

◆ __sys_nerr()

_ACRTIMP int *__cdecl __sys_nerr ( void  )

Definition at line 142 of file syserr.cpp.

143{
144 return const_cast<int*>(&_sys_nerr);
145}
int const _sys_nerr
Definition: syserr.cpp:115

◆ _atodbl()

_ACRTIMP int __cdecl _atodbl ( _CRT_DOUBLE value,
char str 
)

Definition at line 1162 of file string.c.

1163{
1164 return _atodbl_l(value, str, NULL);
1165}
#define NULL
Definition: types.h:112
int CDECL _atodbl_l(_CRT_DOUBLE *value, char *str, _locale_t locale)
Definition: string.c:1147
const WCHAR * str
Definition: pdh_main.c:96

Referenced by test__atodbl().

◆ _atodbl_l()

_ACRTIMP int __cdecl _atodbl_l ( _CRT_DOUBLE value,
char str,
_locale_t  locale 
)

Definition at line 1147 of file string.c.

1148{
1149 int err;
1150
1152 if(isinf(value->x))
1153 return _OVERFLOW;
1154 if((value->x!=0 || err) && value->x>-DBL_MIN && value->x<DBL_MIN)
1155 return _UNDERFLOW;
1156 return 0;
1157}
#define DBL_MIN
Definition: float.h:24
#define _UNDERFLOW
Definition: math.h:23
#define isinf(x)
Definition: math.h:359
#define _OVERFLOW
Definition: math.h:22
static double strtod_helper(const char *str, char **end, _locale_t locale, int *perr)
Definition: string.c:1024
#define err(...)

Referenced by _atodbl().

◆ _atoflt()

_ACRTIMP int __cdecl _atoflt ( _CRT_FLOAT value,
char str 
)

Definition at line 1139 of file string.c.

1140{
1141 return _atoflt_l(value, str, NULL);
1142}
int CDECL _atoflt_l(_CRT_FLOAT *value, char *str, _locale_t locale)
Definition: string.c:1122

◆ _atoflt_l()

_ACRTIMP int __cdecl _atoflt_l ( _CRT_FLOAT value,
char str,
_locale_t  locale 
)

Definition at line 1122 of file string.c.

1123{
1124 double d;
1125 int err;
1126
1128 value->f = d;
1129 if(isinf(value->f))
1130 return _OVERFLOW;
1131 if((d!=0 || err) && value->f>-FLT_MIN && value->f<FLT_MIN)
1132 return _UNDERFLOW;
1133 return 0;
1134}
#define FLT_MIN
Definition: float.h:40
#define d
Definition: ke_i.h:81

Referenced by _atoflt().

◆ _atoi64()

_ACRTIMP __int64 __cdecl _atoi64 ( const char str)

Definition at line 1757 of file string.c.

1758{
1759 return _strtoi64_l(str, NULL, 10, NULL);
1760}
__int64 CDECL _strtoi64_l(const char *nptr, char **endptr, int base, _locale_t locale)
Definition: string.c:1617

Referenced by atol(), atoll(), CommandDumpSector(), IopStartRamdisk(), main(), and RamDiskInitialize().

◆ _atoi_l()

_ACRTIMP int __cdecl _atoi_l ( const char str,
_locale_t  locale 
)

Definition at line 1697 of file string.c.

1698{
1700
1701 if(ret > INT_MAX) {
1702 ret = INT_MAX;
1703 *_errno() = ERANGE;
1704 } else if(ret < INT_MIN) {
1705 ret = INT_MIN;
1706 *_errno() = ERANGE;
1707 }
1708 return ret;
1709}
int *CDECL _errno(void)
Definition: errno.c:215
#define __int64
Definition: corecrt.h:72
#define ERANGE
Definition: errno.h:55
#define INT_MIN
Definition: limits.h:25
#define INT_MAX
Definition: limits.h:26
return ret
Definition: mutex.c:146

◆ _atoldbl()

_ACRTIMP int __cdecl _atoldbl ( _LDOUBLE value,
char str 
)

Definition at line 1584 of file string.c.

1585{
1586 return _atoldbl_l( (MSVCRT__LDOUBLE*)value, str, NULL );
1587}
int CDECL _atoldbl_l(MSVCRT__LDOUBLE *value, char *str, _locale_t locale)
Definition: string.c:1570

◆ _beep()

_ACRTIMP void __cdecl _beep ( unsigned int  freq,
unsigned int  duration 
)

Definition at line 41 of file misc.c.

42{
43 TRACE(":Freq %d, Duration %d\n",freq,duration);
44 Beep(freq, duration);
45}
BOOL WINAPI Beep(IN DWORD dwFreq, IN DWORD dwDuration)
Definition: deviceio.c:48
#define TRACE(s)
Definition: solgame.cpp:4

◆ _byteswap_uint64()

_ACRTIMP unsigned __int64 __cdecl _byteswap_uint64 ( unsigned  __int64)

Definition at line 49 of file byteswap.cpp.

50{
51 unsigned __int64 j;
52 j = (i << 56);
53 j += (i << 40) & 0x00FF000000000000;
54 j += (i << 24) & 0x0000FF0000000000;
55 j += (i << 8) & 0x000000FF00000000;
56 j += (i >> 8) & 0x00000000FF000000;
57 j += (i >> 24) & 0x0000000000FF0000;
58 j += (i >> 40) & 0x000000000000FF00;
59 j += (i >> 56);
60 return j;
61
62}
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
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

Referenced by RtlUlonglongByteSwap().

◆ _byteswap_ulong()

◆ _byteswap_ushort()

_ACRTIMP unsigned short __cdecl _byteswap_ushort ( unsigned short  value)

Definition at line 42 of file intrin_arm.h.

43{
44 return (value >> 8) | (value << 8);
45}

Referenced by PerformQualityConversion(), and RtlUshortByteSwap().

◆ _ecvt()

_ACRTIMP char *__cdecl _ecvt ( double  number,
int  ndigits,
int decpt,
int sign 
)

Definition at line 1748 of file math.c.

1749{
1750 int prec, len;
1752 /* FIXME: check better for overflow (native supports over 300 chars) */
1753 ndigits = min( ndigits, 80 - 8); /* 8 : space for sign, dec point, "e",
1754 * 4 for exponent and one for
1755 * terminating '\0' */
1756 if (!data->efcvt_buffer)
1757 data->efcvt_buffer = malloc( 80 ); /* ought to be enough */
1758
1759 /* handle cases with zero ndigits or less */
1760 prec = ndigits;
1761 if( prec < 1) prec = 2;
1762 len = _snprintf(data->efcvt_buffer, 80, "%.*le", prec - 1, number);
1763
1764 if (data->efcvt_buffer[0] == '-') {
1765 memmove( data->efcvt_buffer, data->efcvt_buffer + 1, len-- );
1766 *sign = 1;
1767 } else *sign = 0;
1768
1769 /* take the decimal "point away */
1770 if( prec != 1)
1771 memmove( data->efcvt_buffer + 1, data->efcvt_buffer + 2, len - 1 );
1772 /* take the exponential "e" out */
1773 data->efcvt_buffer[ prec] = '\0';
1774 /* read the exponent */
1775 sscanf( data->efcvt_buffer + prec + 1, "%d", decpt);
1776 (*decpt)++;
1777 /* adjust for some border cases */
1778 if( data->efcvt_buffer[0] == '0')/* value is zero */
1779 *decpt = 0;
1780 /* handle cases with zero ndigits or less */
1781 if( ndigits < 1){
1782 if( data->efcvt_buffer[ 0] >= '5')
1783 (*decpt)++;
1784 data->efcvt_buffer[ 0] = '\0';
1785 }
1786 TRACE("out=\"%s\"\n",data->efcvt_buffer);
1787 return data->efcvt_buffer;
1788}
#define malloc
Definition: debug_ros.c:4
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
#define sign(x)
Definition: mapdesc.cc:613
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static unsigned int number
Definition: dsound.c:1479
static size_t double int ndigits
Definition: printf.c:52
static size_t double int int * decpt
Definition: printf.c:52
#define min(a, b)
Definition: monoChain.cc:55
#define _snprintf
Definition: xmlstorage.h:200

Referenced by ecvt(), and test_xcvt().

◆ _errno()

_ACRTIMP int *__cdecl _errno ( void  )

Definition at line 215 of file errno.c.

216{
217 return &msvcrt_get_thread_data()->thread_errno;
218}

◆ _Exit()

Definition at line 60 of file process.h.

61 { _exit(status); }
void CDECL _exit(int exitcode)
Definition: exit.c:187
Definition: ps.c:97

◆ _exit()

◆ _fcvt()

_ACRTIMP char *__cdecl _fcvt ( double  number,
int  ndigits,
int decpt,
int sign 
)

Definition at line 1840 of file math.c.

1841{
1843 int stop, dec1, dec2;
1844 char *ptr1, *ptr2, *first;
1845 char buf[80]; /* ought to be enough */
1846 char decimal_separator = get_locinfo()->lconv->decimal_point[0];
1847
1848 if (!data->efcvt_buffer)
1849 data->efcvt_buffer = malloc( 80 ); /* ought to be enough */
1850
1851 stop = _snprintf(buf, 80, "%.*f", ndigits < 0 ? 0 : ndigits, number);
1852 ptr1 = buf;
1853 ptr2 = data->efcvt_buffer;
1854 first = NULL;
1855 dec1 = 0;
1856 dec2 = 0;
1857
1858 if (*ptr1 == '-') {
1859 *sign = 1;
1860 ptr1++;
1861 } else *sign = 0;
1862
1863 /* For numbers below the requested resolution, work out where
1864 the decimal point will be rather than finding it in the string */
1865 if (number < 1.0 && number > 0.0) {
1866 dec2 = log10(number + 1e-10);
1867 if (-dec2 <= ndigits) dec2 = 0;
1868 }
1869
1870 /* If requested digits is zero or less, we will need to truncate
1871 * the returned string */
1872 if (ndigits < 1) {
1873 stop += ndigits;
1874 }
1875
1876 while (*ptr1 == '0') ptr1++; /* Skip leading zeroes */
1877 while (*ptr1 != '\0' && *ptr1 != decimal_separator) {
1878 if (!first) first = ptr2;
1879 if ((ptr1 - buf) < stop) {
1880 *ptr2++ = *ptr1++;
1881 } else {
1882 ptr1++;
1883 }
1884 dec1++;
1885 }
1886
1887 if (ndigits > 0) {
1888 ptr1++;
1889 if (!first) {
1890 while (*ptr1 == '0') { /* Process leading zeroes */
1891 *ptr2++ = *ptr1++;
1892 dec1--;
1893 }
1894 }
1895 while (*ptr1 != '\0') {
1896 if (!first) first = ptr2;
1897 *ptr2++ = *ptr1++;
1898 }
1899 }
1900
1901 *ptr2 = '\0';
1902
1903 /* We never found a non-zero digit, then our number is either
1904 * smaller than the requested precision, or 0.0 */
1905 if (!first) {
1906 if (number > 0.0) {
1907 first = ptr2;
1908 } else {
1909 first = data->efcvt_buffer;
1910 dec1 = 0;
1911 }
1912 }
1913
1914 *decpt = dec2 ? dec2 : dec1;
1915 return first;
1916}
double log10(double x)
Definition: freeldr.c:190
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const GLint * first
Definition: glext.h:5794
#define e
Definition: ke_i.h:82

Referenced by fcvt(), test_fcvt(), and test_xcvt().

◆ _fullpath()

_ACRTIMP char *__cdecl _fullpath ( char abs_path,
const char rel_path,
size_t  size 
)

Definition at line 1272 of file dir.c.

1273{
1274 wchar_t abs_pathW[MAX_PATH], *rel_pathW = NULL, *retW;
1275 size_t len;
1276
1277 if (rel_path && !(rel_pathW = wstrdupa_utf8(rel_path))) return NULL;
1278 retW = _wfullpath(abs_pathW, rel_pathW, ARRAY_SIZE(abs_pathW));
1279 free(rel_pathW);
1280 if (!retW) return NULL;
1281
1282 if (!abs_path) return astrdupw_utf8(abs_pathW);
1283 len = convert_wcs_to_acp_utf8(abs_pathW, NULL, 0);
1284 if (!len) return NULL;
1285 if (len > size)
1286 {
1287 *_errno() = ERANGE;
1288 return NULL;
1289 }
1290 convert_wcs_to_acp_utf8(abs_pathW, abs_path, size);
1291 return abs_path;
1292}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define free
Definition: debug_ros.c:5
#define MAX_PATH
Definition: compat.h:34
wchar_t *CDECL _wfullpath(wchar_t *absPath, const wchar_t *relPath, size_t size)
Definition: dir.c:1218
static wchar_t * wstrdupa_utf8(const char *str)
Definition: msvcrt.h:440
static char * astrdupw_utf8(const wchar_t *wstr)
Definition: msvcrt.h:452
static int convert_wcs_to_acp_utf8(const wchar_t *wstr, char *str, int len)
Definition: msvcrt.h:435
GLsizeiptr size
Definition: glext.h:5919

Referenced by _searchenv_s(), test_fullpath(), and test_utf8().

◆ _gcvt()

_ACRTIMP char *__cdecl _gcvt ( double  number,
int  ndigit,
char buff 
)

Definition at line 2008 of file math.c.

2009{
2010 if(!buff) {
2011 *_errno() = EINVAL;
2012 return NULL;
2013 }
2014
2015 if(ndigit < 0) {
2016 *_errno() = ERANGE;
2017 return NULL;
2018 }
2019
2020 sprintf(buff, "%.*g", ndigit, number);
2021 return buff;
2022}
#define EINVAL
Definition: errno.h:44
static unsigned char buff[32768]
Definition: fatten.c:17
#define sprintf
Definition: sprintf.c:45

Referenced by gcvt(), and test_gcvt().

◆ _gcvt_s()

_ACRTIMP errno_t __cdecl _gcvt_s ( char buff,
size_t  size,
double  number,
int  digits 
)

Definition at line 2027 of file math.c.

2028{
2029 int len;
2030
2031 if(!buff) {
2032 *_errno() = EINVAL;
2033 return EINVAL;
2034 }
2035
2036 if( digits<0 || digits>=size) {
2037 if(size)
2038 buff[0] = '\0';
2039
2040 *_errno() = ERANGE;
2041 return ERANGE;
2042 }
2043
2044 len = _scprintf("%.*g", digits, number);
2045 if(len > size) {
2046 buff[0] = '\0';
2047 *_errno() = ERANGE;
2048 return ERANGE;
2049 }
2050
2051 sprintf(buff, "%.*g", digits, number);
2052 return 0;
2053}
_ACRTIMP int __cdecl _scprintf(const char *,...) __WINE_CRT_PRINTF_ATTR(1
static const int digits[]
Definition: decode.c:71

Referenced by _gcvt().

◆ _get_doserrno()

_ACRTIMP errno_t __cdecl _get_doserrno ( int pValue)

Definition at line 243 of file errno.c.

244{
245 if (!pValue)
246 return EINVAL;
247
248 *pValue = *__doserrno();
249 return 0;
250}
__msvcrt_ulong *CDECL __doserrno(void)
Definition: errno.c:223
PWCHAR pValue

◆ _get_errno()

_ACRTIMP errno_t __cdecl _get_errno ( int pValue)

Definition at line 231 of file errno.c.

232{
233 if (!pValue)
234 return EINVAL;
235
236 *pValue = *_errno();
237 return 0;
238}

◆ _get_fmode()

_ACRTIMP errno_t __cdecl _get_fmode ( int mode)

Definition at line 287 of file data.c.

288{
290 return EINVAL;
291
293 return 0;
294}
int MSVCRT__fmode
Definition: data.c:34
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
GLenum mode
Definition: glext.h:6217

Referenced by _pipe(), _wpopen(), configure_text_mode(), is_text_mode(), and split_oflags().

◆ _get_invalid_parameter_handler()

_ACRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler ( void  )

Definition at line 36 of file _invalid_parameter.c.

37{
38 TRACE("\n");
40}
static _invalid_parameter_handler invalid_parameter_handler

Referenced by test_invalid_parameter_handler().

◆ _get_purecall_handler()

_ACRTIMP _purecall_handler __cdecl _get_purecall_handler ( void  )

◆ _get_thread_local_invalid_parameter_handler()

_ACRTIMP _invalid_parameter_handler __cdecl _get_thread_local_invalid_parameter_handler ( void  )

Definition at line 333 of file invalid_parameter.cpp.

334{
336 if (!ptd)
337 {
338 return nullptr;
339 }
340
341 return ptd->_thread_local_iph;
342}
__acrt_ptd *__cdecl __acrt_getptd_noexit(void)
_In_ size_t const _In_ int _In_ bool const _In_ unsigned const _In_ __acrt_rounding_mode const _Inout_ __crt_cached_ptd_host & ptd
Definition: cvt.cpp:355

Referenced by test_invalid_parameter_handler().

◆ _i64toa()

_ACRTIMP char *__cdecl _i64toa ( __int64  value,
char str,
int  radix 
)

Definition at line 2247 of file string.c.

2248{
2249 unsigned __int64 val;
2250 BOOL is_negative;
2251 char buffer[65], *pos;
2252
2253 if (value < 0 && radix == 10)
2254 {
2255 is_negative = TRUE;
2256 val = -value;
2257 }
2258 else
2259 {
2260 is_negative = FALSE;
2261 val = value;
2262 }
2263
2264 pos = buffer + 64;
2265 *pos = '\0';
2266
2267 do
2268 {
2269 int digit = val % radix;
2270 val /= radix;
2271
2272 if (digit < 10)
2273 *--pos = '0' + digit;
2274 else
2275 *--pos = 'a' + digit - 10;
2276 }
2277 while (val != 0);
2278
2279 if (is_negative)
2280 *--pos = '-';
2281
2282 memcpy(str, pos, buffer + 65 - pos);
2283 return str;
2284}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint buffer
Definition: glext.h:5915
GLuint GLfloat * val
Definition: glext.h:7180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
size_t const unsigned const radix
Definition: xtoa.cpp:37

Referenced by lltoa().

◆ _i64toa_s()

_ACRTIMP errno_t __cdecl _i64toa_s ( __int64  value,
char str,
size_t  size,
int  radix 
)

Definition at line 2516 of file string.c.

2517{
2518 unsigned __int64 val;
2519 unsigned int digit;
2520 BOOL is_negative;
2521 char buffer[65], *pos;
2522 size_t len;
2523
2524 if (!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
2525 if (!MSVCRT_CHECK_PMT(size > 0)) return EINVAL;
2526 if (!MSVCRT_CHECK_PMT(radix >= 2 && radix <= 36))
2527 {
2528 str[0] = '\0';
2529 return EINVAL;
2530 }
2531
2532 if (value < 0 && radix == 10)
2533 {
2534 is_negative = TRUE;
2535 val = -value;
2536 }
2537 else
2538 {
2539 is_negative = FALSE;
2540 val = value;
2541 }
2542
2543 pos = buffer + 64;
2544 *pos = '\0';
2545
2546 do
2547 {
2548 digit = val % radix;
2549 val /= radix;
2550
2551 if (digit < 10)
2552 *--pos = '0' + digit;
2553 else
2554 *--pos = 'a' + digit - 10;
2555 }
2556 while (val != 0);
2557
2558 if (is_negative)
2559 *--pos = '-';
2560
2561 len = buffer + 65 - pos;
2562 if (len > size)
2563 {
2564 size_t i;
2565 char *p = str;
2566
2567 /* Copy the temporary buffer backwards up to the available number of
2568 * characters. Don't copy the negative sign if present. */
2569
2570 if (is_negative)
2571 {
2572 p++;
2573 size--;
2574 }
2575
2576 for (pos = buffer + 63, i = 0; i < size; i++)
2577 *p++ = *pos--;
2578
2579 str[0] = '\0';
2580 MSVCRT_INVALID_PMT("str[size] is too small", ERANGE);
2581 return ERANGE;
2582 }
2583
2584 memcpy(str, pos, len);
2585 return 0;
2586}
#define MSVCRT_INVALID_PMT(x, err)
Definition: msvcrt.h:376
GLfloat GLfloat p
Definition: glext.h:8902

◆ _invalid_parameter()

void __cdecl _invalid_parameter ( const wchar_t expr,
const wchar_t func,
const wchar_t file,
unsigned int  line,
uintptr_t  arg 
)

Definition at line 461 of file errno.c.

463{
464#if _MSVCR_VER >= 140
466
467 if (data->invalid_parameter_handler)
468 {
469 data->invalid_parameter_handler( expr, func, file, line, arg );
470 return;
471 }
472#endif
473
475 else
476 {
477 ERR( "%s:%u %s: %s %Ix\n", debugstr_w(file), line, debugstr_w(func), debugstr_w(expr), arg );
478#if _MSVCR_VER >= 80
480#endif
481 }
482}
#define ERR(fmt,...)
Definition: precomp.h:57
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
static _invalid_parameter_handler invalid_parameter_handler
Definition: errno.c:129
GLenum func
Definition: glext.h:6028
#define debugstr_w
Definition: kernel32.h:32
#define STATUS_INVALID_CRUNTIME_PARAMETER
Definition: ntstatus.h:1092
Definition: query.h:86
Definition: fci.c:127
Definition: parser.c:49
#define EXCEPTION_NONCONTINUABLE
Definition: stubs.h:23

◆ _itoa()

_ACRTIMP char *__cdecl _itoa ( int  value,
char str,
int  radix 
)

Definition at line 2111 of file string.c.

2112{
2113 return ltoa_helper(value, str, SIZE_MAX, radix) ? NULL : str;
2114}
#define SIZE_MAX
Definition: limits.h:49
static int ltoa_helper(__msvcrt_long value, char *str, size_t size, int radix)
Definition: string.c:1940

◆ _itoa_s()

_ACRTIMP errno_t __cdecl _itoa_s ( int  value,
char str,
size_t  size,
int  radix 
)

Definition at line 2103 of file string.c.

2104{
2105 return _ltoa_s(value, str, size, radix);
2106}
int CDECL _ltoa_s(__msvcrt_long value, char *str, size_t size, int radix)
Definition: string.c:2071

Referenced by _VCrtDbgReportA().

◆ _lrotl()

◆ _lrotr()

◆ _ltoa()

_ACRTIMP char *__cdecl _ltoa ( __msvcrt_long  value,
char str,
int  radix 
)

Definition at line 2119 of file string.c.

2120{
2121 return ltoa_helper(value, str, SIZE_MAX, radix) ? NULL : str;
2122}

◆ _ltoa_s()

_ACRTIMP errno_t __cdecl _ltoa_s ( __msvcrt_long  value,
char str,
size_t  size,
int  radix 
)

Definition at line 2071 of file string.c.

2072{
2073 if (!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
2074 if (!MSVCRT_CHECK_PMT(size > 0)) return EINVAL;
2075 if (!MSVCRT_CHECK_PMT(radix >= 2 && radix <= 36))
2076 {
2077 str[0] = '\0';
2078 return EINVAL;
2079 }
2080
2081 return ltoa_helper(value, str, size, radix);
2082}

Referenced by _itoa_s(), and test_invalid_parameter_handler().

◆ _makepath()

_ACRTIMP void __cdecl _makepath ( char path,
const char drive,
const char directory,
const char filename,
const char extension 
)

Definition at line 1310 of file dir.c.

1313{
1314 char *p = path;
1315
1316 TRACE("(%s %s %s %s)\n", debugstr_a(drive), debugstr_a(directory),
1317 debugstr_a(filename), debugstr_a(extension) );
1318
1319 if ( !path )
1320 return;
1321
1322 if (drive && drive[0])
1323 {
1324 *p++ = drive[0];
1325 *p++ = ':';
1326 }
1327 if (directory && directory[0])
1328 {
1329 unsigned int len = strlen(directory);
1331 p += len;
1332 if (p[-1] != '/' && p[-1] != '\\')
1333 *p++ = '\\';
1334 }
1335 if (filename && filename[0])
1336 {
1337 unsigned int len = strlen(filename);
1338 memmove(p, filename, len);
1339 p += len;
1340 }
1341 if (extension && extension[0])
1342 {
1343 if (extension[0] != '.')
1344 *p++ = '.';
1345 strcpy(p, extension);
1346 }
1347 else
1348 *p = '\0';
1349 TRACE("returning %s\n",path);
1350}
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
const char * filename
Definition: ioapi.h:137
#define debugstr_a
Definition: kernel32.h:31
strcpy
Definition: string.h:131

◆ _makepath_s()

_ACRTIMP int __cdecl _makepath_s ( char path,
size_t  size,
const char drive,
const char directory,
const char filename,
const char extension 
)

Definition at line 1404 of file dir.c.

1407{
1408 char *p = path;
1409
1410 if (!path || !size)
1411 {
1412 *_errno() = EINVAL;
1413 return EINVAL;
1414 }
1415
1416 if (drive && drive[0])
1417 {
1418 if (size <= 2)
1419 goto range;
1420
1421 *p++ = drive[0];
1422 *p++ = ':';
1423 size -= 2;
1424 }
1425
1426 if (directory && directory[0])
1427 {
1428 unsigned int len = strlen(directory);
1429 unsigned int needs_separator = directory[len - 1] != '/' && directory[len - 1] != '\\';
1430 unsigned int copylen = min(size - 1, len);
1431
1432 if (size < 2)
1433 goto range;
1434
1435 memmove(p, directory, copylen);
1436
1437 if (size <= len)
1438 goto range;
1439
1440 p += copylen;
1441 size -= copylen;
1442
1443 if (needs_separator)
1444 {
1445 if (size < 2)
1446 goto range;
1447
1448 *p++ = '\\';
1449 size -= 1;
1450 }
1451 }
1452
1453 if (filename && filename[0])
1454 {
1455 unsigned int len = strlen(filename);
1456 unsigned int copylen = min(size - 1, len);
1457
1458 if (size < 2)
1459 goto range;
1460
1461 memmove(p, filename, copylen);
1462
1463 if (size <= len)
1464 goto range;
1465
1466 p += len;
1467 size -= len;
1468 }
1469
1470 if (extension && extension[0])
1471 {
1472 unsigned int len = strlen(extension);
1473 unsigned int needs_period = extension[0] != '.';
1474 unsigned int copylen;
1475
1476 if (size < 2)
1477 goto range;
1478
1479 if (needs_period)
1480 {
1481 *p++ = '.';
1482 size -= 1;
1483 }
1484
1485 copylen = min(size - 1, len);
1486 memcpy(p, extension, copylen);
1487
1488 if (size <= len)
1489 goto range;
1490
1491 p += copylen;
1492 }
1493
1494 *p = '\0';
1495 return 0;
1496
1497range:
1498 path[0] = '\0';
1499 *_errno() = ERANGE;
1500 return ERANGE;
1501}
GLenum GLint * range
Definition: glext.h:7539

Referenced by _makepath().

◆ _mbstrlen()

_ACRTIMP size_t __cdecl _mbstrlen ( const char str)

Definition at line 3153 of file mbcs.c.

3154{
3155 return _mbstrlen_l(str, NULL);
3156}
size_t CDECL _mbstrlen_l(const char *str, _locale_t locale)
Definition: mbcs.c:3127

Referenced by test_mbcp().

◆ _onexit()

_ACRTIMP _onexit_t __cdecl _onexit ( _onexit_t  func)

Definition at line 347 of file exit.c.

348{
349 TRACE("(%p)\n",func);
350
351 if (!func)
352 return NULL;
353
354 LOCK_EXIT;
357
358 return func;
359}
#define LOCK_EXIT
Definition: exit.c:32
#define UNLOCK_EXIT
Definition: exit.c:33
static _onexit_table_t MSVCRT_atexit_table
Definition: exit.c:37
static int register_onexit_function(_onexit_table_t *table, _onexit_t func)
Definition: exit.c:72

Referenced by _onexit(), atexit(), MSVCRT_atexit(), and onexit().

◆ _putenv()

_ACRTIMP int __cdecl _putenv ( const char str)

Definition at line 362 of file environ.c.

363{
364 const char *eq;
365
366 TRACE("%s\n", debugstr_a(str));
367
368 if (!str || !(eq = strchr(str, '=')))
369 return -1;
370
371 return putenv_helper(str, NULL, eq);
372}
static int putenv_helper(const char *name, const char *val, const char *eq)
Definition: environ.c:266
_ACRTIMP char *__cdecl strchr(const char *, int)
Definition: string.c:3286
#define eq(received, expected, label, type)
Definition: locale.c:179

Referenced by putenv(), test__environ(), test__tzset(), test__wenviron(), test_case_insensitive(), test_environment_manipulation(), and test_utf8().

◆ _putenv_s()

_ACRTIMP errno_t __cdecl _putenv_s ( const char name,
const char value 
)

Definition at line 392 of file environ.c.

393{
394 errno_t ret = 0;
395
396 TRACE("%s %s\n", debugstr_a(name), debugstr_a(value));
397
398 if (!MSVCRT_CHECK_PMT(name != NULL)) return EINVAL;
399 if (!MSVCRT_CHECK_PMT(value != NULL)) return EINVAL;
400
401 if (putenv_helper(name, value, NULL) < 0)
402 {
404 ret = *_errno();
405 }
406
407 return ret;
408}
int errno_t
Definition: corecrt.h:249
#define msvcrt_set_errno
Definition: heap.c:50
Definition: name.c:39
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ _rotl()

unsigned int _rotl ( unsigned int  value,
int  shift 
)

Definition at line 43 of file rot.c.

44{
45 int max_bits = sizeof(unsigned int)<<3;
46 if ( shift < 0 )
47 return _rotr(value,-shift);
48
49 if ( shift > max_bits )
50 shift = shift % max_bits;
51 return (value << shift) | (value >> (max_bits-shift));
52}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define shift
Definition: input.c:1755
unsigned int _rotr(unsigned int value, int shift)
Definition: rot.c:57

Referenced by _rotr(), KsecGenRandom(), ObpHash(), and PALETTE_ulGetNearestBitFieldsIndex().

◆ _rotr()

unsigned int _rotr ( unsigned int  value,
int  shift 
)

Definition at line 57 of file rot.c.

58{
59 int max_bits = sizeof(unsigned int)<<3;
60 if ( shift < 0 )
61 return _rotl(value,-shift);
62
63 if ( shift > max_bits )
64 shift = shift % max_bits;
65 return (value >> shift) | (value << (max_bits-shift));
66}
unsigned int _rotl(unsigned int value, int shift)
Definition: rot.c:43

Referenced by _rotl().

◆ _searchenv()

_ACRTIMP void __cdecl _searchenv ( const char file,
const char env,
char buf 
)

Definition at line 1702 of file dir.c.

1703{
1705}
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:171
int CDECL _searchenv_s(const char *file, const char *env, char *buf, size_t count)
Definition: dir.c:1610

Referenced by TConfig::keyfile_init(), test_searchenv(), and test_utf8().

◆ _set_abort_behavior()

_ACRTIMP unsigned int __cdecl _set_abort_behavior ( unsigned int  flags,
unsigned int  mask 
)

Specifies the behavior of the abort() function.

Parameters
flags- Value of the new flags.
mask- Mask that specifies which flags to update.
Returns
The old flags value.

Definition at line 20 of file _set_abort_behavior.c.

23{
24 unsigned int old_flags;
25
26 /* Save the old flags */
27 old_flags = __abort_behavior;
28
29 /* Reset all flags that are not in the mask */
30 flags &= mask;
31
32 /* Update the flags in the mask to the new flags value */
35
36 /* Return the old flags */
37 return old_flags;
38}
unsigned int __abort_behavior
Definition: abort.c:12
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161

Referenced by _assert().

◆ _set_doserrno()

_ACRTIMP errno_t __cdecl _set_doserrno ( int  value)

Definition at line 264 of file errno.c.

265{
266 *__doserrno() = value;
267 return 0;
268}

Referenced by _dosmaperr().

◆ _set_errno()

◆ _set_error_mode()

_ACRTIMP int __cdecl _set_error_mode ( int  mode)

Definition at line 515 of file exit.c.

516{
517
518 const int old = MSVCRT_error_mode;
519 if ( _REPORT_ERRMODE != mode ) {
521 }
522 return old;
523}
static int MSVCRT_error_mode
Definition: exit.c:58
#define _REPORT_ERRMODE
Definition: stdlib.h:76

Referenced by common_assert(), and should_write_error_to_console().

◆ _set_fmode()

_ACRTIMP errno_t __cdecl _set_fmode ( int  mode)

Definition at line 274 of file data.c.

275{
276 /* TODO: support _O_WTEXT */
278 return EINVAL;
279
281 return 0;
282}
#define _O_BINARY
Definition: cabinet.h:51
#define _O_TEXT
Definition: cabinet.h:50

◆ _set_invalid_parameter_handler()

_ACRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler ( _invalid_parameter_handler  handler)

Definition at line 43 of file _invalid_parameter.c.

45{
47
48 TRACE("(%p)\n", handler);
49
51 return old;
52}
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7512
void(__cdecl * _invalid_parameter_handler)(const wchar_t *, const wchar_t *, const wchar_t *, unsigned, uintptr_t)
Definition: stdlib.h:259

Referenced by START_TEST(), test_invalid_parameter_handler(), and test_thread_invalid_params().

◆ _set_purecall_handler()

_ACRTIMP _purecall_handler __cdecl _set_purecall_handler ( _purecall_handler  function)

Definition at line 9 of file purecall.c.

10{
12
13 TRACE("(%p)\n", function);
14 purecall_handler = function;
15 return ret;
16}
static MSVCRT_purecall_handler purecall_handler
Definition: purecall.c:6
void(__cdecl * MSVCRT_purecall_handler)(void)
Definition: purecall.c:4

◆ _set_thread_local_invalid_parameter_handler()

_ACRTIMP _invalid_parameter_handler __cdecl _set_thread_local_invalid_parameter_handler ( _invalid_parameter_handler  new_handler)

Definition at line 324 of file invalid_parameter.cpp.

325{
326 __acrt_ptd* const ptd = __acrt_getptd();
327
328 _invalid_parameter_handler const old_handler = ptd->_thread_local_iph;
329 ptd->_thread_local_iph = new_handler;
330 return old_handler;
331}
__acrt_ptd *__cdecl __acrt_getptd(void)

Referenced by test_invalid_parameter_handler().

◆ _seterrormode()

_ACRTIMP void __cdecl _seterrormode ( int  mode)

Definition at line 453 of file errno.c.

454{
456}
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:751

◆ _sleep()

_ACRTIMP void __cdecl _sleep ( __msvcrt_ulong  timeout)

Definition at line 85 of file misc.c.

86{
87 TRACE("_sleep for %ld milliseconds\n",timeout);
89}
Definition: dhcpd.h:248
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790

◆ _splitpath()

_ACRTIMP void __cdecl _splitpath ( const char inpath,
char drv,
char dir,
char fname,
char ext 
)

Definition at line 1112 of file dir.c.

1114{
1115 _splitpath_s(inpath, drv, drv ? _MAX_DRIVE : 0, dir, dir ? _MAX_DIR : 0,
1116 fname, fname ? _MAX_FNAME : 0, ext, ext ? _MAX_EXT : 0);
1117}
unsigned int dir
Definition: maze.c:112
static const WCHAR *const ext[]
Definition: module.c:53
#define _MAX_FNAME
Definition: stdlib.h:38
#define _MAX_DIR
Definition: stdlib.h:39
#define _MAX_DRIVE
Definition: stdlib.h:37
#define _MAX_EXT
Definition: stdlib.h:40
#define _splitpath_s(f, d, dl, p, pl, n, nl, e, el)
Definition: utility.h:212

Referenced by START_TEST(), and test_splitpath().

◆ _splitpath_s()

_ACRTIMP errno_t __cdecl _splitpath_s ( const char inpath,
char drive,
size_t  sz_drive,
char dir,
size_t  sz_dir,
char fname,
size_t  sz_fname,
char ext,
size_t  sz_ext 
)

Definition at line 1024 of file dir.c.

1029{
1030 const char *p, *end;
1031
1032 if (!inpath || (!drive && sz_drive) ||
1033 (drive && !sz_drive) ||
1034 (!dir && sz_dir) ||
1035 (dir && !sz_dir) ||
1036 (!fname && sz_fname) ||
1037 (fname && !sz_fname) ||
1038 (!ext && sz_ext) ||
1039 (ext && !sz_ext))
1040 {
1041 *_errno() = EINVAL;
1042 return EINVAL;
1043 }
1044
1045 if (inpath[0] && inpath[1] == ':')
1046 {
1047 if (drive)
1048 {
1049 if (sz_drive <= 2) goto do_error;
1050 drive[0] = inpath[0];
1051 drive[1] = inpath[1];
1052 drive[2] = 0;
1053 }
1054 inpath += 2;
1055 }
1056 else if (drive) drive[0] = '\0';
1057
1058 /* look for end of directory part */
1059 end = NULL;
1060 for (p = inpath; *p; p++)
1061 {
1062 if (_ismbblead((unsigned char)*p))
1063 {
1064 p++;
1065 continue;
1066 }
1067 if (*p == '/' || *p == '\\') end = p + 1;
1068 }
1069
1070 if (end) /* got a directory */
1071 {
1072 if (dir)
1073 {
1074 if (sz_dir <= end - inpath) goto do_error;
1075 memcpy( dir, inpath, (end - inpath) );
1076 dir[end - inpath] = 0;
1077 }
1078 inpath = end;
1079 }
1080 else if (dir) dir[0] = 0;
1081
1082 /* look for extension: what's after the last dot */
1083 end = NULL;
1084 for (p = inpath; *p; p++) if (*p == '.') end = p;
1085
1086 if (!end) end = p; /* there's no extension */
1087
1088 if (fname)
1089 {
1090 if (sz_fname <= end - inpath) goto do_error;
1091 memcpy( fname, inpath, (end - inpath) );
1092 fname[end - inpath] = 0;
1093 }
1094 if (ext)
1095 {
1096 if (sz_ext <= strlen(end)) goto do_error;
1097 strcpy( ext, end );
1098 }
1099 return 0;
1100do_error:
1101 if (drive) drive[0] = '\0';
1102 if (dir) dir[0] = '\0';
1103 if (fname) fname[0]= '\0';
1104 if (ext) ext[0]= '\0';
1105 *_errno() = ERANGE;
1106 return ERANGE;
1107}
_ACRTIMP int __cdecl _ismbblead(unsigned int)
Definition: mbcs.c:2077
GLuint GLuint end
Definition: gl.h:1545

◆ _strtod_l()

_ACRTIMP double __cdecl _strtod_l ( const char str,
char **  end,
_locale_t  locale 
)

Definition at line 1064 of file string.c.

1065{
1066 return strtod_helper(str, end, locale, NULL);
1067}

Referenced by _atof_l(), _strtold_l(), atof(), and strtod().

◆ _strtof_l()

_ACRTIMP float __cdecl _strtof_l ( const char string,
char **  end_ptr,
_locale_t  locale 
)

Definition at line 63 of file strtod.cpp.

68{
69 return common_strtod_l<float>(string, end_ptr, locale);
70}

◆ _strtoi64()

_ACRTIMP __int64 __cdecl _strtoi64 ( const char nptr,
char **  endptr,
int  base 
)

Definition at line 1689 of file string.c.

1690{
1691 return _strtoi64_l(nptr, endptr, base, NULL);
1692}

Referenced by PROPVAR_ConvertNumber(), START_TEST(), and strtoll().

◆ _strtoi64_l()

_ACRTIMP __int64 __cdecl _strtoi64_l ( const char nptr,
char **  endptr,
int  base,
_locale_t  locale 
)

Definition at line 1617 of file string.c.

1618{
1619 const char *p = nptr;
1620 BOOL negative = FALSE;
1621 BOOL got_digit = FALSE;
1622 __int64 ret = 0;
1623
1624 TRACE("(%s %p %d %p)\n", debugstr_a(nptr), endptr, base, locale);
1625
1626 if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
1627 if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
1628 if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
1629
1630 while(_isspace_l((unsigned char)*nptr, locale)) nptr++;
1631
1632 if(*nptr == '-') {
1633 negative = TRUE;
1634 nptr++;
1635 } else if(*nptr == '+')
1636 nptr++;
1637
1638 if((base==0 || base==16) && *nptr=='0' && _tolower_l(*(nptr+1), locale)=='x') {
1639 base = 16;
1640 nptr += 2;
1641 }
1642
1643 if(base == 0) {
1644 if(*nptr=='0')
1645 base = 8;
1646 else
1647 base = 10;
1648 }
1649
1650 while(*nptr) {
1651 char cur = _tolower_l(*nptr, locale);
1652 int v;
1653
1654 if(cur>='0' && cur<='9') {
1655 if(cur >= '0'+base)
1656 break;
1657 v = cur-'0';
1658 } else {
1659 if(cur<'a' || cur>='a'+base-10)
1660 break;
1661 v = cur-'a'+10;
1662 }
1663 got_digit = TRUE;
1664
1665 if(negative)
1666 v = -v;
1667
1668 nptr++;
1669
1670 if(!negative && (ret>I64_MAX/base || ret*base>I64_MAX-v)) {
1671 ret = I64_MAX;
1672 *_errno() = ERANGE;
1673 } else if(negative && (ret<I64_MIN/base || ret*base<I64_MIN-v)) {
1674 ret = I64_MIN;
1675 *_errno() = ERANGE;
1676 } else
1677 ret = ret*base + v;
1678 }
1679
1680 if(endptr)
1681 *endptr = (char*)(got_digit ? nptr : p);
1682
1683 return ret;
1684}
int CDECL _tolower_l(int c, _locale_t locale)
Definition: ctype.c:532
#define I64_MIN
Definition: limits.h:41
#define I64_MAX
Definition: limits.h:42
FxCollectionEntry * cur
const GLdouble * v
Definition: gl.h:2040
#define _isspace_l(_Char, _Locale)
Definition: ctype.h:648

Referenced by _atoi64(), _atoi64_l(), _atoi_l(), _atol_l(), _strtoi64(), _strtol_l(), and _strtoul_l().

◆ _strtold_l()

static long double _strtold_l ( const char string,
char **  endptr,
_locale_t  locale 
)
inlinestatic

Definition at line 236 of file stdlib.h.

236{ return _strtod_l(string, endptr, locale); }
_ACRTIMP double __cdecl _strtod_l(const char *, char **, _locale_t)
Definition: string.c:1064

◆ _strtoll_l()

_ACRTIMP __int64 __cdecl _strtoll_l ( const char string,
char **  end_ptr,
int  base,
_locale_t  locale 
)

Definition at line 149 of file strtox.cpp.

155{
156 return __crt_strtox::parse_integer_from_string<long long>(string, end_ptr, base, locale);
157}

◆ _strtoui64()

_ACRTIMP unsigned __int64 __cdecl _strtoui64 ( const char nptr,
char **  endptr,
int  base 
)

Definition at line 1935 of file string.c.

1936{
1937 return _strtoui64_l(nptr, endptr, base, NULL);
1938}
unsigned __int64 CDECL _strtoui64_l(const char *nptr, char **endptr, int base, _locale_t locale)
Definition: string.c:1869

Referenced by strtoull().

◆ _strtoui64_l()

_ACRTIMP unsigned __int64 __cdecl _strtoui64_l ( const char nptr,
char **  endptr,
int  base,
_locale_t  locale 
)

Definition at line 1869 of file string.c.

1870{
1871 const char *p = nptr;
1872 BOOL negative = FALSE;
1873 BOOL got_digit = FALSE;
1874 unsigned __int64 ret = 0;
1875
1876 TRACE("(%s %p %d %p)\n", debugstr_a(nptr), endptr, base, locale);
1877
1878 if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
1879 if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
1880 if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
1881
1882 while(_isspace_l((unsigned char)*nptr, locale)) nptr++;
1883
1884 if(*nptr == '-') {
1885 negative = TRUE;
1886 nptr++;
1887 } else if(*nptr == '+')
1888 nptr++;
1889
1890 if((base==0 || base==16) && *nptr=='0' && _tolower_l(*(nptr+1), locale)=='x') {
1891 base = 16;
1892 nptr += 2;
1893 }
1894
1895 if(base == 0) {
1896 if(*nptr=='0')
1897 base = 8;
1898 else
1899 base = 10;
1900 }
1901
1902 while(*nptr) {
1903 char cur = _tolower_l(*nptr, locale);
1904 int v;
1905
1906 if(cur>='0' && cur<='9') {
1907 if(cur >= '0'+base)
1908 break;
1909 v = *nptr-'0';
1910 } else {
1911 if(cur<'a' || cur>='a'+base-10)
1912 break;
1913 v = cur-'a'+10;
1914 }
1915 got_digit = TRUE;
1916
1917 nptr++;
1918
1919 if(ret>UI64_MAX/base || ret*base>UI64_MAX-v) {
1920 ret = UI64_MAX;
1921 *_errno() = ERANGE;
1922 } else
1923 ret = ret*base + v;
1924 }
1925
1926 if(endptr)
1927 *endptr = (char*)(got_digit ? nptr : p);
1928
1929 return negative ? -ret : ret;
1930}
#define UI64_MAX
Definition: limits.h:43

Referenced by _strtoui64().

◆ _strtoull_l()

_ACRTIMP unsigned __int64 __cdecl _strtoull_l ( const char string,
char **  end_ptr,
int  base,
_locale_t  locale 
)

Definition at line 210 of file strtox.cpp.

216{
217 return __crt_strtox::parse_integer_from_string<unsigned long long>(string, end_ptr, base, locale);
218}

◆ _swab()

_ACRTIMP void __cdecl _swab ( char src,
char dst,
int  len 
)

Definition at line 338 of file string.c.

339{
340 if (len > 1)
341 {
342 len = (unsigned)len >> 1;
343
344 while (len--) {
345 char s0 = src[0];
346 char s1 = src[1];
347 *dst++ = s1;
348 *dst++ = s0;
349 src = src + 2;
350 }
351 }
352}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
struct S1 s1
static unsigned(__cdecl *hash_bstr)(bstr_t s)

Referenced by swab(), and test_swab().

◆ _ui64toa()

_ACRTIMP char *__cdecl _ui64toa ( unsigned  __int64,
char str,
int  radix 
)

Definition at line 2175 of file string.c.

2176{
2177 char buffer[65], *pos;
2178
2179 pos = &buffer[64];
2180 *pos = '\0';
2181
2182 do {
2183 int digit = value % radix;
2184 value /= radix;
2185
2186 if (digit < 10)
2187 *--pos = '0' + digit;
2188 else
2189 *--pos = 'a' + digit - 10;
2190 } while (value != 0);
2191
2192 memcpy(str, pos, buffer + 65 - pos);
2193 return str;
2194}

Referenced by ulltoa().

◆ _ui64toa_s()

_ACRTIMP errno_t __cdecl _ui64toa_s ( unsigned  __int64,
char str,
size_t  size,
int  radix 
)

Definition at line 2331 of file string.c.

2333{
2334 char buffer[65], *pos;
2335 int digit;
2336
2337 if (!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
2338 if (!MSVCRT_CHECK_PMT(size > 0)) return EINVAL;
2339 if (!MSVCRT_CHECK_PMT(radix >= 2 && radix <= 36))
2340 {
2341 str[0] = '\0';
2342 return EINVAL;
2343 }
2344
2345 pos = buffer+64;
2346 *pos = '\0';
2347
2348 do {
2349 digit = value%radix;
2350 value /= radix;
2351
2352 if(digit < 10)
2353 *--pos = '0'+digit;
2354 else
2355 *--pos = 'a'+digit-10;
2356 }while(value != 0);
2357
2358 if(buffer-pos+65 > size) {
2359 MSVCRT_INVALID_PMT("str[size] is too small", EINVAL);
2360 return EINVAL;
2361 }
2362
2363 memcpy(str, pos, buffer-pos+65);
2364 return 0;
2365}

◆ _ultoa()

_ACRTIMP char *__cdecl _ultoa ( __msvcrt_ulong  value,
char str,
int  radix 
)

Definition at line 2151 of file string.c.

2152{
2153 char buffer[33], *pos;
2154
2155 pos = &buffer[32];
2156 *pos = '\0';
2157
2158 do {
2159 int digit = value % radix;
2160 value /= radix;
2161
2162 if (digit < 10)
2163 *--pos = '0' + digit;
2164 else
2165 *--pos = 'a' + digit - 10;
2166 } while (value != 0);
2167
2168 memcpy(str, pos, buffer + 33 - pos);
2169 return str;
2170}

◆ _ultoa_s()

_ACRTIMP errno_t __cdecl _ultoa_s ( __msvcrt_ulong  value,
char str,
size_t  size,
int  radix 
)

Definition at line 2408 of file string.c.

2409{
2411 char buffer[33], *pos;
2412 size_t len;
2413
2414 if (!str || !size || radix < 2 || radix > 36)
2415 {
2416 if (str && size)
2417 str[0] = '\0';
2418
2419 *_errno() = EINVAL;
2420 return EINVAL;
2421 }
2422
2423 pos = buffer + 32;
2424 *pos = '\0';
2425
2426 do
2427 {
2428 digit = value % radix;
2429 value /= radix;
2430
2431 if (digit < 10)
2432 *--pos = '0' + digit;
2433 else
2434 *--pos = 'a' + digit - 10;
2435 }
2436 while (value != 0);
2437
2438 len = buffer + 33 - pos;
2439 if (len > size)
2440 {
2441 size_t i;
2442 char *p = str;
2443
2444 /* Copy the temporary buffer backwards up to the available number of
2445 * characters. */
2446
2447 for (pos = buffer + 31, i = 0; i < size; i++)
2448 *p++ = *pos--;
2449
2450 str[0] = '\0';
2451 *_errno() = ERANGE;
2452 return ERANGE;
2453 }
2454
2455 memcpy(str, pos, len);
2456 return 0;
2457}
unsigned long __msvcrt_ulong
Definition: corecrt.h:168

◆ abort()

Aborts the program.

Note
The function does not return.
Todo:
unimplemented
Todo:
unimplemented

Definition at line 252 of file exit.c.

253{
254 TRACE("()\n");
255
256#if (_MSVCR_VER > 0 && _MSVCR_VER < 100) || _MSVCR_VER == 120 || defined(_DEBUG)
257 if (MSVCRT_abort_behavior & _WRITE_ABORT_MSG)
258 {
261 {
262 DoMessageBox("Runtime error!", "abnormal program termination");
263 }
264 else
265 _cputs("\nabnormal program termination\n");
266 }
267#endif
268 raise(SIGABRT);
269 /* in case raise() returns */
270 _exit(3);
271}
int CDECL _cputs(const char *str)
Definition: console.c:78
int CDECL raise(int sig)
Definition: except.c:682
static void DoMessageBox(const char *lead, const char *message)
Definition: exit.c:220
int MSVCRT_app_type
Definition: data.c:59
#define SIGABRT
Definition: signal.h:31
#define _OUT_TO_MSGBOX
Definition: stdlib.h:75
#define _OUT_TO_DEFAULT
Definition: stdlib.h:73
#define _WRITE_ABORT_MSG
Definition: stdlib.h:79

◆ abs()

_ACRTIMP int __cdecl abs ( int  n)

Definition at line 672 of file math.c.

673{
674 return n >= 0 ? n : -n;
675}
GLdouble n
Definition: glext.h:7729

◆ atexit()

int __cdecl atexit ( void(__cdecl *)(void func)

Definition at line 97 of file atonexit.c.

98{
99 return (_onexit((_onexit_t)func) == NULL) ? -1 : 0;
100}
_onexit_t __cdecl _onexit(_onexit_t func)
Definition: atonexit.c:53
int(__cdecl * _onexit_t)(void)

Referenced by main(), openlog(), Test_atexit(), and xmlInitParser().

◆ atof()

_ACRTIMP double __cdecl atof ( const char str)

Definition at line 1106 of file string.c.

1107{
1108 return _strtod_l(str, NULL, NULL);
1109}
double CDECL _strtod_l(const char *str, char **end, _locale_t locale)
Definition: string.c:1064

◆ atoi()

_ACRTIMP int __cdecl atoi ( const char str)

Definition at line 1715 of file string.c.

1716{
1717 BOOL minus = FALSE;
1718 int ret = 0;
1719
1720 if(!str)
1721 return 0;
1722
1723 while(_isspace_l((unsigned char)*str, NULL)) str++;
1724
1725 if(*str == '+') {
1726 str++;
1727 }else if(*str == '-') {
1728 minus = TRUE;
1729 str++;
1730 }
1731
1732 while(*str>='0' && *str<='9') {
1733 ret = ret*10+*str-'0';
1734 str++;
1735 }
1736
1737 return minus ? -ret : ret;
1738}

Referenced by __GetLCIDFromName(), __GetLocaleInfoUsingACP(), __intGetACP(), __intGetOCP(), __rpc_uaddr2taddr_af(), _ecvt(), _Locale_codecvt_create(), _Locale_ctype_create(), _Locale_monetary_create(), _Locale_n_sign_posn(), _Locale_p_sign_posn(), _Locale_strcmp(), _Locale_strxfrm(), _tmain(), add_widl_version_define(), AddrStrToAddr(), atol(), BGStartCmd(), CC_CheckDigitsInEdit(), CmdLineParse(), Telnet::Connect(), CreateOutputFile(), DebugCmd(), demangle_datatype(), DissectArcPath(), DoSHIFTSTATE(), doWinMain(), DriveMapGetBiosDriveNumber(), DriveMapIsValidDriveString(), EditCustomBootReactOS(), Ext2ParseRegistryVolumeParams(), formatopts_proc(), FTP_ParseNextFile(), FTP_ReceiveResponse(), FTPDecodeURL(), FTPQueryFeatures(), get_constant_element_by_name(), get_modified_type(), get_parameter_element_by_name(), get_qualified_type(), get_shell_icon_size(), getline(), GetPortNumber(), GetProtoGetNextEnt(), GetResponse(), GetScreenColumns(), GetSectionName(), gl_init(), handle_switch(), HCR_RegGetIconA(), HelpCmd(), I10_OUTPUT(), InfGetBinaryField(), InfGetIntField(), init(), init_leases_list(), InternetReadFile_test(), interpret(), iso9660_file_length(), isoname_endsok(), lineGetCountryA(), lineGetTranslateCapsA(), TMapLoader::LoadGlobal(), LoadSettings(), locale_to_sname(), main(), metricfromreg(), MSVCRT__create_locale(), MSVCRT_locale_to_LCID(), name_to_codepage(), netif_find(), CDFParser::NextToken(), NSP_GetServiceByNameHeapAllocW(), OpenCmd(), XMLStorage::XPathElement::parse(), ParseCmdline(), ParseFile(), ParseHostLine(), pe_find_section(), ProcessFirewallPrefFile(), processRequest(), puint_t_UserMarshal(), put_resource_id(), read_version_entry(), TConfig::redir_init(), s_square_puint(), s_square_test_us(), s_sum_cpuints(), s_sum_puints(), section_get_dword(), ServiceNameToPortNumber(), TConfig::set_bool(), TConfig::set_value(), SetConnTimeout(), SetCtrlTimeout(), setdebug(), SetLogSize(), SetPassive(), setpeer(), SetRedialDelay(), SetSOBufsize(), setup_dinput_options(), setup_dsound_options(), SetXferTimeout(), spy_init(), START_TEST(), StrToBool(), StrToIntA(), telCommandLine(), test_asyncWAVE(), test_asyncWaveTypeMpegvideo(), test_atoi(), test_AutoOpenWAVE(), test_file_inherit_child(), test_file_inherit_child_no(), test_firstDay(), test_GetCalendarInfo(), test_openCloseWAVE(), test_pipes_child(), test_play(), test_setlocale(), test_wm_set_get_text(), TIFFFetchStripThing(), translate_line(), UnDosLine(), UnLslRLine(), UnMlsT(), us_t_UserMarshal(), value_get_dword_field(), wined3d_dll_init(), wined3d_parse_gl_version(), and WinLdrSetupEms().

◆ atol()

Definition at line 1782 of file string.c.

1783{
1784#if _MSVCR_VER == 0
1785 return atoi(str);
1786#else
1787 return _atol_l(str, NULL);
1788#endif
1789}
__msvcrt_long CDECL _atol_l(const char *str, _locale_t locale)
Definition: string.c:1765
int __cdecl atoi(const char *str)
Definition: string.c:1715

Referenced by _tzset(), arg_get_long(), doDebugger(), ExpInitializeExecutive(), FTP_ParseNextFile(), get_session_start(), init(), IopStartRamdisk(), KdDebuggerInitialize0(), KdpGetDebugMode(), netname2user(), Phase1InitializationDiscard(), PrintProcess(), processRequest(), RamDiskInitialize(), restart(), START_TEST(), Storage_DestroyElement(), test_atol(), and test_installprops().

◆ atoll()

__MINGW_EXTENSION __CRT_INLINE long long __cdecl atoll ( const char _c)

Definition at line 1451 of file stdlib.h.

1451{ return _atoi64 (_c); }
_ACRTIMP __int64 __cdecl _atoi64(const char *)
Definition: string.c:1757

◆ bsearch()

_ACRTIMP void *__cdecl bsearch ( const void ,
const void ,
size_t  ,
size_t  ,
int(__cdecl *)(const void *, const void *)   
)

◆ div()

_ACRTIMP div_t __cdecl div ( int  num,
int  denom 
)

Definition at line 2081 of file math.c.

2082{
2083 div_t ret;
2084
2085 ret.quot = num / denom;
2086 ret.rem = num % denom;
2087 return ret;
2088}
GLuint GLuint num
Definition: glext.h:9618
Definition: stdlib.h:47

Referenced by D3DXBoxBoundProbe(), encode_base64(), encodeBase64(), encodeBase64A(), encodeBase64W(), galois_divpower(), test_docfrag(), test_elems2(), test_onclick(), and VarCyRound().

◆ ecvt()

static char * ecvt ( double  value,
int  ndigit,
int decpt,
int sign 
)
inlinestatic

Definition at line 288 of file stdlib.h.

288{ return _ecvt(value, ndigit, decpt, sign); }
_ACRTIMP char *__cdecl _ecvt(double, int, int *, int *)
Definition: math.c:1748

Referenced by ftoes(), and ftofs().

◆ exit()

Definition at line 364 of file exit.c.

365{
367 void (WINAPI *pCorExitProcess)(int);
368
369 TRACE("(%d)\n",exitcode);
370 _cexit();
371
372 hmscoree = GetModuleHandleW(L"mscoree");
373
374 if (hmscoree)
375 {
376 pCorExitProcess = (void*)GetProcAddress(hmscoree, "CorExitProcess");
377
378 if (pCorExitProcess)
379 pCorExitProcess(exitcode);
380 }
381
382 ExitProcess(exitcode);
383}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
void CDECL _cexit(void)
Definition: exit.c:336
#define L(x)
Definition: resources.c:13
static HMODULE hmscoree
Definition: fusion.c:24
#define WINAPI
Definition: msvc.h:6

◆ fcvt()

static char * fcvt ( double  value,
int  ndigit,
int decpt,
int sign 
)
inlinestatic

Definition at line 289 of file stdlib.h.

289{ return _fcvt(value, ndigit, decpt, sign); }
_ACRTIMP char *__cdecl _fcvt(double, int, int *, int *)
Definition: math.c:1840

Referenced by ftofs().

◆ gcvt()

static char * gcvt ( double  value,
int  ndigit,
char buf 
)
inlinestatic

Definition at line 290 of file stdlib.h.

290{ return _gcvt(value, ndigit, buf); }
_ACRTIMP char *__cdecl _gcvt(double, int, char *)
Definition: math.c:2008

Referenced by for(), and test_gcvt().

◆ getenv()

_ACRTIMP char *__cdecl getenv ( const char name)

Definition at line 227 of file environ.c.

228{
229 char *ret;
230
231 if (!MSVCRT_CHECK_PMT(name != NULL)) return NULL;
232
236 return ret;
237}
static char * getenv_helper(const char *name)
Definition: environ.c:213
void CDECL _lock(int locknum)
Definition: lock.c:85
void CDECL _unlock(int locknum)
Definition: lock.c:114
#define _ENV_LOCK
Definition: mtdll.h:36

Referenced by _getopt_initialize(), _Locale_aux_default(), _searchenv_s(), _tempnam(), _tgetenv(), _tzset(), compat_getenv(), get_locale(), get_wine_loader_name(), GetHomeDir(), getline(), GetPwByName(), GetScreenColumns(), GetUsrName(), gl_destroy_context(), gl_error(), gl_init(), gl_set_home_dir(), HelpCmd(), TConfig::inifile_init(), init_debug(), initialize_context(), InitOurDirectory(), InitPrefs(), InitTermcap(), InitUserInfo(), instrum_getenv(), is_wine_loader(), jinit_memory_mgr(), TConfig::keyfile_init(), load_licence(), main(), make_temp_dir(), matchSpecialFolderPathToEnv(), ODBC_LoadDriverManager(), OpenTrace(), optionInit(), parse_arguments(), printercache_load_blob(), printercache_rename_blob(), printercache_save_blob(), printercache_unlink_blob(), QMyDialog::QMyDialog(), rd_open_file(), rd_pstcache_mkdir(), read_rcfile(), TConfig::redir_init(), ruserpass(), save_licence(), QMyDialog::SaveClicked(), searchfileinpath(), select_file_name(), setnetpath(), shell(), START_TEST(), system(), telCommandLine(), test__tzset(), test_case_insensitive(), test_environment_manipulation(), test_localtime(), test_mktime(), test_searchenv(), test_utf8(), TIFFFetchStripThing(), wave_out_open(), WinHttpGetDefaultProxyConfiguration(), xkeymap_open(), and xmlInitMemoryInternal().

◆ getenv_s()

_ACRTIMP errno_t __cdecl getenv_s ( size_t ret_len,
char buffer,
size_t  len,
const char varname 
)

Definition at line 507 of file environ.c.

508{
509 char *e;
510
511 if (!MSVCRT_CHECK_PMT(ret_len != NULL)) return EINVAL;
512 *ret_len = 0;
513 if (!MSVCRT_CHECK_PMT((buffer && len > 0) || (!buffer && !len))) return EINVAL;
514 if (buffer) buffer[0] = 0;
515
517 e = getenv_helper(varname);
518 if (e)
519 {
520 *ret_len = strlen(e) + 1;
521 if (len >= *ret_len) strcpy(buffer, e);
522 }
524
525 if (!e || !len) return 0;
526 if (len < *ret_len) return ERANGE;
527 return 0;
528}
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
Definition: process.c:81

◆ itoa()

static char * itoa ( int  value,
char str,
int  radix 
)
inlinestatic

◆ labs()

◆ ldiv()

_ACRTIMP ldiv_t __cdecl ldiv ( __msvcrt_long  num,
__msvcrt_long  denom 
)

Definition at line 2115 of file math.c.

2116{
2117 ldiv_t ret;
2118
2119 ret.quot = num / denom;
2120 ret.rem = num % denom;
2121 return ret;
2122}
Definition: stdlib.h:52

Referenced by inter_maxtoabs().

◆ llabs()

◆ lldiv()

_ACRTIMP lldiv_t __cdecl lldiv ( __int64  ,
__int64   
)

Referenced by test_lldiv().

◆ ltoa()

static char * ltoa ( __msvcrt_long  value,
char str,
int  radix 
)
inlinestatic

Definition at line 292 of file stdlib.h.

292{ return _ltoa(value, str, radix); }
_ltoa
Definition: stdlib.h:665

◆ mblen()

_ACRTIMP int __cdecl mblen ( const char str,
size_t  size 
)

Definition at line 3087 of file mbcs.c.

3088{
3089 return _mblen_l(str, size, NULL);
3090}
int CDECL _mblen_l(const char *str, size_t size, _locale_t locale)
Definition: mbcs.c:3067

Referenced by _wctomb_s_l(), streamout_wstring(), test_mbcp(), and wcstombs_len().

◆ onexit()

static _onexit_t onexit ( _onexit_t  func)
inlinestatic

Definition at line 293 of file stdlib.h.

293{ return _onexit(func); }
_ACRTIMP _onexit_t __cdecl _onexit(_onexit_t)
Definition: exit.c:347

◆ perror()

_ACRTIMP void __cdecl perror ( const char str)

Definition at line 337 of file errno.c.

338{
339 int err = *_errno();
340 if (err < 0 || err > MSVCRT__sys_nerr) err = MSVCRT__sys_nerr;
341
342 if (str && *str)
343 {
344 _write( 2, str, strlen(str) );
345 _write( 2, ": ", 2 );
346 }
348 _write( 2, "\n", 1 );
349}
char * MSVCRT__sys_errlist[]
Definition: errno.c:79
unsigned int MSVCRT__sys_nerr
Definition: errno.c:127
int CDECL _write(int fd, const void *buf, unsigned int count)
Definition: file.c:3561

Referenced by _wctomb_s_l(), _wperror(), ADsGetLastError(), check_atari(), check_file_size(), command(), count_blocks(), CreateOutputFile(), dataconn(), disk_close(), disk_create(), disk_query_directory(), disk_query_information(), disk_query_volume_information(), disk_read(), disk_set_information(), disk_write(), flush_output_buffer(), fs_open(), ftruncate_growable(), Generate(), getit(), hookup(), init_leases_list(), initconn(), Jobs(), lcd(), LocalChdirCmd(), LocalMkdirCmd(), LocalRenameCmd(), LocalRmCmd(), LocalRmdirCmd(), main(), MakeDirectory(), MkSpoolDir(), netfinger(), NotifyInfo(), open_tcp_connect(), OpenTmpBookmarkFile(), parallel_create(), PerformRegAction(), printercache_mkdir(), printercache_save_blob(), process_data(), processRegLines(), proxtrans(), PutBookmark(), rd_open_file(), rd_pstcache_mkdir(), read_line(), read_pipe(), recvrequest(), REGPROC_open_export_file(), reset(), rpc_broadcast_exp(), WriterThread::Run(), RunBatch(), ruserpass(), save_licence(), SavePrefs(), sendrequest(), serial_create(), Server(), shell(), ShellCmd(), SpoolGetCmd(), SpoolPutCmd(), SpoolX(), subprocess(), test_file_truncate(), verify_output_file(), WaitForRemoteInput(), WaitForRemoteOutput(), wave_out_open(), wave_out_play(), wave_out_set_format(), wave_out_volume(), wctob(), write_packet(), and xstrdup().

◆ putenv()

static int putenv ( const char str)
inlinestatic

Definition at line 294 of file stdlib.h.

294{ return _putenv(str); }
_ACRTIMP int __cdecl _putenv(const char *)
Definition: environ.c:362

Referenced by test_localtime(), test_mktime(), test_searchenv(), and WinMain().

◆ qsort()

_ACRTIMP void __cdecl qsort ( void ,
size_t  ,
size_t  ,
int(__cdecl *)(const void *, const void *)   
)

◆ qsort_s()

_ACRTIMP void __cdecl qsort_s ( void ,
size_t  ,
size_t  ,
int(__cdecl *)(void *, const void *, const void *)  ,
void  
)

◆ rand()

◆ rand_s()

_ACRTIMP errno_t __cdecl rand_s ( unsigned int pval)

Definition at line 72 of file misc.c.

73{
74 if (!pval || !RtlGenRandom(pval, sizeof(*pval)))
75 {
76 *_errno() = EINVAL;
77 return EINVAL;
78 }
79 return 0;
80}
#define RtlGenRandom
Definition: ntsecapi.h:691

Referenced by START_TEST().

◆ srand()

◆ strtod()

_ACRTIMP double __cdecl strtod ( const char str,
char **  end 
)

Definition at line 1072 of file string.c.

1073{
1074 return _strtod_l( str, end, NULL );
1075}

Referenced by _test_strtod_str(), atof(), closestFit(), EvaluateExpression(), strtold(), and test__strtod().

◆ strtof()

float __cdecl strtof ( const char __restrict__,
char **  __restrict__ 
)

Definition at line 55 of file strtod.cpp.

59{
60 return common_strtod_l<float>(string, end_ptr, nullptr);
61}

Referenced by test_strtof().

◆ strtol()

◆ strtold()

static long double strtold ( const char string,
char **  endptr 
)
inlinestatic

Definition at line 235 of file stdlib.h.

235{ return strtod(string, endptr); }
_ACRTIMP double __cdecl strtod(const char *, char **)
Definition: string.c:1072

Referenced by _atoldbl().

◆ strtoll()

static __int64 strtoll ( const char ptr,
char **  endptr,
int  base 
)
inlinestatic

Definition at line 295 of file stdlib.h.

295{ return _strtoi64(ptr, endptr, base); }
_ACRTIMP __int64 __cdecl _strtoi64(const char *, char **, int)
Definition: string.c:1689
static PVOID ptr
Definition: dispmode.c:27

Referenced by PROPVAR_ConvertNumber().

◆ strtoul()

◆ strtoull()

static unsigned __int64 __cdecl strtoull ( const char ptr,
char **  endptr,
int  base 
)
inlinestatic

Definition at line 296 of file stdlib.h.

296{ return _strtoui64(ptr, endptr, base); }
_ACRTIMP unsigned __int64 __cdecl _strtoui64(const char *, char **, int)
Definition: string.c:1935

◆ swab()

static void swab ( char src,
char dst,
int  len 
)
inlinestatic

Definition at line 297 of file stdlib.h.

297{ _swab(src, dst, len); }
_ACRTIMP void __cdecl _swab(char *, char *, int)
Definition: string.c:338

◆ system()

_ACRTIMP int __cdecl system ( const char cmd)

Definition at line 1297 of file process.c.

1298{
1299 int res = -1;
1300 wchar_t *cmdW;
1301
1302 if (cmd == NULL)
1303 return _wsystem(NULL);
1304
1305 if ((cmdW = wstrdupa_utf8(cmd)))
1306 {
1307 res = _wsystem(cmdW);
1308 free(cmdW);
1309 }
1310 return res;
1311}
int CDECL _wsystem(const wchar_t *cmd)
Definition: process.c:1254
GLuint res
Definition: glext.h:9613
Definition: ftp_var.h:139

◆ ultoa()

static char * ultoa ( __msvcrt_ulong  value,
char str,
int  radix 
)
inlinestatic

Definition at line 298 of file stdlib.h.

298{ return _ultoa(value, str, radix); }
_ultoa
Definition: stdlib.h:688

Variable Documentation

◆ __argc

int __argc
extern

Definition at line 21 of file getargs.c.

◆ __argv

char** __argv
extern

Definition at line 18 of file getargs.c.

◆ __wargv

wchar_t** __wargv
extern

Definition at line 20 of file getargs.c.

◆ _environ

char** _environ
extern

Definition at line 22 of file environ.c.

◆ _fmode

unsigned int _fmode
extern

Definition at line 4 of file fmode.c.

◆ _osver

unsigned int _osver
extern

Definition at line 11 of file environ.c.

Referenced by crt_process_init(), DliNotifyHook(), and Test__osver().

◆ _wenviron

wchar_t** _wenviron
extern

Definition at line 23 of file environ.c.

◆ _winmajor

unsigned int _winmajor
extern

Definition at line 13 of file environ.c.

Referenced by crt_process_init(), and Test__winmajor().

◆ _winminor

unsigned int _winminor
extern

Definition at line 12 of file environ.c.

Referenced by crt_process_init(), and Test__winminor().

◆ _winver