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)
 
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)
 
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_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 116 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 313 of file SDL_stdinc.h.

◆ SDL_const_cast

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

Definition at line 140 of file SDL_stdinc.h.

◆ SDL_FOURCC

#define SDL_FOURCC (   A,
  B,
  C,
 
)
Value:

Definition at line 145 of file SDL_stdinc.h.

◆ SDL_ICONV_E2BIG

#define SDL_ICONV_E2BIG   (size_t)-2

Definition at line 552 of file SDL_stdinc.h.

◆ SDL_ICONV_EILSEQ

#define SDL_ICONV_EILSEQ   (size_t)-3

Definition at line 553 of file SDL_stdinc.h.

◆ SDL_ICONV_EINVAL

#define SDL_ICONV_EINVAL   (size_t)-4

Definition at line 554 of file SDL_stdinc.h.

◆ SDL_ICONV_ERROR

#define SDL_ICONV_ERROR   (size_t)-1

Definition at line 551 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 572 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 573 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 574 of file SDL_stdinc.h.

◆ SDL_IN_BYTECAP

#define SDL_IN_BYTECAP (   x)

Definition at line 295 of file SDL_stdinc.h.

◆ SDL_INOUT_Z_CAP

#define SDL_INOUT_Z_CAP (   x)

Definition at line 296 of file SDL_stdinc.h.

◆ SDL_max

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

Definition at line 408 of file SDL_stdinc.h.

◆ SDL_MAX_SINT16

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

A signed 16-bit integer type.

Definition at line 184 of file SDL_stdinc.h.

◆ SDL_MAX_SINT32

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

A signed 32-bit integer type.

Definition at line 196 of file SDL_stdinc.h.

◆ SDL_MAX_SINT64

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

A signed 64-bit integer type.

Definition at line 209 of file SDL_stdinc.h.

◆ SDL_MAX_SINT8

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

A signed 8-bit integer type.

Definition at line 172 of file SDL_stdinc.h.

◆ SDL_MAX_UINT16

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

An unsigned 16-bit integer type.

Definition at line 190 of file SDL_stdinc.h.

◆ SDL_MAX_UINT32

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

An unsigned 32-bit integer type.

Definition at line 202 of file SDL_stdinc.h.

◆ SDL_MAX_UINT64

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

An unsigned 64-bit integer type.

Definition at line 215 of file SDL_stdinc.h.

◆ SDL_MAX_UINT8

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

An unsigned 8-bit integer type.

Definition at line 178 of file SDL_stdinc.h.

◆ SDL_min

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

Definition at line 407 of file SDL_stdinc.h.

◆ SDL_MIN_SINT16

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

Definition at line 185 of file SDL_stdinc.h.

◆ SDL_MIN_SINT32

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

Definition at line 197 of file SDL_stdinc.h.

◆ SDL_MIN_SINT64

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

Definition at line 210 of file SDL_stdinc.h.

◆ SDL_MIN_SINT8

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

Definition at line 173 of file SDL_stdinc.h.

◆ SDL_MIN_UINT16

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

Definition at line 191 of file SDL_stdinc.h.

◆ SDL_MIN_UINT32

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

Definition at line 203 of file SDL_stdinc.h.

◆ SDL_MIN_UINT64

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

Definition at line 216 of file SDL_stdinc.h.

◆ SDL_MIN_UINT8

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

Definition at line 179 of file SDL_stdinc.h.

◆ SDL_OUT_BYTECAP

#define SDL_OUT_BYTECAP (   x)

Definition at line 299 of file SDL_stdinc.h.

◆ SDL_OUT_CAP

#define SDL_OUT_CAP (   x)

Definition at line 298 of file SDL_stdinc.h.

◆ SDL_OUT_Z_BYTECAP

#define SDL_OUT_Z_BYTECAP (   x)

Definition at line 300 of file SDL_stdinc.h.

◆ SDL_OUT_Z_CAP

#define SDL_OUT_Z_CAP (   x)

Definition at line 297 of file SDL_stdinc.h.

◆ SDL_PRINTF_FORMAT_STRING

#define SDL_PRINTF_FORMAT_STRING

Definition at line 301 of file SDL_stdinc.h.

◆ SDL_PRINTF_VARARG_FUNC

#define SDL_PRINTF_VARARG_FUNC (   fmtargnumber)

Definition at line 308 of file SDL_stdinc.h.

◆ SDL_PRIs64

#define SDL_PRIs64   "I64d"

Definition at line 228 of file SDL_stdinc.h.

◆ SDL_PRIu64

#define SDL_PRIu64   "I64u"

Definition at line 239 of file SDL_stdinc.h.

◆ SDL_PRIx64

#define SDL_PRIx64   "I64x"

Definition at line 250 of file SDL_stdinc.h.

◆ SDL_PRIX64

#define SDL_PRIX64   "I64X"

Definition at line 261 of file SDL_stdinc.h.

◆ SDL_reinterpret_cast

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

Definition at line 138 of file SDL_stdinc.h.

◆ SDL_SCANF_FORMAT_STRING

#define SDL_SCANF_FORMAT_STRING

Definition at line 302 of file SDL_stdinc.h.

◆ SDL_SCANF_VARARG_FUNC

#define SDL_SCANF_VARARG_FUNC (   fmtargnumber)

Definition at line 309 of file SDL_stdinc.h.

◆ SDL_stack_alloc

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

Definition at line 355 of file SDL_stdinc.h.

◆ SDL_stack_free

#define SDL_stack_free (   data)

Definition at line 356 of file SDL_stdinc.h.

◆ SDL_static_cast

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

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

◆ SDL_TABLESIZE

#define SDL_TABLESIZE (   table)    SDL_arraysize(table)

Definition at line 117 of file SDL_stdinc.h.

◆ SDL_zero

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

Definition at line 419 of file SDL_stdinc.h.

◆ SDL_zeroa

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

Definition at line 421 of file SDL_stdinc.h.

◆ SDL_zerop

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

Definition at line 420 of file SDL_stdinc.h.

Typedef Documentation

◆ SDL_calloc_func

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

Definition at line 367 of file SDL_stdinc.h.

◆ SDL_free_func

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) 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 369 of file SDL_stdinc.h.

◆ SDL_malloc_func

typedef void*( * SDL_malloc_func) (size_t size)

Definition at line 366 of file SDL_stdinc.h.

◆ SDL_realloc_func

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

Definition at line 368 of file SDL_stdinc.h.

◆ Sint16

typedef int16_t Sint16

Definition at line 185 of file SDL_stdinc.h.

◆ Sint32

typedef int32_t Sint32

Definition at line 197 of file SDL_stdinc.h.

◆ Sint64

SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 Uint32 return SDL_AudioCVT SDL_AudioFormat Uint8 int SDL_AudioFormat Uint8 int return Uint8 const Uint8 Uint32 int const char return return return return return return return return Uint32 return Uint32 SDL_Event return SDL_Event int return SDL_EventFilter void SDL_EventFilter void SDL_EventFilter void int return const char const char return SDL_JoystickGUID return int return int return SDL_GameController return int return const char return SDL_GameController SDL_GameControllerAxis return const char return SDL_GameController SDL_GameControllerButton return SDL_GameController SDL_RWops return SDL_TouchID SDL_RWops return int return int return return SDL_Joystick return SDL_Haptic SDL_Haptic return SDL_Haptic return SDL_Haptic SDL_HapticEffect return SDL_Haptic int Uint32 return SDL_Haptic int SDL_Haptic int return SDL_Haptic return SDL_Haptic return SDL_Haptic return SDL_Haptic return const char const char return const char SDL_HintCallback void int return SDL_Joystick return SDL_Joystick return const char return SDL_Joystick return SDL_Joystick return SDL_Joystick return int return SDL_Joystick int return SDL_Joystick int return return return SDL_Scancode return SDL_Scancode return SDL_Keycode return return const char return void int SDL_LogPriority SDL_LogOutputFunction void Uint32 const char const char SDL_Window return int int return SDL_Window int int return SDL_Surface int int return SDL_Cursor return int return SDL_mutex return SDL_mutex return Uint32 return SDL_sem return SDL_sem Uint32 return SDL_sem return SDL_cond SDL_cond return SDL_cond SDL_mutex Uint32 return Uint32 int Uint32 Uint32 Uint32 Uint32 return Uint32 return int return SDL_Palette const SDL_Color int int return const SDL_PixelFormat Uint8 Uint8 Uint8 return Uint32 const SDL_PixelFormat Uint8 Uint8 Uint8 float Uint16 int int return const SDL_Rect const SDL_Rect SDL_Rect return const SDL_Point int const SDL_Rect SDL_Rect return return int int Uint32 SDL_Window SDL_Renderer return SDL_Surface return SDL_Renderer SDL_RendererInfo return SDL_Renderer Uint32 int int int return SDL_Texture Uint32 int int int return SDL_Texture Uint8 Uint8 Uint8 return SDL_Texture Uint8 return SDL_Texture SDL_BlendMode return SDL_Texture const SDL_Rect const Uint8 int const Uint8 int const Uint8 int return SDL_Texture SDL_Renderer SDL_Texture return SDL_Renderer int int return SDL_Renderer const SDL_Rect return SDL_Renderer const SDL_Rect return SDL_Renderer float float return SDL_Renderer Uint8 Uint8 Uint8 Uint8 return SDL_Renderer SDL_BlendMode return SDL_Renderer return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Point int return SDL_Renderer const SDL_Rect int return SDL_Renderer const SDL_Rect int return SDL_Renderer SDL_Texture const SDL_Rect const SDL_Rect const double const SDL_Point const SDL_RendererFlip return SDL_Renderer SDL_Renderer SDL_Texture return void int return return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops return SDL_RWops Uint16 return SDL_RWops Uint32 return SDL_RWops Uint64 return const char unsigned int unsigned int unsigned int unsigned int Uint32 return SDL_Window SDL_Surface SDL_WindowShapeMode return size_t return void size_t return const char return void size_t size_t int(*) 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 210 of file SDL_stdinc.h.

◆ Sint8

typedef int8_t Sint8

Definition at line 173 of file SDL_stdinc.h.

◆ Uint16

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

Definition at line 191 of file SDL_stdinc.h.

◆ Uint32

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

Definition at line 203 of file SDL_stdinc.h.

◆ Uint64

typedef uint64_t Uint64

Definition at line 216 of file SDL_stdinc.h.

◆ Uint8

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

Definition at line 179 of file SDL_stdinc.h.

Enumeration Type Documentation

◆ SDL_bool

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

Definition at line 161 of file SDL_stdinc.h.

162 {
163  SDL_FALSE = 0,
164  SDL_TRUE = 1
165 } SDL_bool;

Function Documentation

◆ SDL_abs()

int SDL_abs ( int  x)

Definition at line 429 of file SDL_stdlib.c.

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

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

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 }

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 }

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 }

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 }

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 }

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

852 {
853 #ifdef HAVE_ATOF
854  return atof(string);
855 #else
856  return SDL_strtod(string, NULL);
857 #endif /* HAVE_ATOF */
858 }

References NULL, and SDL_strtod().

◆ SDL_atoi()

int SDL_atoi ( const char *  str)

Definition at line 842 of file SDL_string.c.

843 {
844 #ifdef HAVE_ATOI
845  return atoi(string);
846 #else
847  return SDL_strtol(string, NULL, 0);
848 #endif /* HAVE_ATOI */
849 }

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 }

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 }

References SDL_floor().

Referenced by SDL_ceilf().

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

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 }

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 }

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 }

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 }

References SDL_cos().

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

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 }

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 }

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 }

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 }

References floor(), and SDL_uclibc_floor().

Referenced by SDL_ceil(), and SDL_floorf().

◆ 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 264 of file SDL_stdlib.c.

265 {
266 #if defined(HAVE_FMOD)
267  return fmod(x, y);
268 #else
269  return SDL_uclibc_fmod(x, y);
270 #endif
271 }

References SDL_uclibc_fmod().

Referenced by SDL_fmodf().

◆ SDL_fmodf()

float SDL_fmodf ( float  x,
float  y 
)

Definition at line 274 of file SDL_stdlib.c.

275 {
276 #if defined(HAVE_FMODF)
277  return fmodf(x, y);
278 #else
279  return (float)SDL_fmod((double)x, (double)y);
280 #endif
281 }

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 }

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  int len, i;
222  char *value;
223 
224  /* Input validation */
225  if (!name || SDL_strlen(name)==0) {
226  return NULL;
227  }
228 
229  value = (char *) 0;
230  if (SDL_env) {
231  len = SDL_strlen(name);
232  for (i = 0; SDL_env[i] && !value; ++i) {
233  if ((SDL_strncmp(SDL_env[i], name, len) == 0) &&
234  (SDL_env[i][len] == '=')) {
235  value = &SDL_env[i][len + 1];
236  }
237  }
238  }
239  return value;
240 }

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 }

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 }

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 }

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 }

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 }

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 446 of file SDL_stdlib.c.

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

◆ SDL_islower()

int SDL_islower ( int  x)

Definition at line 449 of file SDL_stdlib.c.

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

◆ SDL_isspace()

int SDL_isspace ( int  x)

Definition at line 447 of file SDL_stdlib.c.

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

◆ SDL_isupper()

int SDL_isupper ( int  x)

Definition at line 448 of file SDL_stdlib.c.

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

◆ SDL_itoa()

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

Definition at line 735 of file SDL_string.c.

736 {
737 #ifdef HAVE_ITOA
738  return itoa(value, string, radix);
739 #else
740  return SDL_ltoa((long)value, string, radix);
741 #endif /* HAVE_ITOA */
742 }

References SDL_ltoa().

◆ SDL_lltoa()

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

Definition at line 799 of file SDL_string.c.

800 {
801 #if defined(HAVE__I64TOA)
802  return _i64toa(value, string, radix);
803 #else
804  char *bufp = string;
805 
806  if (value < 0) {
807  *bufp++ = '-';
808  SDL_ulltoa(-value, bufp, radix);
809  } else {
810  SDL_ulltoa(value, bufp, radix);
811  }
812 
813  return string;
814 #endif /* HAVE__I64TOA */
815 }

References SDL_ulltoa().

Referenced by SDL_PrintLongLong().

◆ SDL_log()

double SDL_log ( double  x)

Definition at line 284 of file SDL_stdlib.c.

285 {
286 #if defined(HAVE_LOG)
287  return log(x);
288 #else
289  return SDL_uclibc_log(x);
290 #endif
291 }

References SDL_uclibc_log().

Referenced by SDL_logf().

◆ SDL_log10()

double SDL_log10 ( double  x)

Definition at line 304 of file SDL_stdlib.c.

305 {
306 #if defined(HAVE_LOG10)
307  return log10(x);
308 #else
309  return SDL_uclibc_log10(x);
310 #endif
311 }

References SDL_uclibc_log10().

Referenced by SDL_log10f().

◆ SDL_log10f()

float SDL_log10f ( float  x)

Definition at line 314 of file SDL_stdlib.c.

315 {
316 #if defined(HAVE_LOG10F)
317  return log10f(x);
318 #else
319  return (float)SDL_log10((double)x);
320 #endif
321 }

References SDL_log10().

