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
 
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))
 
#define SDL_FOURCC(A, B, C, D)
 

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 */
 
#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_zeroa(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)
 
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
 
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)
 
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_isupper (int x)
 
int SDL_islower (int x)
 
int SDL_toupper (int x)
 
int SDL_tolower (int x)
 
Uint32 SDL_crc32 (Uint32 crc, const void *data, size_t len)
 
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)
 
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)
 
wchar_t * SDL_wcsdup (const wchar_t *wstr)
 
wchar_t * SDL_wcsstr (const wchar_t *haystack, const wchar_t *needle)
 
int SDL_wcscmp (const wchar_t *str1, const wchar_t *str2)
 
int SDL_wcsncmp (const wchar_t *str1, const wchar_t *str2, size_t maxlen)
 
int SDL_wcscasecmp (const wchar_t *str1, const wchar_t *str2)
 
int SDL_wcsncasecmp (const wchar_t *str1, const wchar_t *str2, size_t len)
 
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)
 
char * SDL_strtokr (char *s1, const char *s2, char **saveptr)
 
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_trunc (double x)
 
float SDL_truncf (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)
 

Detailed Description

This is a general header that includes C language support.

Definition in file SDL_stdinc.h.

Macro Definition Documentation

◆ SDL_arraysize

#define SDL_arraysize (   array)    (sizeof(array)/sizeof(array[0]))

The number of elements in an array.

Definition at line 121 of file SDL_stdinc.h.

◆ SDL_COMPILE_TIME_ASSERT

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

Definition at line 318 of file SDL_stdinc.h.

◆ SDL_const_cast

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

Definition at line 145 of file SDL_stdinc.h.

◆ SDL_FOURCC

#define SDL_FOURCC (   A,
  B,
  C,
 
)
Value:
uint8_t Uint8
Definition: SDL_stdinc.h:185
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:144
uint32_t Uint32
Definition: SDL_stdinc.h:209

Definition at line 150 of file SDL_stdinc.h.

◆ SDL_ICONV_E2BIG

#define SDL_ICONV_E2BIG   (size_t)-2

Definition at line 563 of file SDL_stdinc.h.

◆ SDL_ICONV_EILSEQ

#define SDL_ICONV_EILSEQ   (size_t)-3

Definition at line 564 of file SDL_stdinc.h.

◆ SDL_ICONV_EINVAL

#define SDL_ICONV_EINVAL   (size_t)-4

Definition at line 565 of file SDL_stdinc.h.

◆ SDL_ICONV_ERROR

#define SDL_ICONV_ERROR   (size_t)-1

Definition at line 562 of file SDL_stdinc.h.

◆ SDL_iconv_utf8_locale

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

Definition at line 583 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 584 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 585 of file SDL_stdinc.h.

◆ SDL_IN_BYTECAP

#define SDL_IN_BYTECAP (   x)

Definition at line 300 of file SDL_stdinc.h.

◆ SDL_INOUT_Z_CAP

#define SDL_INOUT_Z_CAP (   x)

Definition at line 301 of file SDL_stdinc.h.

◆ SDL_max

#define SDL_max (   x,
  y 
)    (((x) > (y)) ? (x) : (y))

Definition at line 413 of file SDL_stdinc.h.

◆ SDL_MAX_SINT16

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

A signed 16-bit integer type.

Definition at line 189 of file SDL_stdinc.h.

◆ SDL_MAX_SINT32

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

A signed 32-bit integer type.

Definition at line 201 of file SDL_stdinc.h.

◆ SDL_MAX_SINT64

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

A signed 64-bit integer type.

Definition at line 214 of file SDL_stdinc.h.

◆ SDL_MAX_SINT8

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

A signed 8-bit integer type.

Definition at line 177 of file SDL_stdinc.h.

◆ SDL_MAX_UINT16

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

An unsigned 16-bit integer type.

Definition at line 195 of file SDL_stdinc.h.

◆ SDL_MAX_UINT32

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

An unsigned 32-bit integer type.

Definition at line 207 of file SDL_stdinc.h.

◆ SDL_MAX_UINT64

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

An unsigned 64-bit integer type.

Definition at line 220 of file SDL_stdinc.h.

◆ SDL_MAX_UINT8

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

An unsigned 8-bit integer type.

Definition at line 183 of file SDL_stdinc.h.

◆ SDL_min

#define SDL_min (   x,
  y 
)    (((x) < (y)) ? (x) : (y))

Definition at line 412 of file SDL_stdinc.h.

◆ SDL_MIN_SINT16

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

Definition at line 190 of file SDL_stdinc.h.

◆ SDL_MIN_SINT32

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

Definition at line 202 of file SDL_stdinc.h.

◆ SDL_MIN_SINT64

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

Definition at line 215 of file SDL_stdinc.h.

◆ SDL_MIN_SINT8

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

Definition at line 178 of file SDL_stdinc.h.

◆ SDL_MIN_UINT16

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

Definition at line 196 of file SDL_stdinc.h.

◆ SDL_MIN_UINT32

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

Definition at line 208 of file SDL_stdinc.h.

◆ SDL_MIN_UINT64

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

Definition at line 221 of file SDL_stdinc.h.

◆ SDL_MIN_UINT8

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

Definition at line 184 of file SDL_stdinc.h.

◆ SDL_OUT_BYTECAP

#define SDL_OUT_BYTECAP (   x)

Definition at line 304 of file SDL_stdinc.h.

◆ SDL_OUT_CAP

#define SDL_OUT_CAP (   x)

Definition at line 303 of file SDL_stdinc.h.

◆ SDL_OUT_Z_BYTECAP

#define SDL_OUT_Z_BYTECAP (   x)

Definition at line 305 of file SDL_stdinc.h.

◆ SDL_OUT_Z_CAP

#define SDL_OUT_Z_CAP (   x)

Definition at line 302 of file SDL_stdinc.h.

◆ SDL_PRINTF_FORMAT_STRING

#define SDL_PRINTF_FORMAT_STRING

Definition at line 306 of file SDL_stdinc.h.

◆ SDL_PRINTF_VARARG_FUNC

#define SDL_PRINTF_VARARG_FUNC (   fmtargnumber)

Definition at line 313 of file SDL_stdinc.h.

◆ SDL_PRIs64

#define SDL_PRIs64   "I64d"

Definition at line 233 of file SDL_stdinc.h.

◆ SDL_PRIu64

#define SDL_PRIu64   "I64u"

Definition at line 244 of file SDL_stdinc.h.

◆ SDL_PRIx64

#define SDL_PRIx64   "I64x"

Definition at line 255 of file SDL_stdinc.h.

◆ SDL_PRIX64

#define SDL_PRIX64   "I64X"

Definition at line 266 of file SDL_stdinc.h.

◆ SDL_reinterpret_cast

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

Definition at line 143 of file SDL_stdinc.h.

◆ SDL_SCANF_FORMAT_STRING

#define SDL_SCANF_FORMAT_STRING

Definition at line 307 of file SDL_stdinc.h.

◆ SDL_SCANF_VARARG_FUNC

#define SDL_SCANF_VARARG_FUNC (   fmtargnumber)

Definition at line 314 of file SDL_stdinc.h.

◆ SDL_stack_alloc

#define SDL_stack_alloc (   type,
  count 
)    (type*)alloca(sizeof(type)*(count))

Definition at line 360 of file SDL_stdinc.h.

◆ SDL_stack_free

#define SDL_stack_free (   data)

Definition at line 361 of file SDL_stdinc.h.

◆ SDL_static_cast

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

Definition at line 144 of file SDL_stdinc.h.

◆ 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 129 of file SDL_stdinc.h.

◆ SDL_TABLESIZE

#define SDL_TABLESIZE (   table)    SDL_arraysize(table)

Definition at line 122 of file SDL_stdinc.h.

◆ SDL_zero

#define SDL_zero (   x)    SDL_memset(&(x), 0, sizeof((x)))

Definition at line 426 of file SDL_stdinc.h.

◆ SDL_zeroa

#define SDL_zeroa (   x)    SDL_memset((x), 0, sizeof((x)))

Definition at line 428 of file SDL_stdinc.h.

◆ SDL_zerop

#define SDL_zerop (   x)    SDL_memset((x), 0, sizeof(*(x)))

Definition at line 427 of file SDL_stdinc.h.

Typedef Documentation

◆ SDL_calloc_func

typedef void*( * SDL_calloc_func) (size_t nmemb, size_t size)

Definition at line 373 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(*) void 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 int return int return int return SDL_RWops size_t int return SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation return const char return SDL_Window VkInstance VkSurfaceKHR return SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func

Definition at line 375 of file SDL_stdinc.h.

◆ SDL_malloc_func

typedef void*( * SDL_malloc_func) (size_t size)

Definition at line 372 of file SDL_stdinc.h.

◆ SDL_realloc_func

typedef void*( * SDL_realloc_func) (void *mem, size_t size)

Definition at line 374 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 int return int return int return SDL_RWops size_t int return SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation return const char return SDL_Window VkInstance VkSurfaceKHR return SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return SDL_AudioStream const void int return SDL_AudioStream SDL_AudioStream float return float return float return float return float return float int return float float return return SDL_Renderer return double return int return double return const wchar_t return SDL_Joystick Uint16 Uint16 Uint32 return int return int return int return SDL_Sensor return SDL_Sensor return SDL_Sensor float int return int return SDL_ThreadFunction const char const size_t void return SDL_Joystick return SDL_Renderer return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FRect int return SDL_Renderer const SDL_FRect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_FRect const double const SDL_FPoint const SDL_RendererFlip return return void SDL_RWops Sint64 int return SDL_RWops void size_t size_t return SDL_RWops return SDL_Window return SDL_Texture const SDL_Rect SDL_Surface return char const char char return const wchar_t const wchar_t size_t return SDL_GameController return SDL_GameController int SDL_Joystick int SDL_Texture SDL_ScaleMode return int return int return SDL_Joystick int Sint16

Definition at line 191 of file SDL_stdinc.h.

◆ Sint32

typedef int32_t Sint32

