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:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

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

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

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

Typedefs

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

Functions

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

Basic data types

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

Detailed Description

This is a general header that includes C language support.

Definition in file SDL_stdinc.h.

Macro Definition Documentation

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

Definition at line 312 of file SDL_stdinc.h.

Referenced by SDL_AtomicTryLock(), and TestTypes().

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

Definition at line 139 of file SDL_stdinc.h.

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

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

Definition at line 144 of file SDL_stdinc.h.

#define SDL_ICONV_E2BIG   (size_t)-2

Definition at line 542 of file SDL_stdinc.h.

Referenced by SDL_iconv(), and SDL_iconv_string().

#define SDL_ICONV_EILSEQ   (size_t)-3

Definition at line 543 of file SDL_stdinc.h.

Referenced by SDL_iconv_string().

#define SDL_ICONV_EINVAL   (size_t)-4

Definition at line 544 of file SDL_stdinc.h.

Referenced by SDL_iconv(), and SDL_iconv_string().

#define SDL_ICONV_ERROR   (size_t)-1

Definition at line 541 of file SDL_stdinc.h.

Referenced by SDL_iconv_string().

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

Definition at line 562 of file SDL_stdinc.h.

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

Definition at line 563 of file SDL_stdinc.h.

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

Definition at line 564 of file SDL_stdinc.h.

#define SDL_IN_BYTECAP (   x)

Definition at line 294 of file SDL_stdinc.h.

#define SDL_INOUT_Z_CAP (   x)

Definition at line 295 of file SDL_stdinc.h.

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

A signed 16-bit integer type.

Definition at line 183 of file SDL_stdinc.h.

Referenced by TestTypes().

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

A signed 32-bit integer type.

Definition at line 195 of file SDL_stdinc.h.

Referenced by SDL_CreateRGBSurfaceWithFormat(), and TestTypes().

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

A signed 64-bit integer type.

Definition at line 208 of file SDL_stdinc.h.

Referenced by TestTypes().

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

A signed 8-bit integer type.

Definition at line 171 of file SDL_stdinc.h.

Referenced by TestTypes().

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

An unsigned 16-bit integer type.

Definition at line 189 of file SDL_stdinc.h.

Referenced by TestTypes().

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

An unsigned 32-bit integer type.

Definition at line 201 of file SDL_stdinc.h.

Referenced by TestTypes().

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

An unsigned 64-bit integer type.

Definition at line 214 of file SDL_stdinc.h.

Referenced by TestTypes().

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

An unsigned 8-bit integer type.

Definition at line 177 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 184 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 196 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 209 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 172 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 190 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 202 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 215 of file SDL_stdinc.h.

Referenced by TestTypes().

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

Definition at line 178 of file SDL_stdinc.h.

Referenced by TestTypes().

#define SDL_OUT_BYTECAP (   x)

Definition at line 298 of file SDL_stdinc.h.

#define SDL_OUT_CAP (   x)

Definition at line 297 of file SDL_stdinc.h.

#define SDL_OUT_Z_BYTECAP (   x)

Definition at line 299 of file SDL_stdinc.h.

#define SDL_OUT_Z_CAP (   x)

Definition at line 296 of file SDL_stdinc.h.

#define SDL_PRINTF_FORMAT_STRING

Definition at line 300 of file SDL_stdinc.h.

#define SDL_PRINTF_VARARG_FUNC (   fmtargnumber)

Definition at line 307 of file SDL_stdinc.h.

#define SDL_PRIx64   "I64x"

Definition at line 249 of file SDL_stdinc.h.

Referenced by SDLTest_LogAllocations().

#define SDL_PRIX64   "I64X"

Definition at line 260 of file SDL_stdinc.h.

Referenced by platform_testEndianessAndSwap(), and TestEndian().

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

Definition at line 137 of file SDL_stdinc.h.

#define SDL_SCANF_FORMAT_STRING

Definition at line 301 of file SDL_stdinc.h.

#define SDL_SCANF_VARARG_FUNC (   fmtargnumber)

Definition at line 308 of file SDL_stdinc.h.

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

Definition at line 138 of file SDL_stdinc.h.

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

#define SDL_STRINGIFY_ARG (   arg)    #arg

Macro useful for building other macros with strings in them

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

Definition at line 123 of file SDL_stdinc.h.

#define SDL_TABLESIZE (   table)    SDL_arraysize(table)

Definition at line 116 of file SDL_stdinc.h.

Referenced by handleKeyboardEvent().

Typedef Documentation

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

Definition at line 367 of file SDL_stdinc.h.

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.

typedef void*( * SDL_malloc_func)(size_t size)

Definition at line 366 of file SDL_stdinc.h.

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

Definition at line 368 of file SDL_stdinc.h.

typedef int16_t Sint16

Definition at line 185 of file SDL_stdinc.h.

typedef int32_t Sint32

Definition at line 197 of file SDL_stdinc.h.

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

Definition at line 210 of file SDL_stdinc.h.

typedef int8_t Sint8

Definition at line 173 of file SDL_stdinc.h.

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.

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.

typedef uint64_t Uint64

Definition at line 216 of file SDL_stdinc.h.

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

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.

{
SDL_FALSE = 0,

Function Documentation

int SDL_abs ( int  x)

Definition at line 429 of file SDL_stdlib.c.

{
#if defined(HAVE_ABS)
return abs(x);
#else
return ((x) < 0 ? -(x) : (x));
#endif
}
double SDL_acos ( double  x)

Definition at line 75 of file SDL_stdlib.c.

References SDL_atan, and SDL_sqrt.

{
#if defined(HAVE_ACOS)
return acos(val);
#else
double result;
if (val == -1.0) {
result = M_PI;
} else {
result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
if (result < 0.0)
{
result += M_PI;
}
}
return result;
#endif
}
float SDL_acosf ( float  x)

Definition at line 95 of file SDL_stdlib.c.

References SDL_acos.

{
#if defined(HAVE_ACOSF)
return acosf(val);
#else
return (float)SDL_acos((double)val);
#endif
}
double SDL_asin ( double  x)

Definition at line 105 of file SDL_stdlib.c.

References SDL_acos.

{
#if defined(HAVE_ASIN)
return asin(val);
#else
double result;
if (val == -1.0) {
result = -(M_PI / 2.0);
} else {
result = (M_PI / 2.0) - SDL_acos(val);
}
return result;
#endif
}
float SDL_asinf ( float  x)

Definition at line 121 of file SDL_stdlib.c.

References SDL_asin.

{
#if defined(HAVE_ASINF)
return asinf(val);
#else
return (float)SDL_asin((double)val);
#endif
}
double SDL_atan ( double  x)

Definition at line 35 of file SDL_stdlib.c.

References atan(), and SDL_uclibc_atan().

{
#if defined(HAVE_ATAN)
return atan(x);
#else
return SDL_uclibc_atan(x);
#endif
}
double SDL_atan2 ( double  x,
double  y 
)

Definition at line 55 of file SDL_stdlib.c.

References SDL_uclibc_atan2().

{
#if defined(HAVE_ATAN2)
return atan2(x, y);
#else
return SDL_uclibc_atan2(x, y);
#endif
}
float SDL_atan2f ( float  x,
float  y 
)

Definition at line 65 of file SDL_stdlib.c.

References SDL_atan2.

{
#if defined(HAVE_ATAN2F)
return atan2f(x, y);
#else
return (float)SDL_atan2((double)x, (double)y);
#endif
}
float SDL_atanf ( float  x)

Definition at line 45 of file SDL_stdlib.c.

References SDL_atan.

{
#if defined(HAVE_ATANF)
return atanf(x);
#else
return (float)SDL_atan((double)x);
#endif
}
double SDL_atof ( const char *  str)

Definition at line 818 of file SDL_string.c.

References NULL, and SDL_strtod.

{
#ifdef HAVE_ATOF
return (double) atof(string);
#else
return SDL_strtod(string, NULL);
#endif /* HAVE_ATOF */
}
int SDL_atoi ( const char *  str)

Definition at line 809 of file SDL_string.c.

References NULL, and SDL_strtol.

{
#ifdef HAVE_ATOI
return atoi(string);
#else
return SDL_strtol(string, NULL, 0);
#endif /* HAVE_ATOI */
}
void* SDL_calloc ( size_t  nmemb,
size_t  size 
)

Definition at line 5335 of file SDL_malloc.c.

References s_mem, and SDL_AtomicIncRef.

{
void *mem;
if (!nmemb || !size) {
nmemb = 1;
size = 1;
}
mem = s_mem.calloc_func(nmemb, size);
if (mem) {
SDL_AtomicIncRef(&s_mem.num_allocations);
}
return mem;
}
double SDL_ceil ( double  x)

Definition at line 131 of file SDL_stdlib.c.

References SDL_floor.

{
#if defined(HAVE_CEIL)
return ceil(x);
#else
double integer = SDL_floor(x);
double fraction = x - integer;
if (fraction > 0.0) {
integer += 1.0;
}
return integer;
#endif /* HAVE_CEIL */
}
float SDL_ceilf ( float  x)

Definition at line 146 of file SDL_stdlib.c.

References SDL_ceil.

{
#if defined(HAVE_CEILF)
return ceilf(x);
#else
return (float)SDL_ceil((float)x);
#endif
}
double SDL_copysign ( double  x,
double  y 
)

Definition at line 156 of file SDL_stdlib.c.

References copysign(), and SDL_uclibc_copysign().

{
#if defined(HAVE_COPYSIGN)
return copysign(x, y);
#elif defined(HAVE__COPYSIGN)
return _copysign(x, y);
#elif defined(__WATCOMC__) && defined(__386__)
/* this is nasty as hell, but it works.. */
unsigned int *xi = (unsigned int *) &x,
*yi = (unsigned int *) &y;
xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff);
return x;
#else
#endif /* HAVE_COPYSIGN */
}
float SDL_copysignf ( float  x,
float  y 
)

