SDL  2.0
SDL_stdinc.h File Reference
#include "SDL_config.h"
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <strings.h>
#include <wchar.h>
#include <inttypes.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <alloca.h>
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_stdinc.h:

Go to the source code of this file.

Macros

#define SDL_arraysize(array)   (sizeof(array)/sizeof(array[0]))
 
#define SDL_TABLESIZE(table)   SDL_arraysize(table)
 
#define SDL_STRINGIFY_ARG(arg)   #arg
 
#define SDL_FOURCC(A, B, C, D)
 
#define SDL_PRIs64   "I64d"
 
#define SDL_PRIu64   "I64u"
 
#define SDL_PRIx64   "I64x"
 
#define SDL_PRIX64   "I64X"
 
#define SDL_IN_BYTECAP(x)
 
#define SDL_INOUT_Z_CAP(x)
 
#define SDL_OUT_Z_CAP(x)
 
#define SDL_OUT_CAP(x)
 
#define SDL_OUT_BYTECAP(x)
 
#define SDL_OUT_Z_BYTECAP(x)
 
#define SDL_PRINTF_FORMAT_STRING
 
#define SDL_SCANF_FORMAT_STRING
 
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber)
 
#define SDL_SCANF_VARARG_FUNC(fmtargnumber)
 
#define SDL_COMPILE_TIME_ASSERT(name, x)   typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
 
#define SDL_stack_alloc(type, count)   (type*)alloca(sizeof(type)*(count))
 
#define SDL_stack_free(data)
 
#define SDL_min(x, y)   (((x) < (y)) ? (x) : (y))
 
#define SDL_max(x, y)   (((x) > (y)) ? (x) : (y))
 
#define SDL_zero(x)   SDL_memset(&(x), 0, sizeof((x)))
 
#define SDL_zerop(x)   SDL_memset((x), 0, sizeof(*(x)))
 
#define SDL_ICONV_ERROR   (size_t)-1
 
#define SDL_ICONV_E2BIG   (size_t)-2
 
#define SDL_ICONV_EILSEQ   (size_t)-3
 
#define SDL_ICONV_EINVAL   (size_t)-4
 
#define SDL_iconv_utf8_locale(S)   SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
 
#define SDL_iconv_utf8_ucs2(S)   (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
 
#define SDL_iconv_utf8_ucs4(S)   (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
 
Cast operators

Use proper C++ casts when compiled as C++ to be compatible with the option -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).

#define SDL_reinterpret_cast(type, expression)   ((type)(expression))
 
#define SDL_static_cast(type, expression)   ((type)(expression))
 
#define SDL_const_cast(type, expression)   ((type)(expression))
 

Typedefs

typedef void *(* SDL_malloc_func) (size_t size)
 
typedef void *(* SDL_calloc_func) (size_t nmemb, size_t size)
 
typedef void *(* SDL_realloc_func) (void *mem, size_t size)
 
typedef void(* SDL_free_func) (void *mem)
 

Functions

voidSDL_malloc (size_t size)
 
voidSDL_calloc (size_t nmemb, size_t size)
 
voidSDL_realloc (void *mem, size_t size)
 
void SDL_free (void *mem)
 
void SDL_GetMemoryFunctions (SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func)
 Get the current set of SDL memory functions. More...
 
int SDL_SetMemoryFunctions (SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func)
 Replace SDL's memory allocation functions with a custom set. More...
 
int SDL_GetNumAllocations (void)
 Get the number of outstanding (unfreed) allocations. More...
 
char * SDL_getenv (const char *name)
 
int SDL_setenv (const char *name, const char *value, int overwrite)
 
void SDL_qsort (void *base, size_t nmemb, size_t size, int(*compare)(const void *, const void *))
 
int SDL_abs (int x)
 
int SDL_isdigit (int x)
 
int SDL_isspace (int x)
 
int SDL_toupper (int x)
 
int SDL_tolower (int x)
 
voidSDL_memset (SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
 
SDL_FORCE_INLINE void SDL_memset4 (void *dst, Uint32 val, size_t dwords)
 
voidSDL_memcpy (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
 
voidSDL_memmove (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
 
int SDL_memcmp (const void *s1, const void *s2, size_t len)
 
wchar_t * SDL_wcsdup (const wchar_t *wstr)
 
size_t SDL_wcslen (const wchar_t *wstr)
 
size_t SDL_wcslcpy (SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
 
size_t SDL_wcslcat (SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
 
int SDL_wcscmp (const wchar_t *str1, const wchar_t *str2)
 
size_t SDL_strlen (const char *str)
 
size_t SDL_strlcpy (SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
 
size_t SDL_utf8strlcpy (SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)
 
size_t SDL_strlcat (SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
 
char * SDL_strdup (const char *str)
 
char * SDL_strrev (char *str)
 
char * SDL_strupr (char *str)
 
char * SDL_strlwr (char *str)
 
char * SDL_strchr (const char *str, int c)
 
char * SDL_strrchr (const char *str, int c)
 
char * SDL_strstr (const char *haystack, const char *needle)
 
size_t SDL_utf8strlen (const char *str)
 
char * SDL_itoa (int value, char *str, int radix)
 
char * SDL_uitoa (unsigned int value, char *str, int radix)
 
char * SDL_ltoa (long value, char *str, int radix)
 
char * SDL_ultoa (unsigned long value, char *str, int radix)
 
char * SDL_lltoa (Sint64 value, char *str, int radix)
 
char * SDL_ulltoa (Uint64 value, char *str, int radix)
 
int SDL_atoi (const char *str)
 
double SDL_atof (const char *str)
 
long SDL_strtol (const char *str, char **endp, int base)
 
unsigned long SDL_strtoul (const char *str, char **endp, int base)
 
Sint64 SDL_strtoll (const char *str, char **endp, int base)
 
Uint64 SDL_strtoull (const char *str, char **endp, int base)
 
double SDL_strtod (const char *str, char **endp)
 
int SDL_strcmp (const char *str1, const char *str2)
 
int SDL_strncmp (const char *str1, const char *str2, size_t maxlen)
 
int SDL_strcasecmp (const char *str1, const char *str2)
 
int SDL_strncasecmp (const char *str1, const char *str2, size_t len)
 
int SDL_sscanf (const char *text, SDL_SCANF_FORMAT_STRING const char *fmt,...) SDL_SCANF_VARARG_FUNC(2)
 
int SDL_vsscanf (const char *text, const char *fmt, va_list ap)
 
int SDL_snprintf (SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(3)
 
int SDL_vsnprintf (SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
 
double SDL_acos (double x)
 
float SDL_acosf (float x)
 
double SDL_asin (double x)
 
float SDL_asinf (float x)
 
double SDL_atan (double x)
 
float SDL_atanf (float x)
 
double SDL_atan2 (double x, double y)
 
float SDL_atan2f (float x, float y)
 
double SDL_ceil (double x)
 
float SDL_ceilf (float x)
 
double SDL_copysign (double x, double y)
 
float SDL_copysignf (float x, float y)
 
double SDL_cos (double x)
 
float SDL_cosf (float x)
 
double SDL_exp (double x)
 
float SDL_expf (float x)
 
double SDL_fabs (double x)
 
float SDL_fabsf (float x)
 
double SDL_floor (double x)
 
float SDL_floorf (float x)
 
double SDL_fmod (double x, double y)
 
float SDL_fmodf (float x, float y)
 
double SDL_log (double x)
 
float SDL_logf (float x)
 
double SDL_log10 (double x)
 
float SDL_log10f (float x)
 
double SDL_pow (double x, double y)
 
float SDL_powf (float x, float y)
 
double SDL_scalbn (double x, int n)
 
float SDL_scalbnf (float x, int n)
 
double SDL_sin (double x)
 
float SDL_sinf (float x)
 
double SDL_sqrt (double x)
 
float SDL_sqrtf (float x)
 
double SDL_tan (double x)
 
float SDL_tanf (float x)
 
SDL_iconv_t SDL_iconv_open (const char *tocode, const char *fromcode)
 
int SDL_iconv_close (SDL_iconv_t cd)
 
size_t SDL_iconv (SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 
char * SDL_iconv_string (const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft)
 
SDL_FORCE_INLINE voidSDL_memcpy4 (SDL_OUT_BYTECAP(dwords *4) void *dst, SDL_IN_BYTECAP(dwords *4) const void *src, size_t dwords)
 

Basic data types

#define SDL_MAX_SINT8   ((Sint8)0x7F) /* 127 */
 A signed 8-bit integer type. More...
 
#define SDL_MIN_SINT8   ((Sint8)(~0x7F)) /* -128 */
 
#define SDL_MAX_UINT8   ((Uint8)0xFF) /* 255 */
 An unsigned 8-bit integer type. More...
 
#define SDL_MIN_UINT8   ((Uint8)0x00) /* 0 */
 
#define SDL_MAX_SINT16   ((Sint16)0x7FFF) /* 32767 */
 A signed 16-bit integer type. More...
 
#define SDL_MIN_SINT16   ((Sint16)(~0x7FFF)) /* -32768 */
 
#define SDL_MAX_UINT16   ((Uint16)0xFFFF) /* 65535 */
 An unsigned 16-bit integer type. More...
 
#define SDL_MIN_UINT16   ((Uint16)0x0000) /* 0 */
 
#define SDL_MAX_SINT32   ((Sint32)0x7FFFFFFF) /* 2147483647 */
 A signed 32-bit integer type. More...
 
#define SDL_MIN_SINT32   ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
 
#define SDL_MAX_UINT32   ((Uint32)0xFFFFFFFFu) /* 4294967295 */
 An unsigned 32-bit integer type. More...
 
#define SDL_MIN_UINT32   ((Uint32)0x00000000) /* 0 */
 
#define SDL_MAX_SINT64   ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
 A signed 64-bit integer type. More...
 
#define SDL_MIN_SINT64   ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
 
#define SDL_MAX_UINT64   ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
 An unsigned 64-bit integer type. More...
 
#define SDL_MIN_UINT64   ((Uint64)(0x0000000000000000ull)) /* 0 */
 
enum  SDL_bool {
  SDL_FALSE = 0,
  SDL_TRUE = 1
}
 
typedef int8_t Sint8
 
typedef uint8_t Uint8
 
typedef int16_t Sint16
 
typedef uint16_t Uint16
 
typedef int32_t Sint32
 
typedef uint32_t Uint32
 
typedef int64_t Sint64
 
typedef uint64_t Uint64
 

Detailed Description

This is a general header that includes C language support.

Definition in file SDL_stdinc.h.

Macro Definition Documentation

◆ SDL_arraysize

◆ SDL_COMPILE_TIME_ASSERT

#define SDL_COMPILE_TIME_ASSERT (   name,
  x 
)    typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]

Definition at line 312 of file SDL_stdinc.h.

Referenced by SDL_AtomicTryLock(), and TestTypes().

◆ SDL_const_cast

#define SDL_const_cast (   type,
  expression 
)    ((type)(expression))

Definition at line 139 of file SDL_stdinc.h.

Referenced by SDL_strchr(), SDL_strrchr(), SDL_strstr(), and SDL_TLSSet().

◆ SDL_FOURCC

#define SDL_FOURCC (   A,
  B,
  C,
 
)
Value:
uint8_t Uint8
Definition: SDL_stdinc.h:179
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:138

Definition at line 144 of file SDL_stdinc.h.

◆ SDL_ICONV_E2BIG

#define SDL_ICONV_E2BIG   (size_t)-2

Definition at line 542 of file SDL_stdinc.h.

Referenced by SDL_iconv(), and SDL_iconv_string().

◆ SDL_ICONV_EILSEQ

#define SDL_ICONV_EILSEQ   (size_t)-3

Definition at line 543 of file SDL_stdinc.h.

Referenced by SDL_iconv_string().

◆ SDL_ICONV_EINVAL

#define SDL_ICONV_EINVAL   (size_t)-4

Definition at line 544 of file SDL_stdinc.h.

Referenced by SDL_iconv(), and SDL_iconv_string().

◆ SDL_ICONV_ERROR

#define SDL_ICONV_ERROR   (size_t)-1

Definition at line 541 of file SDL_stdinc.h.

Referenced by SDL_iconv_string().

◆ SDL_iconv_utf8_locale

#define SDL_iconv_utf8_locale (   S)    SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)

Definition at line 562 of file SDL_stdinc.h.

◆ SDL_iconv_utf8_ucs2

#define SDL_iconv_utf8_ucs2 (   S)    (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)

Definition at line 563 of file SDL_stdinc.h.

◆ SDL_iconv_utf8_ucs4

#define SDL_iconv_utf8_ucs4 (   S)    (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)

Definition at line 564 of file SDL_stdinc.h.

◆ SDL_IN_BYTECAP

#define SDL_IN_BYTECAP (   x)

Definition at line 294 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_INOUT_Z_CAP

#define SDL_INOUT_Z_CAP (   x)

Definition at line 295 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_max

◆ SDL_MAX_SINT16

#define SDL_MAX_SINT16   ((Sint16)0x7FFF) /* 32767 */

A signed 16-bit integer type.

Definition at line 183 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MAX_SINT32

#define SDL_MAX_SINT32   ((Sint32)0x7FFFFFFF) /* 2147483647 */

A signed 32-bit integer type.

Definition at line 195 of file SDL_stdinc.h.

Referenced by SDL_CreateRGBSurfaceWithFormat(), and TestTypes().

◆ SDL_MAX_SINT64

#define SDL_MAX_SINT64   ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */

A signed 64-bit integer type.

Definition at line 208 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MAX_SINT8

#define SDL_MAX_SINT8   ((Sint8)0x7F) /* 127 */

A signed 8-bit integer type.

Definition at line 171 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MAX_UINT16

#define SDL_MAX_UINT16   ((Uint16)0xFFFF) /* 65535 */

An unsigned 16-bit integer type.

Definition at line 189 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MAX_UINT32

#define SDL_MAX_UINT32   ((Uint32)0xFFFFFFFFu) /* 4294967295 */

An unsigned 32-bit integer type.

Definition at line 201 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MAX_UINT64

#define SDL_MAX_UINT64   ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */

An unsigned 64-bit integer type.

Definition at line 214 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MAX_UINT8

#define SDL_MAX_UINT8   ((Uint8)0xFF) /* 255 */

An unsigned 8-bit integer type.

Definition at line 177 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_min

◆ SDL_MIN_SINT16

#define SDL_MIN_SINT16   ((Sint16)(~0x7FFF)) /* -32768 */

Definition at line 184 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_SINT32

#define SDL_MIN_SINT32   ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */

Definition at line 196 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_SINT64

#define SDL_MIN_SINT64   ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */

Definition at line 209 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_SINT8

#define SDL_MIN_SINT8   ((Sint8)(~0x7F)) /* -128 */

Definition at line 172 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_UINT16

#define SDL_MIN_UINT16   ((Uint16)0x0000) /* 0 */

Definition at line 190 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_UINT32

#define SDL_MIN_UINT32   ((Uint32)0x00000000) /* 0 */

Definition at line 202 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_UINT64

#define SDL_MIN_UINT64   ((Uint64)(0x0000000000000000ull)) /* 0 */

Definition at line 215 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_MIN_UINT8

#define SDL_MIN_UINT8   ((Uint8)0x00) /* 0 */

Definition at line 178 of file SDL_stdinc.h.

Referenced by TestTypes().

◆ SDL_OUT_BYTECAP

#define SDL_OUT_BYTECAP (   x)

Definition at line 298 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_OUT_CAP

#define SDL_OUT_CAP (   x)

Definition at line 297 of file SDL_stdinc.h.

◆ SDL_OUT_Z_BYTECAP

#define SDL_OUT_Z_BYTECAP (   x)

Definition at line 299 of file SDL_stdinc.h.

◆ SDL_OUT_Z_CAP

#define SDL_OUT_Z_CAP (   x)

Definition at line 296 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_PRINTF_FORMAT_STRING

#define SDL_PRINTF_FORMAT_STRING

Definition at line 300 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_PRINTF_VARARG_FUNC

#define SDL_PRINTF_VARARG_FUNC (   fmtargnumber)

Definition at line 307 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_PRIs64

◆ SDL_PRIu64

◆ SDL_PRIx64

#define SDL_PRIx64   "I64x"

Definition at line 249 of file SDL_stdinc.h.

Referenced by SDLTest_LogAllocations().

◆ SDL_PRIX64

#define SDL_PRIX64   "I64X"

Definition at line 260 of file SDL_stdinc.h.

Referenced by platform_testEndianessAndSwap(), and TestEndian().

◆ SDL_reinterpret_cast

#define SDL_reinterpret_cast (   type,
  expression 
)    ((type)(expression))

Definition at line 137 of file SDL_stdinc.h.

◆ SDL_SCANF_FORMAT_STRING

#define SDL_SCANF_FORMAT_STRING

Definition at line 301 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_SCANF_VARARG_FUNC

#define SDL_SCANF_VARARG_FUNC (   fmtargnumber)

Definition at line 308 of file SDL_stdinc.h.

Referenced by SDL_memset4().

◆ SDL_stack_alloc

◆ SDL_stack_free

◆ SDL_static_cast

#define SDL_static_cast (   type,
  expression 
)    ((type)(expression))

Definition at line 138 of file SDL_stdinc.h.

Referenced by SDL_memset4(), SDL_Swap16(), SDL_Swap32(), and SDL_Swap64().

◆ SDL_STRINGIFY_ARG

#define SDL_STRINGIFY_ARG (   arg)    #arg

Macro useful for building other macros with strings in them

e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(FUNCTION) ": " X "\n")

Definition at line 123 of file SDL_stdinc.h.

◆ SDL_TABLESIZE

#define SDL_TABLESIZE (   table)    SDL_arraysize(table)

Definition at line 116 of file SDL_stdinc.h.

Referenced by handleKeyboardEvent().

◆ SDL_zero

◆ SDL_zerop

Typedef Documentation

◆ SDL_calloc_func

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) b int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func SDL_calloc_func

Definition at line 367 of file SDL_stdinc.h.

◆ SDL_free_func

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) d int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func

Definition at line 369 of file SDL_stdinc.h.

◆ SDL_malloc_func

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func

Definition at line 366 of file SDL_stdinc.h.

◆ SDL_realloc_func

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) c int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func SDL_calloc_func SDL_realloc_func