Definition at line 203 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(*) 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 int return int return int return SDL_RWops size_t int return SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation return const char return SDL_Window VkInstance VkSurfaceKHR return SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return SDL_AudioStream const void int return SDL_AudioStream SDL_AudioStream float return float return float return float return float return float int return float float return return SDL_Renderer return double return int return double return const wchar_t return SDL_Joystick Uint16 Uint16 Uint32 return int return int return int return SDL_Sensor return SDL_Sensor return SDL_Sensor float int return int return SDL_ThreadFunction const char const size_t void return SDL_Joystick return SDL_Renderer return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FRect int return SDL_Renderer const SDL_FRect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_FRect const double const SDL_FPoint const SDL_RendererFlip return return void SDL_RWops Sint64

Definition at line 216 of file SDL_stdinc.h.

◆ Sint8

typedef int8_t Sint8

Definition at line 179 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 int return int return int return SDL_RWops size_t int return SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation return const char return SDL_Window VkInstance VkSurfaceKHR return SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return SDL_AudioStream const void int return SDL_AudioStream SDL_AudioStream float return float return float return float return float return float int return float float return return SDL_Renderer return double return int return double return const wchar_t return SDL_Joystick Uint16 Uint16 Uint32 return int return int return int return SDL_Sensor return SDL_Sensor return SDL_Sensor float int return int return SDL_ThreadFunction const char const size_t void return SDL_Joystick return SDL_Renderer return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FRect int return SDL_Renderer const SDL_FRect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_FRect const double const SDL_FPoint const SDL_RendererFlip return return void SDL_RWops Sint64 int return SDL_RWops void size_t size_t return SDL_RWops return SDL_Window return SDL_Texture const SDL_Rect SDL_Surface return char const char char return const wchar_t const wchar_t size_t return SDL_GameController return SDL_GameController int SDL_Joystick int SDL_Texture SDL_ScaleMode return int return int return SDL_Joystick int Sint16 return SDL_Joystick int Uint8 return SDL_MetalView return double return return const char return SDL_GameController return SDL_Joystick return SDL_GameController Uint16 Uint16

Definition at line 197 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 int return int return int return SDL_RWops size_t int return SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation return const char return SDL_Window VkInstance VkSurfaceKHR return SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return SDL_AudioStream const void int return SDL_AudioStream SDL_AudioStream float return float return float return float return float return float int return float float return return SDL_Renderer return double return int return double return const wchar_t return SDL_Joystick Uint16 Uint16 Uint32 return int return int return int return SDL_Sensor return SDL_Sensor return SDL_Sensor float int return int return SDL_ThreadFunction const char const size_t void return SDL_Joystick return SDL_Renderer return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FRect int return SDL_Renderer const SDL_FRect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_FRect const double const SDL_FPoint const SDL_RendererFlip return return void SDL_RWops Sint64 int return SDL_RWops void size_t size_t return SDL_RWops return SDL_Window return SDL_Texture const SDL_Rect SDL_Surface return char const char char return const wchar_t const wchar_t size_t return SDL_GameController return SDL_GameController int SDL_Joystick int SDL_Texture SDL_ScaleMode return int return int return SDL_Joystick int Sint16 return SDL_Joystick int Uint8 return SDL_MetalView return double return return const char return SDL_GameController return SDL_Joystick return SDL_GameController Uint16 Uint16 Uint32

Definition at line 209 of file SDL_stdinc.h.

◆ Uint64

typedef uint64_t Uint64

Definition at line 222 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(*) 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 int return int return int return SDL_RWops size_t int return SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation SDL_BlendFactor SDL_BlendFactor SDL_BlendOperation return const char return SDL_Window VkInstance VkSurfaceKHR return SDL_malloc_func SDL_calloc_func SDL_realloc_func SDL_free_func return SDL_AudioStream const void int return SDL_AudioStream SDL_AudioStream float return float return float return float return float return float int return float float return return SDL_Renderer return double return int return double return const wchar_t return SDL_Joystick Uint16 Uint16 Uint32 return int return int return int return SDL_Sensor return SDL_Sensor return SDL_Sensor float int return int return SDL_ThreadFunction const char const size_t void return SDL_Joystick return SDL_Renderer return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FPoint int return SDL_Renderer const SDL_FRect int return SDL_Renderer const SDL_FRect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_FRect const double const SDL_FPoint const SDL_RendererFlip return return void SDL_RWops Sint64 int return SDL_RWops void size_t size_t return SDL_RWops return SDL_Window return SDL_Texture const SDL_Rect SDL_Surface return char const char char return const wchar_t const wchar_t size_t return SDL_GameController return SDL_GameController int SDL_Joystick int SDL_Texture SDL_ScaleMode return int return int return SDL_Joystick int Sint16 return SDL_Joystick int Uint8

Definition at line 185 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 167 of file SDL_stdinc.h.

168 {
169  SDL_FALSE = 0,
170  SDL_TRUE = 1
171 } SDL_bool;
SDL_bool
Definition: SDL_stdinc.h:168
@ SDL_TRUE
Definition: SDL_stdinc.h:170
@ SDL_FALSE
Definition: SDL_stdinc.h:169

Function Documentation

◆ SDL_abs()

int SDL_abs ( int  x)

Definition at line 453 of file SDL_stdlib.c.

454 {
455 #if defined(HAVE_ABS)
456  return abs(x);
457 #else
458  return ((x) < 0 ? -(x) : (x));
459 #endif
460 }
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.

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 }
GLuint GLfloat * val
GLuint64EXT * result
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:414
double SDL_atan(double x)
Definition: SDL_stdlib.c:35

References SDL_atan(), and SDL_sqrt().

Referenced by SDL_acosf(), and SDL_asin().

◆ SDL_acosf()

float SDL_acosf ( float  x)

Definition at line 95 of file SDL_stdlib.c.

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

References SDL_acos().

◆ SDL_asin()

double SDL_asin ( double  x)

Definition at line 105 of file SDL_stdlib.c.

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 }

References SDL_acos().

Referenced by SDL_asinf().

◆ SDL_asinf()

float SDL_asinf ( float  x)

Definition at line 121 of file SDL_stdlib.c.

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

References SDL_asin().

◆ SDL_atan()

double SDL_atan ( double  x)

Definition at line 35 of file SDL_stdlib.c.

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

References atan(), and SDL_uclibc_atan().

Referenced by SDL_acos(), and SDL_atanf().

◆ SDL_atan2()

double SDL_atan2 ( double  x,
double  y 
)

Definition at line 55 of file SDL_stdlib.c.

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 GLint y
Definition: SDL_opengl.h:1574
double SDL_uclibc_atan2(double y, double x)

References SDL_uclibc_atan2().

Referenced by SDL_atan2f().

◆ SDL_atan2f()

float SDL_atan2f ( float  x,
float  y 
)

Definition at line 65 of file SDL_stdlib.c.

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 }
double SDL_atan2(double x, double y)
Definition: SDL_stdlib.c:55

References SDL_atan2().

◆ SDL_atanf()

float SDL_atanf ( float  x)

Definition at line 45 of file SDL_stdlib.c.

46 {
47 #if defined(HAVE_ATANF)
48  return atanf(x);
49 #else
50  return (float)SDL_atan((double)x);
51 #endif
52 }

References SDL_atan().

◆ SDL_atof()

double SDL_atof ( const char *  str)

Definition at line 935 of file SDL_string.c.

936 {
937 #ifdef HAVE_ATOF
938  return atof(string);
939 #else
940  return SDL_strtod(string, NULL);
941 #endif /* HAVE_ATOF */
942 }
double SDL_strtod(const char *string, char **endp)
Definition: SDL_string.c:1045
#define NULL
Definition: begin_code.h:163

References NULL, and SDL_strtod().

◆ SDL_atoi()

int SDL_atoi ( const char *  str)

Definition at line 926 of file SDL_string.c.

927 {
928 #ifdef HAVE_ATOI
929  return atoi(string);
930 #else
931  return SDL_strtol(string, NULL, 0);
932 #endif /* HAVE_ATOI */
933 }
long SDL_strtol(const char *string, char **endp, int base)
Definition: SDL_string.c:945

References NULL, and SDL_strtol().

◆ SDL_calloc()

void* SDL_calloc ( size_t  nmemb,
size_t  size 
)

Definition at line 5394 of file SDL_malloc.c.

5395 {
5396  void *mem;
5397 
5398  if (!nmemb || !size) {
5399  nmemb = 1;
5400  size = 1;
5401  }
5402 
5403  mem = s_mem.calloc_func(nmemb, size);
5404  if (mem) {
5405  SDL_AtomicIncRef(&s_mem.num_allocations);
5406  }
5407  return mem;
5408 }
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
Definition: SDL_atomic.h:252
static struct @45 s_mem
GLsizeiptr size

References s_mem, and SDL_AtomicIncRef.

◆ SDL_ceil()

double SDL_ceil ( double  x)

Definition at line 131 of file SDL_stdlib.c.

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 }
double SDL_floor(double x)
Definition: SDL_stdlib.c:244

References SDL_floor().

Referenced by SDL_ceilf(), and SDL_trunc().

◆ SDL_ceilf()

float SDL_ceilf ( float  x)

Definition at line 146 of file SDL_stdlib.c.

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

References SDL_ceil().

◆ SDL_copysign()

double SDL_copysign ( double  x,
double  y 
)

Definition at line 156 of file SDL_stdlib.c.

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 }
double SDL_uclibc_copysign(double x, double y)
double copysign(double x, double y)
Definition: s_copysign.c:21

References copysign(), and SDL_uclibc_copysign().

Referenced by SDL_copysignf().

◆ SDL_copysignf()

float SDL_copysignf ( float  x,
float  y 
)

Definition at line 174 of file SDL_stdlib.c.

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 }
double SDL_copysign(double x, double y)
Definition: SDL_stdlib.c:156

References SDL_copysign().

◆ SDL_cos()

double SDL_cos ( double  x)

Definition at line 184 of file SDL_stdlib.c.

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

References cos(), and SDL_uclibc_cos().

Referenced by SDL_cosf().

◆ SDL_cosf()

float SDL_cosf ( float  x)

Definition at line 194 of file SDL_stdlib.c.

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

References SDL_cos().

◆ SDL_crc32()

Uint32 SDL_crc32 ( Uint32  crc,
const void data,
size_t  len 
)

Definition at line 42 of file SDL_crc32.c.

43 {
44  /* As an optimization we can precalculate a 256 entry table for each byte */
45  size_t i;
46  for(i = 0; i < len; ++i) {
47  crc = crc32_for_byte((Uint8)crc ^ ((const Uint8*)data)[i]) ^ crc >> 8;
48  }
49  return crc;
50 }
static Uint32 crc32_for_byte(Uint32 r)
Definition: SDL_crc32.c:33
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
GLenum GLsizei len
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