Definition at line 174 of file SDL_stdlib.c.

References SDL_copysign.

{
#if defined(HAVE_COPYSIGNF)
return copysignf(x, y);
#else
return (float)SDL_copysign((double)x, (double)y);
#endif
}
double SDL_cos ( double  x)

Definition at line 184 of file SDL_stdlib.c.

References cos(), and SDL_uclibc_cos().

{
#if defined(HAVE_COS)
return cos(x);
#else
return SDL_uclibc_cos(x);
#endif
}
float SDL_cosf ( float  x)

Definition at line 194 of file SDL_stdlib.c.

References SDL_cos.

{
#if defined(HAVE_COSF)
return cosf(x);
#else
return (float)SDL_cos((double)x);
#endif
}
double SDL_exp ( double  x)

Definition at line 204 of file SDL_stdlib.c.

References SDL_uclibc_exp().

{
#if defined(HAVE_EXP)
return exp(x);
#else
return SDL_uclibc_exp(x);
#endif
}
float SDL_expf ( float  x)

Definition at line 214 of file SDL_stdlib.c.

References SDL_exp.

{
#if defined(HAVE_EXPF)
return expf(x);
#else
return (float)SDL_exp((double)x);
#endif
}
double SDL_fabs ( double  x)

Definition at line 224 of file SDL_stdlib.c.

References fabs(), and SDL_uclibc_fabs().

{
#if defined(HAVE_FABS)
return fabs(x);
#else
return SDL_uclibc_fabs(x);
#endif
}
float SDL_fabsf ( float  x)

Definition at line 234 of file SDL_stdlib.c.

References SDL_fabs.

{
#if defined(HAVE_FABSF)
return fabsf(x);
#else
return (float)SDL_fabs((double)x);
#endif
}
double SDL_floor ( double  x)

Definition at line 244 of file SDL_stdlib.c.

References floor(), and SDL_uclibc_floor().

{
#if defined(HAVE_FLOOR)
return floor(x);
#else
#endif
}
float SDL_floorf ( float  x)

Definition at line 254 of file SDL_stdlib.c.

References SDL_floor.

{
#if defined(HAVE_FLOORF)
return floorf(x);
#else
return (float)SDL_floor((double)x);
#endif
}
double SDL_fmod ( double  x,
double  y 
)

Definition at line 264 of file SDL_stdlib.c.

References SDL_uclibc_fmod().

{
#if defined(HAVE_FMOD)
return fmod(x, y);
#else
return SDL_uclibc_fmod(x, y);
#endif
}
float SDL_fmodf ( float  x,
float  y 
)

Definition at line 274 of file SDL_stdlib.c.

References SDL_fmod.

{
#if defined(HAVE_FMODF)
return fmodf(x, y);
#else
return (float)SDL_fmod((double)x, (double)y);
#endif
}
void SDL_free ( void mem)

Definition at line 5366 of file SDL_malloc.c.

References s_mem, SDL_AtomicDecRef, and void.

{
if (!ptr) {
return;
}
s_mem.free_func(ptr);
(void)SDL_AtomicDecRef(&s_mem.num_allocations);
}
char* SDL_getenv ( const char *  name)

Definition at line 219 of file SDL_getenv.c.

References i, NULL, SDL_strlen, and SDL_strncmp.

{
int len, i;
char *value;
/* Input validation */
if (!name || SDL_strlen(name)==0) {
return NULL;
}
value = (char *) 0;
if (SDL_env) {
len = SDL_strlen(name);
for (i = 0; SDL_env[i] && !value; ++i) {
if ((SDL_strncmp(SDL_env[i], name, len) == 0) &&
(SDL_env[i][len] == '=')) {
value = &SDL_env[i][len + 1];
}
}
}
return value;
}
void SDL_GetMemoryFunctions ( SDL_malloc_func malloc_func,
SDL_calloc_func calloc_func,
SDL_realloc_func realloc_func,
SDL_free_func free_func 
)

Get the current set of SDL memory functions.

Definition at line 5271 of file SDL_malloc.c.

References s_mem.

{
if (malloc_func) {
*malloc_func = s_mem.malloc_func;
}
if (calloc_func) {
*calloc_func = s_mem.calloc_func;
}
if (realloc_func) {
*realloc_func = s_mem.realloc_func;
}
if (free_func) {
*free_func = s_mem.free_func;
}
}
int SDL_GetNumAllocations ( void  )

Get the number of outstanding (unfreed) allocations.

Definition at line 5315 of file SDL_malloc.c.

References s_mem, and SDL_AtomicGet.

{
return SDL_AtomicGet(&s_mem.num_allocations);
}
size_t SDL_iconv ( SDL_iconv_t  cd,
const char **  inbuf,
size_t inbytesleft,
char **  outbuf,
size_t outbytesleft 
)

Definition at line 248 of file SDL_iconv.c.

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