Definition at line 368 of file SDL_stdinc.h.

◆ Sint16

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) c int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16

Definition at line 185 of file SDL_stdinc.h.

◆ Sint32

typedef int32_t Sint32

Definition at line 197 of file SDL_stdinc.h.

◆ Sint64

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64

Definition at line 210 of file SDL_stdinc.h.

◆ Sint8

typedef int8_t Sint8

Definition at line 173 of file SDL_stdinc.h.

◆ Uint16

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) c int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return const SDL_AudioFormat const Uint8 const int const SDL_AudioFormat const Uint8 const int return SDL_AudioStream void int return SDL_AudioStream return SDL_AudioStream return float return float float return float float return float return float float return double double return SDL_YUV_CONVERSION_MODE int int return SDL_Renderer return float return return float return SDL_GameController Uint16 Uint16

Definition at line 191 of file SDL_stdinc.h.

◆ Uint32

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) d int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return const SDL_AudioFormat const Uint8 const int const SDL_AudioFormat const Uint8 const int return SDL_AudioStream void int return SDL_AudioStream return SDL_AudioStream return float return float float return float float return float return float float return double double return SDL_YUV_CONVERSION_MODE int int return SDL_Renderer return float return return float return SDL_GameController Uint16 Uint16 Uint32

Definition at line 203 of file SDL_stdinc.h.

◆ Uint64

typedef uint64_t Uint64

Definition at line 216 of file SDL_stdinc.h.

◆ Uint8

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) e int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool return int return SDL_Joystick return SDL_Joystick return SDL_GameController return return return SDL_Joystick int Sint16 return SDL_Joystick return const char return const wchar_t const wchar_t return SDL_Surface return return SDL_Window unsigned int const char return SDL_Window int int SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return const SDL_AudioFormat const Uint8 const int const SDL_AudioFormat const Uint8

Definition at line 179 of file SDL_stdinc.h.

Enumeration Type Documentation

◆ SDL_bool

enum SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) b int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool return int int return SDL_AudioDeviceID const void Uint32 return SDL_AudioDeviceID int float float float return SDL_JoystickID return int SDL_Rect return SDL_Window float return SDL_Window return SDL_Renderer SDL_bool return SDL_AudioDeviceID void Uint32 return Uint32 int int int Uint32 return const char SDL_bool
Enumerator
SDL_FALSE 
SDL_TRUE 

Definition at line 161 of file SDL_stdinc.h.

162 {
163  SDL_FALSE = 0,
164  SDL_TRUE = 1
165 } SDL_bool;
SDL_bool
Definition: SDL_stdinc.h:161

Function Documentation

◆ SDL_abs()

int SDL_abs ( int  x)

Definition at line 429 of file SDL_stdlib.c.

References SDL_isdigit(), SDL_isspace(), SDL_tolower(), and SDL_toupper().