References crc32_for_byte(), and i.

◆ SDL_exp()

double SDL_exp ( double  x)

Definition at line 204 of file SDL_stdlib.c.

205 {
206 #if defined(HAVE_EXP)
207  return exp(x);
208 #else
209  return SDL_uclibc_exp(x);
210 #endif
211 }
double SDL_uclibc_exp(double x)

References SDL_uclibc_exp().

Referenced by SDL_expf().

◆ SDL_expf()

float SDL_expf ( float  x)

Definition at line 214 of file SDL_stdlib.c.

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

References SDL_exp().

◆ SDL_fabs()

double SDL_fabs ( double  x)

Definition at line 224 of file SDL_stdlib.c.

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

References fabs(), and SDL_uclibc_fabs().

Referenced by SDL_fabsf().

◆ SDL_fabsf()

float SDL_fabsf ( float  x)

Definition at line 234 of file SDL_stdlib.c.

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

References SDL_fabs().

◆ SDL_floor()

double SDL_floor ( double  x)

Definition at line 244 of file SDL_stdlib.c.

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

References floor(), and SDL_uclibc_floor().

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

◆ SDL_floorf()

float SDL_floorf ( float  x)

Definition at line 254 of file SDL_stdlib.c.

255 {
256 #if defined(HAVE_FLOORF)
257  return floorf(x);
258 #else
259  return (float)SDL_floor((double)x);
260 #endif
261 }

References SDL_floor().

◆ SDL_fmod()

double SDL_fmod ( double  x,
double  y 
)

Definition at line 288 of file SDL_stdlib.c.

289 {
290 #if defined(HAVE_FMOD)
291  return fmod(x, y);
292 #else
293  return SDL_uclibc_fmod(x, y);
294 #endif
295 }
double SDL_uclibc_fmod(double x, double y)

References SDL_uclibc_fmod().

Referenced by SDL_fmodf().

◆ SDL_fmodf()

float SDL_fmodf ( float  x,
float  y 
)

Definition at line 298 of file SDL_stdlib.c.

299 {
300 #if defined(HAVE_FMODF)
301  return fmodf(x, y);
302 #else
303  return (float)SDL_fmod((double)x, (double)y);
304 #endif
305 }
double SDL_fmod(double x, double y)
Definition: SDL_stdlib.c:288

References SDL_fmod().

◆ SDL_free()

void SDL_free ( void mem)

Definition at line 5425 of file SDL_malloc.c.

5426 {
5427  if (!ptr) {
5428  return;
5429  }
5430 
5431  s_mem.free_func(ptr);
5432  (void)SDL_AtomicDecRef(&s_mem.num_allocations);
5433 }
#define SDL_AtomicDecRef(a)
Decrement an atomic variable used as a reference count.
Definition: SDL_atomic.h:262
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
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr

References ptr, s_mem, SDL_AtomicDecRef, and void.

◆ SDL_getenv()

char* SDL_getenv ( const char *  name)

Definition at line 219 of file SDL_getenv.c.

220 {
221  size_t 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
#define SDL_strlen
static char ** SDL_env
Definition: SDL_getenv.c:108
GLuint const GLchar * name
GLsizei const GLfloat * value

References i, NULL, SDL_env, SDL_strlen, and SDL_strncmp.

Referenced by SDL_setenv().

◆ 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 5330 of file SDL_malloc.c.

5334 {
5335  if (malloc_func) {
5336  *malloc_func = s_mem.malloc_func;
5337  }
5338  if (calloc_func) {
5339  *calloc_func = s_mem.calloc_func;
5340  }
5341  if (realloc_func) {
5342  *realloc_func = s_mem.realloc_func;
5343  }
5344  if (free_func) {
5345  *free_func = s_mem.free_func;
5346  }
5347 }
SDL_malloc_func malloc_func
Definition: SDL_malloc.c:5321
SDL_calloc_func calloc_func
Definition: SDL_malloc.c:5322
SDL_realloc_func realloc_func
Definition: SDL_malloc.c:5323
SDL_free_func free_func
Definition: SDL_malloc.c:5324

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

◆ SDL_GetNumAllocations()

int SDL_GetNumAllocations ( void  )

Get the number of outstanding (unfreed) allocations.

Definition at line 676 of file SDL_dynapi_procs.h.

References s_mem, and 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.

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 }
#define UNICODE_BOM
Definition: SDL_iconv.c:95
#define UNKNOWN_UNICODE
Definition: SDL_iconv.c:98
#define ENCODING_UTF16NATIVE
Definition: SDL_iconv.c:118
#define ENCODING_UTF32NATIVE
Definition: SDL_iconv.c:119
@ ENCODING_UTF16
Definition: SDL_iconv.c:106
@ ENCODING_LATIN1
Definition: SDL_iconv.c:104
@ ENCODING_UCS2BE
Definition: SDL_iconv.c:112
@ ENCODING_UCS4LE
Definition: SDL_iconv.c:115
@ ENCODING_UCS2LE
Definition: SDL_iconv.c:113
@ ENCODING_ASCII
Definition: SDL_iconv.c:103
@ ENCODING_UCS4BE
Definition: SDL_iconv.c:114
@ ENCODING_UTF16BE
Definition: SDL_iconv.c:107
@ ENCODING_UTF32
Definition: SDL_iconv.c:109
@ ENCODING_UTF32LE
Definition: SDL_iconv.c:111
@ ENCODING_UTF8
Definition: SDL_iconv.c:105
@ ENCODING_UTF16LE
Definition: SDL_iconv.c:108
@ ENCODING_UTF32BE
Definition: SDL_iconv.c:110
#define UNKNOWN_ASCII
Definition: SDL_iconv.c:97
GLenum src
GLint left
GLenum GLenum dst
GLfloat GLfloat p
GLdouble n
#define SDL_ICONV_EINVAL
Definition: SDL_stdinc.h:565
uint16_t Uint16
Definition: SDL_stdinc.h:197
#define SDL_ICONV_E2BIG
Definition: SDL_stdinc.h:563

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().

◆ SDL_iconv_close()

int SDL_iconv_close ( SDL_iconv_t  cd)

Definition at line 854 of file SDL_iconv.c.

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

References SDL_free.

Referenced by SDL_iconv_string().

◆ SDL_iconv_open()

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

Definition at line 208 of file SDL_iconv.c.

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 }
#define SDL_malloc
#define SDL_strcasecmp
static struct @44 encodings[]
@ ENCODING_UNKNOWN
Definition: SDL_iconv.c:102
static const char * getlocale(char *buffer, size_t bufsize)
Definition: SDL_iconv.c:173
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:121

References ENCODING_UNKNOWN, encodings, getlocale(), i, SDL_arraysize, SDL_malloc, and SDL_strcasecmp.

Referenced by SDL_iconv_string().

◆ 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.

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 = (char *) 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  const size_t oldinbytesleft = inbytesleft;
902  retCode = SDL_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
903  switch (retCode) {
904  case SDL_ICONV_E2BIG:
905  {
906  char *oldstring = string;
907  stringsize *= 2;
908  string = (char *) SDL_realloc(string, stringsize);
909  if (!string) {
910  SDL_iconv_close(cd);
911  return NULL;
912  }
913  outbuf = string + (outbuf - oldstring);
914  outbytesleft = stringsize - (outbuf - string);
915  SDL_memset(outbuf, 0, 4);
916  }
917  break;
918  case SDL_ICONV_EILSEQ:
919  /* Try skipping some input data - not perfect, but... */
920  ++inbuf;
921  --inbytesleft;
922  break;
923  case SDL_ICONV_EINVAL:
924  case SDL_ICONV_ERROR:
925  /* We can't continue... */
926  inbytesleft = 0;
927  break;
928  }
929  /* Avoid infinite loops when nothing gets converted */
930  if (oldinbytesleft == inbytesleft)
931  {
932  break;
933  }
934  }
935  SDL_iconv_close(cd);
936 
937  return string;
938 }
#define SDL_memset
#define SDL_realloc
SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
Definition: SDL_iconv.c:208
size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: SDL_iconv.c:248
int SDL_iconv_close(SDL_iconv_t cd)
Definition: SDL_iconv.c:854
GLsizei const GLchar *const * string
#define SDL_ICONV_ERROR
Definition: SDL_stdinc.h:562
#define SDL_ICONV_EILSEQ
Definition: SDL_stdinc.h:564

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.

◆ SDL_isdigit()

int SDL_isdigit ( int  x)

Definition at line 470 of file SDL_stdlib.c.

470 { return ((x) >= '0') && ((x) <= '9'); }

◆ SDL_islower()

int SDL_islower ( int  x)

Definition at line 473 of file SDL_stdlib.c.

473 { return ((x) >= 'a') && ((x) <= 'z'); }

◆ SDL_isspace()

int SDL_isspace ( int  x)

Definition at line 471 of file SDL_stdlib.c.