{
/* For simplicity, we'll convert everything to and from UCS-4 */
const char *src;
char *dst;
size_t srclen, dstlen;
Uint32 ch = 0;
size_t total;
if (!inbuf || !*inbuf) {
/* Reset the context */
return 0;
}
if (!outbuf || !*outbuf || !outbytesleft || !*outbytesleft) {
}
src = *inbuf;
srclen = (inbytesleft ? *inbytesleft : 0);
dst = *outbuf;
dstlen = *outbytesleft;
switch (cd->src_fmt) {
/* Scan for a byte order marker */
{
Uint8 *p = (Uint8 *) src;
size_t n = srclen / 2;
while (n) {
if (p[0] == 0xFF && p[1] == 0xFE) {
cd->src_fmt = ENCODING_UTF16BE;
break;
} else if (p[0] == 0xFE && p[1] == 0xFF) {
cd->src_fmt = ENCODING_UTF16LE;
break;
}
p += 2;
--n;
}
if (n == 0) {
/* We can't tell, default to host order */
cd->src_fmt = ENCODING_UTF16NATIVE;
}
}
break;
/* Scan for a byte order marker */
{
Uint8 *p = (Uint8 *) src;
size_t n = srclen / 4;
while (n) {
if (p[0] == 0xFF && p[1] == 0xFE &&
p[2] == 0x00 && p[3] == 0x00) {
cd->src_fmt = ENCODING_UTF32BE;
break;
} else if (p[0] == 0x00 && p[1] == 0x00 &&
p[2] == 0xFE && p[3] == 0xFF) {
cd->src_fmt = ENCODING_UTF32LE;
break;
}
p += 4;
--n;
}
if (n == 0) {
/* We can't tell, default to host order */
cd->src_fmt = ENCODING_UTF32NATIVE;
}
}
break;
}
switch (cd->dst_fmt) {
/* Default to host order, need to add byte order marker */
if (dstlen < 2) {
}
*(Uint16 *) dst = UNICODE_BOM;
dst += 2;
dstlen -= 2;
cd->dst_fmt = ENCODING_UTF16NATIVE;
break;
/* Default to host order, need to add byte order marker */
if (dstlen < 4) {
}
*(Uint32 *) dst = UNICODE_BOM;
dst += 4;
dstlen -= 4;
cd->dst_fmt = ENCODING_UTF32NATIVE;
break;
}
total = 0;
while (srclen > 0) {
/* Decode a character */
switch (cd->src_fmt) {
{
Uint8 *p = (Uint8 *) src;
ch = (Uint32) (p[0] & 0x7F);
++src;
--srclen;
}
break;
{
Uint8 *p = (Uint8 *) src;
ch = (Uint32) p[0];
++src;
--srclen;
}
break;
case ENCODING_UTF8: /* RFC 3629 */
{
Uint8 *p = (Uint8 *) src;
size_t left = 0;
SDL_bool overlong = SDL_FALSE;
if (p[0] >= 0xFC) {
if ((p[0] & 0xFE) != 0xFC) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
} else {
if (p[0] == 0xFC && srclen > 1 && (p[1] & 0xFC) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x01);
left = 5;
}
} else if (p[0] >= 0xF8) {
if ((p[0] & 0xFC) != 0xF8) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
} else {
if (p[0] == 0xF8 && srclen > 1 && (p[1] & 0xF8) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x03);
left = 4;
}
} else if (p[0] >= 0xF0) {
if ((p[0] & 0xF8) != 0xF0) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
} else {
if (p[0] == 0xF0 && srclen > 1 && (p[1] & 0xF0) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x07);
left = 3;
}
} else if (p[0] >= 0xE0) {
if ((p[0] & 0xF0) != 0xE0) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
} else {
if (p[0] == 0xE0 && srclen > 1 && (p[1] & 0xE0) == 0x80) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x0F);
left = 2;
}
} else if (p[0] >= 0xC0) {
if ((p[0] & 0xE0) != 0xC0) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
} else {
if ((p[0] & 0xDE) == 0xC0) {
overlong = SDL_TRUE;
}
ch = (Uint32) (p[0] & 0x1F);
left = 1;
}
} else {
if ((p[0] & 0x80) != 0x00) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
} else {
ch = (Uint32) p[0];
}
}
++src;
--srclen;
if (srclen < left) {
}
while (left--) {
++p;
if ((p[0] & 0xC0) != 0x80) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
break;
}
ch <<= 6;
ch |= (p[0] & 0x3F);
++src;
--srclen;
}
if (overlong) {
/* Potential security risk
return SDL_ICONV_EILSEQ;
*/
}
if ((ch >= 0xD800 && ch <= 0xDFFF) ||
(ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
}
}
break;
case ENCODING_UTF16BE: /* RFC 2781 */
{
Uint8 *p = (Uint8 *) src;
Uint16 W1, W2;
if (srclen < 2) {
}
W1 = ((Uint16) p[0] << 8) | (Uint16) p[1];
src += 2;
srclen -= 2;
if (W1 < 0xD800 || W1 > 0xDFFF) {
ch = (Uint32) W1;
break;
}
if (W1 > 0xDBFF) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
break;
}
if (srclen < 2) {
}
p = (Uint8 *) src;
W2 = ((Uint16) p[0] << 8) | (Uint16) p[1];
src += 2;
srclen -= 2;
if (W2 < 0xDC00 || W2 > 0xDFFF) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
break;
}
ch = (((Uint32) (W1 & 0x3FF) << 10) |
(Uint32) (W2 & 0x3FF)) + 0x10000;
}
break;
case ENCODING_UTF16LE: /* RFC 2781 */
{
Uint8 *p = (Uint8 *) src;
Uint16 W1, W2;
if (srclen < 2) {
}
W1 = ((Uint16) p[1] << 8) | (Uint16) p[0];
src += 2;
srclen -= 2;
if (W1 < 0xD800 || W1 > 0xDFFF) {
ch = (Uint32) W1;
break;
}
if (W1 > 0xDBFF) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
break;
}
if (srclen < 2) {
}
p = (Uint8 *) src;
W2 = ((Uint16) p[1] << 8) | (Uint16) p[0];
src += 2;
srclen -= 2;
if (W2 < 0xDC00 || W2 > 0xDFFF) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
break;
}
ch = (((Uint32) (W1 & 0x3FF) << 10) |
(Uint32) (W2 & 0x3FF)) + 0x10000;
}
break;
{
Uint8 *p = (Uint8 *) src;
if (srclen < 2) {
}
ch = ((Uint32) p[1] << 8) | (Uint32) p[0];
src += 2;
srclen -= 2;
}
break;
{
Uint8 *p = (Uint8 *) src;
if (srclen < 2) {
}
ch = ((Uint32) p[0] << 8) | (Uint32) p[1];
src += 2;
srclen -= 2;
}
break;
{
Uint8 *p = (Uint8 *) src;
if (srclen < 4) {
}
ch = ((Uint32) p[0] << 24) |
((Uint32) p[1] << 16) |
((Uint32) p[2] << 8) | (Uint32) p[3];
src += 4;
srclen -= 4;
}
break;
{
Uint8 *p = (Uint8 *) src;
if (srclen < 4) {
}
ch = ((Uint32) p[3] << 24) |
((Uint32) p[2] << 16) |
((Uint32) p[1] << 8) | (Uint32) p[0];
src += 4;
srclen -= 4;
}
break;
}
/* Encode a character */
switch (cd->dst_fmt) {
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 1) {
}
if (ch > 0x7F) {
} else {
*p = (Uint8) ch;
}
++dst;
--dstlen;
}
break;
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 1) {
}
if (ch > 0xFF) {
} else {
*p = (Uint8) ch;
}
++dst;
--dstlen;
}
break;
case ENCODING_UTF8: /* RFC 3629 */
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0x10FFFF) {
}
if (ch <= 0x7F) {
if (dstlen < 1) {
}
*p = (Uint8) ch;
++dst;
--dstlen;
} else if (ch <= 0x7FF) {
if (dstlen < 2) {
}
p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
p[1] = 0x80 | (Uint8) (ch & 0x3F);
dst += 2;
dstlen -= 2;
} else if (ch <= 0xFFFF) {
if (dstlen < 3) {
}
p[0] = 0xE0 | (Uint8) ((ch >> 12) & 0x0F);
p[1] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[2] = 0x80 | (Uint8) (ch & 0x3F);
dst += 3;
dstlen -= 3;
} else if (ch <= 0x1FFFFF) {
if (dstlen < 4) {
}
p[0] = 0xF0 | (Uint8) ((ch >> 18) & 0x07);
p[1] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
p[2] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[3] = 0x80 | (Uint8) (ch & 0x3F);
dst += 4;
dstlen -= 4;
} else if (ch <= 0x3FFFFFF) {
if (dstlen < 5) {
}
p[0] = 0xF8 | (Uint8) ((ch >> 24) & 0x03);
p[1] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
p[2] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
p[3] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[4] = 0x80 | (Uint8) (ch & 0x3F);
dst += 5;
dstlen -= 5;
} else {
if (dstlen < 6) {
}
p[0] = 0xFC | (Uint8) ((ch >> 30) & 0x01);
p[1] = 0x80 | (Uint8) ((ch >> 24) & 0x3F);
p[2] = 0x80 | (Uint8) ((ch >> 18) & 0x3F);
p[3] = 0x80 | (Uint8) ((ch >> 12) & 0x3F);
p[4] = 0x80 | (Uint8) ((ch >> 6) & 0x3F);
p[5] = 0x80 | (Uint8) (ch & 0x3F);
dst += 6;
dstlen -= 6;
}
}
break;
case ENCODING_UTF16BE: /* RFC 2781 */
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0x10FFFF) {
}
if (ch < 0x10000) {
if (dstlen < 2) {
}
p[0] = (Uint8) (ch >> 8);
p[1] = (Uint8) ch;
dst += 2;
dstlen -= 2;
} else {
Uint16 W1, W2;
if (dstlen < 4) {
}
ch = ch - 0x10000;
W1 = 0xD800 | (Uint16) ((ch >> 10) & 0x3FF);
W2 = 0xDC00 | (Uint16) (ch & 0x3FF);
p[0] = (Uint8) (W1 >> 8);
p[1] = (Uint8) W1;
p[2] = (Uint8) (W2 >> 8);
p[3] = (Uint8) W2;
dst += 4;
dstlen -= 4;
}
}
break;
case ENCODING_UTF16LE: /* RFC 2781 */
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0x10FFFF) {
}
if (ch < 0x10000) {
if (dstlen < 2) {
}
p[1] = (Uint8) (ch >> 8);
p[0] = (Uint8) ch;
dst += 2;
dstlen -= 2;
} else {
Uint16 W1, W2;
if (dstlen < 4) {
}
ch = ch - 0x10000;
W1 = 0xD800 | (Uint16) ((ch >> 10) & 0x3FF);
W2 = 0xDC00 | (Uint16) (ch & 0x3FF);
p[1] = (Uint8) (W1 >> 8);
p[0] = (Uint8) W1;
p[3] = (Uint8) (W2 >> 8);
p[2] = (Uint8) W2;
dst += 4;
dstlen -= 4;
}
}
break;
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0xFFFF) {
}
if (dstlen < 2) {
}
p[0] = (Uint8) (ch >> 8);
p[1] = (Uint8) ch;
dst += 2;
dstlen -= 2;
}
break;
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0xFFFF) {
}
if (dstlen < 2) {
}
p[1] = (Uint8) (ch >> 8);
p[0] = (Uint8) ch;
dst += 2;
dstlen -= 2;
}
break;
if (ch > 0x10FFFF) {
}
/* fallthrough */
if (ch > 0x7FFFFFFF) {
}
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 4) {
}
p[0] = (Uint8) (ch >> 24);
p[1] = (Uint8) (ch >> 16);
p[2] = (Uint8) (ch >> 8);
p[3] = (Uint8) ch;
dst += 4;
dstlen -= 4;
}
break;
if (ch > 0x10FFFF) {
}
/* fallthrough */
if (ch > 0x7FFFFFFF) {
}
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 4) {
}
p[3] = (Uint8) (ch >> 24);
p[2] = (Uint8) (ch >> 16);
p[1] = (Uint8) (ch >> 8);
p[0] = (Uint8) ch;
dst += 4;
dstlen -= 4;
}
break;
}
/* Update state */
*inbuf = src;
*inbytesleft = srclen;
*outbuf = dst;
*outbytesleft = dstlen;
++total;
}
return total;
}
int SDL_iconv_close ( SDL_iconv_t  cd)