◆ SDL_logf()

float SDL_logf ( float  x)

Definition at line 294 of file SDL_stdlib.c.

295 {
296 #if defined(HAVE_LOGF)
297  return logf(x);
298 #else
299  return (float)SDL_log((double)x);
300 #endif
301 }

References SDL_log().

◆ SDL_ltoa()

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

Definition at line 755 of file SDL_string.c.

756 {
757 #if defined(HAVE__LTOA)
758  return _ltoa(value, string, radix);
759 #else
760  char *bufp = string;
761 
762  if (value < 0) {
763  *bufp++ = '-';
764  SDL_ultoa(-value, bufp, radix);
765  } else {
766  SDL_ultoa(value, bufp, radix);
767  }
768 
769  return string;
770 #endif /* HAVE__LTOA */
771 }

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 }

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

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

605 {
606  return SDL_memcpy(dst, src, dwords * 4);
607 }

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 }

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 }

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

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

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 324 of file SDL_stdlib.c.

325 {
326 #if defined(HAVE_POW)
327  return pow(x, y);
328 #else
329  return SDL_uclibc_pow(x, y);
330 #endif
331 }

References SDL_uclibc_pow().

Referenced by SDL_powf().

◆ SDL_powf()

float SDL_powf ( float  x,
float  y 
)

Definition at line 334 of file SDL_stdlib.c.

335 {
336 #if defined(HAVE_POWF)
337  return powf(x, y);
338 #else
339  return (float)SDL_pow((double)x, (double)y);
340 #endif
341 }

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 344 of file SDL_stdlib.c.

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

References scalbn, and SDL_uclibc_scalbn().

Referenced by SDL_scalbnf().

◆ SDL_scalbnf()

float SDL_scalbnf ( float  x,
int  n 
)

Definition at line 360 of file SDL_stdlib.c.

361 {
362 #if defined(HAVE_SCALBNF)
363  return scalbnf(x, n);
364 #else
365  return (float)SDL_scalbn((double)x, n);
366 #endif
367 }

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  int len, i;
114  char **new_env;
115  char *new_variable;
116 
117  /* Input validation */
118  if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
119  return (-1);
120  }
121 
122  /* See if it already exists */
123  if (!overwrite && SDL_getenv(name)) {
124  return 0;
125  }
126 
127  /* Allocate memory for the variable */
128  len = SDL_strlen(name) + SDL_strlen(value) + 2;
129  new_variable = (char *) SDL_malloc(len);
130  if (!new_variable) {
131  return (-1);
132  }
133 
134  SDL_snprintf(new_variable, len, "%s=%s", name, value);
135  value = new_variable + SDL_strlen(name) + 1;
136  name = new_variable;
137 
138  /* Actually put it into the environment */
139  added = 0;
140  i = 0;
141  if (SDL_env) {
142  /* Check to see if it's already there... */
143  len = (value - name);
144  for (; SDL_env[i]; ++i) {
145  if (SDL_strncmp(SDL_env[i], name, len) == 0) {
146  break;
147  }
148  }
149  /* If we found it, just replace the entry */
150  if (SDL_env[i]) {
151  SDL_free(SDL_env[i]);
152  SDL_env[i] = new_variable;
153  added = 1;
154  }
155  }
156 
157  /* Didn't find it in the environment, expand and add */
158  if (!added) {
159  new_env = SDL_realloc(SDL_env, (i + 2) * sizeof(char *));
160  if (new_env) {
161  SDL_env = new_env;
162  SDL_env[i++] = new_variable;
163  SDL_env[i++] = (char *) 0;
164  added = 1;
165  } else {
166  SDL_free(new_variable);
167  }
168  }
169  return (added ? 0 : -1);
170 }

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 }

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

◆ SDL_sin()

double SDL_sin ( double  x)

Definition at line 370 of file SDL_stdlib.c.

371 {
372 #if defined(HAVE_SIN)
373  return sin(x);
374 #else
375  return SDL_uclibc_sin(x);
376 #endif
377 }

References SDL_uclibc_sin(), and sin().

Referenced by SDL_sinf().

◆ SDL_sinf()

float SDL_sinf ( float  x)

Definition at line 380 of file SDL_stdlib.c.

381 {
382 #if defined(HAVE_SINF)
383  return sinf(x);
384 #else
385  return (float)SDL_sin((double)x);
386 #endif
387 }

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

1360 {
1361  va_list ap;
1362  int retval;
1363 
1364  va_start(ap, fmt);
1365  retval = SDL_vsnprintf(text, maxlen, fmt, ap);
1366  va_end(ap);
1367 
1368  return retval;
1369 }

References retval, SDL_vsnprintf(), and text.

◆ SDL_sqrt()

double SDL_sqrt ( double  x)

Definition at line 390 of file SDL_stdlib.c.

391 {
392 #if defined(HAVE_SQRT)
393  return sqrt(x);
394 #else
395  return SDL_uclibc_sqrt(x);
396 #endif
397 }

References SDL_uclibc_sqrt().

Referenced by SDL_acos(), and SDL_sqrtf().

◆ SDL_sqrtf()

float SDL_sqrtf ( float  x)

Definition at line 400 of file SDL_stdlib.c.

401 {
402 #if defined(HAVE_SQRTF)
403  return sqrtf(x);
404 #else
405  return (float)SDL_sqrt((double)x);
406 #endif
407 }

References SDL_sqrt().

◆ SDL_sscanf()

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

Definition at line 1067 of file SDL_string.c.

1068 {
1069  int rc;
1070  va_list ap;
1071  va_start(ap, fmt);
1072  rc = SDL_vsscanf(text, fmt, ap);
1073  va_end(ap);
1074  return rc;
1075 }

References SDL_vsscanf(), and text.

◆ SDL_strcasecmp()

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

Definition at line 1014 of file SDL_string.c.

1015 {
1016 #ifdef HAVE_STRCASECMP
1017  return strcasecmp(str1, str2);
1018 #elif defined(HAVE__STRICMP)
1019  return _stricmp(str1, str2);
1020 #else
1021  char a = 0;
1022  char b = 0;
1023  while (*str1 && *str2) {
1024  a = SDL_toupper((unsigned char) *str1);
1025  b = SDL_toupper((unsigned char) *str2);
1026  if (a != b)
1027  break;
1028  ++str1;
1029  ++str2;
1030  }
1031  a = SDL_toupper(*str1);
1032  b = SDL_toupper(*str2);
1033  return (int) ((unsigned char) a - (unsigned char) b);
1034 #endif /* HAVE_STRCASECMP */
1035 }

References SDL_toupper.

◆ SDL_strchr()

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

Definition at line 671 of file SDL_string.c.

672 {
673 #ifdef HAVE_STRCHR
674  return SDL_const_cast(char*,strchr(string, c));
675 #elif defined(HAVE_INDEX)
676  return SDL_const_cast(char*,index(string, c));
677 #else
678  while (*string) {
679  if (*string == c) {
680  return (char *) string;
681  }
682  ++string;
683  }
684  return NULL;
685 #endif /* HAVE_STRCHR */
686 }

References NULL, and SDL_const_cast.

◆ SDL_strcmp()

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

Definition at line 978 of file SDL_string.c.

979 {
980 #if defined(HAVE_STRCMP)
981  return strcmp(str1, str2);
982 #else
983  while (*str1 && *str2) {
984  if (*str1 != *str2)
985  break;
986  ++str1;
987  ++str2;
988  }
989  return (int)((unsigned char) *str1 - (unsigned char) *str2);
990 #endif /* HAVE_STRCMP */
991 }

◆ SDL_strdup()

char* SDL_strdup ( const char *  str)

Definition at line 611 of file SDL_string.c.