471 { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n') || ((x) == '\f') || ((x) == '\v'); }

◆ SDL_isupper()

int SDL_isupper ( int  x)

Definition at line 472 of file SDL_stdlib.c.

472 { return ((x) >= 'A') && ((x) <= 'Z'); }

◆ SDL_itoa()

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

Definition at line 819 of file SDL_string.c.

820 {
821 #ifdef HAVE_ITOA
822  return itoa(value, string, radix);
823 #else
824  return SDL_ltoa((long)value, string, radix);
825 #endif /* HAVE_ITOA */
826 }
char * SDL_ltoa(long value, char *string, int radix)
Definition: SDL_string.c:839

References SDL_ltoa().

◆ SDL_lltoa()

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

Definition at line 883 of file SDL_string.c.

884 {
885 #if defined(HAVE__I64TOA)
886  return _i64toa(value, string, radix);
887 #else
888  char *bufp = string;
889 
890  if (value < 0) {
891  *bufp++ = '-';
892  SDL_ulltoa(-value, bufp, radix);
893  } else {
894  SDL_ulltoa(value, bufp, radix);
895  }
896 
897  return string;
898 #endif /* HAVE__I64TOA */
899 }
char * SDL_ulltoa(Uint64 value, char *string, int radix)
Definition: SDL_string.c:902

References SDL_ulltoa().

Referenced by SDL_PrintLongLong().

◆ SDL_log()

double SDL_log ( double  x)

Definition at line 308 of file SDL_stdlib.c.

309 {
310 #if defined(HAVE_LOG)
311  return log(x);
312 #else
313  return SDL_uclibc_log(x);
314 #endif
315 }
double SDL_uclibc_log(double x)

References SDL_uclibc_log().

Referenced by SDL_logf().

◆ SDL_log10()

double SDL_log10 ( double  x)

Definition at line 328 of file SDL_stdlib.c.

329 {
330 #if defined(HAVE_LOG10)
331  return log10(x);
332 #else
333  return SDL_uclibc_log10(x);
334 #endif
335 }
double SDL_uclibc_log10(double x)

References SDL_uclibc_log10().

Referenced by SDL_log10f().

◆ SDL_log10f()

float SDL_log10f ( float  x)

Definition at line 338 of file SDL_stdlib.c.

339 {
340 #if defined(HAVE_LOG10F)
341  return log10f(x);
342 #else
343  return (float)SDL_log10((double)x);
344 #endif
345 }
double SDL_log10(double x)
Definition: SDL_stdlib.c:328

References SDL_log10().

◆ SDL_logf()

float SDL_logf ( float  x)

Definition at line 318 of file SDL_stdlib.c.

319 {
320 #if defined(HAVE_LOGF)
321  return logf(x);
322 #else
323  return (float)SDL_log((double)x);
324 #endif
325 }
double SDL_log(double x)
Definition: SDL_stdlib.c:308

References SDL_log().

◆ SDL_ltoa()

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

Definition at line 839 of file SDL_string.c.

840 {
841 #if defined(HAVE__LTOA)
842  return _ltoa(value, string, radix);
843 #else
844  char *bufp = string;
845 
846  if (value < 0) {
847  *bufp++ = '-';
848  SDL_ultoa(-value, bufp, radix);
849  } else {
850  SDL_ultoa(value, bufp, radix);
851  }
852 
853  return string;
854 #endif /* HAVE__LTOA */
855 }
char * SDL_ultoa(unsigned long value, char *string, int radix)
Definition: SDL_string.c:858

References SDL_ultoa().

Referenced by SDL_itoa(), and SDL_PrintLong().

◆ SDL_malloc()

void* SDL_malloc ( size_t  size)

Definition at line 5379 of file SDL_malloc.c.

5380 {
5381  void *mem;
5382 
5383  if (!size) {
5384  size = 1;
5385  }
5386 
5387  mem = s_mem.malloc_func(size);
5388  if (mem) {
5389  SDL_AtomicIncRef(&s_mem.num_allocations);
5390  }
5391  return mem;
5392 }

References s_mem, and SDL_AtomicIncRef.

◆ SDL_memcmp()

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

Definition at line 392 of file SDL_string.c.

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 }
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.

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 }
#define memcpy
Definition: SDL_malloc.c:630

References memcpy.

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

◆ 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 634 of file SDL_stdinc.h.

635 {
636  return SDL_memcpy(dst, src, dwords * 4);
637 }
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315

References SDL_memcpy().

◆ 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.

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 }
#define memmove
Definition: SDL_qsort.c:58

References memmove.

Referenced by SDL_IntPrecisionAdjust().

◆ 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.

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 }
#define memset
Definition: SDL_malloc.c:627
const GLubyte * c

References memset.

Referenced by SDL_IntPrecisionAdjust(), SDL_PrintFloat(), and SDL_PrintString().

◆ SDL_memset4()

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

Definition at line 431 of file SDL_stdinc.h.

432 {
433 #ifdef __APPLE__
434  memset_pattern4(dst, &val, dwords * 4);
435 #elif defined(__GNUC__) && defined(i386)
436  int u0, u1, u2;
437  __asm__ __volatile__ (
438  "cld \n\t"
439  "rep ; stosl \n\t"
440  : "=&D" (u0), "=&a" (u1), "=&c" (u2)
441  : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
442  : "memory"
443  );
444 #else
445  size_t _n = (dwords + 3) / 4;
446  Uint32 *_p = SDL_static_cast(Uint32 *, dst);
447  Uint32 _val = (val);
448  if (dwords == 0)
449  return;
450  switch (dwords % 4)
451  {
452  case 0: do { *_p++ = _val; /* fallthrough */
453  case 3: *_p++ = _val; /* fallthrough */
454  case 2: *_p++ = _val; /* fallthrough */
455  case 1: *_p++ = _val; /* fallthrough */
456  } while ( --_n );
457  }
458 #endif
459 }
GLfixed u1
GLfixed GLfixed u2

References SDL_static_cast.

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

◆ SDL_pow()

double SDL_pow ( double  x,
double  y 
)

Definition at line 348 of file SDL_stdlib.c.

349 {
350 #if defined(HAVE_POW)
351  return pow(x, y);
352 #else
353  return SDL_uclibc_pow(x, y);
354 #endif
355 }
double SDL_uclibc_pow(double x, double y)

References SDL_uclibc_pow().

Referenced by SDL_powf().

◆ SDL_powf()

float SDL_powf ( float  x,
float  y 
)

Definition at line 358 of file SDL_stdlib.c.

359 {
360 #if defined(HAVE_POWF)
361  return powf(x, y);
362 #else
363  return (float)SDL_pow((double)x, (double)y);
364 #endif
365 }
double SDL_pow(double x, double y)
Definition: SDL_stdlib.c:348

References SDL_pow().

◆ 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 5410 of file SDL_malloc.c.

5411 {
5412  void *mem;
5413 
5414  if (!ptr && !size) {
5415  size = 1;
5416  }
5417 
5418  mem = s_mem.realloc_func(ptr, size);
5419  if (mem && !ptr) {
5420  SDL_AtomicIncRef(&s_mem.num_allocations);
5421  }
5422  return mem;
5423 }

References ptr, s_mem, and SDL_AtomicIncRef.

◆ SDL_scalbn()

double SDL_scalbn ( double  x,
int  n 
)

Definition at line 368 of file SDL_stdlib.c.

369 {
370 #if defined(HAVE_SCALBN)
371  return scalbn(x, n);
372 #elif defined(HAVE__SCALB)
373  return _scalb(x, n);
374 #elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2)
375 /* from scalbn(3): If FLT_RADIX equals 2 (which is
376  * usual), then scalbn() is equivalent to ldexp(3). */
377  return ldexp(x, n);
378 #else
379  return SDL_uclibc_scalbn(x, n);
380 #endif
381 }
double SDL_uclibc_scalbn(double x, int n)
#define scalbn
Definition: math_private.h:46

References scalbn, and SDL_uclibc_scalbn().

Referenced by SDL_scalbnf().

◆ SDL_scalbnf()

float SDL_scalbnf ( float  x,
int  n 
)

Definition at line 384 of file SDL_stdlib.c.

385 {
386 #if defined(HAVE_SCALBNF)
387  return scalbnf(x, n);
388 #else
389  return (float)SDL_scalbn((double)x, n);
390 #endif
391 }
double SDL_scalbn(double x, int n)
Definition: SDL_stdlib.c:368

References SDL_scalbn().

◆ SDL_setenv()

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

Definition at line 110 of file SDL_getenv.c.

111 {
112  int added;
113  size_t 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 }
#define SDL_strchr
#define SDL_snprintf
char * SDL_getenv(const char *name)
Definition: SDL_getenv.c:219

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

◆ 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 5349 of file SDL_malloc.c.

5353 {
5354  if (!malloc_func) {
5355  return SDL_InvalidParamError("malloc_func");
5356  }
5357  if (!calloc_func) {
5358  return SDL_InvalidParamError("calloc_func");
5359  }
5360  if (!realloc_func) {
5361  return SDL_InvalidParamError("realloc_func");
5362  }
5363  if (!free_func) {
5364  return SDL_InvalidParamError("free_func");
5365  }
5366 
5367  s_mem.malloc_func = malloc_func;
5368  s_mem.calloc_func = calloc_func;
5369  s_mem.realloc_func = realloc_func;
5370  s_mem.free_func = free_func;
5371  return 0;
5372 }
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:90

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

◆ SDL_sin()

double SDL_sin ( double  x)

Definition at line 394 of file SDL_stdlib.c.

395 {
396 #if defined(HAVE_SIN)
397  return sin(x);
398 #else
399  return SDL_uclibc_sin(x);
400 #endif
401 }
double SDL_uclibc_sin(double x)
double sin(double x)
Definition: s_sin.c:46

References SDL_uclibc_sin(), and sin().

Referenced by SDL_sinf().

◆ SDL_sinf()

float SDL_sinf ( float  x)

Definition at line 404 of file SDL_stdlib.c.

405 {
406 #if defined(HAVE_SINF)
407  return sinf(x);
408 #else
409  return (float)SDL_sin((double)x);
410 #endif
411 }
double SDL_sin(double x)
Definition: SDL_stdlib.c:394

References SDL_sin().

◆ 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 1443 of file SDL_string.c.

1444 {
1445  va_list ap;
1446  int retval;
1447 
1448  va_start(ap, fmt);
1449  retval = SDL_vsnprintf(text, maxlen, fmt, ap);
1450  va_end(ap);
1451 
1452  return retval;
1453 }
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
Definition: SDL_string.c:1730
SDL_bool retval
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47

References retval, SDL_vsnprintf(), and text.

◆ SDL_sqrt()

double SDL_sqrt ( double  x)

Definition at line 414 of file SDL_stdlib.c.

415 {
416 #if defined(HAVE_SQRT)
417  return sqrt(x);
418 #else
419  return SDL_uclibc_sqrt(x);
420 #endif
421 }
double SDL_uclibc_sqrt(double x)

References SDL_uclibc_sqrt().

Referenced by SDL_acos(), and SDL_sqrtf().

◆ SDL_sqrtf()

float SDL_sqrtf ( float  x)

Definition at line 424 of file SDL_stdlib.c.

425 {
426 #if defined(HAVE_SQRTF)
427  return sqrtf(x);
428 #else
429  return (float)SDL_sqrt((double)x);
430 #endif
431 }

References SDL_sqrt().

◆ SDL_sscanf()

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

Definition at line 1151 of file SDL_string.c.