Definition at line 854 of file SDL_iconv.c.

References SDL_free.

{
if (cd != (SDL_iconv_t)-1) {
SDL_free(cd);
}
return 0;
}
SDL_iconv_t SDL_iconv_open ( const char *  tocode,
const char *  fromcode 
)

Definition at line 208 of file SDL_iconv.c.

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

{
int src_fmt = ENCODING_UNKNOWN;
int dst_fmt = ENCODING_UNKNOWN;
int i;
char fromcode_buffer[64];
char tocode_buffer[64];
if (!fromcode || !*fromcode) {
fromcode = getlocale(fromcode_buffer, sizeof(fromcode_buffer));
}
if (!tocode || !*tocode) {
tocode = getlocale(tocode_buffer, sizeof(tocode_buffer));
}
for (i = 0; i < SDL_arraysize(encodings); ++i) {
if (SDL_strcasecmp(fromcode, encodings[i].name) == 0) {
src_fmt = encodings[i].format;
if (dst_fmt != ENCODING_UNKNOWN) {
break;
}
}
if (SDL_strcasecmp(tocode, encodings[i].name) == 0) {
dst_fmt = encodings[i].format;
if (src_fmt != ENCODING_UNKNOWN) {
break;
}
}
}
if (src_fmt != ENCODING_UNKNOWN && dst_fmt != ENCODING_UNKNOWN) {
SDL_iconv_t cd = (SDL_iconv_t) SDL_malloc(sizeof(*cd));
if (cd) {
cd->src_fmt = src_fmt;
cd->dst_fmt = dst_fmt;
return cd;
}
}
return (SDL_iconv_t) - 1;
}
char* SDL_iconv_string ( const char *  tocode,
const char *  fromcode,
const char *  inbuf,
size_t  inbytesleft 
)

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

Definition at line 865 of file SDL_iconv.c.

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

{
SDL_iconv_t cd;
char *string;
size_t stringsize;
char *outbuf;
size_t outbytesleft;
size_t retCode = 0;
cd = SDL_iconv_open(tocode, fromcode);
if (cd == (SDL_iconv_t) - 1) {
/* See if we can recover here (fixes iconv on Solaris 11) */
if (!tocode || !*tocode) {
tocode = "UTF-8";
}
if (!fromcode || !*fromcode) {
fromcode = "UTF-8";
}
cd = SDL_iconv_open(tocode, fromcode);
}
if (cd == (SDL_iconv_t) - 1) {
return NULL;
}
stringsize = inbytesleft > 4 ? inbytesleft : 4;
string = SDL_malloc(stringsize);
if (!string) {
return NULL;
}
outbuf = string;
outbytesleft = stringsize;
SDL_memset(outbuf, 0, 4);
while (inbytesleft > 0) {
retCode = SDL_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
switch (retCode) {
{
char *oldstring = string;
stringsize *= 2;
string = SDL_realloc(string, stringsize);
if (!string) {
return NULL;
}
outbuf = string + (outbuf - oldstring);
outbytesleft = stringsize - (outbuf - string);
SDL_memset(outbuf, 0, 4);
}
break;
/* Try skipping some input data - not perfect, but... */
++inbuf;
--inbytesleft;
break;
/* We can't continue... */
inbytesleft = 0;
break;
}
}
return string;
}
int SDL_isdigit ( int  x)

Definition at line 444 of file SDL_stdlib.c.

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

Definition at line 445 of file SDL_stdlib.c.