612 {
613  size_t len = SDL_strlen(string) + 1;
614  char *newstr = (char *)SDL_malloc(len);
615  if (newstr) {
616  SDL_memcpy(newstr, string, len);
617  }
618  return newstr;
619 }

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

597 {
598 #if defined(HAVE_STRLCAT)
599  return strlcat(dst, src, maxlen);
600 #else
601  size_t dstlen = SDL_strlen(dst);
602  size_t srclen = SDL_strlen(src);
603  if (dstlen < maxlen) {
604  SDL_strlcpy(dst + dstlen, src, maxlen - dstlen);
605  }
606  return dstlen + srclen;
607 #endif /* HAVE_STRLCAT */
608 }

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

531 {
532 #if defined(HAVE_STRLCPY)
533  return strlcpy(dst, src, maxlen);
534 #else
535  size_t srclen = SDL_strlen(src);
536  if (maxlen > 0) {
537  size_t len = SDL_min(srclen, maxlen - 1);
538  SDL_memcpy(dst, src, len);
539  dst[len] = '\0';
540  }
541  return srclen;
542 #endif /* HAVE_STRLCPY */
543 }

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

657 {
658 #if defined(HAVE__STRLWR)
659  return _strlwr(string);
660 #else
661  char *bufp = string;
662  while (*bufp) {
663  *bufp = SDL_tolower((unsigned char) *bufp);
664  ++bufp;
665  }
666  return string;
667 #endif /* HAVE__STRLWR */
668 }

References SDL_tolower.

Referenced by SDL_PrintString().

◆ SDL_strncasecmp()

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

Definition at line 1038 of file SDL_string.c.

1039 {
1040 #ifdef HAVE_STRNCASECMP
1041  return strncasecmp(str1, str2, maxlen);
1042 #elif defined(HAVE__STRNICMP)
1043  return _strnicmp(str1, str2, maxlen);
1044 #else
1045  char a = 0;
1046  char b = 0;
1047  while (*str1 && *str2 && maxlen) {
1048  a = SDL_tolower((unsigned char) *str1);
1049  b = SDL_tolower((unsigned char) *str2);
1050  if (a != b)
1051  break;
1052  ++str1;
1053  ++str2;
1054  --maxlen;
1055  }
1056  if (maxlen == 0) {
1057  return 0;
1058  } else {
1059  a = SDL_tolower((unsigned char) *str1);
1060  b = SDL_tolower((unsigned char) *str2);
1061  return (int) ((unsigned char) a - (unsigned char) b);
1062  }
1063 #endif /* HAVE_STRNCASECMP */
1064 }

References SDL_tolower.

◆ SDL_strncmp()

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

Definition at line 994 of file SDL_string.c.

995 {
996 #if defined(HAVE_STRNCMP)
997  return strncmp(str1, str2, maxlen);
998 #else
999  while (*str1 && *str2 && maxlen) {
1000  if (*str1 != *str2)
1001  break;
1002  ++str1;
1003  ++str2;
1004  --maxlen;
1005  }
1006  if (!maxlen) {
1007  return 0;
1008  }
1009  return (int) ((unsigned char) *str1 - (unsigned char) *str2);
1010 #endif /* HAVE_STRNCMP */
1011 }

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

690 {
691 #ifdef HAVE_STRRCHR
692  return SDL_const_cast(char*,strrchr(string, c));
693 #elif defined(HAVE_RINDEX)
694  return SDL_const_cast(char*,rindex(string, c));
695 #else
696  const char *bufp = string + SDL_strlen(string) - 1;
697  while (bufp >= string) {
698  if (*bufp == c) {
699  return (char *) bufp;
700  }
701  --bufp;
702  }
703  return NULL;
704 #endif /* HAVE_STRRCHR */
705 }

References NULL, SDL_const_cast, and SDL_strlen().

◆ SDL_strrev()

char* SDL_strrev ( char *  str)

Definition at line 622 of file SDL_string.c.

623 {
624 #if defined(HAVE__STRREV)
625  return _strrev(string);
626 #else
627  size_t len = SDL_strlen(string);
628  char *a = &string[0];
629  char *b = &string[len - 1];
630  len /= 2;
631  while (len--) {
632  char c = *a;
633  *a++ = *b;
634  *b-- = c;
635  }
636  return string;
637 #endif /* HAVE__STRREV */
638 }

References SDL_strlen().

Referenced by SDL_ulltoa(), and SDL_ultoa().

◆ SDL_strstr()

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

Definition at line 708 of file SDL_string.c.

709 {
710 #if defined(HAVE_STRSTR)
711  return SDL_const_cast(char*,strstr(haystack, needle));
712 #else
713  size_t length = SDL_strlen(needle);
714  while (*haystack) {
715  if (SDL_strncmp(haystack, needle, length) == 0) {
716  return (char *) haystack;
717  }
718  ++haystack;
719  }
720  return NULL;
721 #endif /* HAVE_STRSTR */
722 }

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

◆ SDL_strtod()

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

Definition at line 961 of file SDL_string.c.

962 {
963 #if defined(HAVE_STRTOD)
964  return strtod(string, endp);
965 #else
966  size_t len;
967  double value = 0.0;
968 
969  len = SDL_ScanFloat(string, &value);
970  if (endp) {
971  *endp = (char *) string + len;
972  }
973  return value;
974 #endif /* HAVE_STRTOD */
975 }

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

862 {
863 #if defined(HAVE_STRTOL)
864  return strtol(string, endp, base);
865 #else
866  size_t len;
867  long value = 0;
868 
869  if (!base) {
870  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
871  base = 16;
872  } else {
873  base = 10;
874  }
875  }
876 
877  len = SDL_ScanLong(string, base, &value);
878  if (endp) {
879  *endp = (char *) string + len;
880  }
881  return value;
882 #endif /* HAVE_STRTOL */
883 }

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

912 {
913 #if defined(HAVE_STRTOLL)
914  return strtoll(string, endp, base);
915 #else
916  size_t len;
917  Sint64 value = 0;
918 
919  if (!base) {
920  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
921  base = 16;
922  } else {
923  base = 10;
924  }
925  }
926 
927  len = SDL_ScanLongLong(string, base, &value);
928  if (endp) {
929  *endp = (char *) string + len;
930  }
931  return value;
932 #endif /* HAVE_STRTOLL */
933 }

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

887 {
888 #if defined(HAVE_STRTOUL)
889  return strtoul(string, endp, base);
890 #else
891  size_t len;
892  unsigned long value = 0;
893 
894  if (!base) {
895  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
896  base = 16;
897  } else {
898  base = 10;
899  }
900  }
901 
902  len = SDL_ScanUnsignedLong(string, base, &value);
903  if (endp) {
904  *endp = (char *) string + len;
905  }
906  return value;
907 #endif /* HAVE_STRTOUL */
908 }

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

◆ SDL_strtoull()

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

Definition at line 936 of file SDL_string.c.

937 {
938 #if defined(HAVE_STRTOULL)
939  return strtoull(string, endp, base);
940 #else
941  size_t len;
942  Uint64 value = 0;
943 
944  if (!base) {
945  if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
946  base = 16;
947  } else {
948  base = 10;
949  }
950  }
951 
952  len = SDL_ScanUnsignedLongLong(string, base, &value);
953  if (endp) {
954  *endp = (char *) string + len;
955  }
956  return value;
957 #endif /* HAVE_STRTOULL */
958 }

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

◆ SDL_strupr()

char* SDL_strupr ( char *  str)

Definition at line 641 of file SDL_string.c.