1152 {
1153  int rc;
1154  va_list ap;
1155  va_start(ap, fmt);
1156  rc = SDL_vsscanf(text, fmt, ap);
1157  va_end(ap);
1158  return rc;
1159 }
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
Definition: SDL_string.c:1169

References SDL_vsscanf(), and text.

◆ SDL_strcasecmp()

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

Definition at line 1098 of file SDL_string.c.

1099 {
1100 #ifdef HAVE_STRCASECMP
1101  return strcasecmp(str1, str2);
1102 #elif defined(HAVE__STRICMP)
1103  return _stricmp(str1, str2);
1104 #else
1105  char a = 0;
1106  char b = 0;
1107  while (*str1 && *str2) {
1108  a = SDL_toupper((unsigned char) *str1);
1109  b = SDL_toupper((unsigned char) *str2);
1110  if (a != b)
1111  break;
1112  ++str1;
1113  ++str2;
1114  }
1115  a = SDL_toupper(*str1);
1116  b = SDL_toupper(*str2);
1117  return (int) ((unsigned char) a - (unsigned char) b);
1118 #endif /* HAVE_STRCASECMP */
1119 }
#define SDL_toupper
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a

References SDL_toupper.

◆ SDL_strchr()

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

Definition at line 755 of file SDL_string.c.

756 {
757 #ifdef HAVE_STRCHR
758  return SDL_const_cast(char*,strchr(string, c));
759 #elif defined(HAVE_INDEX)
760  return SDL_const_cast(char*,index(string, c));
761 #else
762  while (*string) {
763  if (*string == c) {
764  return (char *) string;
765  }
766  ++string;
767  }
768  return NULL;
769 #endif /* HAVE_STRCHR */
770 }
GLuint index
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:145

References NULL, and SDL_const_cast.

◆ SDL_strcmp()

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

Definition at line 1062 of file SDL_string.c.

1063 {
1064 #if defined(HAVE_STRCMP)
1065  return strcmp(str1, str2);
1066 #else
1067  while (*str1 && *str2) {
1068  if (*str1 != *str2)
1069  break;
1070  ++str1;
1071  ++str2;
1072  }
1073  return (int)((unsigned char) *str1 - (unsigned char) *str2);
1074 #endif /* HAVE_STRCMP */
1075 }

◆ SDL_strdup()

char* SDL_strdup ( const char *  str)

Definition at line 695 of file SDL_string.c.

696 {
697  size_t len = SDL_strlen(string) + 1;
698  char *newstr = (char *)SDL_malloc(len);
699  if (newstr) {
700  SDL_memcpy(newstr, string, len);
701  }
702  return newstr;
703 }
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

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

◆ SDL_strlcat()

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

Definition at line 680 of file SDL_string.c.

681 {
682 #if defined(HAVE_STRLCAT)
683  return strlcat(dst, src, maxlen);
684 #else
685  size_t dstlen = SDL_strlen(dst);
686  size_t srclen = SDL_strlen(src);
687  if (dstlen < maxlen) {
688  SDL_strlcpy(dst + dstlen, src, maxlen - dstlen);
689  }
690  return dstlen + srclen;
691 #endif /* HAVE_STRLCAT */
692 }
size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:614

References SDL_strlcpy(), and SDL_strlen().

◆ SDL_strlcpy()

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

Definition at line 614 of file SDL_string.c.

615 {
616 #if defined(HAVE_STRLCPY)
617  return strlcpy(dst, src, maxlen);
618 #else
619  size_t srclen = SDL_strlen(src);
620  if (maxlen > 0) {
621  size_t len = SDL_min(srclen, maxlen - 1);
622  SDL_memcpy(dst, src, len);
623  dst[len] = '\0';
624  }
625  return srclen;
626 #endif /* HAVE_STRLCPY */
627 }
#define SDL_min(x, y)
Definition: SDL_stdinc.h:412

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

Referenced by SDL_PrintString(), and SDL_strlcat().

◆ SDL_strlen()

size_t SDL_strlen ( const char *  str)

Definition at line 411 of file SDL_string.c.

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 }

Referenced by SDL_IntPrecisionAdjust(), 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().

◆ SDL_strlwr()

char* SDL_strlwr ( char *  str)

Definition at line 740 of file SDL_string.c.

741 {
742 #if defined(HAVE__STRLWR)
743  return _strlwr(string);
744 #else
745  char *bufp = string;
746  while (*bufp) {
747  *bufp = SDL_tolower((unsigned char) *bufp);
748  ++bufp;
749  }
750  return string;
751 #endif /* HAVE__STRLWR */
752 }
#define SDL_tolower

References SDL_tolower.

Referenced by SDL_PrintString().

◆ SDL_strncasecmp()

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

Definition at line 1122 of file SDL_string.c.

1123 {
1124 #ifdef HAVE_STRNCASECMP
1125  return strncasecmp(str1, str2, maxlen);
1126 #elif defined(HAVE__STRNICMP)
1127  return _strnicmp(str1, str2, maxlen);
1128 #else
1129  char a = 0;
1130  char b = 0;
1131  while (*str1 && *str2 && maxlen) {
1132  a = SDL_tolower((unsigned char) *str1);
1133  b = SDL_tolower((unsigned char) *str2);
1134  if (a != b)
1135  break;
1136  ++str1;
1137  ++str2;
1138  --maxlen;
1139  }
1140  if (maxlen == 0) {
1141  return 0;
1142  } else {
1143  a = SDL_tolower((unsigned char) *str1);
1144  b = SDL_tolower((unsigned char) *str2);
1145  return (int) ((unsigned char) a - (unsigned char) b);
1146  }
1147 #endif /* HAVE_STRNCASECMP */
1148 }

References SDL_tolower.

◆ SDL_strncmp()

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

Definition at line 1078 of file SDL_string.c.

1079 {
1080 #if defined(HAVE_STRNCMP)
1081  return strncmp(str1, str2, maxlen);
1082 #else
1083  while (*str1 && *str2 && maxlen) {
1084  if (*str1 != *str2)
1085  break;
1086  ++str1;
1087  ++str2;
1088  --maxlen;
1089  }
1090  if (!maxlen) {
1091  return 0;
1092  }
1093  return (int) ((unsigned char) *str1 - (unsigned char) *str2);
1094 #endif /* HAVE_STRNCMP */
1095 }

Referenced by 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().

◆ SDL_strrchr()

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

Definition at line 773 of file SDL_string.c.

774 {
775 #ifdef HAVE_STRRCHR
776  return SDL_const_cast(char*,strrchr(string, c));
777 #elif defined(HAVE_RINDEX)
778  return SDL_const_cast(char*,rindex(string, c));
779 #else
780  const char *bufp = string + SDL_strlen(string) - 1;
781  while (bufp >= string) {
782  if (*bufp == c) {
783  return (char *) bufp;
784  }
785  --bufp;
786  }
787  return NULL;
788 #endif /* HAVE_STRRCHR */
789 }

References NULL, SDL_const_cast, and SDL_strlen().

◆ SDL_strrev()

char* SDL_strrev ( char *  str)

Definition at line 706 of file SDL_string.c.

707 {
708 #if defined(HAVE__STRREV)
709  return _strrev(string);
710 #else
711  size_t len = SDL_strlen(string);
712  char *a = &string[0];
713  char *b = &string[len - 1];
714  len /= 2;
715  while (len--) {
716  char c = *a;
717  *a++ = *b;
718  *b-- = c;
719  }
720  return string;
721 #endif /* HAVE__STRREV */
722 }

References SDL_strlen().

Referenced by SDL_ulltoa(), and SDL_ultoa().

◆ SDL_strstr()

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

Definition at line 792 of file SDL_string.c.

793 {
794 #if defined(HAVE_STRSTR)
795  return SDL_const_cast(char*,strstr(haystack, needle));
796 #else
797  size_t length = SDL_strlen(needle);
798  while (*haystack) {
799  if (SDL_strncmp(haystack, needle, length) == 0) {
800  return (char *) haystack;
801  }
802  ++haystack;
803  }
804  return NULL;
805 #endif /* HAVE_STRSTR */
806 }
GLuint GLsizei GLsizei * length
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:1078

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

◆ SDL_strtod()

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

Definition at line 1045 of file SDL_string.c.

1046 {
1047 #if defined(HAVE_STRTOD)
1048  return strtod(string, endp);
1049 #else
1050  size_t len;
1051  double value = 0.0;
1052 
1053  len = SDL_ScanFloat(string, &value);
1054  if (endp) {
1055  *endp = (char *) string + len;
1056  }
1057  return value;
1058 #endif /* HAVE_STRTOD */
1059 }
static size_t SDL_ScanFloat(const char *text, double *valuep)
Definition: SDL_string.c:231

References SDL_ScanFloat().

Referenced by SDL_atof().

◆ SDL_strtokr()

char* SDL_strtokr ( char *  s1,
const char *  s2,
char **  saveptr 
)

Definition at line 29 of file SDL_strtokr.c.

30 {
31 #if defined(HAVE_STRTOK_R)
32  return strtok_r(s1, s2, ptr);
33 
34 #elif defined(_MSC_VER) && defined(HAVE_STRTOK_S)
35  return strtok_s(s1, s2, ptr);
36 
37 #else /* SDL implementation */
38 /*
39  * Adapted from _PDCLIB_strtok() of PDClib library at
40  * https://github.com/DevSolar/pdclib.git
41  *
42  * The code was under CC0 license:
43  * https://creativecommons.org/publicdomain/zero/1.0/legalcode :
44  *
45  * No Copyright
46  *
47  * The person who associated a work with this deed has dedicated the
48  * work to the public domain by waiving all of his or her rights to
49  * the work worldwide under copyright law, including all related and
50  * neighboring rights, to the extent allowed by law.
51  *
52  * You can copy, modify, distribute and perform the work, even for
53  * commercial purposes, all without asking permission. See Other
54  * Information below.
55  */
56  const char *p = s2;
57 
58  if (!s2 || !ptr || (!s1 && !*ptr)) return NULL;
59 
60  if (s1 != NULL) { /* new string */
61  *ptr = s1;
62  } else { /* old string continued */
63  if (*ptr == NULL) {
64  /* No old string, no new string, nothing to do */
65  return NULL;
66  }
67  s1 = *ptr;
68  }
69 
70  /* skip leading s2 characters */
71  while (*p && *s1) {
72  if (*s1 == *p) {
73  /* found separator; skip and start over */
74  ++s1;
75  p = s2;
76  continue;
77  }
78  ++p;
79  }
80 
81  if (! *s1) { /* no more to parse */
82  *ptr = s1;
83  return NULL;
84  }
85 
86  /* skipping non-s2 characters */
87  *ptr = s1;
88  while (**ptr) {
89  p = s2;
90  while (*p) {
91  if (**ptr == *p++) {
92  /* found separator; overwrite with '\0', position *ptr, return */
93  *((*ptr)++) = '\0';
94  return s1;
95  }
96  }
97  ++(*ptr);
98  }
99 
100  /* parsed to end of string */
101  return s1;
102 #endif
103 }