{ return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n') || ((x) == '\f') || ((x) == '\v'); }
char* SDL_itoa ( int  value,
char *  str,
int  radix 
)

Definition at line 702 of file SDL_string.c.

References SDL_ltoa.

{
#ifdef HAVE_ITOA
return itoa(value, string, radix);
#else
return SDL_ltoa((long)value, string, radix);
#endif /* HAVE_ITOA */
}
char* SDL_lltoa ( Sint64  value,
char *  str,
int  radix 
)

Definition at line 766 of file SDL_string.c.

References SDL_ulltoa.

{
#if defined(HAVE__I64TOA)
return _i64toa(value, string, radix);
#else
char *bufp = string;
if (value < 0) {
*bufp++ = '-';
SDL_ulltoa(-value, bufp, radix);
} else {
SDL_ulltoa(value, bufp, radix);
}
return string;
#endif /* HAVE__I64TOA */
}
double SDL_log ( double  x)

Definition at line 284 of file SDL_stdlib.c.

References SDL_uclibc_log().

{
#if defined(HAVE_LOG)
return log(x);
#else
return SDL_uclibc_log(x);
#endif
}
double SDL_log10 ( double  x)

Definition at line 304 of file SDL_stdlib.c.

References SDL_uclibc_log10().

{
#if defined(HAVE_LOG10)
return log10(x);
#else
#endif
}
float SDL_log10f ( float  x)

Definition at line 314 of file SDL_stdlib.c.

References SDL_log10.

{
#if defined(HAVE_LOG10F)
return log10f(x);
#else
return (float)SDL_log10((double)x);
#endif
}
float SDL_logf ( float  x)

Definition at line 294 of file SDL_stdlib.c.

References SDL_log.

{
#if defined(HAVE_LOGF)
return logf(x);
#else
return (float)SDL_log((double)x);
#endif
}
char* SDL_ltoa ( long  value,
char *  str,
int  radix 
)

Definition at line 722 of file SDL_string.c.

References SDL_ultoa.

{
#if defined(HAVE__LTOA)
return _ltoa(value, string, radix);
#else
char *bufp = string;
if (value < 0) {
*bufp++ = '-';
SDL_ultoa(-value, bufp, radix);
} else {
SDL_ultoa(value, bufp, radix);
}
return string;
#endif /* HAVE__LTOA */
}
void* SDL_malloc ( size_t  size)

Definition at line 5320 of file SDL_malloc.c.

References s_mem, and SDL_AtomicIncRef.

{
void *mem;
if (!size) {
size = 1;
}
mem = s_mem.malloc_func(size);
if (mem) {
SDL_AtomicIncRef(&s_mem.num_allocations);
}
return mem;
}
int SDL_memcmp ( const void s1,
const void s2,
size_t  len 
)

Definition at line 392 of file SDL_string.c.

{
#if defined(HAVE_MEMCMP)
return memcmp(s1, s2, len);
#else
char *s1p = (char *) s1;
char *s2p = (char *) s2;
while (len--) {
if (*s1p != *s2p) {
return (*s1p - *s2p);
}
++s1p;
++s2p;
}
return 0;
#endif /* HAVE_MEMCMP */
}
void* SDL_memcpy ( SDL_OUT_BYTECAP(len) void dst,
SDL_IN_BYTECAP(len) const void src,
size_t  len 
)

Definition at line 315 of file SDL_string.c.

References memcpy.

{
#ifdef __GNUC__
/* Presumably this is well tuned for speed.
On my machine this is twice as fast as the C code below.
*/
return __builtin_memcpy(dst, src, len);
#elif defined(HAVE_MEMCPY)
return memcpy(dst, src, len);
#elif defined(HAVE_BCOPY)
bcopy(src, dst, len);
return dst;
#else
/* GCC 4.9.0 with -O3 will generate movaps instructions with the loop
using Uint32* pointers, so we need to make sure the pointers are
aligned before we loop using them.
*/
if (((intptr_t)src & 0x3) || ((intptr_t)dst & 0x3)) {
/* Do an unaligned byte copy */
Uint8 *srcp1 = (Uint8 *)src;
Uint8 *dstp1 = (Uint8 *)dst;
while (len--) {
*dstp1++ = *srcp1++;
}
} else {
size_t left = (len % 4);
Uint32 *srcp4, *dstp4;
Uint8 *srcp1, *dstp1;
srcp4 = (Uint32 *) src;
dstp4 = (Uint32 *) dst;
len /= 4;
while (len--) {
*dstp4++ = *srcp4++;
}
srcp1 = (Uint8 *) srcp4;
dstp1 = (Uint8 *) dstp4;
switch (left) {
case 3:
*dstp1++ = *srcp1++;
case 2:
*dstp1++ = *srcp1++;
case 1:
*dstp1++ = *srcp1++;
}
}
return dst;
#endif /* __GNUC__ */
}
SDL_FORCE_INLINE void* SDL_memcpy4 ( SDL_OUT_BYTECAP(dwords *4) void dst,
SDL_IN_BYTECAP(dwords *4) const void src,
size_t  dwords 
)

Definition at line 594 of file SDL_stdinc.h.

References SDL_memcpy.

{
return SDL_memcpy(dst, src, dwords * 4);
}
void* SDL_memmove ( SDL_OUT_BYTECAP(len) void dst,
SDL_IN_BYTECAP(len) const void src,
size_t  len 
)

Definition at line 368 of file SDL_string.c.

References memmove.

{
#if defined(HAVE_MEMMOVE)
return memmove(dst, src, len);
#else
char *srcp = (char *) src;
char *dstp = (char *) dst;
if (src < dst) {
srcp += len - 1;
dstp += len - 1;
while (len--) {
*dstp-- = *srcp--;
}
} else {
while (len--) {
*dstp++ = *srcp++;
}
}
return dst;
#endif /* HAVE_MEMMOVE */
}
void* SDL_memset ( SDL_OUT_BYTECAP(len) void dst,
int  c,
size_t  len 
)

Definition at line 266 of file SDL_string.c.

References memset.

{
#if defined(HAVE_MEMSET)
return memset(dst, c, len);
#else
size_t left;
Uint32 *dstp4;
Uint8 *dstp1 = (Uint8 *) dst;
Uint8 value1;
Uint32 value4;
/* The value used in memset() is a byte, passed as an int */
c &= 0xff;
/* The destination pointer needs to be aligned on a 4-byte boundary to
* execute a 32-bit set. Set first bytes manually if needed until it is
* aligned. */
value1 = (Uint8)c;
while ((intptr_t)dstp1 & 0x3) {
if (len--) {
*dstp1++ = value1;
} else {
return dst;
}
}
value4 = (c | (c << 8) | (c << 16) | (c << 24));
dstp4 = (Uint32 *) dstp1;
left = (len % 4);
len /= 4;
while (len--) {
*dstp4++ = value4;
}
dstp1 = (Uint8 *) dstp4;
switch (left) {
case 3:
*dstp1++ = value1;
case 2:
*dstp1++ = value1;
case 1:
*dstp1++ = value1;
}
return dst;
#endif /* HAVE_MEMSET */
}
SDL_FORCE_INLINE void SDL_memset4 ( void dst,
Uint32  val,
size_t  dwords 
)

Definition at line 420 of file SDL_stdinc.h.

References SDL_static_cast.

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

{
#if defined(__GNUC__) && defined(i386)
int u0, u1, u2;
__asm__ __volatile__ (
"cld \n\t"
"rep ; stosl \n\t"
: "=&D" (u0), "=&a" (u1), "=&c" (u2)
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
: "memory"
);
#else
size_t _n = (dwords + 3) / 4;
Uint32 _val = (val);
if (dwords == 0)
return;
switch (dwords % 4)
{
case 0: do { *_p++ = _val; /* fallthrough */
case 3: *_p++ = _val; /* fallthrough */
case 2: *_p++ = _val; /* fallthrough */
case 1: *_p++ = _val; /* fallthrough */
} while ( --_n );
}
#endif
}
double SDL_pow ( double  x,
double  y 
)

Definition at line 324 of file SDL_stdlib.c.

References SDL_uclibc_pow().

{
#if defined(HAVE_POW)
return pow(x, y);
#else
return SDL_uclibc_pow(x, y);
#endif
}
float SDL_powf ( float  x,
float  y 
)

Definition at line 334 of file SDL_stdlib.c.

References SDL_pow.

{
#if defined(HAVE_POWF)
return powf(x, y);
#else
return (float)SDL_pow((double)x, (double)y);
#endif
}
void SDL_qsort ( void base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *)  compare 
)
void* SDL_realloc ( void mem,
size_t  size 
)

Definition at line 5351 of file SDL_malloc.c.

References s_mem, and SDL_AtomicIncRef.

{
void *mem;
if (!ptr && !size) {
size = 1;
}
mem = s_mem.realloc_func(ptr, size);
if (mem && !ptr) {
SDL_AtomicIncRef(&s_mem.num_allocations);
}
return mem;
}
double SDL_scalbn ( double  x,
int  n 
)

Definition at line 344 of file SDL_stdlib.c.

References scalbn, and SDL_uclibc_scalbn().

{
#if defined(HAVE_SCALBN)
return scalbn(x, n);
#elif defined(HAVE__SCALB)
return _scalb(x, n);
#elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2)
/* from scalbn(3): If FLT_RADIX equals 2 (which is
* usual), then scalbn() is equivalent to ldexp(3). */
return ldexp(x, n);
#else
return SDL_uclibc_scalbn(x, n);
#endif
}
float SDL_scalbnf ( float  x,
int  n 
)

Definition at line 360 of file SDL_stdlib.c.

References SDL_scalbn.

{
#if defined(HAVE_SCALBNF)
return scalbnf(x, n);
#else
return (float)SDL_scalbn((double)x, n);
#endif
}
int SDL_setenv ( const char *  name,
const char *  value,
int  overwrite 
)

Definition at line 110 of file SDL_getenv.c.

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

{
int added;
int len, i;
char **new_env;
char *new_variable;
/* Input validation */
if (!name || SDL_strlen(name) == 0 || SDL_strchr(name, '=') != NULL || !value) {
return (-1);
}
/* See if it already exists */
if (!overwrite && SDL_getenv(name)) {
return 0;
}
/* Allocate memory for the variable */
new_variable = (char *) SDL_malloc(len);
if (!new_variable) {
return (-1);
}
SDL_snprintf(new_variable, len, "%s=%s", name, value);
value = new_variable + SDL_strlen(name) + 1;
name = new_variable;
/* Actually put it into the environment */
added = 0;
i = 0;
if (SDL_env) {
/* Check to see if it's already there... */
len = (value - name);
for (; SDL_env[i]; ++i) {
if (SDL_strncmp(SDL_env[i], name, len) == 0) {
break;
}
}
/* If we found it, just replace the entry */
if (SDL_env[i]) {
SDL_env[i] = new_variable;
added = 1;
}
}
/* Didn't find it in the environment, expand and add */
if (!added) {
new_env = SDL_realloc(SDL_env, (i + 2) * sizeof(char *));
if (new_env) {
SDL_env = new_env;
SDL_env[i++] = new_variable;
SDL_env[i++] = (char *) 0;
added = 1;
} else {
SDL_free(new_variable);
}
}
return (added ? 0 : -1);
}
int SDL_SetMemoryFunctions ( SDL_malloc_func  malloc_func,
SDL_calloc_func  calloc_func,
SDL_realloc_func  realloc_func,
SDL_free_func  free_func 
)

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

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

Definition at line 5290 of file SDL_malloc.c.

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

{
if (!malloc_func) {
return SDL_InvalidParamError("malloc_func");
}
if (!calloc_func) {
return SDL_InvalidParamError("calloc_func");
}
if (!realloc_func) {
return SDL_InvalidParamError("realloc_func");
}
if (!free_func) {
return SDL_InvalidParamError("free_func");
}
s_mem.malloc_func = malloc_func;
s_mem.calloc_func = calloc_func;
s_mem.realloc_func = realloc_func;
s_mem.free_func = free_func;
return 0;
}
double SDL_sin ( double  x)

Definition at line 370 of file SDL_stdlib.c.

References SDL_uclibc_sin(), and sin().

{
#if defined(HAVE_SIN)
return sin(x);
#else
return SDL_uclibc_sin(x);
#endif
}
float SDL_sinf ( float  x)

Definition at line 380 of file SDL_stdlib.c.

References SDL_sin.

{
#if defined(HAVE_SINF)
return sinf(x);
#else
return (float)SDL_sin((double)x);
#endif
}
int SDL_snprintf ( SDL_OUT_Z_CAP(maxlen) char *  text,
size_t  maxlen,
SDL_PRINTF_FORMAT_STRING const char *  fmt,
  ... 
)

Definition at line 1326 of file SDL_string.c.

References retval, and SDL_vsnprintf.