430 {
431 #if defined(HAVE_ABS)
432  return abs(x);
433 #else
434  return ((x) < 0 ? -(x) : (x));
435 #endif
436 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_acos()

double SDL_acos ( double  x)

Definition at line 75 of file SDL_stdlib.c.

References SDL_atan(), and SDL_sqrt().

Referenced by SDL_acosf(), SDL_asin(), and SDL_memset4().

76 {
77 #if defined(HAVE_ACOS)
78  return acos(val);
79 #else
80  double result;
81  if (val == -1.0) {
82  result = M_PI;
83  } else {
84  result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
85  if (result < 0.0)
86  {
87  result += M_PI;
88  }
89  }
90  return result;
91 #endif
92 }
GLuint64EXT * result
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:390
double SDL_atan(double x)
Definition: SDL_stdlib.c:35
GLuint GLfloat * val

◆ SDL_acosf()

float SDL_acosf ( float  x)

Definition at line 95 of file SDL_stdlib.c.

References SDL_acos().

Referenced by SDL_memset4().

96 {
97 #if defined(HAVE_ACOSF)
98  return acosf(val);
99 #else
100  return (float)SDL_acos((double)val);
101 #endif
102 }
double SDL_acos(double val)
Definition: SDL_stdlib.c:75
GLuint GLfloat * val

◆ SDL_asin()

double SDL_asin ( double  x)

Definition at line 105 of file SDL_stdlib.c.

References SDL_acos().

Referenced by SDL_asinf(), and SDL_memset4().

106 {
107 #if defined(HAVE_ASIN)
108  return asin(val);
109 #else
110  double result;
111  if (val == -1.0) {
112  result = -(M_PI / 2.0);
113  } else {
114  result = (M_PI / 2.0) - SDL_acos(val);
115  }
116  return result;
117 #endif
118 }
GLuint64EXT * result
double SDL_acos(double val)
Definition: SDL_stdlib.c:75
GLuint GLfloat * val

◆ SDL_asinf()

float SDL_asinf ( float  x)

Definition at line 121 of file SDL_stdlib.c.

References SDL_asin().

Referenced by SDL_memset4().

122 {
123 #if defined(HAVE_ASINF)
124  return asinf(val);
125 #else
126  return (float)SDL_asin((double)val);
127 #endif
128 }
GLuint GLfloat * val
double SDL_asin(double val)
Definition: SDL_stdlib.c:105

◆ SDL_atan()

double SDL_atan ( double  x)

Definition at line 35 of file SDL_stdlib.c.

References atan(), and SDL_uclibc_atan().

Referenced by SDL_acos(), SDL_atanf(), and SDL_memset4().

36 {
37 #if defined(HAVE_ATAN)
38  return atan(x);
39 #else
40  return SDL_uclibc_atan(x);
41 #endif
42 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_atan(double x)
double atan(double x)
Definition: s_atan.c:67

◆ SDL_atan2()

double SDL_atan2 ( double  x,
double  y 
)

Definition at line 55 of file SDL_stdlib.c.

References SDL_uclibc_atan2().

Referenced by SDL_atan2f(), and SDL_memset4().

56 {
57 #if defined(HAVE_ATAN2)
58  return atan2(x, y);
59 #else
60  return SDL_uclibc_atan2(x, y);
61 #endif
62 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_atan2(double y, double x)
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574

◆ SDL_atan2f()

float SDL_atan2f ( float  x,
float  y 
)

Definition at line 65 of file SDL_stdlib.c.

References SDL_atan2().

Referenced by SDL_memset4().

66 {
67 #if defined(HAVE_ATAN2F)
68  return atan2f(x, y);
69 #else
70  return (float)SDL_atan2((double)x, (double)y);
71 #endif
72 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
double SDL_atan2(double x, double y)
Definition: SDL_stdlib.c:55

◆ SDL_atanf()

float SDL_atanf ( float  x)

Definition at line 45 of file SDL_stdlib.c.

References SDL_atan().

Referenced by SDL_memset4().

46 {
47 #if defined(HAVE_ATANF)
48  return atanf(x);
49 #else
50  return (float)SDL_atan((double)x);
51 #endif
52 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_atan(double x)
Definition: SDL_stdlib.c:35

◆ SDL_atof()

double SDL_atof ( const char *  str)

Definition at line 818 of file SDL_string.c.

References NULL, and SDL_strtod().

Referenced by SDL_memset4().

819 {
820 #ifdef HAVE_ATOF
821  return (double) atof(string);
822 #else
823  return SDL_strtod(string, NULL);
824 #endif /* HAVE_ATOF */
825 }
double SDL_strtod(const char *string, char **endp)
Definition: SDL_string.c:928
#define NULL
Definition: begin_code.h:164

◆ SDL_atoi()

int SDL_atoi ( const char *  str)

Definition at line 809 of file SDL_string.c.

References NULL, and SDL_strtol().

Referenced by SDL_memset4().

810 {
811 #ifdef HAVE_ATOI
812  return atoi(string);
813 #else
814  return SDL_strtol(string, NULL, 0);
815 #endif /* HAVE_ATOI */
816 }
long SDL_strtol(const char *string, char **endp, int base)
Definition: SDL_string.c:828
#define NULL
Definition: begin_code.h:164

◆ SDL_calloc()

void* SDL_calloc ( size_t  nmemb,
size_t  size 
)

Definition at line 5335 of file SDL_malloc.c.

References s_mem, and SDL_AtomicIncRef.

5336 {
5337  void *mem;
5338 
5339  if (!nmemb || !size) {
5340  nmemb = 1;
5341  size = 1;
5342  }
5343 
5344  mem = s_mem.calloc_func(nmemb, size);
5345  if (mem) {
5346  SDL_AtomicIncRef(&s_mem.num_allocations);
5347  }
5348  return mem;
5349 }
static struct @31 s_mem
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
Definition: SDL_atomic.h:234
GLsizeiptr size

◆ SDL_ceil()

double SDL_ceil ( double  x)

Definition at line 131 of file SDL_stdlib.c.

References SDL_floor().

Referenced by SDL_ceilf(), and SDL_memset4().

132 {
133 #if defined(HAVE_CEIL)
134  return ceil(x);
135 #else
136  double integer = SDL_floor(x);
137  double fraction = x - integer;
138  if (fraction > 0.0) {
139  integer += 1.0;
140  }
141  return integer;
142 #endif /* HAVE_CEIL */
143 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_floor(double x)
Definition: SDL_stdlib.c:244

◆ SDL_ceilf()

float SDL_ceilf ( float  x)

Definition at line 146 of file SDL_stdlib.c.

References SDL_ceil().

Referenced by SDL_memset4().

147 {
148 #if defined(HAVE_CEILF)
149  return ceilf(x);
150 #else
151  return (float)SDL_ceil((float)x);
152 #endif
153 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_ceil(double x)
Definition: SDL_stdlib.c:131

◆ SDL_copysign()

double SDL_copysign ( double  x,
double  y 
)

Definition at line 156 of file SDL_stdlib.c.

References copysign(), and SDL_uclibc_copysign().

Referenced by SDL_copysignf(), and SDL_memset4().

157 {
158 #if defined(HAVE_COPYSIGN)
159  return copysign(x, y);
160 #elif defined(HAVE__COPYSIGN)
161  return _copysign(x, y);
162 #elif defined(__WATCOMC__) && defined(__386__)
163  /* this is nasty as hell, but it works.. */
164  unsigned int *xi = (unsigned int *) &x,
165  *yi = (unsigned int *) &y;
166  xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff);
167  return x;
168 #else
169  return SDL_uclibc_copysign(x, y);
170 #endif /* HAVE_COPYSIGN */
171 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_copysign(double x, double y)
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
double copysign(double x, double y)
Definition: s_copysign.c:21

◆ SDL_copysignf()

float SDL_copysignf ( float  x,
float  y 
)

Definition at line 174 of file SDL_stdlib.c.

References SDL_copysign().

Referenced by SDL_memset4().

175 {
176 #if defined(HAVE_COPYSIGNF)
177  return copysignf(x, y);
178 #else
179  return (float)SDL_copysign((double)x, (double)y);
180 #endif
181 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
double SDL_copysign(double x, double y)
Definition: SDL_stdlib.c:156

◆ SDL_cos()

double SDL_cos ( double  x)

Definition at line 184 of file SDL_stdlib.c.

References cos(), and SDL_uclibc_cos().

Referenced by SDL_cosf(), and SDL_memset4().

185 {
186 #if defined(HAVE_COS)
187  return cos(x);
188 #else
189  return SDL_uclibc_cos(x);
190 #endif
191 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_cos(double x)
double cos(double x)
Definition: s_cos.c:46

◆ SDL_cosf()

float SDL_cosf ( float  x)

Definition at line 194 of file SDL_stdlib.c.

References SDL_cos().

Referenced by SDL_memset4().

195 {
196 #if defined(HAVE_COSF)
197  return cosf(x);
198 #else
199  return (float)SDL_cos((double)x);
200 #endif
201 }
double SDL_cos(double x)
Definition: SDL_stdlib.c:184
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_exp()

double SDL_exp ( double  x)

Definition at line 204 of file SDL_stdlib.c.

References SDL_uclibc_exp().

Referenced by SDL_expf(), and SDL_memset4().

205 {
206 #if defined(HAVE_EXP)
207  return exp(x);
208 #else
209  return SDL_uclibc_exp(x);
210 #endif
211 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_exp(double x)

◆ SDL_expf()

float SDL_expf ( float  x)

Definition at line 214 of file SDL_stdlib.c.

References SDL_exp().

Referenced by SDL_memset4().

215 {
216 #if defined(HAVE_EXPF)
217  return expf(x);
218 #else
219  return (float)SDL_exp((double)x);
220 #endif
221 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_exp(double x)
Definition: SDL_stdlib.c:204

◆ SDL_fabs()

double SDL_fabs ( double  x)

Definition at line 224 of file SDL_stdlib.c.

References fabs(), and SDL_uclibc_fabs().

Referenced by SDL_fabsf(), and SDL_memset4().

225 {
226 #if defined(HAVE_FABS)
227  return fabs(x);
228 #else
229  return SDL_uclibc_fabs(x);
230 #endif
231 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_fabs(double x)
double fabs(double x)
Definition: s_fabs.c:22

◆ SDL_fabsf()

float SDL_fabsf ( float  x)

Definition at line 234 of file SDL_stdlib.c.

References SDL_fabs().

Referenced by SDL_memset4().

235 {
236 #if defined(HAVE_FABSF)
237  return fabsf(x);
238 #else
239  return (float)SDL_fabs((double)x);
240 #endif
241 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_fabs(double x)
Definition: SDL_stdlib.c:224

◆ SDL_floor()

double SDL_floor ( double  x)

Definition at line 244 of file SDL_stdlib.c.

References floor(), and SDL_uclibc_floor().

Referenced by SDL_ceil(), SDL_floorf(), and SDL_memset4().

245 {
246 #if defined(HAVE_FLOOR)
247  return floor(x);
248 #else
249  return SDL_uclibc_floor(x);
250 #endif
251 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_floor(double x)
double floor(double x)
Definition: s_floor.c:29

◆ SDL_floorf()

float SDL_floorf ( float  x)

Definition at line 254 of file SDL_stdlib.c.

References SDL_floor().

Referenced by SDL_memset4().

255 {
256 #if defined(HAVE_FLOORF)
257  return floorf(x);
258 #else
259  return (float)SDL_floor((double)x);
260 #endif
261 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_floor(double x)
Definition: SDL_stdlib.c:244

◆ SDL_fmod()

double SDL_fmod ( double  x,
double  y 
)

Definition at line 264 of file SDL_stdlib.c.

References SDL_uclibc_fmod().

Referenced by SDL_fmodf(), and SDL_memset4().

265 {
266 #if defined(HAVE_FMOD)
267  return fmod(x, y);
268 #else
269  return SDL_uclibc_fmod(x, y);
270 #endif
271 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
double SDL_uclibc_fmod(double x, double y)

◆ SDL_fmodf()

float SDL_fmodf ( float  x,
float  y 
)

Definition at line 274 of file SDL_stdlib.c.

References SDL_fmod().

Referenced by SDL_memset4().

275 {
276 #if defined(HAVE_FMODF)
277  return fmodf(x, y);
278 #else
279  return (float)SDL_fmod((double)x, (double)y);
280 #endif
281 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_fmod(double x, double y)
Definition: SDL_stdlib.c:264
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574

◆ SDL_free()

void SDL_free ( void mem)

Definition at line 5366 of file SDL_malloc.c.

References s_mem, SDL_AtomicDecRef, and void.

5367 {
5368  if (!ptr) {
5369  return;
5370  }
5371 
5372  s_mem.free_func(ptr);
5373  (void)SDL_AtomicDecRef(&s_mem.num_allocations);
5374 }
static struct @31 s_mem
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
#define SDL_AtomicDecRef(a)
Decrement an atomic variable used as a reference count.
Definition: SDL_atomic.h:244

◆ SDL_getenv()

char* SDL_getenv ( const char *  name)

Definition at line 219 of file SDL_getenv.c.

References i, main, NULL, SDL_setenv(), SDL_strcmp, SDL_strlen, and SDL_strncmp.

Referenced by SDL_setenv().

220 {
221  int len, i;
222  char *value;
223 
224  /* Input validation */
225  if (!name || SDL_strlen(name)==0) {
226  return NULL;
227  }
228 
229  value = (char *) 0;
230  if (SDL_env) {
231  len = SDL_strlen(name);
232  for (i = 0; SDL_env[i] && !value; ++i) {
233  if ((SDL_strncmp(SDL_env[i], name, len) == 0) &&
234  (SDL_env[i][len] == '=')) {
235  value = &SDL_env[i][len + 1];
236  }
237  }
238  }
239  return value;
240 }
#define SDL_strncmp
static char ** SDL_env
Definition: SDL_getenv.c:108
GLenum GLsizei len
GLuint const GLchar * name
GLsizei const GLfloat * value
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define SDL_strlen

◆ SDL_GetMemoryFunctions()

void SDL_GetMemoryFunctions ( SDL_malloc_func malloc_func,
SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func 
)

Get the current set of SDL memory functions.

Definition at line 5271 of file SDL_malloc.c.

References s_mem.

5275 {
5276  if (malloc_func) {
5277  *malloc_func = s_mem.malloc_func;
5278  }
5279  if (calloc_func) {
5280  *calloc_func = s_mem.calloc_func;
5281  }
5282  if (realloc_func) {
5283  *realloc_func = s_mem.realloc_func;
5284  }
5285  if (free_func) {
5286  *free_func = s_mem.free_func;
5287  }
5288 }
static struct @31 s_mem
SDL_realloc_func realloc_func
Definition: SDL_malloc.c:5264
SDL_malloc_func malloc_func
Definition: SDL_malloc.c:5262
SDL_free_func free_func
Definition: SDL_malloc.c:5265
SDL_calloc_func calloc_func
Definition: SDL_malloc.c:5263

◆ SDL_GetNumAllocations()

int SDL_GetNumAllocations ( void  )

Get the number of outstanding (unfreed) allocations.

Definition at line 5315 of file SDL_malloc.c.

References s_mem, and SDL_AtomicGet.

5316 {
5317  return SDL_AtomicGet(&s_mem.num_allocations);
5318 }
static struct @31 s_mem
#define SDL_AtomicGet

◆ SDL_iconv()

size_t SDL_iconv ( SDL_iconv_t  cd,
const char **  inbuf,
size_t inbytesleft,
char **  outbuf,
size_t outbytesleft 
)

Definition at line 248 of file SDL_iconv.c.

References ENCODING_ASCII, ENCODING_LATIN1, ENCODING_UCS2BE, ENCODING_UCS2LE, ENCODING_UCS4BE, ENCODING_UCS4LE, ENCODING_UTF16, ENCODING_UTF16BE, ENCODING_UTF16LE, ENCODING_UTF16NATIVE, ENCODING_UTF32, ENCODING_UTF32BE, ENCODING_UTF32LE, ENCODING_UTF32NATIVE, ENCODING_UTF8, SDL_FALSE, SDL_ICONV_E2BIG, SDL_ICONV_EINVAL, SDL_TRUE, UNICODE_BOM, UNKNOWN_ASCII, and UNKNOWN_UNICODE.

Referenced by SDL_iconv_string().

251 {
252  /* For simplicity, we'll convert everything to and from UCS-4 */
253  const char *src;
254  char *dst;
255  size_t srclen, dstlen;
256  Uint32 ch = 0;
257  size_t total;
258 
259  if (!inbuf || !*inbuf) {
260  /* Reset the context */
261  return 0;
262  }
263  if (!outbuf || !*outbuf || !outbytesleft || !*outbytesleft) {
264  return SDL_ICONV_E2BIG;
265  }
266  src = *inbuf;
267  srclen = (inbytesleft ? *inbytesleft : 0);
268  dst = *outbuf;
269  dstlen = *outbytesleft;
270 
271  switch (cd->src_fmt) {
272  case ENCODING_UTF16:
273  /* Scan for a byte order marker */
274  {
275  Uint8 *p = (Uint8 *) src;
276  size_t n = srclen / 2;
277  while (n) {
278  if (p[0] == 0xFF && p[1] == 0xFE) {
279  cd->src_fmt = ENCODING_UTF16BE;
280  break;
281  } else if (p[0] == 0xFE && p[1] == 0xFF) {
282  cd->src_fmt = ENCODING_UTF16LE;
283  break;
284  }
285  p += 2;
286  --n;
287  }
288  if (n == 0) {
289  /* We can't tell, default to host order */
290  cd->src_fmt = ENCODING_UTF16NATIVE;
291  }
292  }
293  break;
294  case ENCODING_UTF32:
295  /* Scan for a byte order marker */
296  {
297  Uint8 *p = (Uint8 *) src;
298  size_t n = srclen / 4;
299  while (n) {
300  if (p[0] == 0xFF && p[1] == 0xFE &&
301  p[2] == 0x00 && p[3] == 0x00) {
302  cd->src_fmt = ENCODING_UTF32BE;
303  break;
304  } else if (p[0] == 0x00 && p[1] == 0x00 &&
305  p[2] == 0xFE && p[3] == 0xFF) {
306  cd->src_fmt = ENCODING_UTF32LE;
307  break;
308  }
309  p += 4;
310  --n;
311  }
312  if (n == 0) {
313  /* We can't tell, default to host order */
314  cd->src_fmt = ENCODING_UTF32NATIVE;
315  }
316  }
317  break;
318  }
319 
320  switch (cd->dst_fmt) {
321  case ENCODING_UTF16:
322  /* Default to host order, need to add byte order marker */
323  if (dstlen < 2) {
324  return SDL_ICONV_E2BIG;
325  }
326  *(Uint16 *) dst = UNICODE_BOM;
327  dst += 2;
328  dstlen -= 2;
329  cd->dst_fmt = ENCODING_UTF16NATIVE;
330  break;
331  case ENCODING_UTF32:
332  /* Default to host order, need to add byte order marker */
333  if (dstlen < 4) {
334  return SDL_ICONV_E2BIG;
335  }
336  *(Uint32 *) dst = UNICODE_BOM;
337  dst += 4;
338  dstlen -= 4;
339  cd->dst_fmt = ENCODING_UTF32NATIVE;
340  break;
341  }
342 
343  total = 0;
344  while (srclen > 0) {
345  /* Decode a character */
346  switch (cd->src_fmt) {
347  case ENCODING_ASCII:
348  {
349  Uint8 *p = (Uint8 *) src;
350  ch = (Uint32) (p[0] & 0x7F);
351  ++src;
352  --srclen;
353  }
354  break;
355  case ENCODING_LATIN1:
356  {
357  Uint8 *p = (Uint8 *) src;
358  ch = (Uint32) p[0];
359  ++src;
360  --srclen;
361  }
362  break;
363  case ENCODING_UTF8: /* RFC 3629 */
364  {
365  Uint8 *p = (Uint8 *) src;
366  size_t left = 0;
367  SDL_bool overlong = SDL_FALSE;
368  if (p[0] >= 0xFC) {
369  if ((p[0] & 0xFE) != 0xFC) {
370  /* Skip illegal sequences
371  return SDL_ICONV_EILSEQ;
372  */
373  ch = UNKNOWN_UNICODE;
374  } else {
375  if (p[0] == 0xFC && srclen > 1 && (p[1] & 0xFC) == 0x80) {
376  overlong = SDL_TRUE;
377  }
378  ch = (Uint32) (p[0] & 0x01);
379  left = 5;
380  }
381  } else if (p[0] >= 0xF8) {
382  if ((p[0] & 0xFC) != 0xF8) {
383  /* Skip illegal sequences
384  return SDL_ICONV_EILSEQ;
385  */
386  ch = UNKNOWN_UNICODE;
387  } else {
388  if (p[0] == 0xF8 && srclen > 1 && (p[1] & 0xF8) == 0x80) {
389  overlong = SDL_TRUE;
390  }
391  ch = (Uint32) (p[0] & 0x03);
392  left = 4;
393  }
394  } else if (p[0] >= 0xF0) {
395  if ((p[0] & 0xF8) != 0xF0) {
396  /* Skip illegal sequences
397  return SDL_ICONV_EILSEQ;
398  */
399  ch = UNKNOWN_UNICODE;
400  } else {
401  if (p[0] == 0xF0 && srclen > 1 && (p[1] & 0xF0) == 0x80) {
402  overlong = SDL_TRUE;
403  }
404  ch = (Uint32) (p[0] & 0x07);
405  left = 3;
406  }
407  } else if (p[0] >= 0xE0) {
408  if ((p[0] & 0xF0) != 0xE0) {
409  /* Skip illegal sequences
410  return SDL_ICONV_EILSEQ;
411  */
412  ch = UNKNOWN_UNICODE;
413  } else {
414  if (p[0] == 0xE0 && srclen > 1 && (p[1] & 0xE0) == 0x80) {
415  overlong = SDL_TRUE;
416  }
417  ch = (Uint32) (p[0] & 0x0F);
418  left = 2;
419  }
420  } else if (p[0] >= 0xC0) {
421  if ((p[0] & 0xE0) != 0xC0) {
422  /* Skip illegal sequences
423  return SDL_ICONV_EILSEQ;
424  */
425  ch = UNKNOWN_UNICODE;
426  } else {
427  if ((p[0] & 0xDE) == 0xC0) {
428  overlong = SDL_TRUE;
429  }
430  ch = (Uint32) (p[0] & 0x1F);
431  left = 1;
432  }
433  } else {
434  if ((p[0] & 0x80) != 0x00) {
435  /* Skip illegal sequences
436  return SDL_ICONV_EILSEQ;
437  */
438  ch = UNKNOWN_UNICODE;
439  } else {
440  ch = (Uint32) p[0];
441  }
442  }
443  ++src;
444  --srclen;
445  if (srclen < left) {
446  return SDL_ICONV_EINVAL;
447  }
448  while (left--) {
449  ++p;
450  if ((p[0] & 0xC0) != 0x80) {
451  /* Skip illegal sequences
452  return SDL_ICONV_EILSEQ;
453  */
454  ch = UNKNOWN_UNICODE;
455  break;
456  }
457  ch <<= 6;
458  ch |= (p[0] & 0x3F);
459  ++src;
460  --srclen;
461  }
462  if (overlong) {
463  /* Potential security risk
464  return SDL_ICONV_EILSEQ;
465  */
466  ch = UNKNOWN_UNICODE;
467  }
468  if ((ch >= 0xD800 && ch <= 0xDFFF) ||
469  (ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
470  /* Skip illegal sequences
471  return SDL_ICONV_EILSEQ;
472  */
473  ch = UNKNOWN_UNICODE;
474  }
475  }
476  break;
477  case ENCODING_UTF16BE: /* RFC 2781 */
478  {
479  Uint8 *p = (Uint8 *) src;
480  Uint16 W1, W2;
481  if (srclen < 2) {
482  return SDL_ICONV_EINVAL;
483  }
484  W1 = ((Uint16) p[0] << 8) | (Uint16) p[1];
485  src += 2;
486  srclen -= 2;
487  if (W1 < 0xD800 || W1 > 0xDFFF) {
488  ch = (Uint32) W1;
489  break;
490  }
491  if (W1 > 0xDBFF) {
492  /* Skip illegal sequences
493  return SDL_ICONV_EILSEQ;
494  */
495  ch = UNKNOWN_UNICODE;
496  break;
497  }
498  if (srclen < 2) {
499  return SDL_ICONV_EINVAL;
500  }
501  p = (Uint8 *) src;
502  W2 = ((Uint16) p[0] << 8) | (Uint16) p[1];
503  src += 2;
504  srclen -= 2;
505  if (W2 < 0xDC00 || W2 > 0xDFFF) {
506  /* Skip illegal sequences
507  return SDL_ICONV_EILSEQ;
508  */
509  ch = UNKNOWN_UNICODE;
510  break;
511  }
512  ch = (((Uint32) (W1 & 0x3FF) << 10) |
513  (Uint32) (W2 & 0x3FF)) + 0x10000;
514  }
515  break;
516  case ENCODING_UTF16LE: /* RFC 2781 */
517  {
518  Uint8 *p = (Uint8 *) src;
519  Uint16 W1, W2;
520  if (srclen < 2) {
521  return SDL_ICONV_EINVAL;
522  }
523  W1 = ((Uint16) p[1] << 8) | (Uint16) p[0];
524  src += 2;
525  srclen -= 2;
526  if (W1 < 0xD800 || W1 > 0xDFFF) {
527  ch = (Uint32) W1;
528  break;
529  }
530  if (W1 > 0xDBFF) {
531  /* Skip illegal sequences
532  return SDL_ICONV_EILSEQ;
533  */
534  ch = UNKNOWN_UNICODE;
535  break;
536  }
537  if (srclen < 2) {
538  return SDL_ICONV_EINVAL;
539  }
540  p = (Uint8 *) src;
541  W2 = ((Uint16) p[1] << 8) | (Uint16) p[0];
542  src += 2;
543  srclen -= 2;
544  if (W2 < 0xDC00 || W2 > 0xDFFF) {
545  /* Skip illegal sequences
546  return SDL_ICONV_EILSEQ;
547  */
548  ch = UNKNOWN_UNICODE;
549  break;
550  }
551  ch = (((Uint32) (W1 & 0x3FF) << 10) |
552  (Uint32) (W2 & 0x3FF)) + 0x10000;
553  }
554  break;
555  case ENCODING_UCS2LE:
556  {
557  Uint8 *p = (Uint8 *) src;
558  if (srclen < 2) {
559  return SDL_ICONV_EINVAL;
560  }
561  ch = ((Uint32) p[1] << 8) | (Uint32) p[0];
562  src += 2;
563  srclen -= 2;
564  }
565  break;
566  case ENCODING_UCS2BE:
567  {
568  Uint8 *p = (Uint8 *) src;
569  if (srclen < 2) {
570  return SDL_ICONV_EINVAL;
571  }
572  ch = ((Uint32) p[0] << 8) | (Uint32) p[1];
573  src += 2;
574  srclen -= 2;
575  }
576  break;
577  case ENCODING_UCS4BE:
578  case ENCODING_UTF32BE:
579  {
580  Uint8 *p = (Uint8 *) src;
581  if (srclen < 4) {
582  return SDL_ICONV_EINVAL;
583  }
584  ch = ((Uint32) p[0] << 24) |
585  ((Uint32) p[1] << 16) |
586  ((Uint32) p[2] << 8) | (Uint32) p[3];
587  src += 4;
588  srclen -= 4;
589  }
590  break;
591  case ENCODING_UCS4LE:
592  case ENCODING_UTF32LE:
593  {
594  Uint8 *p = (Uint8 *) src;
595  if (srclen < 4) {
596  return SDL_ICONV_EINVAL;
597  }
598  ch = ((Uint32) p[3] << 24) |
599  ((Uint32) p[2] << 16) |
600  ((Uint32) p[1] << 8) | (Uint32) p[0];
601  src += 4;
602  srclen -= 4;
603  }
604  break;
605  }
606 
607  /* Encode a character */
608  switch (cd->dst_fmt) {
609  case ENCODING_ASCII:
610  {
611  Uint8 *p = (Uint8 *) dst;
612  if (dstlen < 1) {
613  return SDL_ICONV_E2BIG;
614  }
615  if (ch > 0x7F) {
616  *p = UNKNOWN_ASCII;
617  } else {
618  *p = (Uint8) ch;
619  }
620  ++dst;
621  --dstlen;
622  }
623  break;
624  case ENCODING_LATIN1:
625  {
626  Uint8 *p = (Uint8 *) dst;
627  if (dstlen < 1) {
628  return SDL_ICONV_E2BIG;
629  }
630  if (ch > 0xFF) {
631  *p = UNKNOWN_ASCII;
632  } else {
633  *p = (Uint8) ch;
634  }
635  ++dst;
636  --dstlen;
637  }
638  break;
639  case ENCODING_UTF8: /* RFC 3629 */
640  {
641  Uint8 *p = (Uint8 *) dst;
642  if (ch > 0x10FFFF) {
643  ch = UNKNOWN_UNICODE;
644  }
645  if (ch <= 0x7F) {
646  if (dstlen < 1) {
647  return SDL_ICONV_E2BIG;
648  }
649  *p = (Uint8) ch;
650  ++dst;
651  --dstlen;
652  } else if (ch <= 0x7FF) {
653  if (dstlen < 2) {
654  return SDL_ICONV_E2BIG;
655  }
656  p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
657  p[1] = 0x80 | (Uint8) (ch & 0x3F);
658  dst += 2;
659  dstlen -= 2;
660  } else if (ch <= 0xFFFF) {
661  if (dstlen < 3) {
662  return SDL_ICONV_E2BIG;
663  }
664  p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
665  p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
666  p[2] = 0x80 | (Uint8) (ch & 0x3F);
667  dst += 3;
668  dstlen -= 3;
669  } else if (ch <= 0x1FFFFF) {
670  if (dstlen < 4) {
671  return SDL_ICONV_E2BIG;
672  }
673  p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
674  p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
675  p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
676  p[3] = 0x80 | (Uint8) (ch & 0x3F);
677  dst += 4;
678  dstlen -= 4;
679  } else if (ch <= 0x3FFFFFF) {
680  if (dstlen < 5) {
681  return SDL_ICONV_E2BIG;
682  }
683  p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
684  p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
685  p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
686  p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
687  p[4] = 0x80 | (Uint8) (ch & 0x3F);
688  dst += 5;
689  dstlen -= 5;
690  } else {
691  if (dstlen < 6) {
692  return SDL_ICONV_E2BIG;
693  }
694  p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
695  p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
696  p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
697  p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
698  p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
699  p[5] = 0x80 | (Uint8) (ch & 0x3F);
700  dst += 6;
701  dstlen -= 6;
702  }
703  }
704  break;
705  case ENCODING_UTF16BE: /* RFC 2781 */
706  {
707  Uint8 *p = (Uint8 *) dst;
708  if (ch > 0x10FFFF) {
709  ch = UNKNOWN_UNICODE;
710  }
711  if (ch < 0x10000) {
712  if (dstlen < 2) {
713  return SDL_ICONV_E2BIG;
714  }
715  p[0] = (Uint8) (ch >> 8);
716  p[1] = (Uint8) ch;
717  dst += 2;
718  dstlen -= 2;
719  } else {
720  Uint16 W1, W2;
721  if (dstlen < 4) {
722  return SDL_ICONV_E2BIG;
723  }
724  ch = ch - 0x10000;
725  W1 = 0xD800 | (Uint16) ((ch >> 10) & 0x3FF);
726  W2 = 0xDC00 | (Uint16) (ch & 0x3FF);
727  p[0] = (Uint8) (W1 >> 8);
728  p[1] = (Uint8) W1;
729  p[2] = (Uint8) (W2 >> 8);
730  p[3] = (Uint8) W2;
731  dst += 4;
732  dstlen -= 4;
733  }
734  }
735  break;
736  case ENCODING_UTF16LE: /* RFC 2781 */
737  {
738  Uint8 *p = (Uint8 *) dst;
739  if (ch > 0x10FFFF) {
740  ch = UNKNOWN_UNICODE;
741  }
742  if (ch < 0x10000) {
743  if (dstlen < 2) {
744  return SDL_ICONV_E2BIG;
745  }
746  p[1] = (Uint8) (ch >> 8);
747  p[0] = (Uint8) ch;
748  dst += 2;
749  dstlen -= 2;
750  } else {
751  Uint16 W1, W2;
752  if (dstlen < 4) {
753  return SDL_ICONV_E2BIG;
754  }
755  ch = ch - 0x10000;
756  W1 = 0xD800 | (Uint16) ((ch >> 10) & 0x3FF);
757  W2 = 0xDC00 | (Uint16) (ch & 0x3FF);
758  p[1] = (Uint8) (W1 >> 8);
759  p[0] = (Uint8) W1;
760  p[3] = (Uint8) (W2 >> 8);
761  p[2] = (Uint8) W2;
762  dst += 4;
763  dstlen -= 4;
764  }
765  }
766  break;
767  case ENCODING_UCS2BE:
768  {
769  Uint8 *p = (Uint8 *) dst;
770  if (ch > 0xFFFF) {
771  ch = UNKNOWN_UNICODE;
772  }
773  if (dstlen < 2) {
774  return SDL_ICONV_E2BIG;
775  }
776  p[0] = (Uint8) (ch >> 8);
777  p[1] = (Uint8) ch;
778  dst += 2;
779  dstlen -= 2;
780  }
781  break;
782  case ENCODING_UCS2LE:
783  {
784  Uint8 *p = (Uint8 *) dst;
785  if (ch > 0xFFFF) {
786  ch = UNKNOWN_UNICODE;
787  }
788  if (dstlen < 2) {
789  return SDL_ICONV_E2BIG;
790  }
791  p[1] = (Uint8) (ch >> 8);
792  p[0] = (Uint8) ch;
793  dst += 2;
794  dstlen -= 2;
795  }
796  break;
797  case ENCODING_UTF32BE:
798  if (ch > 0x10FFFF) {
799  ch = UNKNOWN_UNICODE;
800  }
801  /* fallthrough */
802  case ENCODING_UCS4BE:
803  if (ch > 0x7FFFFFFF) {
804  ch = UNKNOWN_UNICODE;
805  }
806  {
807  Uint8 *p = (Uint8 *) dst;
808  if (dstlen < 4) {
809  return SDL_ICONV_E2BIG;
810  }
811  p[0] = (Uint8) (ch >> 24);
812  p[1] = (Uint8) (ch >> 16);
813  p[2] = (Uint8) (ch >> 8);
814  p[3] = (Uint8) ch;
815  dst += 4;
816  dstlen -= 4;
817  }
818  break;
819  case ENCODING_UTF32LE:
820  if (ch > 0x10FFFF) {
821  ch = UNKNOWN_UNICODE;
822  }
823  /* fallthrough */
824  case ENCODING_UCS4LE:
825  if (ch > 0x7FFFFFFF) {
826  ch = UNKNOWN_UNICODE;
827  }
828  {
829  Uint8 *p = (Uint8 *) dst;
830  if (dstlen < 4) {
831  return SDL_ICONV_E2BIG;
832  }
833  p[3] = (Uint8) (ch >> 24);
834  p[2] = (Uint8) (ch >> 16);
835  p[1] = (Uint8) (ch >> 8);
836  p[0] = (Uint8) ch;
837  dst += 4;
838  dstlen -= 4;
839  }
840  break;
841  }
842 
843  /* Update state */
844  *inbuf = src;
845  *inbytesleft = srclen;
846  *outbuf = dst;
847  *outbytesleft = dstlen;
848  ++total;
849  }
850  return total;
851 }
GLenum GLenum dst
#define UNKNOWN_UNICODE
Definition: SDL_iconv.c:98
GLfloat GLfloat p
uint8_t Uint8
Definition: SDL_stdinc.h:179
GLenum src
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define UNICODE_BOM
Definition: SDL_iconv.c:95
#define SDL_ICONV_E2BIG
Definition: SDL_stdinc.h:542
#define ENCODING_UTF32NATIVE
Definition: SDL_iconv.c:119
#define SDL_ICONV_EINVAL
Definition: SDL_stdinc.h:544
SDL_bool
Definition: SDL_stdinc.h:161
#define UNKNOWN_ASCII
Definition: SDL_iconv.c:97
GLdouble n
uint16_t Uint16
Definition: SDL_stdinc.h:191
#define ENCODING_UTF16NATIVE
Definition: SDL_iconv.c:118
GLint left

◆ SDL_iconv_close()

int SDL_iconv_close ( SDL_iconv_t  cd)

Definition at line 854 of file SDL_iconv.c.

References SDL_free.

Referenced by SDL_iconv_string().

855 {
856  if (cd != (SDL_iconv_t)-1) {
857  SDL_free(cd);
858  }
859  return 0;
860 }
#define SDL_free

◆ SDL_iconv_open()

SDL_iconv_t SDL_iconv_open ( const char *  tocode,
const char *  fromcode 
)

Definition at line 208 of file SDL_iconv.c.

References SDL_iconv_t::dst_fmt, ENCODING_UNKNOWN, encodings, getlocale(), i, SDL_arraysize, SDL_malloc, SDL_strcasecmp, and SDL_iconv_t::src_fmt.

Referenced by SDL_iconv_string().

209 {
210  int src_fmt = ENCODING_UNKNOWN;
211  int dst_fmt = ENCODING_UNKNOWN;
212  int i;
213  char fromcode_buffer[64];
214  char tocode_buffer[64];
215 
216  if (!fromcode || !*fromcode) {
217  fromcode = getlocale(fromcode_buffer, sizeof(fromcode_buffer));
218  }
219  if (!tocode || !*tocode) {
220  tocode = getlocale(tocode_buffer, sizeof(tocode_buffer));
221  }
222  for (i = 0; i < SDL_arraysize(encodings); ++i) {
223  if (SDL_strcasecmp(fromcode, encodings[i].name) == 0) {
224  src_fmt = encodings[i].format;
225  if (dst_fmt != ENCODING_UNKNOWN) {
226  break;
227  }
228  }
229  if (SDL_strcasecmp(tocode, encodings[i].name) == 0) {
230  dst_fmt = encodings[i].format;
231  if (src_fmt != ENCODING_UNKNOWN) {
232  break;
233  }
234  }
235  }
236  if (src_fmt != ENCODING_UNKNOWN && dst_fmt != ENCODING_UNKNOWN) {
237  SDL_iconv_t cd = (SDL_iconv_t) SDL_malloc(sizeof(*cd));
238  if (cd) {
239  cd->src_fmt = src_fmt;
240  cd->dst_fmt = dst_fmt;
241  return cd;
242  }
243  }
244  return (SDL_iconv_t) - 1;
245 }
static struct @30 encodings[]
#define SDL_strcasecmp
GLuint const GLchar * name
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
#define SDL_malloc
static const char * getlocale(char *buffer, size_t bufsize)
Definition: SDL_iconv.c:173

◆ SDL_iconv_string()

char* SDL_iconv_string ( const char *  tocode,
const char *  fromcode,
const char *  inbuf,
size_t  inbytesleft 
)

This function converts a string between encodings in one pass, returning a string that must be freed with SDL_free() or NULL on error.

Definition at line 865 of file SDL_iconv.c.

References NULL, SDL_iconv(), SDL_iconv_close(), SDL_ICONV_E2BIG, SDL_ICONV_EILSEQ, SDL_ICONV_EINVAL, SDL_ICONV_ERROR, SDL_iconv_open(), SDL_malloc, SDL_memset, and SDL_realloc.

867 {
868  SDL_iconv_t cd;
869  char *string;
870  size_t stringsize;
871  char *outbuf;
872  size_t outbytesleft;
873  size_t retCode = 0;
874 
875  cd = SDL_iconv_open(tocode, fromcode);
876  if (cd == (SDL_iconv_t) - 1) {
877  /* See if we can recover here (fixes iconv on Solaris 11) */
878  if (!tocode || !*tocode) {
879  tocode = "UTF-8";
880  }
881  if (!fromcode || !*fromcode) {
882  fromcode = "UTF-8";
883  }
884  cd = SDL_iconv_open(tocode, fromcode);
885  }
886  if (cd == (SDL_iconv_t) - 1) {
887  return NULL;
888  }
889 
890  stringsize = inbytesleft > 4 ? inbytesleft : 4;
891  string = SDL_malloc(stringsize);
892  if (!string) {
893  SDL_iconv_close(cd);
894  return NULL;
895  }
896  outbuf = string;
897  outbytesleft = stringsize;
898  SDL_memset(outbuf, 0, 4);
899 
900  while (inbytesleft > 0) {
901  retCode = SDL_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
902  switch (retCode) {
903  case SDL_ICONV_E2BIG:
904  {
905  char *oldstring = string;
906  stringsize *= 2;
907  string = SDL_realloc(string, stringsize);
908  if (!string) {
909  SDL_iconv_close(cd);
910  return NULL;
911  }
912  outbuf = string + (outbuf - oldstring);
913  outbytesleft = stringsize - (outbuf - string);
914  SDL_memset(outbuf, 0, 4);
915  }
916  break;
917  case SDL_ICONV_EILSEQ:
918  /* Try skipping some input data - not perfect, but... */
919  ++inbuf;
920  --inbytesleft;
921  break;
922  case SDL_ICONV_EINVAL:
923  case SDL_ICONV_ERROR:
924  /* We can't continue... */
925  inbytesleft = 0;
926  break;
927  }
928  }
929  SDL_iconv_close(cd);
930 
931  return string;
932 }
int SDL_iconv_close(SDL_iconv_t cd)
Definition: SDL_iconv.c:854
GLsizei const GLchar *const * string
#define SDL_ICONV_EILSEQ
Definition: SDL_stdinc.h:543
SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
Definition: SDL_iconv.c:208
#define SDL_realloc
#define SDL_ICONV_E2BIG
Definition: SDL_stdinc.h:542
#define SDL_ICONV_EINVAL
Definition: SDL_stdinc.h:544
#define NULL
Definition: begin_code.h:164
#define SDL_ICONV_ERROR
Definition: SDL_stdinc.h:541
#define SDL_malloc
size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: SDL_iconv.c:248
#define SDL_memset

◆ SDL_isdigit()

int SDL_isdigit ( int  x)

Definition at line 444 of file SDL_stdlib.c.

Referenced by SDL_abs().

444 { return ((x) >= '0') && ((x) <= '9'); }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_isspace()

int SDL_isspace ( int  x)

Definition at line 445 of file SDL_stdlib.c.

Referenced by SDL_abs().

445 { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n') || ((x) == '\f') || ((x) == '\v'); }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_itoa()

char* SDL_itoa ( int  value,
char *  str,
int  radix 
)

Definition at line 702 of file SDL_string.c.

References SDL_ltoa().

Referenced by SDL_memset4().

703 {
704 #ifdef HAVE_ITOA
705  return itoa(value, string, radix);
706 #else
707  return SDL_ltoa((long)value, string, radix);
708 #endif /* HAVE_ITOA */
709 }
GLsizei const GLfloat * value
char * SDL_ltoa(long value, char *string, int radix)
Definition: SDL_string.c:722

◆ SDL_lltoa()

char* SDL_lltoa ( Sint64  value,
char *  str,
int  radix 
)

Definition at line 766 of file SDL_string.c.

References SDL_ulltoa().

Referenced by SDL_memset4(), and SDL_PrintLongLong().

767 {
768 #if defined(HAVE__I64TOA)
769  return _i64toa(value, string, radix);
770 #else
771  char *bufp = string;
772 
773  if (value < 0) {
774  *bufp++ = '-';
775  SDL_ulltoa(-value, bufp, radix);
776  } else {
777  SDL_ulltoa(value, bufp, radix);
778  }
779 
780  return string;
781 #endif /* HAVE__I64TOA */
782 }
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
char * SDL_ulltoa(Uint64 value, char *string, int radix)
Definition: SDL_string.c:785

◆ SDL_log()

double SDL_log ( double  x)

Definition at line 284 of file SDL_stdlib.c.

References SDL_uclibc_log().

Referenced by SDL_logf(), and SDL_memset4().

285 {
286 #if defined(HAVE_LOG)
287  return log(x);
288 #else
289  return SDL_uclibc_log(x);
290 #endif
291 }
double SDL_uclibc_log(double x)
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_log10()

double SDL_log10 ( double  x)

Definition at line 304 of file SDL_stdlib.c.

References SDL_uclibc_log10().

Referenced by SDL_log10f(), and SDL_memset4().

305 {
306 #if defined(HAVE_LOG10)
307  return log10(x);
308 #else
309  return SDL_uclibc_log10(x);
310 #endif
311 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_log10(double x)

◆ SDL_log10f()

float SDL_log10f ( float  x)

Definition at line 314 of file SDL_stdlib.c.

References SDL_log10().

Referenced by SDL_memset4().

315 {
316 #if defined(HAVE_LOG10F)
317  return log10f(x);
318 #else
319  return (float)SDL_log10((double)x);
320 #endif
321 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_log10(double x)
Definition: SDL_stdlib.c:304

◆ SDL_logf()

float SDL_logf ( float  x)

Definition at line 294 of file SDL_stdlib.c.

References SDL_log().

Referenced by SDL_memset4().

295 {
296 #if defined(HAVE_LOGF)
297  return logf(x);
298 #else
299  return (float)SDL_log((double)x);
300 #endif
301 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_log(double x)
Definition: SDL_stdlib.c:284

◆ SDL_ltoa()

char* SDL_ltoa ( long  value,
char *  str,
int  radix 
)

Definition at line 722 of file SDL_string.c.

References SDL_ultoa().

Referenced by SDL_itoa(), SDL_memset4(), and SDL_PrintLong().

723 {
724 #if defined(HAVE__LTOA)
725  return _ltoa(value, string, radix);
726 #else
727  char *bufp = string;
728 
729  if (value < 0) {
730  *bufp++ = '-';
731  SDL_ultoa(-value, bufp, radix);
732  } else {
733  SDL_ultoa(value, bufp, radix);
734  }
735 
736  return string;
737 #endif /* HAVE__LTOA */
738 }
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
char * SDL_ultoa(unsigned long value, char *string, int radix)
Definition: SDL_string.c:741

◆ SDL_malloc()

void* SDL_malloc ( size_t  size)

Definition at line 5320 of file SDL_malloc.c.

References s_mem, and SDL_AtomicIncRef.

5321 {
5322  void *mem;
5323 
5324  if (!size) {
5325  size = 1;
5326  }
5327 
5328  mem = s_mem.malloc_func(size);
5329  if (mem) {
5330  SDL_AtomicIncRef(&s_mem.num_allocations);
5331  }
5332  return mem;
5333 }
static struct @31 s_mem
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
Definition: SDL_atomic.h:234
GLsizeiptr size

◆ SDL_memcmp()

int SDL_memcmp ( const void s1,
const void s2,
size_t  len 
)

Definition at line 392 of file SDL_string.c.

Referenced by SDL_memset4().

393 {
394 #if defined(HAVE_MEMCMP)
395  return memcmp(s1, s2, len);
396 #else
397  char *s1p = (char *) s1;
398  char *s2p = (char *) s2;
399  while (len--) {
400  if (*s1p != *s2p) {
401  return (*s1p - *s2p);
402  }
403  ++s1p;
404  ++s2p;
405  }
406  return 0;
407 #endif /* HAVE_MEMCMP */
408 }
GLenum GLsizei len
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1

◆ SDL_memcpy()

void* SDL_memcpy ( SDL_OUT_BYTECAP(len) void dst,
SDL_IN_BYTECAP(len) const void src,
size_t  len 
)

Definition at line 315 of file SDL_string.c.

References memcpy.

Referenced by SDL_memcpy4(), SDL_memset4(), SDL_strdup(), SDL_strlcpy(), SDL_utf8strlcpy(), SDL_wcsdup(), and SDL_wcslcpy().

316 {
317 #ifdef __GNUC__
318  /* Presumably this is well tuned for speed.
319  On my machine this is twice as fast as the C code below.
320  */
321  return __builtin_memcpy(dst, src, len);
322 #elif defined(HAVE_MEMCPY)
323  return memcpy(dst, src, len);
324 #elif defined(HAVE_BCOPY)
325  bcopy(src, dst, len);
326  return dst;
327 #else
328  /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop
329  using Uint32* pointers, so we need to make sure the pointers are
330  aligned before we loop using them.
331  */
332  if (((intptr_t)src & 0x3) || ((intptr_t)dst & 0x3)) {
333  /* Do an unaligned byte copy */
334  Uint8 *srcp1 = (Uint8 *)src;
335  Uint8 *dstp1 = (Uint8 *)dst;
336 
337  while (len--) {
338  *dstp1++ = *srcp1++;
339  }
340  } else {
341  size_t left = (len % 4);
342  Uint32 *srcp4, *dstp4;
343  Uint8 *srcp1, *dstp1;
344 
345  srcp4 = (Uint32 *) src;
346  dstp4 = (Uint32 *) dst;
347  len /= 4;
348  while (len--) {
349  *dstp4++ = *srcp4++;
350  }
351 
352  srcp1 = (Uint8 *) srcp4;
353  dstp1 = (Uint8 *) dstp4;
354  switch (left) {
355  case 3:
356  *dstp1++ = *srcp1++;
357  case 2:
358  *dstp1++ = *srcp1++;
359  case 1:
360  *dstp1++ = *srcp1++;
361  }
362  }
363  return dst;
364 #endif /* __GNUC__ */
365 }
GLenum GLenum dst
uint8_t Uint8
Definition: SDL_stdinc.h:179
GLenum src
uint32_t Uint32
Definition: SDL_stdinc.h:203
GLenum GLsizei len
#define memcpy
Definition: SDL_malloc.c:622
GLint left

◆ SDL_memcpy4()

SDL_FORCE_INLINE void* SDL_memcpy4 ( SDL_OUT_BYTECAP(dwords *4) void dst,
SDL_IN_BYTECAP(dwords *4) const void src,
size_t  dwords 
)

Definition at line 594 of file SDL_stdinc.h.

References SDL_memcpy().

595 {
596  return SDL_memcpy(dst, src, dwords * 4);
597 }
GLenum GLenum dst
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315
GLenum src

◆ SDL_memmove()

void* SDL_memmove ( SDL_OUT_BYTECAP(len) void dst,
SDL_IN_BYTECAP(len) const void src,
size_t  len 
)

Definition at line 368 of file SDL_string.c.

References memmove.

Referenced by SDL_IntPrecisionAdjust(), and SDL_memset4().

369 {
370 #if defined(HAVE_MEMMOVE)
371  return memmove(dst, src, len);
372 #else
373  char *srcp = (char *) src;
374  char *dstp = (char *) dst;
375 
376  if (src < dst) {
377  srcp += len - 1;
378  dstp += len - 1;
379  while (len--) {
380  *dstp-- = *srcp--;
381  }
382  } else {
383  while (len--) {
384  *dstp++ = *srcp++;
385  }
386  }
387  return dst;
388 #endif /* HAVE_MEMMOVE */
389 }
GLenum GLenum dst
#define memmove
Definition: SDL_qsort.c:59
GLenum src
GLenum GLsizei len

◆ SDL_memset()

void* SDL_memset ( SDL_OUT_BYTECAP(len) void dst,
int  c,
size_t  len 
)

Definition at line 266 of file SDL_string.c.

References memset.

Referenced by SDL_IntPrecisionAdjust().

267 {
268 #if defined(HAVE_MEMSET)
269  return memset(dst, c, len);
270 #else
271  size_t left;
272  Uint32 *dstp4;
273  Uint8 *dstp1 = (Uint8 *) dst;
274  Uint8 value1;
275  Uint32 value4;
276 
277  /* The value used in memset() is a byte, passed as an int */
278  c &= 0xff;
279 
280  /* The destination pointer needs to be aligned on a 4-byte boundary to
281  * execute a 32-bit set. Set first bytes manually if needed until it is
282  * aligned. */
283  value1 = (Uint8)c;
284  while ((intptr_t)dstp1 & 0x3) {
285  if (len--) {
286  *dstp1++ = value1;
287  } else {
288  return dst;
289  }
290  }
291 
292  value4 = (c | (c << 8) | (c << 16) | (c << 24));
293  dstp4 = (Uint32 *) dstp1;
294  left = (len % 4);
295  len /= 4;
296  while (len--) {
297  *dstp4++ = value4;
298  }
299 
300  dstp1 = (Uint8 *) dstp4;
301  switch (left) {
302  case 3:
303  *dstp1++ = value1;
304  case 2:
305  *dstp1++ = value1;
306  case 1:
307  *dstp1++ = value1;
308  }
309 
310  return dst;
311 #endif /* HAVE_MEMSET */
312 }
GLenum GLenum dst
uint8_t Uint8
Definition: SDL_stdinc.h:179
#define memset
Definition: SDL_malloc.c:619
uint32_t Uint32
Definition: SDL_stdinc.h:203
GLenum GLsizei len
const GLubyte * c
GLint left

◆ SDL_memset4()

SDL_FORCE_INLINE void SDL_memset4 ( void dst,
Uint32  val,
size_t  dwords 
)

Definition at line 420 of file SDL_stdinc.h.

References DECLSPEC, SDL_acos(), SDL_acosf(), SDL_asin(), SDL_asinf(), SDL_atan(), SDL_atan2(), SDL_atan2f(), SDL_atanf(), SDL_atof(), SDL_atoi(), SDL_ceil(), SDL_ceilf(), SDL_copysign(), SDL_copysignf(), SDL_cos(), SDL_cosf(), SDL_exp(), SDL_expf(), SDL_fabs(), SDL_fabsf(), SDL_floor(), SDL_floorf(), SDL_fmod(), SDL_fmodf(), SDL_IN_BYTECAP, SDL_INOUT_Z_CAP, SDL_itoa(), SDL_lltoa(), SDL_log(), SDL_log10(), SDL_log10f(), SDL_logf(), SDL_ltoa(), SDL_memcmp(), SDL_memcpy(), SDL_memmove(), SDL_OUT_BYTECAP, SDL_OUT_Z_CAP, SDL_pow(), SDL_powf(), SDL_PRINTF_FORMAT_STRING, SDL_PRINTF_VARARG_FUNC, SDL_scalbn(), SDL_scalbnf(), SDL_SCANF_FORMAT_STRING, SDL_SCANF_VARARG_FUNC, SDL_sin(), SDL_sinf(), SDL_snprintf(), SDL_sqrt(), SDL_sqrtf(), SDL_sscanf(), SDL_static_cast, SDL_strcasecmp(), SDL_strchr(), SDL_strcmp(), SDL_strdup(), SDL_strlcat(), SDL_strlcpy(), SDL_strlen(), SDL_strlwr(), SDL_strncasecmp(), SDL_strncmp(), SDL_strrchr(), SDL_strrev(), SDL_strstr(), SDL_strtod(), SDL_strtol(), SDL_strtoll(), SDL_strtoul(), SDL_strtoull(), SDL_strupr(), SDL_tan(), SDL_tanf(), SDL_uitoa(), SDL_ulltoa(), SDL_ultoa(), SDL_utf8strlcpy(), SDL_utf8strlen(), SDL_vsnprintf(), SDL_vsscanf(), SDL_wcscmp(), SDL_wcsdup(), SDL_wcslcat(), SDL_wcslcpy(), SDL_wcslen(), SDLCALL, and text.

Referenced by SDL_FillRect1(), SDL_FillRect2(), and SDL_FillRect4().

421 {
422 #if defined(__GNUC__) && defined(i386)
423  int u0, u1, u2;
424  __asm__ __volatile__ (
425  "cld \n\t"
426  "rep ; stosl \n\t"
427  : "=&D" (u0), "=&a" (u1), "=&c" (u2)
428  : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
429  : "memory"
430  );
431 #else
432  size_t _n = (dwords + 3) / 4;
433  Uint32 *_p = SDL_static_cast(Uint32 *, dst);
434  Uint32 _val = (val);
435  if (dwords == 0)
436  return;
437  switch (dwords % 4)
438  {
439  case 0: do { *_p++ = _val; /* fallthrough */
440  case 3: *_p++ = _val; /* fallthrough */
441  case 2: *_p++ = _val; /* fallthrough */
442  case 1: *_p++ = _val; /* fallthrough */
443  } while ( --_n );
444  }
445 #endif
446 }
GLenum GLenum dst
GLfixed u1
uint32_t Uint32
Definition: SDL_stdinc.h:203
GLfixed GLfixed u2
GLuint GLfloat * val
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:138

◆ SDL_pow()

double SDL_pow ( double  x,
double  y 
)

Definition at line 324 of file SDL_stdlib.c.

References SDL_uclibc_pow().

Referenced by SDL_memset4(), and SDL_powf().

325 {
326 #if defined(HAVE_POW)
327  return pow(x, y);
328 #else
329  return SDL_uclibc_pow(x, y);
330 #endif
331 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_pow(double x, double y)
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574

◆ SDL_powf()

float SDL_powf ( float  x,
float  y 
)

Definition at line 334 of file SDL_stdlib.c.

References SDL_pow().

Referenced by SDL_memset4().

335 {
336 #if defined(HAVE_POWF)
337  return powf(x, y);
338 #else
339  return (float)SDL_pow((double)x, (double)y);
340 #endif
341 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
double SDL_pow(double x, double y)
Definition: SDL_stdlib.c:324

◆ SDL_qsort()

void SDL_qsort ( void base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *)  compare 
)

◆ SDL_realloc()

void* SDL_realloc ( void mem,
size_t  size 
)

Definition at line 5351 of file SDL_malloc.c.

References s_mem, and SDL_AtomicIncRef.

5352 {
5353  void *mem;
5354 
5355  if (!ptr && !size) {
5356  size = 1;
5357  }
5358 
5359  mem = s_mem.realloc_func(ptr, size);
5360  if (mem && !ptr) {
5361  SDL_AtomicIncRef(&s_mem.num_allocations);
5362  }
5363  return mem;
5364 }
static struct @31 s_mem
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
Definition: SDL_atomic.h:234
GLsizeiptr size

◆ SDL_scalbn()

double SDL_scalbn ( double  x,
int  n 
)

Definition at line 344 of file SDL_stdlib.c.

References scalbn, and SDL_uclibc_scalbn().

Referenced by SDL_memset4(), and SDL_scalbnf().

345 {
346 #if defined(HAVE_SCALBN)
347  return scalbn(x, n);
348 #elif defined(HAVE__SCALB)
349  return _scalb(x, n);
350 #elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2)
351 /* from scalbn(3): If FLT_RADIX equals 2 (which is
352  * usual), then scalbn() is equivalent to ldexp(3). */
353  return ldexp(x, n);
354 #else
355  return SDL_uclibc_scalbn(x, n);
356 #endif
357 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
#define scalbn
Definition: math_private.h:46
GLdouble n
double SDL_uclibc_scalbn(double x, int n)

◆ SDL_scalbnf()

float SDL_scalbnf ( float  x,
int  n 
)

Definition at line 360 of file SDL_stdlib.c.

References SDL_scalbn().

Referenced by SDL_memset4().

361 {
362 #if defined(HAVE_SCALBNF)
363  return scalbnf(x, n);
364 #else
365  return (float)SDL_scalbn((double)x, n);
366 #endif
367 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_scalbn(double x, int n)
Definition: SDL_stdlib.c:344
GLdouble n

◆ SDL_setenv()

int SDL_setenv ( const char *  name,
const char *  value,
int  overwrite 
)

Definition at line 110 of file SDL_getenv.c.

References Android_JNI_GetManifestEnvironmentVariables(), i, NULL, SDL_free, SDL_getenv(), SDL_malloc, SDL_realloc, SDL_snprintf, SDL_strchr, SDL_strlen, and SDL_strncmp.

Referenced by SDL_getenv().

111 {
112  int added;
113  int len, i;
114  char **new_env;
115  char *new_variable;
116 
117  /* Input validation */
118  if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
119  return (-1);
120  }
121 
122  /* See if it already exists */
123  if (!overwrite && SDL_getenv(name)) {
124  return 0;
125  }
126 
127  /* Allocate memory for the variable */
128  len = SDL_strlen(name) + SDL_strlen(value) + 2;
129  new_variable = (char *) SDL_malloc(len);
130  if (!new_variable) {
131  return (-1);
132  }
133 
134  SDL_snprintf(new_variable, len, "%s=%s", name, value);
135  value = new_variable + SDL_strlen(name) + 1;
136  name = new_variable;
137 
138  /* Actually put it into the environment */
139  added = 0;
140  i = 0;
141  if (SDL_env) {
142  /* Check to see if it's already there... */
143  len = (value - name);
144  for (; SDL_env[i]; ++i) {
145  if (SDL_strncmp(SDL_env[i], name, len) == 0) {
146  break;
147  }
148  }
149  /* If we found it, just replace the entry */
150  if (SDL_env[i]) {
151  SDL_free(SDL_env[i]);
152  SDL_env[i] = new_variable;
153  added = 1;
154  }
155  }
156 
157  /* Didn't find it in the environment, expand and add */
158  if (!added) {
159  new_env = SDL_realloc(SDL_env, (i + 2) * sizeof(char *));
160  if (new_env) {
161  SDL_env = new_env;
162  SDL_env[i++] = new_variable;
163  SDL_env[i++] = (char *) 0;
164  added = 1;
165  } else {
166  SDL_free(new_variable);
167  }
168  }
169  return (added ? 0 : -1);
170 }
char * SDL_getenv(const char *name)
Definition: SDL_getenv.c:219
#define SDL_realloc
#define SDL_strncmp
static char ** SDL_env
Definition: SDL_getenv.c:108
GLenum GLsizei len
GLuint const GLchar * name
#define SDL_strchr
#define SDL_free
GLsizei const GLfloat * value
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define NULL
Definition: begin_code.h:164
#define SDL_strlen
#define SDL_snprintf
#define SDL_malloc

◆ SDL_SetMemoryFunctions()

int SDL_SetMemoryFunctions ( SDL_malloc_func  malloc_func,
SDL_calloc_func  calloc_func,
SDL_realloc_func  realloc_func,
SDL_free_func  free_func 
)

Replace SDL's memory allocation functions with a custom set.

Note
If you are replacing SDL's memory functions, you should call SDL_GetNumAllocations() and be very careful if it returns non-zero. That means that your free function will be called with memory allocated by the previous memory allocation functions.

Definition at line 5290 of file SDL_malloc.c.

References calloc_func, free_func, malloc_func, realloc_func, s_mem, and SDL_InvalidParamError.

5294 {
5295  if (!malloc_func) {
5296  return SDL_InvalidParamError("malloc_func");
5297  }
5298  if (!calloc_func) {
5299  return SDL_InvalidParamError("calloc_func");
5300  }
5301  if (!realloc_func) {
5302  return SDL_InvalidParamError("realloc_func");
5303  }
5304  if (!free_func) {
5305  return SDL_InvalidParamError("free_func");
5306  }
5307 
5308  s_mem.malloc_func = malloc_func;
5309  s_mem.calloc_func = calloc_func;
5310  s_mem.realloc_func = realloc_func;
5311  s_mem.free_func = free_func;
5312  return 0;
5313 }
static struct @31 s_mem
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_realloc_func realloc_func
Definition: SDL_malloc.c:5264
SDL_malloc_func malloc_func
Definition: SDL_malloc.c:5262
SDL_free_func free_func
Definition: SDL_malloc.c:5265
SDL_calloc_func calloc_func
Definition: SDL_malloc.c:5263

◆ SDL_sin()

double SDL_sin ( double  x)

Definition at line 370 of file SDL_stdlib.c.

References SDL_uclibc_sin(), and sin().

Referenced by SDL_memset4(), and SDL_sinf().

371 {
372 #if defined(HAVE_SIN)
373  return sin(x);
374 #else
375  return SDL_uclibc_sin(x);
376 #endif
377 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_sin(double x)
double sin(double x)
Definition: s_sin.c:46

◆ SDL_sinf()

float SDL_sinf ( float  x)

Definition at line 380 of file SDL_stdlib.c.

References SDL_sin().

Referenced by SDL_memset4().

381 {
382 #if defined(HAVE_SINF)
383  return sinf(x);
384 #else
385  return (float)SDL_sin((double)x);
386 #endif
387 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_sin(double x)
Definition: SDL_stdlib.c:370

◆ SDL_snprintf()

int SDL_snprintf ( SDL_OUT_Z_CAP(maxlen) char *  text,
size_t  maxlen,
SDL_PRINTF_FORMAT_STRING const char *  fmt,
  ... 
)

Definition at line 1326 of file SDL_string.c.

References retval, SDL_OUT_Z_CAP, and SDL_vsnprintf().

Referenced by SDL_memset4().

1327 {
1328  va_list ap;
1329  int retval;
1330 
1331  va_start(ap, fmt);
1332  retval = SDL_vsnprintf(text, maxlen, fmt, ap);
1333  va_end(ap);
1334 
1335  return retval;
1336 }
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
Definition: SDL_string.c:1610
SDL_bool retval
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47

◆ SDL_sqrt()

double SDL_sqrt ( double  x)

Definition at line 390 of file SDL_stdlib.c.

References SDL_uclibc_sqrt().

Referenced by SDL_acos(), SDL_memset4(), and SDL_sqrtf().

391 {
392 #if defined(HAVE_SQRT)
393  return sqrt(x);
394 #else
395  return SDL_uclibc_sqrt(x);
396 #endif
397 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_sqrt(double x)

◆ SDL_sqrtf()

float SDL_sqrtf ( float  x)

Definition at line 400 of file SDL_stdlib.c.

References SDL_sqrt().

Referenced by SDL_memset4().

401 {
402 #if defined(HAVE_SQRTF)
403  return sqrtf(x);
404 #else
405  return (float)SDL_sqrt((double)x);
406 #endif
407 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:390

◆ SDL_sscanf()

int SDL_sscanf ( const char *  text,
SDL_SCANF_FORMAT_STRING const char *  fmt,
  ... 
)

Definition at line 1034 of file SDL_string.c.

References SDL_vsscanf(), and text.

Referenced by SDL_memset4().

1035 {
1036  int rc;
1037  va_list ap;
1038  va_start(ap, fmt);
1039  rc = SDL_vsscanf(text, fmt, ap);
1040  va_end(ap);
1041  return rc;
1042 }
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
Definition: SDL_string.c:1052

◆ SDL_strcasecmp()

int SDL_strcasecmp ( const char *  str1,
const char *  str2 
)

Definition at line 981 of file SDL_string.c.

References SDL_toupper.

Referenced by SDL_memset4().

982 {
983 #ifdef HAVE_STRCASECMP
984  return strcasecmp(str1, str2);
985 #elif defined(HAVE__STRICMP)
986  return _stricmp(str1, str2);
987 #else
988  char a = 0;
989  char b = 0;
990  while (*str1 && *str2) {
991  a = SDL_toupper((unsigned char) *str1);
992  b = SDL_toupper((unsigned char) *str2);
993  if (a != b)
994  break;
995  ++str1;
996  ++str2;
997  }
998  a = SDL_toupper(*str1);
999  b = SDL_toupper(*str2);
1000  return (int) ((unsigned char) a - (unsigned char) b);
1001 #endif /* HAVE_STRCASECMP */
1002 }
#define SDL_toupper
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ SDL_strchr()

char* SDL_strchr ( const char *  str,
int  c 
)

Definition at line 638 of file SDL_string.c.

References NULL, and SDL_const_cast.

Referenced by SDL_memset4().

639 {
640 #ifdef HAVE_STRCHR
641  return SDL_const_cast(char*,strchr(string, c));
642 #elif defined(HAVE_INDEX)
643  return SDL_const_cast(char*,index(string, c));
644 #else
645  while (*string) {
646  if (*string == c) {
647  return (char *) string;
648  }
649  ++string;
650  }
651  return NULL;
652 #endif /* HAVE_STRCHR */
653 }
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:139
GLsizei const GLchar *const * string
const GLubyte * c
GLuint index
#define NULL
Definition: begin_code.h:164

◆ SDL_strcmp()

int SDL_strcmp ( const char *  str1,
const char *  str2 
)

Definition at line 945 of file SDL_string.c.

Referenced by SDL_memset4().

946 {
947 #if defined(HAVE_STRCMP)
948  return strcmp(str1, str2);
949 #else
950  while (*str1 && *str2) {
951  if (*str1 != *str2)
952  break;
953  ++str1;
954  ++str2;
955  }
956  return (int)((unsigned char) *str1 - (unsigned char) *str2);
957 #endif /* HAVE_STRCMP */
958 }

◆ SDL_strdup()

char* SDL_strdup ( const char *  str)

Definition at line 578 of file SDL_string.c.

References SDL_malloc, SDL_memcpy(), and SDL_strlen().

Referenced by SDL_memset4().

579 {
580  size_t len = SDL_strlen(string) + 1;
581  char *newstr = (char *)SDL_malloc(len);
582  if (newstr) {
583  SDL_memcpy(newstr, string, len);
584  }
585  return newstr;
586 }
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315
#define SDL_malloc

◆ SDL_strlcat()

size_t SDL_strlcat ( SDL_INOUT_Z_CAP(maxlen) char *  dst,
const char *  src,
size_t  maxlen 
)

Definition at line 563 of file SDL_string.c.

References SDL_strlcpy(), and SDL_strlen().

Referenced by SDL_memset4().

564 {
565 #if defined(HAVE_STRLCAT)
566  return strlcat(dst, src, maxlen);
567 #else
568  size_t dstlen = SDL_strlen(dst);
569  size_t srclen = SDL_strlen(src);
570  if (dstlen < maxlen) {
571  SDL_strlcpy(dst + dstlen, src, maxlen - dstlen);
572  }
573  return dstlen + srclen;
574 #endif /* HAVE_STRLCAT */
575 }
GLenum GLenum dst
size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:497
GLenum src
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411

◆ SDL_strlcpy()

size_t SDL_strlcpy ( SDL_OUT_Z_CAP(maxlen) char *  dst,
const char *  src,
size_t  maxlen 
)

Definition at line 497 of file SDL_string.c.

References SDL_memcpy(), SDL_min, and SDL_strlen().

Referenced by SDL_memset4(), SDL_PrintString(), and SDL_strlcat().

498 {
499 #if defined(HAVE_STRLCPY)
500  return strlcpy(dst, src, maxlen);
501 #else
502  size_t srclen = SDL_strlen(src);
503  if (maxlen > 0) {
504  size_t len = SDL_min(srclen, maxlen - 1);
505  SDL_memcpy(dst, src, len);
506  dst[len] = '\0';
507  }
508  return srclen;
509 #endif /* HAVE_STRLCPY */
510 }
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
GLenum GLenum dst
GLenum src
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315

◆ SDL_strlen()

size_t SDL_strlen ( const char *  str)

Definition at line 411 of file SDL_string.c.

Referenced by SDL_IntPrecisionAdjust(), SDL_memset4(), SDL_PrintString(), SDL_strdup(), SDL_strlcat(), SDL_strlcpy(), SDL_strrchr(), SDL_strrev(), SDL_strstr(), SDL_strtol(), SDL_strtoll(), SDL_strtoul(), SDL_strtoull(), and SDL_utf8strlcpy().

412 {
413 #if defined(HAVE_STRLEN)
414  return strlen(string);
415 #else
416  size_t len = 0;
417  while (*string++) {
418  ++len;
419  }
420  return len;
421 #endif /* HAVE_STRLEN */
422 }
GLenum GLsizei len

◆ SDL_strlwr()

char* SDL_strlwr ( char *  str)

Definition at line 623 of file SDL_string.c.

References SDL_tolower.

Referenced by SDL_memset4(), and SDL_PrintString().

624 {
625 #if defined(HAVE__STRLWR)
626  return _strlwr(string);
627 #else
628  char *bufp = string;
629  while (*bufp) {
630  *bufp = SDL_tolower((unsigned char) *bufp);
631  ++bufp;
632  }
633  return string;
634 #endif /* HAVE__STRLWR */
635 }
GLsizei const GLchar *const * string
#define SDL_tolower

◆ SDL_strncasecmp()

int SDL_strncasecmp ( const char *  str1,
const char *  str2,
size_t  len 
)

Definition at line 1005 of file SDL_string.c.

References SDL_tolower.

Referenced by SDL_memset4().

1006 {
1007 #ifdef HAVE_STRNCASECMP
1008  return strncasecmp(str1, str2, maxlen);
1009 #elif defined(HAVE__STRNICMP)
1010  return _strnicmp(str1, str2, maxlen);
1011 #else
1012  char a = 0;
1013  char b = 0;
1014  while (*str1 && *str2 && maxlen) {
1015  a = SDL_tolower((unsigned char) *str1);
1016  b = SDL_tolower((unsigned char) *str2);
1017  if (a != b)
1018  break;
1019  ++str1;
1020  ++str2;
1021  --maxlen;
1022  }
1023  if (maxlen == 0) {
1024  return 0;
1025  } else {
1026  a = SDL_tolower((unsigned char) *str1);
1027  b = SDL_tolower((unsigned char) *str2);
1028  return (int) ((unsigned char) a - (unsigned char) b);
1029  }
1030 #endif /* HAVE_STRNCASECMP */
1031 }
#define SDL_tolower
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ SDL_strncmp()

int SDL_strncmp ( const char *  str1,
const char *  str2,
size_t  maxlen 
)

Definition at line 961 of file SDL_string.c.

Referenced by SDL_memset4(), SDL_ScanLong(), SDL_ScanLongLong(), SDL_ScanUintPtrT(), SDL_ScanUnsignedLong(), SDL_ScanUnsignedLongLong(), SDL_strstr(), SDL_strtol(), SDL_strtoll(), SDL_strtoul(), SDL_strtoull(), SDL_vsnprintf(), and SDL_vsscanf().

962 {
963 #if defined(HAVE_STRNCMP)
964  return strncmp(str1, str2, maxlen);
965 #else
966  while (*str1 && *str2 && maxlen) {
967  if (*str1 != *str2)
968  break;
969  ++str1;
970  ++str2;
971  --maxlen;
972  }
973  if (!maxlen) {
974  return 0;
975  }
976  return (int) ((unsigned char) *str1 - (unsigned char) *str2);
977 #endif /* HAVE_STRNCMP */
978 }

◆ SDL_strrchr()

char* SDL_strrchr ( const char *  str,
int  c 
)

Definition at line 656 of file SDL_string.c.

References NULL, SDL_const_cast, and SDL_strlen().

Referenced by SDL_memset4().

657 {
658 #ifdef HAVE_STRRCHR
659  return SDL_const_cast(char*,strrchr(string, c));
660 #elif defined(HAVE_RINDEX)
661  return SDL_const_cast(char*,rindex(string, c));
662 #else
663  const char *bufp = string + SDL_strlen(string) - 1;
664  while (bufp >= string) {
665  if (*bufp == c) {
666  return (char *) bufp;
667  }
668  --bufp;
669  }
670  return NULL;
671 #endif /* HAVE_STRRCHR */
672 }
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:139
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
const GLubyte * c
#define NULL
Definition: begin_code.h:164

◆ SDL_strrev()

char* SDL_strrev ( char *  str)

Definition at line 589 of file SDL_string.c.

References SDL_strlen().

Referenced by SDL_memset4(), SDL_ulltoa(), and SDL_ultoa().

590 {
591 #if defined(HAVE__STRREV)
592  return _strrev(string);
593 #else
594  size_t len = SDL_strlen(string);
595  char *a = &string[0];
596  char *b = &string[len - 1];
597  len /= 2;
598  while (len--) {
599  char c = *a;
600  *a++ = *b;
601  *b-- = c;
602  }
603  return string;
604 #endif /* HAVE__STRREV */
605 }
GLsizei const GLchar *const * string
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
const GLubyte * c
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

◆ SDL_strstr()

char* SDL_strstr ( const char *  haystack,
const char *  needle 
)

Definition at line 675 of file SDL_string.c.

References NULL, SDL_const_cast, SDL_strlen(), and SDL_strncmp().

Referenced by SDL_memset4().

676 {
677 #if defined(HAVE_STRSTR)
678  return SDL_const_cast(char*,strstr(haystack, needle));
679 #else
680  size_t length = SDL_strlen(needle);
681  while (*haystack) {
682  if (SDL_strncmp(haystack, needle, length) == 0) {
683  return (char *) haystack;
684  }
685  ++haystack;
686  }
687  return NULL;
688 #endif /* HAVE_STRSTR */
689 }
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:139
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
#define NULL
Definition: begin_code.h:164
GLuint GLsizei GLsizei * length

◆ SDL_strtod()

double SDL_strtod ( const char *  str,
char **  endp 
)

Definition at line 928 of file SDL_string.c.

References SDL_ScanFloat().

Referenced by SDL_atof(), and SDL_memset4().

929 {
930 #if defined(HAVE_STRTOD)
931  return strtod(string, endp);
932 #else
933  size_t len;
934  double value = 0.0;
935 
936  len = SDL_ScanFloat(string, &value);
937  if (endp) {
938  *endp = (char *) string + len;
939  }
940  return value;
941 #endif /* HAVE_STRTOD */
942 }
static size_t SDL_ScanFloat(const char *text, double *valuep)
Definition: SDL_string.c:231
GLenum GLsizei len
GLsizei const GLfloat * value

◆ SDL_strtol()

long SDL_strtol ( const char *  str,
char **  endp,
int  base 
)

Definition at line 828 of file SDL_string.c.

References SDL_ScanLong(), SDL_strlen(), and SDL_strncmp().

Referenced by SDL_atoi(), SDL_memset4(), and SDL_vsnprintf().

829 {
830 #if defined(HAVE_STRTOL)
831  return strtol(string, endp, base);
832 #else
833  size_t len;
834  long value = 0;
835 
836  if (!base) {
837  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
838  base = 16;
839  } else {
840  base = 10;
841  }
842  }
843 
844  len = SDL_ScanLong(string, base, &value);
845  if (endp) {
846  *endp = (char *) string + len;
847  }
848  return value;
849 #endif /* HAVE_STRTOL */
850 }
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
Definition: SDL_string.c:53
GLsizei const GLfloat * value

◆ SDL_strtoll()

Sint64 SDL_strtoll ( const char *  str,
char **  endp,
int  base 
)

Definition at line 878 of file SDL_string.c.

References SDL_ScanLongLong(), SDL_strlen(), and SDL_strncmp().

Referenced by SDL_memset4().

879 {
880 #if defined(HAVE_STRTOLL)
881  return strtoll(string, endp, base);
882 #else
883  size_t len;
884  Sint64 value = 0;
885 
886  if (!base) {
887  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
888  base = 16;
889  } else {
890  base = 10;
891  }
892  }
893 
894  len = SDL_ScanLongLong(string, base, &value);
895  if (endp) {
896  *endp = (char *) string + len;
897  }
898  return value;
899 #endif /* HAVE_STRTOLL */
900 }
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
GLsizei const GLfloat * value
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
Definition: SDL_string.c:158
int64_t Sint64
Definition: SDL_stdinc.h:210

◆ SDL_strtoul()

unsigned long SDL_strtoul ( const char *  str,
char **  endp,
int  base 
)

Definition at line 853 of file SDL_string.c.

References SDL_ScanUnsignedLong(), SDL_strlen(), and SDL_strncmp().

Referenced by SDL_memset4().

854 {
855 #if defined(HAVE_STRTOUL)
856  return strtoul(string, endp, base);
857 #else
858  size_t len;
859  unsigned long value = 0;
860 
861  if (!base) {
862  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
863  base = 16;
864  } else {
865  base = 10;
866  }
867  }
868 
869  len = SDL_ScanUnsignedLong(string, base, &value);
870  if (endp) {
871  *endp = (char *) string + len;
872  }
873  return value;
874 #endif /* HAVE_STRTOUL */
875 }
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
GLsizei const GLfloat * value
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
Definition: SDL_string.c:94

◆ SDL_strtoull()

Uint64 SDL_strtoull ( const char *  str,
char **  endp,
int  base 
)

Definition at line 903 of file SDL_string.c.

References SDL_ScanUnsignedLongLong(), SDL_strlen(), and SDL_strncmp().

Referenced by SDL_memset4().

904 {
905 #if defined(HAVE_STRTOULL)
906  return strtoull(string, endp, base);
907 #else
908  size_t len;
909  Uint64 value = 0;
910 
911  if (!base) {
912  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
913  base = 16;
914  } else {
915  base = 10;
916  }
917  }
918 
919  len = SDL_ScanUnsignedLongLong(string, base, &value);
920  if (endp) {
921  *endp = (char *) string + len;
922  }
923  return value;
924 #endif /* HAVE_STRTOULL */
925 }
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
uint64_t Uint64
Definition: SDL_stdinc.h:216
GLenum GLsizei len
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
GLsizei const GLfloat * value
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
Definition: SDL_string.c:199

◆ SDL_strupr()

char* SDL_strupr ( char *  str)

Definition at line 608 of file SDL_string.c.

References SDL_toupper.

Referenced by SDL_memset4(), and SDL_PrintString().

609 {
610 #if defined(HAVE__STRUPR)
611  return _strupr(string);
612 #else
613  char *bufp = string;
614  while (*bufp) {
615  *bufp = SDL_toupper((unsigned char) *bufp);
616  ++bufp;
617  }
618  return string;
619 #endif /* HAVE__STRUPR */
620 }
GLsizei const GLchar *const * string
#define SDL_toupper

◆ SDL_tan()

double SDL_tan ( double  x)

Definition at line 410 of file SDL_stdlib.c.

References SDL_uclibc_tan(), and tan().

Referenced by SDL_memset4(), and SDL_tanf().

411 {
412 #if defined(HAVE_TAN)
413  return tan(x);
414 #else
415  return SDL_uclibc_tan(x);
416 #endif
417 }
double tan(double x)
Definition: s_tan.c:45
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_uclibc_tan(double x)

◆ SDL_tanf()

float SDL_tanf ( float  x)

Definition at line 420 of file SDL_stdlib.c.

References SDL_tan().

Referenced by SDL_memset4().

421 {
422 #if defined(HAVE_TANF)
423  return tanf(x);
424 #else
425  return (float)SDL_tan((double)x);
426 #endif
427 }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
double SDL_tan(double x)
Definition: SDL_stdlib.c:410

◆ SDL_tolower()

int SDL_tolower ( int  x)

Definition at line 447 of file SDL_stdlib.c.

References i, L1, L2, L3, L4, L5, L6, memcpy, and pop.

Referenced by SDL_abs().

447 { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_toupper()

int SDL_toupper ( int  x)

Definition at line 446 of file SDL_stdlib.c.

Referenced by SDL_abs().

446 { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574

◆ SDL_uitoa()

char* SDL_uitoa ( unsigned int  value,
char *  str,
int  radix 
)

Definition at line 712 of file SDL_string.c.

References SDL_ultoa().

Referenced by SDL_memset4().

713 {
714 #ifdef HAVE__UITOA
715  return _uitoa(value, string, radix);
716 #else
717  return SDL_ultoa((unsigned long)value, string, radix);
718 #endif /* HAVE__UITOA */
719 }
GLsizei const GLfloat * value
char * SDL_ultoa(unsigned long value, char *string, int radix)
Definition: SDL_string.c:741

◆ SDL_ulltoa()

char* SDL_ulltoa ( Uint64  value,
char *  str,
int  radix 
)

Definition at line 785 of file SDL_string.c.

References SDL_strrev().

Referenced by SDL_lltoa(), SDL_memset4(), and SDL_PrintUnsignedLongLong().

786 {
787 #if defined(HAVE__UI64TOA)
788  return _ui64toa(value, string, radix);
789 #else
790  char *bufp = string;
791 
792  if (value) {
793  while (value > 0) {
794  *bufp++ = ntoa_table[value % radix];
795  value /= radix;
796  }
797  } else {
798  *bufp++ = '0';
799  }
800  *bufp = '\0';
801 
802  /* The numbers went into the string backwards. :) */
803  SDL_strrev(string);
804 
805  return string;
806 #endif /* HAVE__UI64TOA */
807 }
GLsizei const GLchar *const * string
static const char ntoa_table[]
Definition: SDL_string.c:693
char * SDL_strrev(char *string)
Definition: SDL_string.c:589
GLsizei const GLfloat * value

◆ SDL_ultoa()

char* SDL_ultoa ( unsigned long  value,
char *  str,
int  radix 
)

Definition at line 741 of file SDL_string.c.

References SDL_strrev().

Referenced by SDL_ltoa(), SDL_memset4(), SDL_PrintUnsignedLong(), and SDL_uitoa().

742 {
743 #if defined(HAVE__ULTOA)
744  return _ultoa(value, string, radix);
745 #else
746  char *bufp = string;
747 
748  if (value) {
749  while (value > 0) {
750  *bufp++ = ntoa_table[value % radix];
751  value /= radix;
752  }
753  } else {
754  *bufp++ = '0';
755  }
756  *bufp = '\0';
757 
758  /* The numbers went into the string backwards. :) */
759  SDL_strrev(string);
760 
761  return string;
762 #endif /* HAVE__ULTOA */
763 }
GLsizei const GLchar *const * string
static const char ntoa_table[]
Definition: SDL_string.c:693
char * SDL_strrev(char *string)
Definition: SDL_string.c:589
GLsizei const GLfloat * value

◆ SDL_utf8strlcpy()

size_t SDL_utf8strlcpy ( SDL_OUT_Z_CAP(dst_bytes) char *  dst,
const char *  src,
size_t  dst_bytes 
)

Definition at line 513 of file SDL_string.c.

References i, SDL_memcpy(), SDL_min, SDL_strlen(), UTF8_IsLeadByte, UTF8_IsTrailingByte, and UTF8_TrailingBytes().

Referenced by SDL_memset4().

514 {
515  size_t src_bytes = SDL_strlen(src);
516  size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
517  size_t i = 0;
518  char trailing_bytes = 0;
519  if (bytes)
520  {
521  unsigned char c = (unsigned char)src[bytes - 1];
522  if (UTF8_IsLeadByte(c))
523  --bytes;
524  else if (UTF8_IsTrailingByte(c))
525  {
526  for (i = bytes - 1; i != 0; --i)
527  {
528  c = (unsigned char)src[i];
529  trailing_bytes = UTF8_TrailingBytes(c);
530  if (trailing_bytes)
531  {
532  if (bytes - i != trailing_bytes + 1)
533  bytes = i;
534 
535  break;
536  }
537  }
538  }
539  SDL_memcpy(dst, src, bytes);
540  }
541  dst[bytes] = '\0';
542  return bytes;
543 }
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
GLenum GLenum dst
GLenum src
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
#define UTF8_IsLeadByte(c)
Definition: SDL_string.c:36
const GLubyte * c
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315
static int UTF8_TrailingBytes(unsigned char c)
Definition: SDL_string.c:39
#define UTF8_IsTrailingByte(c)
Definition: SDL_string.c:37

◆ SDL_utf8strlen()

size_t SDL_utf8strlen ( const char *  str)

Definition at line 546 of file SDL_string.c.

References retval.

Referenced by SDL_memset4().

547 {
548  size_t retval = 0;
549  const char *p = str;
550  char ch;
551 
552  while ((ch = *(p++))) {
553  /* if top two bits are 1 and 0, it's a continuation byte. */
554  if ((ch & 0xc0) != 0x80) {
555  retval++;
556  }
557  }
558 
559  return retval;
560 }
GLfloat GLfloat p
SDL_bool retval

◆ SDL_vsnprintf()

int SDL_vsnprintf ( SDL_OUT_Z_CAP(maxlen) char *  text,
size_t  maxlen,
const char *  fmt,
va_list  ap 
)

Definition at line 1610 of file SDL_string.c.

References done, SDL_FormatInfo::force_case, SDL_FormatInfo::force_sign, SDL_FormatInfo::force_type, SDL_FormatInfo::left_justify, SDL_FormatInfo::pad_zeroes, SDL_FormatInfo::precision, SDL_FormatInfo::radix, SDL_CASE_LOWER, SDL_CASE_NOCHANGE, SDL_CASE_UPPER, SDL_FALSE, SDL_free, SDL_iconv_string, SDL_min, SDL_PrintFloat(), SDL_PrintLong(), SDL_PrintLongLong(), SDL_PrintString(), SDL_PrintUnsignedLong(), SDL_PrintUnsignedLongLong(), SDL_strncmp(), SDL_strtol(), SDL_TRUE, SDL_wcslen(), SDL_zero, text, and SDL_FormatInfo::width.

Referenced by SDL_memset4(), and SDL_snprintf().

1611 {
1612  size_t left = maxlen;
1613  char *textstart = text;
1614 
1615  if (!fmt) {
1616  fmt = "";
1617  }
1618  while (*fmt && left > 1) {
1619  if (*fmt == '%') {
1621  size_t len = 0;
1622  SDL_bool check_flag;
1623  SDL_FormatInfo info;
1624  enum
1625  {
1626  DO_INT,
1627  DO_LONG,
1628  DO_LONGLONG
1629  } inttype = DO_INT;
1630 
1631  SDL_zero(info);
1632  info.radix = 10;
1633  info.precision = -1;
1634 
1635  check_flag = SDL_TRUE;
1636  while (check_flag) {
1637  ++fmt;
1638  switch (*fmt) {
1639  case '-':
1640  info.left_justify = SDL_TRUE;
1641  break;
1642  case '+':
1643  info.force_sign = SDL_TRUE;
1644  break;
1645  case '#':
1646  info.force_type = SDL_TRUE;
1647  break;
1648  case '0':
1649  info.pad_zeroes = SDL_TRUE;
1650  break;
1651  default:
1652  check_flag = SDL_FALSE;
1653  break;
1654  }
1655  }
1656 
1657  if (*fmt >= '0' && *fmt <= '9') {
1658  info.width = SDL_strtol(fmt, (char **)&fmt, 0);
1659  }
1660  else if (*fmt == '*') {
1661  ++fmt;
1662  info.width = va_arg(ap, int);
1663  }
1664 
1665  if (*fmt == '.') {
1666  ++fmt;
1667  if (*fmt >= '0' && *fmt <= '9') {
1668  info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
1669  } else if (*fmt == '*') {
1670  ++fmt;
1671  info.precision = va_arg(ap, int);
1672  } else {
1673  info.precision = 0;
1674  }
1675  if (info.precision < 0) {
1676  info.precision = 0;
1677  }
1678  }
1679 
1680  while (!done) {
1681  switch (*fmt) {
1682  case '%':
1683  if (left > 1) {
1684  *text = '%';
1685  }
1686  len = 1;
1687  done = SDL_TRUE;
1688  break;
1689  case 'c':
1690  /* char is promoted to int when passed through (...) */
1691  if (left > 1) {
1692  *text = (char) va_arg(ap, int);
1693  }
1694  len = 1;
1695  done = SDL_TRUE;
1696  break;
1697  case 'h':
1698  /* short is promoted to int when passed through (...) */
1699  break;
1700  case 'l':
1701  if (inttype < DO_LONGLONG) {
1702  ++inttype;
1703  }
1704  break;
1705  case 'I':
1706  if (SDL_strncmp(fmt, "I64", 3) == 0) {
1707  fmt += 2;
1708  inttype = DO_LONGLONG;
1709  }
1710  break;
1711  case 'i':
1712  case 'd':
1713  if (info.precision >= 0) {
1714  info.pad_zeroes = SDL_FALSE;
1715  }
1716  switch (inttype) {
1717  case DO_INT:
1718  len = SDL_PrintLong(text, left, &info,
1719  (long) va_arg(ap, int));
1720  break;
1721  case DO_LONG:
1722  len = SDL_PrintLong(text, left, &info,
1723  va_arg(ap, long));
1724  break;
1725  case DO_LONGLONG:
1726  len = SDL_PrintLongLong(text, left, &info,
1727  va_arg(ap, Sint64));
1728  break;
1729  }
1730  done = SDL_TRUE;
1731  break;
1732  case 'p':
1733  case 'x':
1734  info.force_case = SDL_CASE_LOWER;
1735  /* Fall through to 'X' handling */
1736  case 'X':
1737  if (info.force_case == SDL_CASE_NOCHANGE) {
1738  info.force_case = SDL_CASE_UPPER;
1739  }
1740  if (info.radix == 10) {
1741  info.radix = 16;
1742  }
1743  if (*fmt == 'p') {
1744  inttype = DO_LONG;
1745  }
1746  /* Fall through to unsigned handling */
1747  case 'o':
1748  if (info.radix == 10) {
1749  info.radix = 8;
1750  }
1751  /* Fall through to unsigned handling */
1752  case 'u':
1753  info.force_sign = SDL_FALSE;
1754  if (info.precision >= 0) {
1755  info.pad_zeroes = SDL_FALSE;
1756  }
1757  switch (inttype) {
1758  case DO_INT:
1759  len = SDL_PrintUnsignedLong(text, left, &info,
1760  (unsigned long)
1761  va_arg(ap, unsigned int));
1762  break;
1763  case DO_LONG:
1764  len = SDL_PrintUnsignedLong(text, left, &info,
1765  va_arg(ap, unsigned long));
1766  break;
1767  case DO_LONGLONG:
1768  len = SDL_PrintUnsignedLongLong(text, left, &info,
1769  va_arg(ap, Uint64));
1770  break;
1771  }
1772  done = SDL_TRUE;
1773  break;
1774  case 'f':
1775  len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
1776  done = SDL_TRUE;
1777  break;
1778  case 'S':
1779  {
1780  /* In practice this is used on Windows for WCHAR strings */
1781  wchar_t *wide_arg = va_arg(ap, wchar_t *);
1782  char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
1783  info.pad_zeroes = SDL_FALSE;
1784  len = SDL_PrintString(text, left, &info, arg);
1785  SDL_free(arg);
1786  done = SDL_TRUE;
1787  }
1788  break;
1789  case 's':
1790  info.pad_zeroes = SDL_FALSE;
1791  len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
1792  done = SDL_TRUE;
1793  break;
1794  default:
1795  done = SDL_TRUE;
1796  break;
1797  }
1798  ++fmt;
1799  }
1800  if (len >= left) {
1801  text += (left > 1) ? left - 1 : 0;
1802  left = SDL_min(left, 1);
1803  } else {
1804  text += len;
1805  left -= len;
1806  }
1807  } else {
1808  *text++ = *fmt++;
1809  --left;
1810  }
1811  }
1812  if (left > 0) {
1813  *text = '\0';
1814  }
1815  return (int)(text - textstart);
1816 }
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:436
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
SDL_bool left_justify
Definition: SDL_string.c:1368
SDL_bool pad_zeroes
Definition: SDL_string.c:1371
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
SDL_bool force_type
Definition: SDL_string.c:1370
uint64_t Uint64
Definition: SDL_stdinc.h:216
GLenum GLsizei len
long SDL_strtol(const char *string, char **endp, int base)
Definition: SDL_string.c:828
static size_t SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
Definition: SDL_string.c:1483
static size_t SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
Definition: SDL_string.c:1459
SDL_bool force_sign
Definition: SDL_string.c:1369
#define SDL_free
int done
Definition: checkkeys.c:28
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
SDL_bool
Definition: SDL_stdinc.h:161
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
#define SDL_iconv_string
SDL_letter_case force_case
Definition: SDL_string.c:1372
static size_t SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
Definition: SDL_string.c:1497
int64_t Sint64
Definition: SDL_stdinc.h:210
static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
Definition: SDL_string.c:1379
GLint left
static size_t SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
Definition: SDL_string.c:1473
static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
Definition: SDL_string.c:1507

◆ SDL_vsscanf()

int SDL_vsscanf ( const char *  text,
const char *  fmt,
va_list  ap 
)

Definition at line 1052 of file SDL_string.c.

References done, retval, SDL_FALSE, SDL_isspace, SDL_ScanFloat(), SDL_ScanLong(), SDL_ScanLongLong(), SDL_ScanUintPtrT(), SDL_ScanUnsignedLong(), SDL_ScanUnsignedLongLong(), SDL_strncmp(), SDL_tolower, SDL_TRUE, and text.

Referenced by SDL_memset4(), and SDL_sscanf().

1053 {
1054  int retval = 0;
1055 
1056  if (!text || !*text) {
1057  return -1;
1058  }
1059 
1060  while (*fmt) {
1061  if (*fmt == ' ') {
1062  while (SDL_isspace((unsigned char) *text)) {
1063  ++text;
1064  }
1065  ++fmt;
1066  continue;
1067  }
1068  if (*fmt == '%') {
1070  long count = 0;
1071  int radix = 10;
1072  enum
1073  {
1074  DO_SHORT,
1075  DO_INT,
1076  DO_LONG,
1077  DO_LONGLONG
1078  } inttype = DO_INT;
1079  size_t advance;
1080  SDL_bool suppress = SDL_FALSE;
1081 
1082  ++fmt;
1083  if (*fmt == '%') {
1084  if (*text == '%') {
1085  ++text;
1086  ++fmt;
1087  continue;
1088  }
1089  break;
1090  }
1091  if (*fmt == '*') {
1092  suppress = SDL_TRUE;
1093  ++fmt;
1094  }
1095  fmt += SDL_ScanLong(fmt, 10, &count);
1096 
1097  if (*fmt == 'c') {
1098  if (!count) {
1099  count = 1;
1100  }
1101  if (suppress) {
1102  while (count--) {
1103  ++text;
1104  }
1105  } else {
1106  char *valuep = va_arg(ap, char *);
1107  while (count--) {
1108  *valuep++ = *text++;
1109  }
1110  ++retval;
1111  }
1112  continue;
1113  }
1114 
1115  while (SDL_isspace((unsigned char) *text)) {
1116  ++text;
1117  }
1118 
1119  /* FIXME: implement more of the format specifiers */
1120  while (!done) {
1121  switch (*fmt) {
1122  case '*':
1123  suppress = SDL_TRUE;
1124  break;
1125  case 'h':
1126  if (inttype > DO_SHORT) {
1127  ++inttype;
1128  }
1129  break;
1130  case 'l':
1131  if (inttype < DO_LONGLONG) {
1132  ++inttype;
1133  }
1134  break;
1135  case 'I':
1136  if (SDL_strncmp(fmt, "I64", 3) == 0) {
1137  fmt += 2;
1138  inttype = DO_LONGLONG;
1139  }
1140  break;
1141  case 'i':
1142  {
1143  int index = 0;
1144  if (text[index] == '-') {
1145  ++index;
1146  }
1147  if (text[index] == '0') {
1148  if (SDL_tolower((unsigned char) text[index + 1]) == 'x') {
1149  radix = 16;
1150  } else {
1151  radix = 8;
1152  }
1153  }
1154  }
1155  /* Fall through to %d handling */
1156  case 'd':
1157  if (inttype == DO_LONGLONG) {
1158  Sint64 value;
1159  advance = SDL_ScanLongLong(text, radix, &value);
1160  text += advance;
1161  if (advance && !suppress) {
1162  Sint64 *valuep = va_arg(ap, Sint64 *);
1163  *valuep = value;
1164  ++retval;
1165  }
1166  } else {
1167  long value;
1168  advance = SDL_ScanLong(text, radix, &value);
1169  text += advance;
1170  if (advance && !suppress) {
1171  switch (inttype) {
1172  case DO_SHORT:
1173  {
1174  short *valuep = va_arg(ap, short *);
1175  *valuep = (short) value;
1176  }
1177  break;
1178  case DO_INT:
1179  {
1180  int *valuep = va_arg(ap, int *);
1181  *valuep = (int) value;
1182  }
1183  break;
1184  case DO_LONG:
1185  {
1186  long *valuep = va_arg(ap, long *);
1187  *valuep = value;
1188  }
1189  break;
1190  case DO_LONGLONG:
1191  /* Handled above */
1192  break;
1193  }
1194  ++retval;
1195  }
1196  }
1197  done = SDL_TRUE;
1198  break;
1199  case 'o':
1200  if (radix == 10) {
1201  radix = 8;
1202  }
1203  /* Fall through to unsigned handling */
1204  case 'x':
1205  case 'X':
1206  if (radix == 10) {
1207  radix = 16;
1208  }
1209  /* Fall through to unsigned handling */
1210  case 'u':
1211  if (inttype == DO_LONGLONG) {
1212  Uint64 value = 0;
1213  advance = SDL_ScanUnsignedLongLong(text, radix, &value);
1214  text += advance;
1215  if (advance && !suppress) {
1216  Uint64 *valuep = va_arg(ap, Uint64 *);
1217  *valuep = value;
1218  ++retval;
1219  }
1220  } else {
1221  unsigned long value = 0;
1222  advance = SDL_ScanUnsignedLong(text, radix, &value);
1223  text += advance;
1224  if (advance && !suppress) {
1225  switch (inttype) {
1226  case DO_SHORT:
1227  {
1228  short *valuep = va_arg(ap, short *);
1229  *valuep = (short) value;
1230  }
1231  break;
1232  case DO_INT:
1233  {
1234  int *valuep = va_arg(ap, int *);
1235  *valuep = (int) value;
1236  }
1237  break;
1238  case DO_LONG:
1239  {
1240  long *valuep = va_arg(ap, long *);
1241  *valuep = value;
1242  }
1243  break;
1244  case DO_LONGLONG:
1245  /* Handled above */
1246  break;
1247  }
1248  ++retval;
1249  }
1250  }
1251  done = SDL_TRUE;
1252  break;
1253  case 'p':
1254  {
1255  uintptr_t value = 0;
1256  advance = SDL_ScanUintPtrT(text, 16, &value);
1257  text += advance;
1258  if (advance && !suppress) {
1259  void **valuep = va_arg(ap, void **);
1260  *valuep = (void *) value;
1261  ++retval;
1262  }
1263  }
1264  done = SDL_TRUE;
1265  break;
1266  case 'f':
1267  {
1268  double value;
1269  advance = SDL_ScanFloat(text, &value);
1270  text += advance;
1271  if (advance && !suppress) {
1272  float *valuep = va_arg(ap, float *);
1273  *valuep = (float) value;
1274  ++retval;
1275  }
1276  }
1277  done = SDL_TRUE;
1278  break;
1279  case 's':
1280  if (suppress) {
1281  while (!SDL_isspace((unsigned char) *text)) {
1282  ++text;
1283  if (count) {
1284  if (--count == 0) {
1285  break;
1286  }
1287  }
1288  }
1289  } else {
1290  char *valuep = va_arg(ap, char *);
1291  while (!SDL_isspace((unsigned char) *text)) {
1292  *valuep++ = *text++;
1293  if (count) {
1294  if (--count == 0) {
1295  break;
1296  }
1297  }
1298  }
1299  *valuep = '\0';
1300  ++retval;
1301  }
1302  done = SDL_TRUE;
1303  break;
1304  default:
1305  done = SDL_TRUE;
1306  break;
1307  }
1308  ++fmt;
1309  }
1310  continue;
1311  }
1312  if (*text == *fmt) {
1313  ++text;
1314  ++fmt;
1315  continue;
1316  }
1317  /* Text didn't match format specifier */
1318  break;
1319  }
1320 
1321  return retval;
1322 }
static size_t SDL_ScanFloat(const char *text, double *valuep)
Definition: SDL_string.c:231
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:961
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
#define SDL_tolower
uint64_t Uint64
Definition: SDL_stdinc.h:216
static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
Definition: SDL_string.c:126
static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
Definition: SDL_string.c:53
SDL_bool retval
int done
Definition: checkkeys.c:28
GLsizei const GLfloat * value
unsigned int uintptr_t
#define SDL_isspace
GLuint index
SDL_bool
Definition: SDL_stdinc.h:161
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
Definition: SDL_string.c:158
int64_t Sint64
Definition: SDL_stdinc.h:210
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
Definition: SDL_string.c:199
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
Definition: SDL_string.c:94

◆ SDL_wcscmp()

int SDL_wcscmp ( const wchar_t *  str1,
const wchar_t *  str2 
)

Definition at line 481 of file SDL_string.c.

Referenced by SDL_memset4().

482 {
483 #if defined(HAVE_WCSCMP)
484  return wcscmp(str1, str2);
485 #else
486  while (*str1 && *str2) {
487  if (*str1 != *str2)
488  break;
489  ++str1;
490  ++str2;
491  }
492  return (int)(*str1 - *str2);
493 #endif /* HAVE_WCSCMP */
494 }

◆ SDL_wcsdup()

wchar_t* SDL_wcsdup ( const wchar_t *  wstr)

Definition at line 425 of file SDL_string.c.

References SDL_malloc, SDL_memcpy(), and SDL_wcslen().

Referenced by SDL_memset4().

426 {
427  size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t));
428  wchar_t *newstr = (wchar_t *)SDL_malloc(len);
429  if (newstr) {
430  SDL_memcpy(newstr, string, len);
431  }
432  return newstr;
433 }
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:436
GLenum GLsizei len
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315
#define SDL_malloc

◆ SDL_wcslcat()

size_t SDL_wcslcat ( SDL_INOUT_Z_CAP(maxlen) wchar_t *  dst,
const wchar_t *  src,
size_t  maxlen 
)

Definition at line 466 of file SDL_string.c.

References SDL_wcslcpy(), and SDL_wcslen().

Referenced by SDL_memset4().

467 {
468 #if defined(HAVE_WCSLCAT)
469  return wcslcat(dst, src, maxlen);
470 #else
471  size_t dstlen = SDL_wcslen(dst);
472  size_t srclen = SDL_wcslen(src);
473  if (dstlen < maxlen) {
474  SDL_wcslcpy(dst + dstlen, src, maxlen - dstlen);
475  }
476  return dstlen + srclen;
477 #endif /* HAVE_WCSLCAT */
478 }
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:436
GLenum GLenum dst
GLenum src
size_t SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
Definition: SDL_string.c:450

◆ SDL_wcslcpy()

size_t SDL_wcslcpy ( SDL_OUT_Z_CAP(maxlen) wchar_t *  dst,
const wchar_t *  src,
size_t  maxlen 
)

Definition at line 450 of file SDL_string.c.

References SDL_memcpy(), SDL_min, and SDL_wcslen().

Referenced by SDL_memset4(), and SDL_wcslcat().

451 {
452 #if defined(HAVE_WCSLCPY)
453  return wcslcpy(dst, src, maxlen);
454 #else
455  size_t srclen = SDL_wcslen(src);
456  if (maxlen > 0) {
457  size_t len = SDL_min(srclen, maxlen - 1);
458  SDL_memcpy(dst, src, len * sizeof(wchar_t));
459  dst[len] = '\0';
460  }
461  return srclen;
462 #endif /* HAVE_WCSLCPY */
463 }
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:436
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
GLenum GLenum dst
GLenum src
GLenum GLsizei len
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315

◆ SDL_wcslen()

size_t SDL_wcslen ( const wchar_t *  wstr)

Definition at line 436 of file SDL_string.c.

Referenced by SDL_memset4(), SDL_vsnprintf(), SDL_wcsdup(), SDL_wcslcat(), and SDL_wcslcpy().

437 {
438 #if defined(HAVE_WCSLEN)
439  return wcslen(string);
440 #else
441  size_t len = 0;
442  while (*string++) {
443  ++len;
444  }
445  return len;
446 #endif /* HAVE_WCSLEN */
447 }
GLenum GLsizei len