References NULL, and ptr.

◆ SDL_strtol()

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

Definition at line 945 of file SDL_string.c.

946 {
947 #if defined(HAVE_STRTOL)
948  return strtol(string, endp, base);
949 #else
950  size_t len;
951  long value = 0;
952 
953  if (!base) {
954  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
955  base = 16;
956  } else {
957  base = 10;
958  }
959  }
960 
961  len = SDL_ScanLong(string, base, &value);
962  if (endp) {
963  *endp = (char *) string + len;
964  }
965  return value;
966 #endif /* HAVE_STRTOL */
967 }
static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
Definition: SDL_string.c:53
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst base

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

Referenced by SDL_atoi(), and SDL_vsnprintf().

◆ SDL_strtoll()

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

Definition at line 995 of file SDL_string.c.

996 {
997 #if defined(HAVE_STRTOLL)
998  return strtoll(string, endp, base);
999 #else
1000  size_t len;
1001  Sint64 value = 0;
1002 
1003  if (!base) {
1004  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
1005  base = 16;
1006  } else {
1007  base = 10;
1008  }
1009  }
1010 
1011  len = SDL_ScanLongLong(string, base, &value);
1012  if (endp) {
1013  *endp = (char *) string + len;
1014  }
1015  return value;
1016 #endif /* HAVE_STRTOLL */
1017 }
int64_t Sint64
Definition: SDL_stdinc.h:216
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
Definition: SDL_string.c:158

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

◆ SDL_strtoul()

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

Definition at line 970 of file SDL_string.c.

971 {
972 #if defined(HAVE_STRTOUL)
973  return strtoul(string, endp, base);
974 #else
975  size_t len;
976  unsigned long value = 0;
977 
978  if (!base) {
979  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
980  base = 16;
981  } else {
982  base = 10;
983  }
984  }
985 
986  len = SDL_ScanUnsignedLong(string, base, &value);
987  if (endp) {
988  *endp = (char *) string + len;
989  }
990  return value;
991 #endif /* HAVE_STRTOUL */
992 }
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
Definition: SDL_string.c:94

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

◆ SDL_strtoull()

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

Definition at line 1020 of file SDL_string.c.

1021 {
1022 #if defined(HAVE_STRTOULL)
1023  return strtoull(string, endp, base);
1024 #else
1025  size_t len;
1026  Uint64 value = 0;
1027 
1028  if (!base) {
1029  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
1030  base = 16;
1031  } else {
1032  base = 10;
1033  }
1034  }
1035 
1036  len = SDL_ScanUnsignedLongLong(string, base, &value);
1037  if (endp) {
1038  *endp = (char *) string + len;
1039  }
1040  return value;
1041 #endif /* HAVE_STRTOULL */
1042 }
uint64_t Uint64
Definition: SDL_stdinc.h:222
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
Definition: SDL_string.c:199

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

◆ SDL_strupr()

char* SDL_strupr ( char *  str)

Definition at line 725 of file SDL_string.c.

726 {
727 #if defined(HAVE__STRUPR)
728  return _strupr(string);
729 #else
730  char *bufp = string;
731  while (*bufp) {
732  *bufp = SDL_toupper((unsigned char) *bufp);
733  ++bufp;
734  }
735  return string;
736 #endif /* HAVE__STRUPR */
737 }

References SDL_toupper.

Referenced by SDL_PrintString().

◆ SDL_tan()

double SDL_tan ( double  x)

Definition at line 434 of file SDL_stdlib.c.

435 {
436 #if defined(HAVE_TAN)
437  return tan(x);
438 #else
439  return SDL_uclibc_tan(x);
440 #endif
441 }
double SDL_uclibc_tan(double x)
double tan(double x)
Definition: s_tan.c:45

References SDL_uclibc_tan(), and tan().

Referenced by SDL_tanf().

◆ SDL_tanf()

float SDL_tanf ( float  x)

Definition at line 444 of file SDL_stdlib.c.

445 {
446 #if defined(HAVE_TANF)
447  return tanf(x);
448 #else
449  return (float)SDL_tan((double)x);
450 #endif
451 }
double SDL_tan(double x)
Definition: SDL_stdlib.c:434

References SDL_tan().

◆ SDL_tolower()

int SDL_tolower ( int  x)

Definition at line 475 of file SDL_stdlib.c.

475 { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }

◆ SDL_toupper()

int SDL_toupper ( int  x)

Definition at line 474 of file SDL_stdlib.c.

474 { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }

◆ SDL_trunc()

double SDL_trunc ( double  x)

Definition at line 264 of file SDL_stdlib.c.

265 {
266 #if defined(HAVE_TRUNC)
267  return trunc(x);
268 #else
269  if (x >= 0.0f) {
270  return SDL_floor(x);
271  } else {
272  return SDL_ceil(x);
273  }
274 #endif
275 }

References SDL_ceil(), and SDL_floor().

Referenced by SDL_truncf().

◆ SDL_truncf()

float SDL_truncf ( float  x)

Definition at line 278 of file SDL_stdlib.c.

279 {
280 #if defined(HAVE_TRUNCF)
281  return truncf(x);
282 #else
283  return (float)SDL_trunc((double)x);
284 #endif
285 }
double SDL_trunc(double x)
Definition: SDL_stdlib.c:264

References SDL_trunc().

◆ SDL_uitoa()

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

Definition at line 829 of file SDL_string.c.

830 {
831 #ifdef HAVE__UITOA
832  return _uitoa(value, string, radix);
833 #else
834  return SDL_ultoa((unsigned long)value, string, radix);
835 #endif /* HAVE__UITOA */
836 }

References SDL_ultoa().

◆ SDL_ulltoa()

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

Definition at line 902 of file SDL_string.c.

903 {
904 #if defined(HAVE__UI64TOA)
905  return _ui64toa(value, string, radix);
906 #else
907  char *bufp = string;
908 
909  if (value) {
910  while (value > 0) {
911  *bufp++ = ntoa_table[value % radix];
912  value /= radix;
913  }
914  } else {
915  *bufp++ = '0';
916  }
917  *bufp = '\0';
918 
919  /* The numbers went into the string backwards. :) */
920  SDL_strrev(string);
921 
922  return string;
923 #endif /* HAVE__UI64TOA */
924 }
char * SDL_strrev(char *string)
Definition: SDL_string.c:706
static const char ntoa_table[]
Definition: SDL_string.c:810

References ntoa_table, and SDL_strrev().

Referenced by SDL_lltoa(), and SDL_PrintUnsignedLongLong().

◆ SDL_ultoa()

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

Definition at line 858 of file SDL_string.c.

859 {
860 #if defined(HAVE__ULTOA)
861  return _ultoa(value, string, radix);
862 #else
863  char *bufp = string;
864 
865  if (value) {
866  while (value > 0) {
867  *bufp++ = ntoa_table[value % radix];
868  value /= radix;
869  }
870  } else {
871  *bufp++ = '0';
872  }
873  *bufp = '\0';
874 
875  /* The numbers went into the string backwards. :) */
876  SDL_strrev(string);
877 
878  return string;
879 #endif /* HAVE__ULTOA */
880 }

References ntoa_table, and SDL_strrev().

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

◆ SDL_utf8strlcpy()

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

Definition at line 630 of file SDL_string.c.

631 {
632  size_t src_bytes = SDL_strlen(src);
633  size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
634  size_t i = 0;
635  char trailing_bytes = 0;
636  if (bytes)
637  {
638  unsigned char c = (unsigned char)src[bytes - 1];
639  if (UTF8_IsLeadByte(c))
640  --bytes;
641  else if (UTF8_IsTrailingByte(c))
642  {
643  for (i = bytes - 1; i != 0; --i)
644  {
645  c = (unsigned char)src[i];
646  trailing_bytes = UTF8_TrailingBytes(c);
647  if (trailing_bytes)
648  {
649  if (bytes - i != trailing_bytes + 1)
650  bytes = i;
651 
652  break;
653  }
654  }
655  }
656  SDL_memcpy(dst, src, bytes);
657  }
658  dst[bytes] = '\0';
659  return bytes;
660 }
static int UTF8_TrailingBytes(unsigned char c)
Definition: SDL_string.c:39
#define UTF8_IsTrailingByte(c)
Definition: SDL_string.c:37
#define UTF8_IsLeadByte(c)
Definition: SDL_string.c:36

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

◆ SDL_utf8strlen()

size_t SDL_utf8strlen ( const char *  str)

Definition at line 663 of file SDL_string.c.

664 {
665  size_t retval = 0;
666  const char *p = str;
667  char ch;
668 
669  while ((ch = *(p++)) != 0) {
670  /* if top two bits are 1 and 0, it's a continuation byte. */
671  if ((ch & 0xc0) != 0x80) {
672  retval++;
673  }
674  }
675 
676  return retval;
677 }

References 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 1730 of file SDL_string.c.