{
va_list ap;
int retval;
va_start(ap, fmt);
retval = SDL_vsnprintf(text, maxlen, fmt, ap);
va_end(ap);
return retval;
}
double SDL_sqrt ( double  x)

Definition at line 390 of file SDL_stdlib.c.

References SDL_uclibc_sqrt().

{
#if defined(HAVE_SQRT)
return sqrt(x);
#else
return SDL_uclibc_sqrt(x);
#endif
}
float SDL_sqrtf ( float  x)

Definition at line 400 of file SDL_stdlib.c.

References SDL_sqrt.

{
#if defined(HAVE_SQRTF)
return sqrtf(x);
#else
return (float)SDL_sqrt((double)x);
#endif
}
int SDL_sscanf ( const char *  text,
SDL_SCANF_FORMAT_STRING const char *  fmt,
  ... 
)

Definition at line 1034 of file SDL_string.c.

References SDL_vsscanf.

{
int rc;
va_list ap;
va_start(ap, fmt);
rc = SDL_vsscanf(text, fmt, ap);
va_end(ap);
return rc;
}
int SDL_strcasecmp ( const char *  str1,
const char *  str2 
)

Definition at line 981 of file SDL_string.c.

References SDL_toupper.

{
#ifdef HAVE_STRCASECMP
return strcasecmp(str1, str2);
#elif defined(HAVE__STRICMP)
return _stricmp(str1, str2);
#else
char a = 0;
char b = 0;
while (*str1 && *str2) {
a = SDL_toupper((unsigned char) *str1);
b = SDL_toupper((unsigned char) *str2);
if (a != b)
break;
++str1;
++str2;
}
a = SDL_toupper(*str1);
b = SDL_toupper(*str2);
return (int) ((unsigned char) a - (unsigned char) b);
#endif /* HAVE_STRCASECMP */
}
char* SDL_strchr ( const char *  str,
int  c 
)

Definition at line 638 of file SDL_string.c.

References NULL, and SDL_const_cast.

{
#ifdef HAVE_STRCHR
return SDL_const_cast(char*,strchr(string, c));
#elif defined(HAVE_INDEX)
return SDL_const_cast(char*,index(string, c));
#else
while (*string) {
if (*string == c) {
return (char *) string;
}
++string;
}
return NULL;
#endif /* HAVE_STRCHR */
}
int SDL_strcmp ( const char *  str1,
const char *  str2 
)

Definition at line 945 of file SDL_string.c.

{
#if defined(HAVE_STRCMP)
return strcmp(str1, str2);
#else
while (*str1 && *str2) {
if (*str1 != *str2)
break;
++str1;
++str2;
}
return (int)((unsigned char) *str1 - (unsigned char) *str2);
#endif /* HAVE_STRCMP */
}
char* SDL_strdup ( const char *  str)

Definition at line 578 of file SDL_string.c.

References SDL_malloc, SDL_memcpy, and SDL_strlen.

{
size_t len = SDL_strlen(string) + 1;
char *newstr = (char *)SDL_malloc(len);
if (newstr) {
SDL_memcpy(newstr, string, len);
}
return newstr;
}
size_t SDL_strlcat ( SDL_INOUT_Z_CAP(maxlen) char *  dst,
const char *  src,
size_t  maxlen 
)

Definition at line 563 of file SDL_string.c.

References SDL_strlcpy, and SDL_strlen.

{
#if defined(HAVE_STRLCAT)
return strlcat(dst, src, maxlen);
#else
size_t dstlen = SDL_strlen(dst);
size_t srclen = SDL_strlen(src);
if (dstlen < maxlen) {
SDL_strlcpy(dst + dstlen, src, maxlen - dstlen);
}
return dstlen + srclen;
#endif /* HAVE_STRLCAT */
}
size_t SDL_strlcpy ( SDL_OUT_Z_CAP(maxlen) char *  dst,
const char *  src,
size_t  maxlen 
)

Definition at line 497 of file SDL_string.c.

References SDL_memcpy, SDL_min, and SDL_strlen.

{
#if defined(HAVE_STRLCPY)
return strlcpy(dst, src, maxlen);
#else
size_t srclen = SDL_strlen(src);
if (maxlen > 0) {
size_t len = SDL_min(srclen, maxlen - 1);
SDL_memcpy(dst, src, len);
dst[len] = '\0';
}
return srclen;
#endif /* HAVE_STRLCPY */
}
size_t SDL_strlen ( const char *  str)

Definition at line 411 of file SDL_string.c.

{
#if defined(HAVE_STRLEN)
return strlen(string);
#else
size_t len = 0;
while (*string++) {
++len;
}
return len;
#endif /* HAVE_STRLEN */
}
char* SDL_strlwr ( char *  str)

Definition at line 623 of file SDL_string.c.

References SDL_tolower.

{
#if defined(HAVE__STRLWR)
return _strlwr(string);
#else
char *bufp = string;
while (*bufp) {
*bufp = SDL_tolower((unsigned char) *bufp);
++bufp;
}
return string;
#endif /* HAVE__STRLWR */
}
int SDL_strncasecmp ( const char *  str1,
const char *  str2,
size_t  len 
)

Definition at line 1005 of file SDL_string.c.

References SDL_tolower.

{
#ifdef HAVE_STRNCASECMP
return strncasecmp(str1, str2, maxlen);
#elif defined(HAVE__STRNICMP)
return _strnicmp(str1, str2, maxlen);
#else
char a = 0;
char b = 0;
while (*str1 && *str2 && maxlen) {
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
if (a != b)
break;
++str1;
++str2;
--maxlen;
}
if (maxlen == 0) {
return 0;
} else {
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
return (int) ((unsigned char) a - (unsigned char) b);
}
#endif /* HAVE_STRNCASECMP */
}
int SDL_strncmp ( const char *  str1,
const char *  str2,
size_t  maxlen 
)

Definition at line 961 of file SDL_string.c.

{
#if defined(HAVE_STRNCMP)
return strncmp(str1, str2, maxlen);
#else
while (*str1 && *str2 && maxlen) {
if (*str1 != *str2)
break;
++str1;
++str2;
--maxlen;
}
if (!maxlen) {
return 0;
}
return (int) ((unsigned char) *str1 - (unsigned char) *str2);
#endif /* HAVE_STRNCMP */
}
char* SDL_strrchr ( const char *  str,
int  c 
)

Definition at line 656 of file SDL_string.c.

References NULL, SDL_const_cast, and SDL_strlen.

{
#ifdef HAVE_STRRCHR
return SDL_const_cast(char*,strrchr(string, c));
#elif defined(HAVE_RINDEX)
return SDL_const_cast(char*,rindex(string, c));
#else
const char *bufp = string + SDL_strlen(string) - 1;
while (bufp >= string) {
if (*bufp == c) {
return (char *) bufp;
}
--bufp;
}
return NULL;
#endif /* HAVE_STRRCHR */
}
char* SDL_strrev ( char *  str)

Definition at line 589 of file SDL_string.c.

References SDL_strlen.

{
#if defined(HAVE__STRREV)
return _strrev(string);
#else
size_t len = SDL_strlen(string);
char *a = &string[0];
char *b = &string[len - 1];
len /= 2;
while (len--) {
char c = *a;
*a++ = *b;
*b-- = c;
}
return string;
#endif /* HAVE__STRREV */
}
char* SDL_strstr ( const char *  haystack,
const char *  needle 
)

Definition at line 675 of file SDL_string.c.

References NULL, SDL_const_cast, SDL_strlen, and SDL_strncmp.

{
#if defined(HAVE_STRSTR)
return SDL_const_cast(char*,strstr(haystack, needle));
#else
size_t length = SDL_strlen(needle);
while (*haystack) {
if (SDL_strncmp(haystack, needle, length) == 0) {
return (char *) haystack;
}
++haystack;
}
return NULL;
#endif /* HAVE_STRSTR */
}
double SDL_strtod ( const char *  str,
char **  endp 
)

Definition at line 928 of file SDL_string.c.

References SDL_ScanFloat().

{
#if defined(HAVE_STRTOD)
return strtod(string, endp);
#else
size_t len;
double value = 0.0;
len = SDL_ScanFloat(string, &value);
if (endp) {
*endp = (char *) string + len;
}
return value;
#endif /* HAVE_STRTOD */
}
long SDL_strtol ( const char *  str,
char **  endp,
int  base 
)

Definition at line 828 of file SDL_string.c.

References SDL_ScanLong(), SDL_strlen, and SDL_strncmp.

{
#if defined(HAVE_STRTOL)
return strtol(string, endp, base);
#else
size_t len;
long value = 0;
if (!base) {
if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
base = 16;
} else {
base = 10;
}
}
len = SDL_ScanLong(string, base, &value);
if (endp) {
*endp = (char *) string + len;
}
return value;
#endif /* HAVE_STRTOL */
}
Sint64 SDL_strtoll ( const char *  str,
char **  endp,
int  base 
)