642 {
643 #if defined(HAVE__STRUPR)
644  return _strupr(string);
645 #else
646  char *bufp = string;
647  while (*bufp) {
648  *bufp = SDL_toupper((unsigned char) *bufp);
649  ++bufp;
650  }
651  return string;
652 #endif /* HAVE__STRUPR */
653 }

References SDL_toupper.

Referenced by SDL_PrintString().

◆ SDL_tan()

double SDL_tan ( double  x)

Definition at line 410 of file SDL_stdlib.c.

411 {
412 #if defined(HAVE_TAN)
413  return tan(x);
414 #else
415  return SDL_uclibc_tan(x);
416 #endif
417 }

References SDL_uclibc_tan(), and tan().

Referenced by SDL_tanf().

◆ SDL_tanf()

float SDL_tanf ( float  x)

Definition at line 420 of file SDL_stdlib.c.

421 {
422 #if defined(HAVE_TANF)
423  return tanf(x);
424 #else
425  return (float)SDL_tan((double)x);
426 #endif
427 }

References SDL_tan().

◆ SDL_tolower()

int SDL_tolower ( int  x)

Definition at line 451 of file SDL_stdlib.c.

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

◆ SDL_toupper()

int SDL_toupper ( int  x)

Definition at line 450 of file SDL_stdlib.c.

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

◆ SDL_uitoa()

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

Definition at line 745 of file SDL_string.c.

746 {
747 #ifdef HAVE__UITOA
748  return _uitoa(value, string, radix);
749 #else
750  return SDL_ultoa((unsigned long)value, string, radix);
751 #endif /* HAVE__UITOA */
752 }

References SDL_ultoa().

◆ SDL_ulltoa()

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

Definition at line 818 of file SDL_string.c.

819 {
820 #if defined(HAVE__UI64TOA)
821  return _ui64toa(value, string, radix);
822 #else
823  char *bufp = string;
824 
825  if (value) {
826  while (value > 0) {
827  *bufp++ = ntoa_table[value % radix];
828  value /= radix;
829  }
830  } else {
831  *bufp++ = '0';
832  }
833  *bufp = '\0';
834 
835  /* The numbers went into the string backwards. :) */
836  SDL_strrev(string);
837 
838  return string;
839 #endif /* HAVE__UI64TOA */
840 }

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

775 {
776 #if defined(HAVE__ULTOA)
777  return _ultoa(value, string, radix);
778 #else
779  char *bufp = string;
780 
781  if (value) {
782  while (value > 0) {
783  *bufp++ = ntoa_table[value % radix];
784  value /= radix;
785  }
786  } else {
787  *bufp++ = '0';
788  }
789  *bufp = '\0';
790 
791  /* The numbers went into the string backwards. :) */
792  SDL_strrev(string);
793 
794  return string;
795 #endif /* HAVE__ULTOA */
796 }

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

547 {
548  size_t src_bytes = SDL_strlen(src);
549  size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
550  size_t i = 0;
551  char trailing_bytes = 0;
552  if (bytes)
553  {
554  unsigned char c = (unsigned char)src[bytes - 1];
555  if (UTF8_IsLeadByte(c))
556  --bytes;
557  else if (UTF8_IsTrailingByte(c))
558  {
559  for (i = bytes - 1; i != 0; --i)
560  {
561  c = (unsigned char)src[i];
562  trailing_bytes = UTF8_TrailingBytes(c);
563  if (trailing_bytes)
564  {
565  if (bytes - i != trailing_bytes + 1)
566  bytes = i;
567 
568  break;
569  }
570  }
571  }
572  SDL_memcpy(dst, src, bytes);
573  }
574  dst[bytes] = '\0';
575  return bytes;
576 }

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

580 {
581  size_t retval = 0;
582  const char *p = str;
583  char ch;
584 
585  while ((ch = *(p++)) != 0) {
586  /* if top two bits are 1 and 0, it's a continuation byte. */
587  if ((ch & 0xc0) != 0x80) {
588  retval++;
589  }
590  }
591 
592  return retval;
593 }

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

1647 {
1648  size_t left = maxlen;
1649  char *textstart = text;
1650 
1651  if (!fmt) {
1652  fmt = "";
1653  }
1654  while (*fmt && left > 1) {
1655  if (*fmt == '%') {
1657  size_t len = 0;
1658  SDL_bool check_flag;
1659  SDL_FormatInfo info;
1660  enum
1661  {
1662  DO_INT,
1663  DO_LONG,
1664  DO_LONGLONG
1665  } inttype = DO_INT;
1666 
1667  SDL_zero(info);
1668  info.radix = 10;
1669  info.precision = -1;
1670 
1671  check_flag = SDL_TRUE;
1672  while (check_flag) {
1673  ++fmt;
1674  switch (*fmt) {
1675  case '-':
1676  info.left_justify = SDL_TRUE;
1677  break;
1678  case '+':
1679  info.force_sign = SDL_TRUE;
1680  break;
1681  case '#':
1682  info.force_type = SDL_TRUE;
1683  break;
1684  case '0':
1685  info.pad_zeroes = SDL_TRUE;
1686  break;
1687  default:
1688  check_flag = SDL_FALSE;
1689  break;
1690  }
1691  }
1692 
1693  if (*fmt >= '0' && *fmt <= '9') {
1694  info.width = SDL_strtol(fmt, (char **)&fmt, 0);
1695  }
1696  else if (*fmt == '*') {
1697  ++fmt;
1698  info.width = va_arg(ap, int);
1699  }
1700 
1701  if (*fmt == '.') {
1702  ++fmt;
1703  if (*fmt >= '0' && *fmt <= '9') {
1704  info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
1705  } else if (*fmt == '*') {
1706  ++fmt;
1707  info.precision = va_arg(ap, int);
1708  } else {
1709  info.precision = 0;
1710  }
1711  if (info.precision < 0) {
1712  info.precision = 0;
1713  }
1714  }
1715 
1716  while (!done) {
1717  switch (*fmt) {
1718  case '%':
1719  if (left > 1) {
1720  *text = '%';
1721  }
1722  len = 1;
1723  done = SDL_TRUE;
1724  break;
1725  case 'c':
1726  /* char is promoted to int when passed through (...) */
1727  if (left > 1) {
1728  *text = (char) va_arg(ap, int);
1729  }
1730  len = 1;
1731  done = SDL_TRUE;
1732  break;
1733  case 'h':
1734  /* short is promoted to int when passed through (...) */
1735  break;
1736  case 'l':
1737  if (inttype < DO_LONGLONG) {
1738  ++inttype;
1739  }
1740  break;
1741  case 'I':
1742  if (SDL_strncmp(fmt, "I64", 3) == 0) {
1743  fmt += 2;
1744  inttype = DO_LONGLONG;
1745  }
1746  break;
1747  case 'i':
1748  case 'd':
1749  if (info.precision >= 0) {
1750  info.pad_zeroes = SDL_FALSE;
1751  }
1752  switch (inttype) {
1753  case DO_INT:
1754  len = SDL_PrintLong(text, left, &info,
1755  (long) va_arg(ap, int));
1756  break;
1757  case DO_LONG:
1758  len = SDL_PrintLong(text, left, &info,
1759  va_arg(ap, long));
1760  break;
1761  case DO_LONGLONG:
1762  len = SDL_PrintLongLong(text, left, &info,
1763  va_arg(ap, Sint64));
1764  break;
1765  }
1766  done = SDL_TRUE;
1767  break;
1768  case 'p':
1769  case 'x':
1770  info.force_case = SDL_CASE_LOWER;
1771  /* Fall through to 'X' handling */
1772  case 'X':
1773  if (info.force_case == SDL_CASE_NOCHANGE) {
1774  info.force_case = SDL_CASE_UPPER;
1775  }
1776  if (info.radix == 10) {
1777  info.radix = 16;
1778  }
1779  if (*fmt == 'p') {
1780  inttype = DO_LONG;
1781  }
1782  /* Fall through to unsigned handling */
1783  case 'o':
1784  if (info.radix == 10) {
1785  info.radix = 8;
1786  }
1787  /* Fall through to unsigned handling */
1788  case 'u':
1789  info.force_sign = SDL_FALSE;
1790  if (info.precision >= 0) {
1791  info.pad_zeroes = SDL_FALSE;
1792  }
1793  switch (inttype) {
1794  case DO_INT:
1795  len = SDL_PrintUnsignedLong(text, left, &info,
1796  (unsigned long)
1797  va_arg(ap, unsigned int));
1798  break;
1799  case DO_LONG:
1800  len = SDL_PrintUnsignedLong(text, left, &info,
1801  va_arg(ap, unsigned long));
1802  break;
1803  case DO_LONGLONG:
1805  va_arg(ap, Uint64));
1806  break;
1807  }
1808  done = SDL_TRUE;
1809  break;
1810  case 'f':
1811  len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
1812  done = SDL_TRUE;
1813  break;
1814  case 'S':
1815  {
1816  /* In practice this is used on Windows for WCHAR strings */
1817  wchar_t *wide_arg = va_arg(ap, wchar_t *);
1818  char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
1819  info.pad_zeroes = SDL_FALSE;
1820  len = SDL_PrintString(text, left, &info, arg);
1821  SDL_free(arg);
1822  done = SDL_TRUE;
1823  }
1824  break;
1825  case 's':
1826  info.pad_zeroes = SDL_FALSE;
1827  len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
1828  done = SDL_TRUE;
1829  break;
1830  default:
1831  done = SDL_TRUE;
1832  break;
1833  }
1834  ++fmt;
1835  }
1836  if (len >= left) {
1837  text += (left > 1) ? left - 1 : 0;
1838  left = SDL_min(left, 1);
1839  } else {
1840  text += len;
1841  left -= len;
1842  }
1843  } else {
1844  *text++ = *fmt++;
1845  --left;
1846  }
1847  }
1848  if (left > 0) {
1849  *text = '\0';
1850  }
1851  return (int)(text - textstart);
1852 }

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