1731 {
1732  size_t left = maxlen;
1733  char *textstart = text;
1734 
1735  if (!fmt) {
1736  fmt = "";
1737  }
1738  while (*fmt && left > 1) {
1739  if (*fmt == '%') {
1741  size_t len = 0;
1742  SDL_bool check_flag;
1743  SDL_FormatInfo info;
1744  enum
1745  {
1746  DO_INT,
1747  DO_LONG,
1748  DO_LONGLONG
1749  } inttype = DO_INT;
1750 
1751  SDL_zero(info);
1752  info.radix = 10;
1753  info.precision = -1;
1754 
1755  check_flag = SDL_TRUE;
1756  while (check_flag) {
1757  ++fmt;
1758  switch (*fmt) {
1759  case '-':
1760  info.left_justify = SDL_TRUE;
1761  break;
1762  case '+':
1763  info.force_sign = SDL_TRUE;
1764  break;
1765  case '#':
1766  info.force_type = SDL_TRUE;
1767  break;
1768  case '0':
1769  info.pad_zeroes = SDL_TRUE;
1770  break;
1771  default:
1772  check_flag = SDL_FALSE;
1773  break;
1774  }
1775  }
1776 
1777  if (*fmt >= '0' && *fmt <= '9') {
1778  info.width = SDL_strtol(fmt, (char **)&fmt, 0);
1779  }
1780  else if (*fmt == '*') {
1781  ++fmt;
1782  info.width = va_arg(ap, int);
1783  }
1784 
1785  if (*fmt == '.') {
1786  ++fmt;
1787  if (*fmt >= '0' && *fmt <= '9') {
1788  info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
1789  } else if (*fmt == '*') {
1790  ++fmt;
1791  info.precision = va_arg(ap, int);
1792  } else {
1793  info.precision = 0;
1794  }
1795  if (info.precision < 0) {
1796  info.precision = 0;
1797  }
1798  }
1799 
1800  while (!done) {
1801  switch (*fmt) {
1802  case '%':
1803  if (left > 1) {
1804  *text = '%';
1805  }
1806  len = 1;
1807  done = SDL_TRUE;
1808  break;
1809  case 'c':
1810  /* char is promoted to int when passed through (...) */
1811  if (left > 1) {
1812  *text = (char) va_arg(ap, int);
1813  }
1814  len = 1;
1815  done = SDL_TRUE;
1816  break;
1817  case 'h':
1818  /* short is promoted to int when passed through (...) */
1819  break;
1820  case 'l':
1821  if (inttype < DO_LONGLONG) {
1822  ++inttype;
1823  }
1824  break;
1825  case 'I':
1826  if (SDL_strncmp(fmt, "I64", 3) == 0) {
1827  fmt += 2;
1828  inttype = DO_LONGLONG;
1829  }
1830  break;
1831  case 'i':
1832  case 'd':
1833  if (info.precision >= 0) {
1834  info.pad_zeroes = SDL_FALSE;
1835  }
1836  switch (inttype) {
1837  case DO_INT:
1838  len = SDL_PrintLong(text, left, &info,
1839  (long) va_arg(ap, int));
1840  break;
1841  case DO_LONG:
1842  len = SDL_PrintLong(text, left, &info,
1843  va_arg(ap, long));
1844  break;
1845  case DO_LONGLONG:
1846  len = SDL_PrintLongLong(text, left, &info,
1847  va_arg(ap, Sint64));
1848  break;
1849  }
1850  done = SDL_TRUE;
1851  break;
1852  case 'p':
1853  case 'x':
1854  info.force_case = SDL_CASE_LOWER;
1855  /* Fall through to 'X' handling */
1856  case 'X':
1857  if (info.force_case == SDL_CASE_NOCHANGE) {
1858  info.force_case = SDL_CASE_UPPER;
1859  }
1860  if (info.radix == 10) {
1861  info.radix = 16;
1862  }
1863  if (*fmt == 'p') {
1864  inttype = DO_LONG;
1865  }
1866  /* Fall through to unsigned handling */
1867  case 'o':
1868  if (info.radix == 10) {
1869  info.radix = 8;
1870  }
1871  /* Fall through to unsigned handling */
1872  case 'u':
1873  info.force_sign = SDL_FALSE;
1874  if (info.precision >= 0) {
1875  info.pad_zeroes = SDL_FALSE;
1876  }
1877  switch (inttype) {
1878  case DO_INT:
1879  len = SDL_PrintUnsignedLong(text, left, &info,
1880  (unsigned long)
1881  va_arg(ap, unsigned int));
1882  break;
1883  case DO_LONG:
1884  len = SDL_PrintUnsignedLong(text, left, &info,
1885  va_arg(ap, unsigned long));
1886  break;
1887  case DO_LONGLONG:
1889  va_arg(ap, Uint64));
1890  break;
1891  }
1892  done = SDL_TRUE;
1893  break;
1894  case 'f':
1895  len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
1896  done = SDL_TRUE;
1897  break;
1898  case 'S':
1899  {
1900  /* In practice this is used on Windows for WCHAR strings */
1901  wchar_t *wide_arg = va_arg(ap, wchar_t *);
1902  if (wide_arg) {
1903  char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
1904  info.pad_zeroes = SDL_FALSE;
1905  len = SDL_PrintString(text, left, &info, arg);
1906  SDL_free(arg);
1907  } else {
1908  info.pad_zeroes = SDL_FALSE;
1909  len = SDL_PrintString(text, left, &info, NULL);
1910  }
1911  done = SDL_TRUE;
1912  }
1913  break;
1914  case 's':
1915  info.pad_zeroes = SDL_FALSE;
1916  len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
1917  done = SDL_TRUE;
1918  break;
1919  default:
1920  done = SDL_TRUE;
1921  break;
1922  }
1923  ++fmt;
1924  }
1925  if (len >= left) {
1926  text += (left > 1) ? left - 1 : 0;
1927  left = SDL_min(left, 1);
1928  } else {
1929  text += len;
1930  left -= len;
1931  }
1932  } else {
1933  *text++ = *fmt++;
1934  --left;
1935  }
1936  }
1937  if (left > 0) {
1938  *text = '\0';
1939  }
1940  return (int)(text - textstart);
1941 }
#define SDL_iconv_string
#define SDL_zero(x)
Definition: SDL_stdinc.h:426
@ SDL_CASE_LOWER
Definition: SDL_string.c:1479
@ SDL_CASE_UPPER
Definition: SDL_string.c:1480
@ SDL_CASE_NOCHANGE
Definition: SDL_string.c:1478
static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
Definition: SDL_string.c:1496
static size_t SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
Definition: SDL_string.c:1617
static size_t SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
Definition: SDL_string.c:1579
static size_t SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
Definition: SDL_string.c:1603
static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
Definition: SDL_string.c:1627
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:425
static size_t SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
Definition: SDL_string.c:1593
int done
Definition: checkkeys.c:28
SDL_bool pad_zeroes
Definition: SDL_string.c:1488
SDL_bool left_justify
Definition: SDL_string.c:1485
SDL_bool force_sign
Definition: SDL_string.c:1486
SDL_bool force_type
Definition: SDL_string.c:1487
SDL_letter_case force_case
Definition: SDL_string.c:1489

References done, SDL_FormatInfo::force_case, SDL_FormatInfo::force_sign, SDL_FormatInfo::force_type, SDL_FormatInfo::left_justify, NULL, 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_snprintf().

◆ SDL_vsscanf()

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

Definition at line 1169 of file SDL_string.c.

1170 {
1171  int retval = 0;
1172 
1173  if (!text || !*text) {
1174  return -1;
1175  }
1176 
1177  while (*fmt) {
1178  if (*fmt == ' ') {
1179  while (SDL_isspace((unsigned char) *text)) {
1180  ++text;
1181  }
1182  ++fmt;
1183  continue;
1184  }
1185  if (*fmt == '%') {
1187  long count = 0;
1188  int radix = 10;
1189  enum
1190  {
1191  DO_SHORT,
1192  DO_INT,
1193  DO_LONG,
1194  DO_LONGLONG
1195  } inttype = DO_INT;
1196  size_t advance;
1197  SDL_bool suppress = SDL_FALSE;
1198 
1199  ++fmt;
1200  if (*fmt == '%') {
1201  if (*text == '%') {
1202  ++text;
1203  ++fmt;
1204  continue;
1205  }
1206  break;
1207  }
1208  if (*fmt == '*') {
1209  suppress = SDL_TRUE;
1210  ++fmt;
1211  }
1212  fmt += SDL_ScanLong(fmt, 10, &count);
1213 
1214  if (*fmt == 'c') {
1215  if (!count) {
1216  count = 1;
1217  }
1218  if (suppress) {
1219  while (count--) {
1220  ++text;
1221  }
1222  } else {
1223  char *valuep = va_arg(ap, char *);
1224  while (count--) {
1225  *valuep++ = *text++;
1226  }
1227  ++retval;
1228  }
1229  continue;
1230  }
1231 
1232  while (SDL_isspace((unsigned char) *text)) {
1233  ++text;
1234  }
1235 
1236  /* FIXME: implement more of the format specifiers */
1237  while (!done) {
1238  switch (*fmt) {
1239  case '*':
1240  suppress = SDL_TRUE;
1241  break;
1242  case 'h':
1243  if (inttype > DO_SHORT) {
1244  ++inttype;
1245  }
1246  break;
1247  case 'l':
1248  if (inttype < DO_LONGLONG) {
1249  ++inttype;
1250  }
1251  break;
1252  case 'I':
1253  if (SDL_strncmp(fmt, "I64", 3) == 0) {
1254  fmt += 2;
1255  inttype = DO_LONGLONG;
1256  }
1257  break;
1258  case 'i':
1259  {
1260  int index = 0;
1261  if (text[index] == '-') {
1262  ++index;
1263  }
1264  if (text[index] == '0') {
1265  if (SDL_tolower((unsigned char) text[index + 1]) == 'x') {
1266  radix = 16;
1267  } else {
1268  radix = 8;
1269  }
1270  }
1271  }
1272  /* Fall through to %d handling */
1273  case 'd':
1274  if (inttype == DO_LONGLONG) {
1275  Sint64 value;
1276  advance = SDL_ScanLongLong(text, radix, &value);
1277  text += advance;
1278  if (advance && !suppress) {
1279  Sint64 *valuep = va_arg(ap, Sint64 *);
1280  *valuep = value;
1281  ++retval;
1282  }
1283  } else {
1284  long value;
1285  advance = SDL_ScanLong(text, radix, &value);
1286  text += advance;
1287  if (advance && !suppress) {
1288  switch (inttype) {
1289  case DO_SHORT:
1290  {
1291  short *valuep = va_arg(ap, short *);
1292  *valuep = (short) value;
1293  }
1294  break;
1295  case DO_INT:
1296  {
1297  int *valuep = va_arg(ap, int *);
1298  *valuep = (int) value;
1299  }
1300  break;
1301  case DO_LONG:
1302  {
1303  long *valuep = va_arg(ap, long *);
1304  *valuep = value;
1305  }
1306  break;
1307  case DO_LONGLONG:
1308  /* Handled above */
1309  break;
1310  }
1311  ++retval;
1312  }
1313  }
1314  done = SDL_TRUE;
1315  break;
1316  case 'o':
1317  if (radix == 10) {
1318  radix = 8;
1319  }
1320  /* Fall through to unsigned handling */
1321  case 'x':
1322  case 'X':
1323  if (radix == 10) {
1324  radix = 16;
1325  }
1326  /* Fall through to unsigned handling */
1327  case 'u':
1328  if (inttype == DO_LONGLONG) {
1329  Uint64 value = 0;
1330  advance = SDL_ScanUnsignedLongLong(text, radix, &value);
1331  text += advance;
1332  if (advance && !suppress) {
1333  Uint64 *valuep = va_arg(ap, Uint64 *);
1334  *valuep = value;
1335  ++retval;
1336  }
1337  } else {
1338  unsigned long value = 0;
1339  advance = SDL_ScanUnsignedLong(text, radix, &value);
1340  text += advance;
1341  if (advance && !suppress) {
1342  switch (inttype) {
1343  case DO_SHORT:
1344  {
1345  short *valuep = va_arg(ap, short *);
1346  *valuep = (short) value;
1347  }
1348  break;
1349  case DO_INT:
1350  {
1351  int *valuep = va_arg(ap, int *);
1352  *valuep = (int) value;
1353  }
1354  break;
1355  case DO_LONG:
1356  {
1357  long *valuep = va_arg(ap, long *);
1358  *valuep = value;
1359  }
1360  break;
1361  case DO_LONGLONG:
1362  /* Handled above */
1363  break;
1364  }
1365  ++retval;
1366  }
1367  }
1368  done = SDL_TRUE;
1369  break;
1370  case 'p':
1371  {
1372  uintptr_t value = 0;
1373  advance = SDL_ScanUintPtrT(text, 16, &value);
1374  text += advance;
1375  if (advance && !suppress) {
1376  void **valuep = va_arg(ap, void **);
1377  *valuep = (void *) value;
1378  ++retval;
1379  }
1380  }
1381  done = SDL_TRUE;
1382  break;
1383  case 'f':
1384  {
1385  double value;
1386  advance = SDL_ScanFloat(text, &value);
1387  text += advance;
1388  if (advance && !suppress) {
1389  float *valuep = va_arg(ap, float *);
1390  *valuep = (float) value;
1391  ++retval;
1392  }
1393  }
1394  done = SDL_TRUE;
1395  break;
1396  case 's':
1397  if (suppress) {
1398  while (!SDL_isspace((unsigned char) *text)) {
1399  ++text;
1400  if (count) {
1401  if (--count == 0) {
1402  break;
1403  }
1404  }
1405  }
1406  } else {
1407  char *valuep = va_arg(ap, char *);
1408  while (!SDL_isspace((unsigned char) *text)) {
1409  *valuep++ = *text++;
1410  if (count) {
1411  if (--count == 0) {
1412  break;
1413  }
1414  }
1415  }
1416  *valuep = '\0';
1417  ++retval;
1418  }
1419  done = SDL_TRUE;
1420  break;
1421  default:
1422  done = SDL_TRUE;
1423  break;
1424  }
1425  ++fmt;
1426  }
1427  continue;
1428  }
1429  if (*text == *fmt) {
1430  ++text;
1431  ++fmt;
1432  continue;
1433  }
1434  /* Text didn't match format specifier */
1435  break;
1436  }
1437 
1438  return retval;
1439 }
unsigned int uintptr_t
#define SDL_isspace
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
Definition: SDL_string.c:126
typedef int(__stdcall *FARPROC)()