Definition at line 878 of file SDL_string.c.

References SDL_ScanLongLong(), SDL_strlen, and SDL_strncmp.

{
#if defined(HAVE_STRTOLL)
return strtoll(string, endp, base);
#else
size_t len;
if (!base) {
if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
base = 16;
} else {
base = 10;
}
}
len = SDL_ScanLongLong(string, base, &value);
if (endp) {
*endp = (char *) string + len;
}
return value;
#endif /* HAVE_STRTOLL */
}
unsigned long SDL_strtoul ( const char *  str,
char **  endp,
int  base 
)

Definition at line 853 of file SDL_string.c.

References SDL_ScanUnsignedLong(), SDL_strlen, and SDL_strncmp.

{
#if defined(HAVE_STRTOUL)
return strtoul(string, endp, base);
#else
size_t len;
unsigned long value = 0;
if (!base) {
if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
base = 16;
} else {
base = 10;
}
}
len = SDL_ScanUnsignedLong(string, base, &value);
if (endp) {
*endp = (char *) string + len;
}
return value;
#endif /* HAVE_STRTOUL */
}
Uint64 SDL_strtoull ( const char *  str,
char **  endp,
int  base 
)

Definition at line 903 of file SDL_string.c.

References SDL_ScanUnsignedLongLong(), SDL_strlen, and SDL_strncmp.

{
#if defined(HAVE_STRTOULL)
return strtoull(string, endp, base);
#else
size_t len;
if (!base) {
if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) {
base = 16;
} else {
base = 10;
}
}
len = SDL_ScanUnsignedLongLong(string, base, &value);
if (endp) {
*endp = (char *) string + len;
}
return value;
#endif /* HAVE_STRTOULL */
}
char* SDL_strupr ( char *  str)

Definition at line 608 of file SDL_string.c.

References SDL_toupper.

{
#if defined(HAVE__STRUPR)
return _strupr(string);
#else
char *bufp = string;
while (*bufp) {
*bufp = SDL_toupper((unsigned char) *bufp);
++bufp;
}
return string;
#endif /* HAVE__STRUPR */
}
double SDL_tan ( double  x)

Definition at line 410 of file SDL_stdlib.c.

References SDL_uclibc_tan(), and tan().

{
#if defined(HAVE_TAN)
return tan(x);
#else
return SDL_uclibc_tan(x);
#endif
}
float SDL_tanf ( float  x)

Definition at line 420 of file SDL_stdlib.c.

References SDL_tan.

{
#if defined(HAVE_TANF)
return tanf(x);
#else
return (float)SDL_tan((double)x);
#endif
}
int SDL_tolower ( int  x)

Definition at line 447 of file SDL_stdlib.c.

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

Definition at line 446 of file SDL_stdlib.c.

{ return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
char* SDL_uitoa ( unsigned int  value,
char *  str,
int  radix 
)

Definition at line 712 of file SDL_string.c.

References SDL_ultoa.

{
#ifdef HAVE__UITOA
return _uitoa(value, string, radix);
#else
return SDL_ultoa((unsigned long)value, string, radix);
#endif /* HAVE__UITOA */
}
char* SDL_ulltoa ( Uint64  value,
char *  str,
int  radix 
)

Definition at line 785 of file SDL_string.c.

References SDL_strrev.

{
#if defined(HAVE__UI64TOA)
return _ui64toa(value, string, radix);
#else
char *bufp = string;
if (value) {
while (value > 0) {
*bufp++ = ntoa_table[value % radix];
value /= radix;
}
} else {
*bufp++ = '0';
}
*bufp = '\0';
/* The numbers went into the string backwards. :) */
SDL_strrev(string);
return string;
#endif /* HAVE__UI64TOA */
}
char* SDL_ultoa ( unsigned long  value,
char *  str,
int  radix 
)

Definition at line 741 of file SDL_string.c.

References SDL_strrev.

{
#if defined(HAVE__ULTOA)
return _ultoa(value, string, radix);
#else
char *bufp = string;
if (value) {
while (value > 0) {
*bufp++ = ntoa_table[value % radix];
value /= radix;
}
} else {
*bufp++ = '0';
}
*bufp = '\0';
/* The numbers went into the string backwards. :) */
SDL_strrev(string);
return string;
#endif /* HAVE__ULTOA */
}
size_t SDL_utf8strlcpy ( SDL_OUT_Z_CAP(dst_bytes) char *  dst,
const char *  src,
size_t  dst_bytes 
)

Definition at line 513 of file SDL_string.c.

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

{
size_t src_bytes = SDL_strlen(src);
size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
size_t i = 0;
char trailing_bytes = 0;
if (bytes)
{
unsigned char c = (unsigned char)src[bytes - 1];
--bytes;
else if (UTF8_IsTrailingByte(c))
{
for (i = bytes - 1; i != 0; --i)
{
c = (unsigned char)src[i];
trailing_bytes = UTF8_TrailingBytes(c);
if (trailing_bytes)
{
if (bytes - i != trailing_bytes + 1)
bytes = i;
break;
}
}
}
SDL_memcpy(dst, src, bytes);
}
dst[bytes] = '\0';
return bytes;
}
size_t SDL_utf8strlen ( const char *  str)

Definition at line 546 of file SDL_string.c.

References retval.

{
size_t retval = 0;
const char *p = str;
char ch;
while ((ch = *(p++))) {
/* if top two bits are 1 and 0, it's a continuation byte. */
if ((ch & 0xc0) != 0x80) {
retval++;
}
}
return retval;
}
int SDL_vsnprintf ( SDL_OUT_Z_CAP(maxlen) char *  text,
size_t  maxlen,
const char *  fmt,
va_list  ap 
)

Definition at line 1610 of file SDL_string.c.

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

{
size_t left = maxlen;
char *textstart = text;
if (!fmt) {
fmt = "";
}
while (*fmt && left > 1) {
if (*fmt == '%') {
size_t len = 0;
SDL_bool check_flag;
enum
{
DO_INT,
DO_LONG,
DO_LONGLONG
} inttype = DO_INT;
SDL_zero(info);
info.radix = 10;
info.precision = -1;
check_flag = SDL_TRUE;
while (check_flag) {
++fmt;
switch (*fmt) {
case '-':
break;
case '+':
break;
case '#':
break;
case '0':
break;
default:
check_flag = SDL_FALSE;
break;
}
}
if (*fmt >= '0' && *fmt <= '9') {
info.width = SDL_strtol(fmt, (char **)&fmt, 0);
}
else if (*fmt == '*') {
++fmt;
info.width = va_arg(ap, int);
}
if (*fmt == '.') {
++fmt;
if (*fmt >= '0' && *fmt <= '9') {
info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
} else if (*fmt == '*') {
++fmt;
info.precision = va_arg(ap, int);
} else {
info.precision = 0;
}
if (info.precision < 0) {
info.precision = 0;
}
}
while (!done) {
switch (*fmt) {
case '%':
if (left > 1) {
*text = '%';
}
len = 1;
done = SDL_TRUE;
break;
case 'c':
/* char is promoted to int when passed through (...) */
if (left > 1) {
*text = (char) va_arg(ap, int);
}
len = 1;
done = SDL_TRUE;
break;
case 'h':
/* short is promoted to int when passed through (...) */
break;
case 'l':
if (inttype < DO_LONGLONG) {
++inttype;
}
break;
case 'I':
if (SDL_strncmp(fmt, "I64", 3) == 0) {
fmt += 2;
inttype = DO_LONGLONG;
}
break;
case 'i':
case 'd':
if (info.precision >= 0) {
}
switch (inttype) {
case DO_INT:
len = SDL_PrintLong(text, left, &info,
(long) va_arg(ap, int));
break;
case DO_LONG:
len = SDL_PrintLong(text, left, &info,
va_arg(ap, long));
break;
case DO_LONGLONG:
len = SDL_PrintLongLong(text, left, &info,
va_arg(ap, Sint64));
break;
}
done = SDL_TRUE;
break;
case 'p':
case 'x':
/* Fall through to 'X' handling */
case 'X':
}
if (info.radix == 10) {
info.radix = 16;
}
if (*fmt == 'p') {
inttype = DO_LONG;
}
/* Fall through to unsigned handling */
case 'o':
if (info.radix == 10) {
info.radix = 8;
}
/* Fall through to unsigned handling */
case 'u':
if (info.precision >= 0) {
}
switch (inttype) {
case DO_INT:
len = SDL_PrintUnsignedLong(text, left, &info,
(unsigned long)
va_arg(ap, unsigned int));
break;
case DO_LONG:
len = SDL_PrintUnsignedLong(text, left, &info,
va_arg(ap, unsigned long));
break;
case DO_LONGLONG:
len = SDL_PrintUnsignedLongLong(text, left, &info,
va_arg(ap, Uint64));
break;
}
done = SDL_TRUE;
break;
case 'f':
len = SDL_PrintFloat(text, left, &info, va_arg(ap, double));
done = SDL_TRUE;
break;
case 'S':
{
/* In practice this is used on Windows for WCHAR strings */
wchar_t *wide_arg = va_arg(ap, wchar_t *);
char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
len = SDL_PrintString(text, left, &info, arg);
SDL_free(arg);
done = SDL_TRUE;
}
break;
case 's':
len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
done = SDL_TRUE;
break;
default:
done = SDL_TRUE;
break;
}
++fmt;
}
if (len >= left) {
text += (left > 1) ? left - 1 : 0;
left = SDL_min(left, 1);
} else {
text += len;
left -= len;
}
} else {
*text++ = *fmt++;
--left;
}
}
if (left > 0) {
*text = '\0';
}
return (int)(text - textstart);
}
int SDL_vsscanf ( const char *  text,
const char *  fmt,
va_list  ap 
)