Referenced by SDL_snprintf().

◆ SDL_vsscanf()

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

Definition at line 1085 of file SDL_string.c.

1086 {
1087  int retval = 0;
1088 
1089  if (!text || !*text) {
1090  return -1;
1091  }
1092 
1093  while (*fmt) {
1094  if (*fmt == ' ') {
1095  while (SDL_isspace((unsigned char) *text)) {
1096  ++text;
1097  }
1098  ++fmt;
1099  continue;
1100  }
1101  if (*fmt == '%') {
1103  long count = 0;
1104  int radix = 10;
1105  enum
1106  {
1107  DO_SHORT,
1108  DO_INT,
1109  DO_LONG,
1110  DO_LONGLONG
1111  } inttype = DO_INT;
1112  size_t advance;
1113  SDL_bool suppress = SDL_FALSE;
1114 
1115  ++fmt;
1116  if (*fmt == '%') {
1117  if (*text == '%') {
1118  ++text;
1119  ++fmt;
1120  continue;
1121  }
1122  break;
1123  }
1124  if (*fmt == '*') {
1125  suppress = SDL_TRUE;
1126  ++fmt;
1127  }
1128  fmt += SDL_ScanLong(fmt, 10, &count);
1129 
1130  if (*fmt == 'c') {
1131  if (!count) {
1132  count = 1;
1133  }
1134  if (suppress) {
1135  while (count--) {
1136  ++text;
1137  }
1138  } else {
1139  char *valuep = va_arg(ap, char *);
1140  while (count--) {
1141  *valuep++ = *text++;
1142  }
1143  ++retval;
1144  }
1145  continue;
1146  }
1147 
1148  while (SDL_isspace((unsigned char) *text)) {
1149  ++text;
1150  }
1151 
1152  /* FIXME: implement more of the format specifiers */
1153  while (!done) {
1154  switch (*fmt) {
1155  case '*':
1156  suppress = SDL_TRUE;
1157  break;
1158  case 'h':
1159  if (inttype > DO_SHORT) {
1160  ++inttype;
1161  }
1162  break;
1163  case 'l':
1164  if (inttype < DO_LONGLONG) {
1165  ++inttype;
1166  }
1167  break;
1168  case 'I':
1169  if (SDL_strncmp(fmt, "I64", 3) == 0) {
1170  fmt += 2;
1171  inttype = DO_LONGLONG;
1172  }
1173  break;
1174  case 'i':
1175  {
1176  int index = 0;
1177  if (text[index] == '-') {
1178  ++index;
1179  }
1180  if (text[index] == '0') {
1181  if (SDL_tolower((unsigned char) text[index + 1]) == 'x') {
1182  radix = 16;
1183  } else {
1184  radix = 8;
1185  }
1186  }
1187  }
1188  /* Fall through to %d handling */
1189  case 'd':
1190  if (inttype == DO_LONGLONG) {
1191  Sint64 value;
1192  advance = SDL_ScanLongLong(text, radix, &value);
1193  text += advance;
1194  if (advance && !suppress) {
1195  Sint64 *valuep = va_arg(ap, Sint64 *);
1196  *valuep = value;
1197  ++retval;
1198  }
1199  } else {
1200  long value;
1201  advance = SDL_ScanLong(text, radix, &value);
1202  text += advance;
1203  if (advance && !suppress) {
1204  switch (inttype) {
1205  case DO_SHORT:
1206  {
1207  short *valuep = va_arg(ap, short *);
1208  *valuep = (short) value;
1209  }
1210  break;
1211  case DO_INT:
1212  {
1213  int *valuep = va_arg(ap, int *);
1214  *valuep = (int) value;
1215  }
1216  break;
1217  case DO_LONG:
1218  {
1219  long *valuep = va_arg(ap, long *);
1220  *valuep = value;
1221  }
1222  break;
1223  case DO_LONGLONG:
1224  /* Handled above */
1225  break;
1226  }
1227  ++retval;
1228  }
1229  }
1230  done = SDL_TRUE;
1231  break;
1232  case 'o':
1233  if (radix == 10) {
1234  radix = 8;
1235  }
1236  /* Fall through to unsigned handling */
1237  case 'x':
1238  case 'X':
1239  if (radix == 10) {
1240  radix = 16;
1241  }
1242  /* Fall through to unsigned handling */
1243  case 'u':
1244  if (inttype == DO_LONGLONG) {
1245  Uint64 value = 0;
1246  advance = SDL_ScanUnsignedLongLong(text, radix, &value);
1247  text += advance;
1248  if (advance && !suppress) {
1249  Uint64 *valuep = va_arg(ap, Uint64 *);
1250  *valuep = value;
1251  ++retval;
1252  }
1253  } else {
1254  unsigned long value = 0;
1255  advance = SDL_ScanUnsignedLong(text, radix, &value);
1256  text += advance;
1257  if (advance && !suppress) {
1258  switch (inttype) {
1259  case DO_SHORT:
1260  {
1261  short *valuep = va_arg(ap, short *);
1262  *valuep = (short) value;
1263  }
1264  break;
1265  case DO_INT:
1266  {
1267  int *valuep = va_arg(ap, int *);
1268  *valuep = (int) value;
1269  }
1270  break;
1271  case DO_LONG:
1272  {
1273  long *valuep = va_arg(ap, long *);
1274  *valuep = value;
1275  }
1276  break;
1277  case DO_LONGLONG:
1278  /* Handled above */
1279  break;
1280  }
1281  ++retval;
1282  }
1283  }
1284  done = SDL_TRUE;
1285  break;
1286  case 'p':
1287  {
1288  uintptr_t value = 0;
1289  advance = SDL_ScanUintPtrT(text, 16, &value);
1290  text += advance;
1291  if (advance && !suppress) {
1292  void **valuep = va_arg(ap, void **);
1293  *valuep = (void *) value;
1294  ++retval;
1295  }
1296  }
1297  done = SDL_TRUE;
1298  break;
1299  case 'f':
1300  {
1301  double value;
1302  advance = SDL_ScanFloat(text, &value);
1303  text += advance;
1304  if (advance && !suppress) {
1305  float *valuep = va_arg(ap, float *);
1306  *valuep = (float) value;
1307  ++retval;
1308  }
1309  }
1310  done = SDL_TRUE;
1311  break;
1312  case 's':
1313  if (suppress) {
1314  while (!SDL_isspace((unsigned char) *text)) {
1315  ++text;
1316  if (count) {
1317  if (--count == 0) {
1318  break;
1319  }
1320  }
1321  }
1322  } else {
1323  char *valuep = va_arg(ap, char *);
1324  while (!SDL_isspace((unsigned char) *text)) {
1325  *valuep++ = *text++;
1326  if (count) {
1327  if (--count == 0) {
1328  break;
1329  }
1330  }
1331  }
1332  *valuep = '\0';
1333  ++retval;
1334  }
1335  done = SDL_TRUE;
1336  break;
1337  default:
1338  done = SDL_TRUE;
1339  break;
1340  }
1341  ++fmt;
1342  }
1343  continue;
1344  }
1345  if (*text == *fmt) {
1346  ++text;
1347  ++fmt;
1348  continue;
1349  }
1350  /* Text didn't match format specifier */
1351  break;
1352  }
1353 
1354  return retval;
1355 }

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