References done, int(), 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_sscanf().

◆ SDL_wcscasecmp()

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

Definition at line 535 of file SDL_string.c.

536 {
537 #if defined(HAVE_WCSCASECMP)
538  return wcscasecmp(str1, str2);
539 #elif defined(HAVE__WCSICMP)
540  return _wcsicmp(str1, str2);
541 #else
542  wchar_t a = 0;
543  wchar_t b = 0;
544  while (*str1 && *str2) {
545  /* FIXME: This doesn't actually support wide characters */
546  if (*str1 >= 0x80 || *str2 >= 0x80) {
547  a = *str1;
548  b = *str2;
549  } else {
550  a = SDL_toupper((unsigned char) *str1);
551  b = SDL_toupper((unsigned char) *str2);
552  }
553  if (a != b)
554  break;
555  ++str1;
556  ++str2;
557  }
558 
559  /* FIXME: This doesn't actually support wide characters */
560  if (*str1 >= 0x80 || *str2 >= 0x80) {
561  a = *str1;
562  b = *str2;
563  } else {
564  a = SDL_toupper((unsigned char) *str1);
565  b = SDL_toupper((unsigned char) *str2);
566  }
567  return (int) ((unsigned int) a - (unsigned int) b);
568 #endif /* HAVE__WCSICMP */
569 }

References int(), and SDL_toupper.

◆ SDL_wcscmp()

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

Definition at line 498 of file SDL_string.c.

499 {
500 #if defined(HAVE_WCSCMP)
501  return wcscmp(str1, str2);
502 #else
503  while (*str1 && *str2) {
504  if (*str1 != *str2)
505  break;
506  ++str1;
507  ++str2;
508  }
509  return (int)(*str1 - *str2);
510 #endif /* HAVE_WCSCMP */
511 }

◆ SDL_wcsdup()

wchar_t* SDL_wcsdup ( const wchar_t *  wstr)

Definition at line 470 of file SDL_string.c.

471 {
472  size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t));
473  wchar_t *newstr = (wchar_t *)SDL_malloc(len);
474  if (newstr) {
475  SDL_memcpy(newstr, string, len);
476  }
477  return newstr;
478 }

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

◆ SDL_wcslcat()

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

Definition at line 455 of file SDL_string.c.

456 {
457 #if defined(HAVE_WCSLCAT)
458  return wcslcat(dst, src, maxlen);
459 #else
460  size_t dstlen = SDL_wcslen(dst);
461  size_t srclen = SDL_wcslen(src);
462  if (dstlen < maxlen) {
463  SDL_wcslcpy(dst + dstlen, src, maxlen - dstlen);
464  }
465  return dstlen + srclen;
466 #endif /* HAVE_WCSLCAT */
467 }
size_t SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
Definition: SDL_string.c:439

References SDL_wcslcpy(), and SDL_wcslen().

◆ SDL_wcslcpy()

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

Definition at line 439 of file SDL_string.c.

440 {
441 #if defined(HAVE_WCSLCPY)
442  return wcslcpy(dst, src, maxlen);
443 #else
444  size_t srclen = SDL_wcslen(src);
445  if (maxlen > 0) {
446  size_t len = SDL_min(srclen, maxlen - 1);
447  SDL_memcpy(dst, src, len * sizeof(wchar_t));
448  dst[len] = '\0';
449  }
450  return srclen;
451 #endif /* HAVE_WCSLCPY */
452 }

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

Referenced by SDL_wcslcat().

◆ SDL_wcslen()

size_t SDL_wcslen ( const wchar_t *  wstr)

Definition at line 425 of file SDL_string.c.

426 {
427 #if defined(HAVE_WCSLEN)
428  return wcslen(string);
429 #else
430  size_t len = 0;
431  while (*string++) {
432  ++len;
433  }
434  return len;
435 #endif /* HAVE_WCSLEN */
436 }

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

◆ SDL_wcsncasecmp()

int SDL_wcsncasecmp ( const wchar_t *  str1,
const wchar_t *  str2,
size_t  len 
)

Definition at line 572 of file SDL_string.c.

573 {
574 #if defined(HAVE_WCSNCASECMP)
575  return wcsncasecmp(str1, str2, maxlen);
576 #elif defined(HAVE__WCSNICMP)
577  return _wcsnicmp(str1, str2, maxlen);
578 #else
579  wchar_t a = 0;
580  wchar_t b = 0;
581  while (*str1 && *str2 && maxlen) {
582  /* FIXME: This doesn't actually support wide characters */
583  if (*str1 >= 0x80 || *str2 >= 0x80) {
584  a = *str1;
585  b = *str2;
586  } else {
587  a = SDL_toupper((unsigned char) *str1);
588  b = SDL_toupper((unsigned char) *str2);
589  }
590  if (a != b)
591  break;
592  ++str1;
593  ++str2;
594  --maxlen;
595  }
596 
597  if (maxlen == 0) {
598  return 0;
599  } else {
600  /* FIXME: This doesn't actually support wide characters */
601  if (*str1 >= 0x80 || *str2 >= 0x80) {
602  a = *str1;
603  b = *str2;
604  } else {
605  a = SDL_toupper((unsigned char) *str1);
606  b = SDL_toupper((unsigned char) *str2);
607  }
608  return (int) ((unsigned int) a - (unsigned int) b);
609  }
610 #endif /* HAVE__WCSNICMP */
611 }

References int(), and SDL_toupper.

◆ SDL_wcsncmp()

int SDL_wcsncmp ( const wchar_t *  str1,
const wchar_t *  str2,
size_t  maxlen 
)

Definition at line 514 of file SDL_string.c.

515 {
516 #if defined(HAVE_WCSNCMP)
517  return wcsncmp(str1, str2, maxlen);
518 #else
519  while (*str1 && *str2 && maxlen) {
520  if (*str1 != *str2)
521  break;
522  ++str1;
523  ++str2;
524  --maxlen;
525  }
526  if (!maxlen) {
527  return 0;
528  }
529  return (int) (*str1 - *str2);
530 
531 #endif /* HAVE_WCSNCMP */
532 }

Referenced by SDL_wcsstr().

◆ SDL_wcsstr()

wchar_t* SDL_wcsstr ( const wchar_t *  haystack,
const wchar_t *  needle 
)

Definition at line 481 of file SDL_string.c.

482 {
483 #if defined(HAVE_WCSSTR)
484  return SDL_const_cast(wchar_t*,wcsstr(haystack, needle));
485 #else
486  size_t length = SDL_wcslen(needle);
487  while (*haystack) {
488  if (SDL_wcsncmp(haystack, needle, length) == 0) {
489  return (wchar_t *)haystack;
490  }
491  ++haystack;
492  }
493  return NULL;
494 #endif /* HAVE_WCSSTR */
495 }
int SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
Definition: SDL_string.c:514

References NULL, SDL_const_cast, SDL_wcslen(), and SDL_wcsncmp().