Definition at line 1052 of file SDL_string.c.

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

{
int retval = 0;
if (!text || !*text) {
return -1;
}
while (*fmt) {
if (*fmt == ' ') {
while (SDL_isspace((unsigned char) *text)) {
++text;
}
++fmt;
continue;
}
if (*fmt == '%') {
long count = 0;
int radix = 10;
enum
{
DO_SHORT,
DO_INT,
DO_LONG,
DO_LONGLONG
} inttype = DO_INT;
size_t advance;
SDL_bool suppress = SDL_FALSE;
++fmt;
if (*fmt == '%') {
if (*text == '%') {
++text;
++fmt;
continue;
}
break;
}
if (*fmt == '*') {
suppress = SDL_TRUE;
++fmt;
}
fmt += SDL_ScanLong(fmt, 10, &count);
if (*fmt == 'c') {
if (!count) {
count = 1;
}
if (suppress) {
while (count--) {
++text;
}
} else {
char *valuep = va_arg(ap, char *);
while (count--) {
*valuep++ = *text++;
}
++retval;
}
continue;
}
while (SDL_isspace((unsigned char) *text)) {
++text;
}
/* FIXME: implement more of the format specifiers */
while (!done) {
switch (*fmt) {
case '*':
suppress = SDL_TRUE;
break;
case 'h':
if (inttype > DO_SHORT) {
++inttype;
}
break;
case 'l':
if (inttype < DO_LONGLONG) {
++inttype;
}
break;
case 'I':
if (SDL_strncmp(fmt, "I64", 3) == 0) {
fmt += 2;
inttype = DO_LONGLONG;
}
break;
case 'i':
{
int index = 0;
if (text[index] == '-') {
++index;
}
if (text[index] == '0') {
if (SDL_tolower((unsigned char) text[index + 1]) == 'x') {
radix = 16;
} else {
radix = 8;
}
}
}
/* Fall through to %d handling */
case 'd':
if (inttype == DO_LONGLONG) {
advance = SDL_ScanLongLong(text, radix, &value);
text += advance;
if (advance && !suppress) {
Sint64 *valuep = va_arg(ap, Sint64 *);
*valuep = value;
++retval;
}
} else {
long value;
advance = SDL_ScanLong(text, radix, &value);
text += advance;
if (advance && !suppress) {
switch (inttype) {
case DO_SHORT:
{
short *valuep = va_arg(ap, short *);
*valuep = (short) value;
}
break;
case DO_INT:
{
int *valuep = va_arg(ap, int *);
*valuep = (int) value;
}
break;
case DO_LONG:
{
long *valuep = va_arg(ap, long *);
*valuep = value;
}
break;
case DO_LONGLONG:
/* Handled above */
break;
}
++retval;
}
}
done = SDL_TRUE;
break;
case 'o':
if (radix == 10) {
radix = 8;
}
/* Fall through to unsigned handling */
case 'x':
case 'X':
if (radix == 10) {
radix = 16;
}
/* Fall through to unsigned handling */
case 'u':
if (inttype == DO_LONGLONG) {
Uint64 value = 0;
advance = SDL_ScanUnsignedLongLong(text, radix, &value);
text += advance;
if (advance && !suppress) {
Uint64 *valuep = va_arg(ap, Uint64 *);
*valuep = value;
++retval;
}
} else {
unsigned long value = 0;
advance = SDL_ScanUnsignedLong(text, radix, &value);
text += advance;
if (advance && !suppress) {
switch (inttype) {
case DO_SHORT:
{
short *valuep = va_arg(ap, short *);
*valuep = (short) value;
}
break;
case DO_INT:
{
int *valuep = va_arg(ap, int *);
*valuep = (int) value;
}
break;
case DO_LONG:
{
long *valuep = va_arg(ap, long *);
*valuep = value;
}
break;
case DO_LONGLONG:
/* Handled above */
break;
}
++retval;
}
}
done = SDL_TRUE;
break;
case 'p':
{
uintptr_t value = 0;
advance = SDL_ScanUintPtrT(text, 16, &value);
text += advance;
if (advance && !suppress) {
void **valuep = va_arg(ap, void **);
*valuep = (void *) value;
++retval;
}
}
done = SDL_TRUE;
break;
case 'f':
{
double value;
advance = SDL_ScanFloat(text, &value);
text += advance;
if (advance && !suppress) {
float *valuep = va_arg(ap, float *);
*valuep = (float) value;
++retval;
}
}
done = SDL_TRUE;
break;
case 's':
if (suppress) {
while (!SDL_isspace((unsigned char) *text)) {
++text;
if (count) {
if (--count == 0) {
break;
}
}
}
} else {
char *valuep = va_arg(ap, char *);
while (!SDL_isspace((unsigned char) *text)) {
*valuep++ = *text++;
if (count) {
if (--count == 0) {
break;
}
}
}
*valuep = '\0';
++retval;
}
done = SDL_TRUE;
break;
default:
done = SDL_TRUE;
break;
}
++fmt;
}
continue;
}
if (*text == *fmt) {
++text;
++fmt;
continue;
}
/* Text didn't match format specifier */
break;
}
return retval;
}
int SDL_wcscmp ( const wchar_t *  str1,
const wchar_t *  str2 
)

Definition at line 481 of file SDL_string.c.

{
#if defined(HAVE_WCSCMP)
return wcscmp(str1, str2);
#else
while (*str1 && *str2) {
if (*str1 != *str2)
break;
++str1;
++str2;
}
return (int)(*str1 - *str2);
#endif /* HAVE_WCSCMP */
}
wchar_t* SDL_wcsdup ( const wchar_t *  wstr)

Definition at line 425 of file SDL_string.c.

References SDL_malloc, SDL_memcpy, and SDL_wcslen.

{
size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t));
wchar_t *newstr = (wchar_t *)SDL_malloc(len);
if (newstr) {
SDL_memcpy(newstr, string, len);
}
return newstr;
}
size_t SDL_wcslcat ( SDL_INOUT_Z_CAP(maxlen) wchar_t *  dst,
const wchar_t *  src,
size_t  maxlen 
)

Definition at line 466 of file SDL_string.c.

References SDL_wcslcpy, and SDL_wcslen.

{
#if defined(HAVE_WCSLCAT)
return wcslcat(dst, src, maxlen);
#else
size_t dstlen = SDL_wcslen(dst);
size_t srclen = SDL_wcslen(src);
if (dstlen < maxlen) {
SDL_wcslcpy(dst + dstlen, src, maxlen - dstlen);
}
return dstlen + srclen;
#endif /* HAVE_WCSLCAT */
}
size_t SDL_wcslcpy ( SDL_OUT_Z_CAP(maxlen) wchar_t *  dst,
const wchar_t *  src,
size_t  maxlen 
)

Definition at line 450 of file SDL_string.c.

References SDL_memcpy, SDL_min, and SDL_wcslen.

{
#if defined(HAVE_WCSLCPY)
return wcslcpy(dst, src, maxlen);
#else
size_t srclen = SDL_wcslen(src);
if (maxlen > 0) {
size_t len = SDL_min(srclen, maxlen - 1);
SDL_memcpy(dst, src, len * sizeof(wchar_t));
dst[len] = '\0';
}
return srclen;
#endif /* HAVE_WCSLCPY */
}
size_t SDL_wcslen ( const wchar_t *  wstr)

Definition at line 436 of file SDL_string.c.

{
#if defined(HAVE_WCSLEN)
return wcslen(string);
#else
size_t len = 0;
while (*string++) {
++len;
}
return len;
#endif /* HAVE_WCSLEN */
}