Referenced by SDL_sscanf().

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

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_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) {
520  if (*str1 != *str2)
521  break;
522  ++str1;
523  ++str2;
524  }
525  return (int)(*str1 - *str2);
526 #endif /* HAVE_WCSNCMP */
527 }

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 }

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

SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:418
SDL_floor
double SDL_floor(double x)
Definition: SDL_stdlib.c:244
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:386
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
SDL_PrintUnsignedLongLong
static size_t SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
Definition: SDL_string.c:1533
Sint64
int64_t Sint64
Definition: SDL_stdinc.h:210
SDL_strlcpy
size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:530
SDL_static_cast
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:138
fabs
double fabs(double x)
Definition: s_fabs.c:22
SDL_ICONV_E2BIG
#define SDL_ICONV_E2BIG
Definition: SDL_stdinc.h:551
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
encodings
static struct @30 encodings[]
SDL_log10
double SDL_log10(double x)
Definition: SDL_stdlib.c:304
calloc_func
SDL_calloc_func calloc_func
Definition: SDL_malloc.c:5322
SDL_scalbn
double SDL_scalbn(double x, int n)
Definition: SDL_stdlib.c:344
NULL
#define NULL
Definition: begin_code.h:167
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
SDL_PrintString
static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
Definition: SDL_string.c:1412
ENCODING_UTF16LE
@ ENCODING_UTF16LE
Definition: SDL_iconv.c:108
SDL_PrintFloat
static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
Definition: SDL_string.c:1543
malloc_func
SDL_malloc_func malloc_func
Definition: SDL_malloc.c:5321
cos
double cos(double x)
Definition: s_cos.c:46
base
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
Definition: pixman-arm-simd-asm.h:108
SDL_tolower
#define SDL_tolower
Definition: SDL_dynapi_overrides.h:385
SDL_FormatInfo::precision
int precision
Definition: SDL_string.c:1408
SDL_ScanUintPtrT
static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
Definition: SDL_string.c:126
SDL_FormatInfo::radix
int radix
Definition: SDL_string.c:1407
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1571
SDL_const_cast
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:139
SDL_PrintUnsignedLong
static size_t SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
Definition: SDL_string.c:1509
SDL_uclibc_floor
double SDL_uclibc_floor(double x)
SDL_iconv_open
SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
Definition: SDL_iconv.c:208
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:376
SDL_InvalidParamError
#define SDL_InvalidParamError(param)
Definition: SDL_error.h:54
SDL_AtomicIncRef
#define SDL_AtomicIncRef(a)
Increment an atomic variable used as a reference count.
Definition: SDL_atomic.h:252
memmove
#define memmove
Definition: SDL_qsort.c:59
SDL_uclibc_fmod
double SDL_uclibc_fmod(double x, double y)
UNKNOWN_UNICODE
#define UNKNOWN_UNICODE
Definition: SDL_iconv.c:98
SDL_wcsncmp
int SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
Definition: SDL_string.c:514
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
ENCODING_UTF16BE
@ ENCODING_UTF16BE
Definition: SDL_iconv.c:107
SDL_ICONV_EILSEQ
#define SDL_ICONV_EILSEQ
Definition: SDL_stdinc.h:552
SDL_env
static char ** SDL_env
Definition: SDL_getenv.c:108
SDL_sqrt
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:390
ENCODING_UTF32
@ ENCODING_UTF32
Definition: SDL_iconv.c:109
SDL_strncmp
#define SDL_strncmp
Definition: SDL_dynapi_overrides.h:418
SDL_uclibc_sqrt
double SDL_uclibc_sqrt(double x)
index
GLuint index
Definition: SDL_opengl_glext.h:663
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
SDL_uclibc_scalbn
double SDL_uclibc_scalbn(double x, int n)
memcpy
#define memcpy
Definition: SDL_malloc.c:630
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:672
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
SDL_uclibc_cos
double SDL_uclibc_cos(double x)
SDL_fmod
double SDL_fmod(double x, double y)
Definition: SDL_stdlib.c:264
n
GLdouble n
Definition: SDL_opengl_glext.h:1955
s1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: SDL_opengl_glext.h:8586
ENCODING_UTF32LE
@ ENCODING_UTF32LE
Definition: SDL_iconv.c:111
SDL_strcasecmp
#define SDL_strcasecmp
Definition: SDL_dynapi_overrides.h:419
SDL_uclibc_exp
double SDL_uclibc_exp(double x)
ENCODING_ASCII
@ ENCODING_ASCII
Definition: SDL_iconv.c:103
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
SDL_sin
double SDL_sin(double x)
Definition: SDL_stdlib.c:370
SDL_AtomicDecRef
#define SDL_AtomicDecRef(a)
Decrement an atomic variable used as a reference count.
Definition: SDL_atomic.h:262
u2
GLfixed GLfixed u2
Definition: SDL_opengl_glext.h:4561
ENCODING_UCS2LE
@ ENCODING_UCS2LE
Definition: SDL_iconv.c:113
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
done
int done
Definition: checkkeys.c:28
scalbn
#define scalbn
Definition: math_private.h:46
SDL_strchr
#define SDL_strchr
Definition: SDL_dynapi_overrides.h:401
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11093
SDL_ICONV_EINVAL
#define SDL_ICONV_EINVAL
Definition: SDL_stdinc.h:553
ENCODING_UTF32BE
@ ENCODING_UTF32BE
Definition: SDL_iconv.c:110
ntoa_table
static const char ntoa_table[]
Definition: SDL_string.c:726
ENCODING_UCS4BE
@ ENCODING_UCS4BE
Definition: SDL_iconv.c:114
retval
SDL_bool retval
Definition: testgamecontroller.c:65
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_uclibc_fabs
double SDL_uclibc_fabs(double x)
SDL_uclibc_atan2
double SDL_uclibc_atan2(double y, double x)
SDL_FormatInfo::left_justify
SDL_bool left_justify
Definition: SDL_string.c:1401
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
UNICODE_BOM
#define UNICODE_BOM
Definition: SDL_iconv.c:95
SDL_FormatInfo::force_type
SDL_bool force_type
Definition: SDL_string.c:1403
SDL_copysign
double SDL_copysign(double x, double y)
Definition: SDL_stdlib.c:156
SDL_uclibc_copysign
double SDL_uclibc_copysign(double x, double y)
SDL_asin
double SDL_asin(double val)
Definition: SDL_stdlib.c:105
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:663
free_func
SDL_free_func free_func
Definition: SDL_malloc.c:5324
SDL_uclibc_pow
double SDL_uclibc_pow(double x, double y)
tan
double tan(double x)
Definition: s_tan.c:45
ENCODING_UNKNOWN
@ ENCODING_UNKNOWN
Definition: SDL_iconv.c:102
s_mem
static struct @31 s_mem
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315
SDL_strtod
double SDL_strtod(const char *string, char **endp)
Definition: SDL_string.c:961
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:411
SDL_atan
double SDL_atan(double x)
Definition: SDL_stdlib.c:35
SDL_strtol
long SDL_strtol(const char *string, char **endp, int base)
Definition: SDL_string.c:861
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:406
copysign
double copysign(double x, double y)
Definition: s_copysign.c:21
SDL_ScanLong
static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
Definition: SDL_string.c:53
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
SDL_isspace
#define SDL_isspace
Definition: SDL_dynapi_overrides.h:383
SDL_PrintLongLong
static size_t SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
Definition: SDL_string.c:1519
SDL_tan
double SDL_tan(double x)
Definition: SDL_stdlib.c:410
ENCODING_UTF32NATIVE
#define ENCODING_UTF32NATIVE
Definition: SDL_iconv.c:119
SDL_strrev
char * SDL_strrev(char *string)
Definition: SDL_string.c:622
SDL_PrintLong
static size_t SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
Definition: SDL_string.c:1495
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_FormatInfo::width
int width
Definition: SDL_string.c:1406
SDL_uclibc_atan
double SDL_uclibc_atan(double x)
SDL_ICONV_ERROR
#define SDL_ICONV_ERROR
Definition: SDL_stdinc.h:550
SDL_FormatInfo::force_sign
SDL_bool force_sign
Definition: SDL_string.c:1402
SDL_CASE_UPPER
@ SDL_CASE_UPPER
Definition: SDL_string.c:1396
SDL_ScanLongLong
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
Definition: SDL_string.c:158
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_wcslcpy
size_t SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
Definition: SDL_string.c:439
SDL_ulltoa
char * SDL_ulltoa(Uint64 value, char *string, int radix)
Definition: SDL_string.c:818
SDL_toupper
#define SDL_toupper
Definition: SDL_dynapi_overrides.h:384
SDL_pow
double SDL_pow(double x, double y)
Definition: SDL_stdlib.c:324
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:115
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:315
atan
double atan(double x)
Definition: s_atan.c:71
SDL_fabs
double SDL_fabs(double x)
Definition: SDL_stdlib.c:224
SDL_FormatInfo::pad_zeroes
SDL_bool pad_zeroes
Definition: SDL_string.c:1404
src
GLenum src
Definition: SDL_opengl_glext.h:1740
SDL_getenv
char * SDL_getenv(const char *name)
Definition: SDL_getenv.c:219
UTF8_IsTrailingByte
#define UTF8_IsTrailingByte(c)
Definition: SDL_string.c:37
memset
#define memset
Definition: SDL_malloc.c:627
UTF8_IsLeadByte
#define UTF8_IsLeadByte(c)
Definition: SDL_string.c:36
SDL_iconv_string
#define SDL_iconv_string
Definition: SDL_dynapi_overrides.h:441
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1495
SDL_ltoa
char * SDL_ltoa(long value, char *string, int radix)
Definition: SDL_string.c:755
SDL_snprintf
#define SDL_snprintf
Definition: SDL_dynapi_overrides.h:40
Uint64
uint64_t Uint64
Definition: SDL_stdinc.h:216
SDL_ScanUnsignedLongLong
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
Definition: SDL_string.c:199
SDL_CASE_LOWER
@ SDL_CASE_LOWER
Definition: SDL_string.c:1395
ENCODING_UTF8
@ ENCODING_UTF8
Definition: SDL_iconv.c:105
left
GLint left
Definition: SDL_opengl_glext.h:1952
SDL_vsscanf
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
Definition: SDL_string.c:1085
SDL_ultoa
char * SDL_ultoa(unsigned long value, char *string, int radix)
Definition: SDL_string.c:774
SDL_wcslen
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:425
SDL_ceil
double SDL_ceil(double x)
Definition: SDL_stdlib.c:131
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:393
u1
GLfixed u1
Definition: SDL_opengl_glext.h:4561
SDL_ScanFloat
static size_t SDL_ScanFloat(const char *text, double *valuep)
Definition: SDL_string.c:231
SDL_ScanUnsignedLong
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
Definition: SDL_string.c:94
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
getlocale
static const char * getlocale(char *buffer, size_t bufsize)
Definition: SDL_iconv.c:173
realloc_func
SDL_realloc_func realloc_func
Definition: SDL_malloc.c:5323
SDL_vsnprintf
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
Definition: SDL_string.c:1646
SDL_acos
double SDL_acos(double val)
Definition: SDL_stdlib.c:75
SDL_FormatInfo
Definition: SDL_string.c:1400
SDL_uclibc_sin
double SDL_uclibc_sin(double x)
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
ENCODING_LATIN1
@ ENCODING_LATIN1
Definition: SDL_iconv.c:104
ENCODING_UCS4LE
@ ENCODING_UCS4LE
Definition: SDL_iconv.c:115
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:691
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_uclibc_log
double SDL_uclibc_log(double x)
void
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
Definition: SDL_dynapi_procs.h:89
SDL_iconv_close
int SDL_iconv_close(SDL_iconv_t cd)
Definition: SDL_iconv.c:854
floor
double floor(double x)
Definition: s_floor.c:33
SDL_uclibc_log10
double SDL_uclibc_log10(double x)
ENCODING_UTF16NATIVE
#define ENCODING_UTF16NATIVE
Definition: SDL_iconv.c:118
SDL_exp
double SDL_exp(double x)
Definition: SDL_stdlib.c:204
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:994
ptr
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
Definition: pixman-arm-simd-asm.h:171
sin
double sin(double x)
Definition: s_sin.c:46
UNKNOWN_ASCII
#define UNKNOWN_ASCII
Definition: SDL_iconv.c:97
SDL_CASE_NOCHANGE
@ SDL_CASE_NOCHANGE
Definition: SDL_string.c:1394
SDL_FormatInfo::force_case
SDL_letter_case force_case
Definition: SDL_string.c:1405
i
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
ENCODING_UCS2BE
@ ENCODING_UCS2BE
Definition: SDL_iconv.c:112
UTF8_TrailingBytes
static int UTF8_TrailingBytes(unsigned char c)
Definition: SDL_string.c:39
SDL_atan2
double SDL_atan2(double x, double y)
Definition: SDL_stdlib.c:55
ENCODING_UTF16
@ ENCODING_UTF16
Definition: SDL_iconv.c:106
uintptr_t
unsigned int uintptr_t
Definition: SDL_config_windows.h:70
SDL_cos
double SDL_cos(double x)
Definition: SDL_stdlib.c:184
SDL_log
double SDL_log(double x)
Definition: SDL_stdlib.c:284
SDL_uclibc_tan
double SDL_uclibc_tan(double x)
SDL_iconv
size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: SDL_iconv.c:248