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 <inttypes.h>`
`#include <ctype.h>`
`#include <math.h>`
`#include <iconv.h>`
`#include "begin_code.h"`
`#include <alloca.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_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_dummy_ ## 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))

## Functions

void * | SDL_malloc (size_t size)
void * | SDL_calloc (size_t nmemb, size_t size)
void * | SDL_realloc (void *mem, size_t size)
void | SDL_free (void *mem)
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)
void * | SDL_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)
void * | SDL_memcpy (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
void * | SDL_memmove (SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
int | SDL_memcmp (const void *s1, const void *s2, size_t len)
size_t | SDL_wcslen (const wchar_t *wstr)
size_t | SDL_wcslcpy (SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
size_t | SDL_wcslcat (SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
size_t | SDL_strlen (const char *str)
size_t | SDL_strlcpy (SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
size_t | SDL_utf8strlcpy (SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)
size_t | SDL_strlcat (SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
char * | SDL_strdup (const char *str)
char * | SDL_strrev (char *str)
char * | SDL_strupr (char *str)
char * | SDL_strlwr (char *str)
char * | SDL_strchr (const char *str, int c)
char * | SDL_strrchr (const char *str, int c)
char * | SDL_strstr (const char *haystack, const char *needle)
char * | SDL_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)
double | SDL_asin (double x)
double | SDL_atan (double x)
double | SDL_atan2 (double x, double y)
double | SDL_ceil (double x)
double | SDL_copysign (double x, double y)
double | SDL_cos (double x)
float | SDL_cosf (float x)
double | SDL_fabs (double x)
double | SDL_floor (double x)
double | SDL_log (double x)
double | SDL_pow (double x, double y)
double | SDL_scalbn (double 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 void * | SDL_memcpy4 (SDL_OUT_BYTECAP(dwords *4) void *dst, SDL_IN_BYTECAP(dwords *4) const void *src, size_t dwords)

## Basic data types

enum | SDL_bool { SDL_FALSE = 0, SDL_TRUE = 1 }
typedef int8_t | Sint8
| A signed 8-bit integer type. More...
typedef uint8_t | Uint8
| An unsigned 8-bit integer type. More...
typedef int16_t | Sint16
| A signed 16-bit integer type. More...
typedef uint16_t | Uint16
| An unsigned 16-bit integer type. More...
typedef int32_t | Sint32
| A signed 32-bit integer type. More...
typedef uint32_t | Uint32
| An unsigned 32-bit integer type. More...
typedef int64_t | Sint64
| A signed 64-bit integer type. More...
typedef uint64_t | Uint64
| An unsigned 64-bit integer type. More...

## Detailed Description

This is a general header that includes C language support.

Definition in file SDL_stdinc.h.

## Macro Definition Documentation

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

The number of elements in an array.

Definition at line 93 of file SDL_stdinc.h.

Referenced by __kernel_rem_pio2(), get_audio_device(), IMA_ADPCM_decode(), main(), main_testInitQuitSubSystem(), open_audio_device(), SDL_AudioQuit(), SDL_GameControllerAddMappingsFromRW(), SDL_GameControllerEventState(), SDL_GetErrorMsg(), SDL_GetNumAudioDrivers(), SDL_GetNumRenderDrivers(), SDL_GetNumVideoDrivers(), SDL_GetScancodeFromName(), SDL_iconv_open(), SDL_JoystickEventState(), SDL_LogOutput(), SDL_PromptAssertion(), SDL_SendEditingText(), SDL_SendKeyboardText(), SDL_StopEventLoop(), SDL_SYS_MFIJoystickUpdate(), SDL_WasInit(), SDLTest_CommonInit(), surface_testCompleteSurfaceConversion(), and WatchJoystick().

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

Definition at line 260 of file SDL_stdinc.h.

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

Definition at line 110 of file SDL_stdinc.h.

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

#define SDL_FOURCC | ( |  | A,
|  |  | B,
|  |  | C,
|  |  | D
| ) |  |

Value:
((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
SDL_static_cast
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:109

Definition at line 115 of file SDL_stdinc.h.

#define SDL_ICONV_E2BIG (size_t)-2

Definition at line 462 of file SDL_stdinc.h.

Referenced by SDL_iconv(), and SDL_iconv_string().

#define SDL_ICONV_EILSEQ (size_t)-3

Definition at line 463 of file SDL_stdinc.h.

Referenced by SDL_iconv_string().

#define SDL_ICONV_EINVAL (size_t)-4

Definition at line 464 of file SDL_stdinc.h.

Referenced by SDL_iconv(), and SDL_iconv_string().

#define SDL_ICONV_ERROR (size_t)-1

Definition at line 461 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 482 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 483 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 484 of file SDL_stdinc.h.

#define SDL_IN_BYTECAP | ( |  | x | ) |

Definition at line 242 of file SDL_stdinc.h.

Referenced by SDL_memset4().

#define SDL_INOUT_Z_CAP | ( |  | x | ) |

Definition at line 243 of file SDL_stdinc.h.

Referenced by SDL_memset4().

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

Definition at line 346 of file SDL_stdinc.h.

Referenced by drawLine(), RenderDrawLinesWithRects(), SDL_RendererEventWatch(), SDL_SetWindowMinimumSize(), SDL_SYS_AccelerometerUpdate(), and SW_RenderFillRects().

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

Definition at line 345 of file SDL_stdinc.h.

Referenced by bestDollarDifference(), RenderDrawLinesWithRects(), SDL_BufferQueueDrainCallback(), SDL_PrintFloat(), SDL_QueueAudio(), SDL_RendererEventWatch(), SDL_SetWindowMaximumSize(), SDL_strlcpy(), SDL_SYS_AccelerometerUpdate(), SDL_SYS_AddJoystickDevice(), SDL_utf8strlcpy(), SDL_vsnprintf(), SDL_WasInit(), and SDL_wcslcpy().

#define SDL_OUT_BYTECAP | ( |  | x | ) |

Definition at line 246 of file SDL_stdinc.h.

Referenced by SDL_memset4().

#define SDL_OUT_CAP | ( |  | x | ) |

Definition at line 245 of file SDL_stdinc.h.

#define SDL_OUT_Z_BYTECAP | ( |  | x | ) |

Definition at line 247 of file SDL_stdinc.h.

#define SDL_OUT_Z_CAP | ( |  | x | ) |

Definition at line 244 of file SDL_stdinc.h.

Referenced by SDL_memset4().

#define SDL_PRINTF_FORMAT_STRING

Definition at line 248 of file SDL_stdinc.h.

Referenced by SDL_memset4().

#define SDL_PRINTF_VARARG_FUNC | ( |  | fmtargnumber | ) |

Definition at line 255 of file SDL_stdinc.h.

Referenced by SDL_memset4().

#define SDL_PRIs64 "I64d"

Definition at line 175 of file SDL_stdinc.h.

Referenced by _testGenericRWopsValidations(), loop(), rwops_testFileWriteReadEndian(), SDLTest_PrintEvent(), sdltest_randomBoundaryNumberSint16(), sdltest_randomBoundaryNumberSint32(), sdltest_randomBoundaryNumberSint64(), sdltest_randomBoundaryNumberSint8(), sdltest_randomBoundaryNumberUint16(), sdltest_randomBoundaryNumberUint32(), sdltest_randomBoundaryNumberUint64(), sdltest_randomBoundaryNumberUint8(), and sdltest_randomNumber().

#define SDL_PRIu64 "I64u"

Definition at line 186 of file SDL_stdinc.h.

Referenced by main(), rwops_testCompareRWFromMemWithRWFromFile(), rwops_testFileWriteReadEndian(), sdltest_randomNumber(), SDLTest_RunSuites(), timer_getPerformanceCounter(), and timer_getPerformanceFrequency().

#define SDL_PRIx64 "I64x"

Definition at line 197 of file SDL_stdinc.h.

#define SDL_PRIX64 "I64X"

Definition at line 208 of file SDL_stdinc.h.

Referenced by platform_testEndianessAndSwap(), and TestEndian().

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

Definition at line 108 of file SDL_stdinc.h.

#define SDL_SCANF_FORMAT_STRING

Definition at line 249 of file SDL_stdinc.h.

Referenced by SDL_memset4().

#define SDL_SCANF_VARARG_FUNC | ( |  | fmtargnumber | ) |

Definition at line 256 of file SDL_stdinc.h.

Referenced by SDL_memset4().

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

Definition at line 324 of file SDL_stdinc.h.

Referenced by main(), RenderDrawLinesWithRects(), RenderDrawPointsWithRects(), SDL_LogMessageV(), SDL_LogOutput(), SDL_PromptAssertion(), SDL_RenderDrawLines(), SDL_RenderDrawPoints(), SDL_RenderFillRects(), SDL_RWFromFile(), SW_RenderDrawLines(), SW_RenderDrawPoints(), and SW_RenderFillRects().

#define SDL_stack_free | ( |  | data | ) |

Definition at line 325 of file SDL_stdinc.h.

Referenced by main(), RenderDrawLinesWithRects(), RenderDrawPointsWithRects(), SDL_LogMessageV(), SDL_LogOutput(), SDL_PromptAssertion(), SDL_RenderDrawLines(), SDL_RenderDrawPoints(), SDL_RenderFillRects(), SDL_RWFromFile(), SW_RenderDrawLines(), SW_RenderDrawPoints(), and SW_RenderFillRects().

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

Definition at line 109 of file SDL_stdinc.h.

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

#define SDL_TABLESIZE | ( |  | table | ) | SDL_arraysize(table)

Definition at line 94 of file SDL_stdinc.h.

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

Definition at line 355 of file SDL_stdinc.h.

Referenced by _testGenericRWopsValidations(), GetMouseClickState(), RunFIFOTest(), rwops_testMem(), SDL_AddAudioDevice(), SDL_AddBasicVideoDisplay(), SDL_AudioInit(), SDL_AudioQuit(), SDL_GestureAddTouch(), SDL_GetWindowPosition(), SDL_JoystickGetDeviceGUID(), SDL_JoystickGetGUID(), SDL_LoadWAV_RW(), SDL_OpenedAudioDeviceDisconnected(), SDL_PromptAssertion(), SDL_RenderSetClipRect(), SDL_SetWindowDisplayMode(), SDL_SetWindowPosition(), SDL_ShowSimpleMessageBox(), SDL_SYS_JoystickGetDeviceGUID(), SDL_SYS_JoystickGetGUID(), SDL_UpdateFullscreenMode(), SDL_vsnprintf(), and SDLTest_CommonInit().

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

Definition at line 356 of file SDL_stdinc.h.

Referenced by open_audio_device(), SDL_BuildAudioCVT(), SDL_CreateSurfaceOnStack(), SDL_CreateThread(), SDL_GetErrBuf(), SDL_HapticRumbleInit(), SDL_InitFormat(), SDL_MouseQuit(), and SDL_SYS_AddJoystickDevice().

## Typedef Documentation

typedef int16_t Sint16

A signed 16-bit integer type.

Definition at line 143 of file SDL_stdinc.h.

typedef int32_t Sint32

A signed 32-bit integer type.

Definition at line 151 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

A signed 64-bit integer type.

Definition at line 160 of file SDL_stdinc.h.

typedef int8_t Sint8

A signed 8-bit integer type.

Definition at line 135 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

An unsigned 16-bit integer type.

Definition at line 147 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

An unsigned 32-bit integer type.

Definition at line 155 of file SDL_stdinc.h.

typedef uint64_t Uint64

An unsigned 64-bit integer type.

Definition at line 164 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

An unsigned 8-bit integer type.

Definition at line 139 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(*) a int return int return int size_t return size_t return const wchar_t return const wchar_t size_t return const char size_t return const char size_t return char return char return const char int return int char int return long char int return Sint64 char int return const char return const char char int return const char char int return const char char return const char const char size_t return const char const char size_t return double return double return double return double return double return double return double int return float return const char const char return SDL_iconv_t const char size_t char size_t return Uint32 int int int Uint32 Uint32 Uint32 Uint32 return SDL_Surface SDL_Surface return SDL_RWops int return SDL_Surface int return SDL_Surface Uint32 return SDL_Surface Uint8 Uint8 Uint8 return SDL_Surface Uint8 return SDL_Surface SDL_BlendMode return SDL_Surface SDL_Rect SDL_Surface Uint32 Uint32 return SDL_Surface const SDL_Rect Uint32 return SDL_Surface const SDL_Rect SDL_Surface SDL_Rect return SDL_Surface const SDL_Rect SDL_Surface const SDL_Rect return SDL_Surface SDL_Rect SDL_Surface SDL_Rect return SDL_Thread return SDL_Thread return SDL_Thread int return SDL_TLSID const void void(*) return return Uint32 SDL_TimerID return int return SDL_TouchID int return return return const char return return int return int return int SDL_DisplayMode return int const SDL_DisplayMode SDL_DisplayMode return SDL_Window const SDL_DisplayMode return SDL_Window return const void return Uint32 return SDL_Window const char SDL_Window SDL_Surface SDL_Window const char return SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window int int SDL_Window SDL_Window SDL_Window SDL_Window Uint32 return SDL_Window return SDL_Window SDL_bool SDL_Window float return SDL_Window const Uint16 const Uint16 const Uint16 return SDL_Window const char return SDL_GLattr int return SDL_Window return return SDL_Window int int return SDL_GLContext SDL_RWops int return return void return int int return double return SDL_bool

Enumerator
SDL_FALSE |
SDL_TRUE |

Definition at line 126 of file SDL_stdinc.h.

{
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_FALSE
Definition: SDL_stdinc.h:128

## Function Documentation

int SDL_abs | ( | int | x | ) |

Definition at line 249 of file SDL_stdlib.c.

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

{
#ifdef HAVE_ABS
return abs(x);
#else
return ((x) < 0 ? -(x) : (x));
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

double SDL_acos | ( | double | x | ) |

Definition at line 55 of file SDL_stdlib.c.

References SDL_atan(), and SDL_sqrt().

Referenced by SDL_asin(), and SDL_memset4().

{
#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
}
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDL_sqrt
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:210
SDL_atan
double SDL_atan(double x)
Definition: SDL_stdlib.c:35
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1492

double SDL_asin | ( | double | x | ) |

Definition at line 75 of file SDL_stdlib.c.

References SDL_acos().

Referenced by SDL_memset4().

{
#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
}
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDL_acos
double SDL_acos(double val)
Definition: SDL_stdlib.c:55
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1492

double SDL_atan | ( | double | x | ) |

Definition at line 35 of file SDL_stdlib.c.

References atan(), and SDL_uclibc_atan().

Referenced by SDL_acos(), and SDL_memset4().

{
#ifdef HAVE_ATAN
return atan(x);
#else
return SDL_uclibc_atan(x);
#endif /* HAVE_ATAN */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_atan
double SDL_uclibc_atan(double x)
atan
double atan(double x)
Definition: s_atan.c:67

double SDL_atan2 | ( | double | x,
|  | double | y
| ) |  |

Definition at line 45 of file SDL_stdlib.c.

References SDL_uclibc_atan2().

Referenced by SDL_memset4().

{
#if defined(HAVE_ATAN2)
return atan2(x, y);
#else
return SDL_uclibc_atan2(x, y);
#endif /* HAVE_ATAN2 */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_atan2
double SDL_uclibc_atan2(double y, double x)
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567

double SDL_atof | ( | const char * | str | ) |

Definition at line 776 of file SDL_string.c.

References NULL, and SDL_strtod().

Referenced by SDL_memset4().

{
#ifdef HAVE_ATOF
return (double) atof(string);
#else
return SDL_strtod(string, NULL);
#endif /* HAVE_ATOF */
}
SDL_strtod
double SDL_strtod(const char *string, char **endp)
Definition: SDL_string.c:886
NULL
#define NULL
Definition: begin_code.h:143

int SDL_atoi | ( | const char * | str | ) |

Definition at line 767 of file SDL_string.c.

References NULL, and SDL_strtol().

Referenced by SDL_memset4().

{
#ifdef HAVE_ATOI
return atoi(string);
#else
return SDL_strtol(string, NULL, 0);
#endif /* HAVE_ATOI */
}
SDL_strtol
long SDL_strtol(const char *string, char **endp, int base)
Definition: SDL_string.c:786
NULL
#define NULL
Definition: begin_code.h:143

void* SDL_calloc | ( | size_t | nmemb,
|  | size_t | size
| ) |  |

Referenced by SDL_AllocBlitMap(), SDL_CreateMutex(), SDL_CreateRGBSurface(), SDL_CreateTexture(), SDL_CreateWindow(), SDL_CreateWindowFrom(), SDL_CreateWindowTexture(), SDL_EventState(), SDL_SW_CreateYUVTexture(), SDLTest_CommonCreateState(), and SW_CreateRendererForSurface().

double SDL_ceil | ( | double | x | ) |

Definition at line 91 of file SDL_stdlib.c.

References SDL_floor().

Referenced by SDL_memset4().

{
#ifdef 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 */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_floor
double SDL_floor(double x)
Definition: SDL_stdlib.c:148

double SDL_copysign | ( | double | x,
|  | double | y
| ) |  |

Definition at line 106 of file SDL_stdlib.c.

References copysign, and SDL_uclibc_copysign().

Referenced by SDL_memset4().

{
#if defined(HAVE_COPYSIGN)
return copysign(x, y);
#elif defined(HAVE__COPYSIGN)
return _copysign(x, y);
#else
return SDL_uclibc_copysign(x, y);
#endif /* HAVE_COPYSIGN */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_copysign
double SDL_uclibc_copysign(double x, double y)
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
copysign
#define copysign
Definition: math_private.h:34

double SDL_cos | ( | double | x | ) |

Definition at line 118 of file SDL_stdlib.c.

References cos, and SDL_uclibc_cos().

Referenced by SDL_cosf(), and SDL_memset4().

{
#if defined(HAVE_COS)
return cos(x);
#else
return SDL_uclibc_cos(x);
#endif /* HAVE_COS */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
cos
#define cos
Definition: math_private.h:35
SDL_uclibc_cos
double SDL_uclibc_cos(double x)

float SDL_cosf | ( | float | x | ) |

Definition at line 128 of file SDL_stdlib.c.

References SDL_cos().

Referenced by SDL_memset4().

{
#ifdef HAVE_COSF
return cosf(x);
#else
return (float)SDL_cos((double)x);
#endif
}
SDL_cos
double SDL_cos(double x)
Definition: SDL_stdlib.c:118
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

double SDL_fabs | ( | double | x | ) |

Definition at line 138 of file SDL_stdlib.c.

References fabs, and SDL_uclibc_fabs().

Referenced by SDL_memset4().

{
#if defined(HAVE_FABS)
return fabs(x);
#else
return SDL_uclibc_fabs(x);
#endif /* HAVE_FABS */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_fabs
double SDL_uclibc_fabs(double x)
fabs
#define fabs
Definition: math_private.h:36

double SDL_floor | ( | double | x | ) |

Definition at line 148 of file SDL_stdlib.c.

References floor, and SDL_uclibc_floor().

Referenced by SDL_ceil(), and SDL_memset4().

{
#if defined(HAVE_FLOOR)
return floor(x);
#else
return SDL_uclibc_floor(x);
#endif /* HAVE_FLOOR */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_floor
double SDL_uclibc_floor(double x)
floor
#define floor
Definition: math_private.h:37

void SDL_free | ( | void * | mem | ) |

Referenced by _compare(), audio_convertAudio(), clean_out_device_list(), clipboard_testClipboardTextFunctions(), clipboard_testGetClipboardText(), clipboard_testSetClipboardText(), free_audio_queue(), free_device_list(), hints_setHint(), IMA_ADPCM_decode(), IsSDLWindowEventPending(), keyboard_getScancodeFromNameNegative(), main(), MS_ADPCM_decode(), pixels_calcGammaRamp(), quit(), ReadChunk(), RLEAlphaSurface(), RLEColorkeySurface(), SDL_AddHintCallback(), SDL_AddTimer(), SDL_AllocFormat(), SDL_AllocPalette(), SDL_ClearHints(), SDL_CreateCond(), SDL_CreateMutex(), SDL_CreateSemaphore(), SDL_CreateThread(), SDL_CreateWindowTexture(), SDL_DelEventWatch(), SDL_DelHintCallback(), SDL_DelTouch(), SDL_DestroyCond(), SDL_DestroyMutex(), SDL_DestroySemaphore(), SDL_DestroyTexture(), SDL_DestroyWindow(), SDL_DestroyWindowTexture(), SDL_FreeBlitMap(), SDL_FreeFormat(), SDL_FreePalette(), SDL_FreeRW(), SDL_FreeShapeTree(), SDL_FreeSurface(), SDL_FreeWAV(), SDL_GameControllerAddMapping(), SDL_GameControllerAddMappingsFromRW(), SDL_GameControllerClose(), SDL_GameControllerLoadHints(), SDL_GameControllerOpen(), SDL_GameControllerQuit(), SDL_Generic_SetTLSData(), SDL_GetErrBuf(), SDL_GL_DeleteContext(), SDL_HapticClose(), SDL_HapticOpen(), SDL_HapticOpenFromJoystick(), SDL_iconv_close(), SDL_InvalidateMap(), SDL_JoystickClose(), SDL_JoystickOpen(), SDL_LoadWAV_RW(), SDL_LogOutput(), SDL_LogResetPriorities(), SDL_MouseQuit(), SDL_PrivateAddMappingForGUID(), SDL_RemoveTimer(), SDL_RunThread(), SDL_SetClipboardText(), SDL_setenv(), SDL_SetHintWithPriority(), SDL_SetWindowData(), SDL_SetWindowTitle(), SDL_StopEventLoop(), SDL_SW_DestroyYUVTexture(), SDL_SYS_RemoveJoystickDevice(), SDL_TimerQuit(), SDL_TLSCleanup(), SDL_TouchQuit(), SDL_UnRLESurface(), SDL_UpdateTextureNative(), SDL_UpdateTextureYUV(), SDL_UpdateTextureYUVPlanar(), SDL_VideoQuit(), SDL_WaitThread(), SDLTest_CommonEvent(), SDLTest_CommonQuit(), SDLTest_GenerateExecKey(), sdltest_generateRunSeed(), sdltest_randomAsciiString(), sdltest_randomAsciiStringOfSize(), sdltest_randomAsciiStringWithMaximumLength(), SDLTest_RunSuites(), SDLTest_ScreenShot(), stdlib_getsetenv(), SW_DestroyRenderer(), and video_getSetWindowData().

char* SDL_getenv | ( | const char * | name | ) |

Definition at line 212 of file SDL_getenv.c.

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

Referenced by SDL_setenv().

{
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;
}
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_strncmp
#define SDL_strncmp
Definition: SDL_dynapi_overrides.h:424
SDL_env
static char ** SDL_env
Definition: SDL_getenv.c:106
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:399

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

Definition at line 246 of file SDL_iconv.c.

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

Referenced by SDL_iconv_string().

{
/* 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) {
return SDL_ICONV_E2BIG;
}
src = *inbuf;
srclen = (inbytesleft ? *inbytesleft : 0);
dst = *outbuf;
dstlen = *outbytesleft;
switch (cd->src_fmt) {
case ENCODING_UTF16:
/* 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;
case ENCODING_UTF32:
/* 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) {
case ENCODING_UTF16:
/* Default to host order, need to add byte order marker */
if (dstlen < 2) {
return SDL_ICONV_E2BIG;
}
*(Uint16 *) dst = UNICODE_BOM;
dst += 2;
dstlen -= 2;
cd->dst_fmt = ENCODING_UTF16NATIVE;
break;
case ENCODING_UTF32:
/* Default to host order, need to add byte order marker */
if (dstlen < 4) {
return SDL_ICONV_E2BIG;
}
*(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) {
case ENCODING_ASCII:
{
Uint8 *p = (Uint8 *) src;
ch = (Uint32) (p[0] & 0x7F);
++src;
--srclen;
}
break;
case ENCODING_LATIN1:
{
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;
*/
ch = UNKNOWN_UNICODE;
} 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;
*/
ch = UNKNOWN_UNICODE;
} 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;
*/
ch = UNKNOWN_UNICODE;
} 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;
*/
ch = UNKNOWN_UNICODE;
} 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;
*/
ch = UNKNOWN_UNICODE;
} 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;
*/
ch = UNKNOWN_UNICODE;
} else {
ch = (Uint32) p[0];
}
}
++src;
--srclen;
if (srclen < left) {
return SDL_ICONV_EINVAL;
}
while (left--) {
++p;
if ((p[0] & 0xC0) != 0x80) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
ch = UNKNOWN_UNICODE;
break;
}
ch <<= 6;
ch |= (p[0] & 0x3F);
++src;
--srclen;
}
if (overlong) {
/* Potential security risk
return SDL_ICONV_EILSEQ;
*/
ch = UNKNOWN_UNICODE;
}
if ((ch >= 0xD800 && ch <= 0xDFFF) ||
(ch == 0xFFFE || ch == 0xFFFF) || ch > 0x10FFFF) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/
ch = UNKNOWN_UNICODE;
}
}
break;
case ENCODING_UTF16BE: /* RFC 2781 */
{
Uint8 *p = (Uint8 *) src;
Uint16 W1, W2;
if (srclen < 2) {
return SDL_ICONV_EINVAL;
}
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;
*/
ch = UNKNOWN_UNICODE;
break;
}
if (srclen < 2) {
return SDL_ICONV_EINVAL;
}
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;
*/
ch = UNKNOWN_UNICODE;
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) {
return SDL_ICONV_EINVAL;
}
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;
*/
ch = UNKNOWN_UNICODE;
break;
}
if (srclen < 2) {
return SDL_ICONV_EINVAL;
}
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;
*/
ch = UNKNOWN_UNICODE;
break;
}
ch = (((Uint32) (W1 & 0x3FF) << 10) |
(Uint32) (W2 & 0x3FF)) + 0x10000;
}
break;
case ENCODING_UCS2LE:
{
Uint8 *p = (Uint8 *) src;
if (srclen < 2) {
return SDL_ICONV_EINVAL;
}
ch = ((Uint32) p[1] << 8) | (Uint32) p[0];
src += 2;
srclen -= 2;
}
break;
case ENCODING_UCS2BE:
{
Uint8 *p = (Uint8 *) src;
if (srclen < 2) {
return SDL_ICONV_EINVAL;
}
ch = ((Uint32) p[0] << 8) | (Uint32) p[1];
src += 2;
srclen -= 2;
}
break;
case ENCODING_UCS4BE:
case ENCODING_UTF32BE:
{
Uint8 *p = (Uint8 *) src;
if (srclen < 4) {
return SDL_ICONV_EINVAL;
}
ch = ((Uint32) p[0] << 24) |
((Uint32) p[1] << 16) |
((Uint32) p[2] << 8) | (Uint32) p[3];
src += 4;
srclen -= 4;
}
break;
case ENCODING_UCS4LE:
case ENCODING_UTF32LE:
{
Uint8 *p = (Uint8 *) src;
if (srclen < 4) {
return SDL_ICONV_EINVAL;
}
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) {
case ENCODING_ASCII:
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 1) {
return SDL_ICONV_E2BIG;
}
if (ch > 0x7F) {
*p = UNKNOWN_ASCII;
} else {
*p = (Uint8) ch;
}
++dst;
--dstlen;
}
break;
case ENCODING_LATIN1:
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 1) {
return SDL_ICONV_E2BIG;
}
if (ch > 0xFF) {
*p = UNKNOWN_ASCII;
} else {
*p = (Uint8) ch;
}
++dst;
--dstlen;
}
break;
case ENCODING_UTF8: /* RFC 3629 */
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0x10FFFF) {
ch = UNKNOWN_UNICODE;
}
if (ch <= 0x7F) {
if (dstlen < 1) {
return SDL_ICONV_E2BIG;
}
*p = (Uint8) ch;
++dst;
--dstlen;
} else if (ch <= 0x7FF) {
if (dstlen < 2) {
return SDL_ICONV_E2BIG;
}
p[0] = 0xC0 | (Uint8) ((ch >> 6) & 0x1F);
p[1] = 0x80 | (Uint8) (ch & 0x3F);
dst += 2;
dstlen -= 2;
} else if (ch <= 0xFFFF) {
if (dstlen < 3) {
return SDL_ICONV_E2BIG;
}
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) {
return SDL_ICONV_E2BIG;
}
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) {
return SDL_ICONV_E2BIG;
}
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) {
return SDL_ICONV_E2BIG;
}
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) {
ch = UNKNOWN_UNICODE;
}
if (ch < 0x10000) {
if (dstlen < 2) {
return SDL_ICONV_E2BIG;
}
p[0] = (Uint8) (ch >> 8);
p[1] = (Uint8) ch;
dst += 2;
dstlen -= 2;
} else {
Uint16 W1, W2;
if (dstlen < 4) {
return SDL_ICONV_E2BIG;
}
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) {
ch = UNKNOWN_UNICODE;
}
if (ch < 0x10000) {
if (dstlen < 2) {
return SDL_ICONV_E2BIG;
}
p[1] = (Uint8) (ch >> 8);
p[0] = (Uint8) ch;
dst += 2;
dstlen -= 2;
} else {
Uint16 W1, W2;
if (dstlen < 4) {
return SDL_ICONV_E2BIG;
}
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;
case ENCODING_UCS2BE:
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0xFFFF) {
ch = UNKNOWN_UNICODE;
}
if (dstlen < 2) {
return SDL_ICONV_E2BIG;
}
p[0] = (Uint8) (ch >> 8);
p[1] = (Uint8) ch;
dst += 2;
dstlen -= 2;
}
break;
case ENCODING_UCS2LE:
{
Uint8 *p = (Uint8 *) dst;
if (ch > 0xFFFF) {
ch = UNKNOWN_UNICODE;
}
if (dstlen < 2) {
return SDL_ICONV_E2BIG;
}
p[1] = (Uint8) (ch >> 8);
p[0] = (Uint8) ch;
dst += 2;
dstlen -= 2;
}
break;
case ENCODING_UTF32BE:
if (ch > 0x10FFFF) {
ch = UNKNOWN_UNICODE;
}
case ENCODING_UCS4BE:
if (ch > 0x7FFFFFFF) {
ch = UNKNOWN_UNICODE;
}
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 4) {
return SDL_ICONV_E2BIG;
}
p[0] = (Uint8) (ch >> 24);
p[1] = (Uint8) (ch >> 16);
p[2] = (Uint8) (ch >> 8);
p[3] = (Uint8) ch;
dst += 4;
dstlen -= 4;
}
break;
case ENCODING_UTF32LE:
if (ch > 0x10FFFF) {
ch = UNKNOWN_UNICODE;
}
case ENCODING_UCS4LE:
if (ch > 0x7FFFFFFF) {
ch = UNKNOWN_UNICODE;
}
{
Uint8 *p = (Uint8 *) dst;
if (dstlen < 4) {
return SDL_ICONV_E2BIG;
}
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;
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
ENCODING_ASCII
Definition: SDL_iconv.c:101
ENCODING_UTF16
Definition: SDL_iconv.c:104
n
GLdouble n
Definition: SDL_opengl_glext.h:1952
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
ENCODING_UTF32LE
Definition: SDL_iconv.c:109
UNKNOWN_UNICODE
#define UNKNOWN_UNICODE
Definition: SDL_iconv.c:96
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11090
ENCODING_UTF32BE
Definition: SDL_iconv.c:108
ENCODING_UCS2BE
Definition: SDL_iconv.c:110
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
ENCODING_UTF8
Definition: SDL_iconv.c:103
UNICODE_BOM
#define UNICODE_BOM
Definition: SDL_iconv.c:93
ENCODING_UTF32
Definition: SDL_iconv.c:107
left
GLint left
Definition: SDL_opengl_glext.h:1949
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
ENCODING_UCS4BE
Definition: SDL_iconv.c:112
SDL_ICONV_E2BIG
#define SDL_ICONV_E2BIG
Definition: SDL_stdinc.h:462
SDL_TRUE
Definition: SDL_stdinc.h:129
ENCODING_UTF32NATIVE
#define ENCODING_UTF32NATIVE
Definition: SDL_iconv.c:117
SDL_ICONV_EINVAL
#define SDL_ICONV_EINVAL
Definition: SDL_stdinc.h:464
ENCODING_UCS4LE
Definition: SDL_iconv.c:113
ENCODING_UTF16BE
Definition: SDL_iconv.c:105
UNKNOWN_ASCII
#define UNKNOWN_ASCII
Definition: SDL_iconv.c:95
ENCODING_UTF16LE
Definition: SDL_iconv.c:106
SDL_FALSE
Definition: SDL_stdinc.h:128
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
ENCODING_LATIN1
Definition: SDL_iconv.c:102
ENCODING_UTF16NATIVE
#define ENCODING_UTF16NATIVE
Definition: SDL_iconv.c:116
src
GLenum src
Definition: SDL_opengl_glext.h:1737
ENCODING_UCS2LE
Definition: SDL_iconv.c:111

int SDL_iconv_close | ( | SDL_iconv_t | cd | ) |

Definition at line 850 of file SDL_iconv.c.

References SDL_free().

Referenced by SDL_iconv_string().

{
if (cd != (SDL_iconv_t)-1) {
SDL_free(cd);
}
return 0;
}
SDL_free
void SDL_free(void *mem)

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

Definition at line 206 of file SDL_iconv.c.

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

Referenced by SDL_iconv_string().

{
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;
}
encodings
static struct @26 encodings[]
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_strcasecmp
#define SDL_strcasecmp
Definition: SDL_dynapi_overrides.h:425
ENCODING_UNKNOWN
Definition: SDL_iconv.c:100
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
SDL_arraysize
#define SDL_arraysize(array)
Definition: SDL_stdinc.h:93
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:380
getlocale
static const char * getlocale(char *buffer, size_t bufsize)
Definition: SDL_iconv.c:171

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 861 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) {
SDL_iconv_close(cd);
return NULL;
}
outbuf = string;
outbytesleft = stringsize;
SDL_memset(outbuf, 0, 4);
while (inbytesleft > 0) {
retCode = SDL_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
switch (retCode) {
case SDL_ICONV_E2BIG:
{
char *oldstring = string;
stringsize *= 2;
string = SDL_realloc(string, stringsize);
if (!string) {
SDL_iconv_close(cd);
return NULL;
}
outbuf = string + (outbuf - oldstring);
outbytesleft = stringsize - (outbuf - string);
SDL_memset(outbuf, 0, 4);
}
break;
case SDL_ICONV_EILSEQ:
/* Try skipping some input data - not perfect, but... */
++inbuf;
--inbytesleft;
break;
case SDL_ICONV_EINVAL:
case SDL_ICONV_ERROR:
/* We can't continue... */
inbytesleft = 0;
break;
}
}
SDL_iconv_close(cd);
return string;
}
SDL_iconv_close
int SDL_iconv_close(SDL_iconv_t cd)
Definition: SDL_iconv.c:850
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
SDL_ICONV_EILSEQ
#define SDL_ICONV_EILSEQ
Definition: SDL_stdinc.h:463
SDL_iconv_open
SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
Definition: SDL_iconv.c:206
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:382
SDL_ICONV_E2BIG
#define SDL_ICONV_E2BIG
Definition: SDL_stdinc.h:462
SDL_ICONV_EINVAL
#define SDL_ICONV_EINVAL
Definition: SDL_stdinc.h:464
NULL
#define NULL
Definition: begin_code.h:143
SDL_ICONV_ERROR
#define SDL_ICONV_ERROR
Definition: SDL_stdinc.h:461
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:380
SDL_iconv
size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: SDL_iconv.c:246
SDL_memset
#define SDL_memset
Definition: SDL_dynapi_overrides.h:392

int SDL_isdigit | ( | int | x | ) |

Definition at line 264 of file SDL_stdlib.c.

Referenced by SDL_abs().

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

int SDL_isspace | ( | int | x | ) |

Definition at line 265 of file SDL_stdlib.c.

Referenced by SDL_abs().

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

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

Definition at line 660 of file SDL_string.c.

References SDL_ltoa().

Referenced by SDL_memset4().

{
#ifdef HAVE_ITOA
return itoa(value, string, radix);
#else
return SDL_ltoa((long)value, string, radix);
#endif /* HAVE_ITOA */
}
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ltoa
char * SDL_ltoa(long value, char *string, int radix)
Definition: SDL_string.c:680

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

Definition at line 724 of file SDL_string.c.

References SDL_ulltoa().

Referenced by SDL_memset4(), and SDL_PrintLongLong().

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ulltoa
char * SDL_ulltoa(Uint64 value, char *string, int radix)
Definition: SDL_string.c:743

double SDL_log | ( | double | x | ) |

Definition at line 158 of file SDL_stdlib.c.

References SDL_uclibc_log().

Referenced by SDL_memset4().

{
#if defined(HAVE_LOG)
return log(x);
#else
return SDL_uclibc_log(x);
#endif /* HAVE_LOG */
}
SDL_uclibc_log
double SDL_uclibc_log(double x)
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

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

Definition at line 680 of file SDL_string.c.

References SDL_ultoa().

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

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ultoa
char * SDL_ultoa(unsigned long value, char *string, int radix)
Definition: SDL_string.c:699

void* SDL_malloc | ( | size_t | size | ) |

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

Definition at line 391 of file SDL_string.c.

Referenced by SDL_memset4().

{
#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 */
}
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
s1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: SDL_opengl_glext.h:8583

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

Definition at line 314 of file SDL_string.c.

References memcpy.

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

{
#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__ */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
left
GLint left
Definition: SDL_opengl_glext.h:1949
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
memcpy
#define memcpy
Definition: SDL_malloc.c:640
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

References SDL_memcpy().

{
return SDL_memcpy(dst, src, dwords * 4);
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:314
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

Definition at line 367 of file SDL_string.c.

References memmove.

Referenced by SDL_memset4().

{
#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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
memmove
#define memmove
Definition: SDL_qsort.c:86
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

Definition at line 270 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;
Uint32 value4 = (c | (c << 8) | (c << 16) | (c << 24));
Uint8 value1 = (Uint8) c;
/* 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. */
while ((intptr_t)dstp1 & 0x3) {
if (len--) {
*dstp1++ = value1;
} else {
return dst;
}
}
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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
memset
#define memset
Definition: SDL_malloc.c:639
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
left
GLint left
Definition: SDL_opengl_glext.h:1949
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093

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

Definition at line 359 of file SDL_stdinc.h.

References DECLSPEC, SDL_acos(), SDL_asin(), SDL_atan(), SDL_atan2(), SDL_atof(), SDL_atoi(), SDL_ceil(), SDL_copysign(), SDL_cos(), SDL_cosf(), SDL_fabs(), SDL_floor(), SDL_IN_BYTECAP, SDL_INOUT_Z_CAP, SDL_itoa(), SDL_lltoa(), SDL_log(), SDL_ltoa(), SDL_memcmp(), SDL_memcpy(), SDL_memmove(), SDL_OUT_BYTECAP, SDL_OUT_Z_CAP, SDL_pow(), SDL_PRINTF_FORMAT_STRING, SDL_PRINTF_VARARG_FUNC, SDL_scalbn(), SDL_SCANF_FORMAT_STRING, SDL_SCANF_VARARG_FUNC, SDL_sin(), SDL_sinf(), SDL_snprintf(), SDL_sqrt(), SDL_sqrtf(), SDL_sscanf(), SDL_static_cast, SDL_strcasecmp(), SDL_strchr(), SDL_strcmp(), SDL_strdup(), SDL_strlcat(), SDL_strlcpy(), SDL_strlen(), SDL_strlwr(), SDL_strncasecmp(), SDL_strncmp(), SDL_strrchr(), SDL_strrev(), SDL_strstr(), SDL_strtod(), SDL_strtol(), SDL_strtoll(), SDL_strtoul(), SDL_strtoull(), SDL_strupr(), SDL_tan(), SDL_tanf(), SDL_uitoa(), SDL_ulltoa(), SDL_ultoa(), SDL_utf8strlcpy(), SDL_vsnprintf(), SDL_vsscanf(), SDL_wcslcat(), SDL_wcslcpy(), SDL_wcslen(), SDLCALL, and text.

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 *_p = SDL_static_cast(Uint32 *, dst);
Uint32 _val = (val);
if (dwords == 0)
return;
switch (dwords % 4)
{
case 0: do { *_p++ = _val;
case 3: *_p++ = _val;
case 2: *_p++ = _val;
case 1: *_p++ = _val;
} while ( --_n );
}
#endif
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
u1
GLfixed u1
Definition: SDL_opengl_glext.h:4558
u2
GLfixed GLfixed u2
Definition: SDL_opengl_glext.h:4558
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1492
SDL_static_cast
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:109

double SDL_pow | ( | double | x,
|  | double | y
| ) |  |

Definition at line 168 of file SDL_stdlib.c.

References SDL_uclibc_pow().

Referenced by SDL_memset4().

{
#if defined(HAVE_POW)
return pow(x, y);
#else
return SDL_uclibc_pow(x, y);
#endif /* HAVE_POW */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_pow
double SDL_uclibc_pow(double x, double y)
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567

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

double SDL_scalbn | ( | double | x,
|  | int | n
| ) |  |

Definition at line 178 of file SDL_stdlib.c.

References scalbn, and SDL_uclibc_scalbn().

Referenced by SDL_memset4().

{
#if defined(HAVE_SCALBN)
return scalbn(x, n);
#elif defined(HAVE__SCALB)
return _scalb(x, n);
#else
return SDL_uclibc_scalbn(x, n);
#endif /* HAVE_SCALBN */
}
n
GLdouble n
Definition: SDL_opengl_glext.h:1952
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
scalbn
#define scalbn
Definition: math_private.h:40
SDL_uclibc_scalbn
double SDL_uclibc_scalbn(double x, int n)

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

Definition at line 108 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.

Referenced by SDL_getenv().

{
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 */
len = SDL_strlen(name) + SDL_strlen(value) + 2;
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_free(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);
}
SDL_getenv
char * SDL_getenv(const char *name)
Definition: SDL_getenv.c:212
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_realloc
#define SDL_realloc
Definition: SDL_dynapi_overrides.h:382
SDL_strncmp
#define SDL_strncmp
Definition: SDL_dynapi_overrides.h:424
SDL_env
static char ** SDL_env
Definition: SDL_getenv.c:106
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strchr
#define SDL_strchr
Definition: SDL_dynapi_overrides.h:407
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_free
void SDL_free(void *mem)
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_strlen
#define SDL_strlen
Definition: SDL_dynapi_overrides.h:399
SDL_snprintf
#define SDL_snprintf
Definition: SDL_dynapi_overrides.h:46
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:380

double SDL_sin | ( | double | x | ) |

Definition at line 190 of file SDL_stdlib.c.

References SDL_uclibc_sin(), and sin.

Referenced by SDL_memset4(), and SDL_sinf().

{
#if defined(HAVE_SIN)
return sin(x);
#else
return SDL_uclibc_sin(x);
#endif /* HAVE_SIN */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_sin
double SDL_uclibc_sin(double x)
sin
#define sin
Definition: math_private.h:41

float SDL_sinf | ( | float | x | ) |

Definition at line 200 of file SDL_stdlib.c.

References SDL_sin().

Referenced by SDL_memset4().

{
#ifdef HAVE_SINF
return sinf(x);
#else
return (float)SDL_sin((double)x);
#endif /* HAVE_SINF */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_sin
double SDL_sin(double x)
Definition: SDL_stdlib.c:190

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

Definition at line 1273 of file SDL_string.c.

References retval, SDL_OUT_Z_CAP, and SDL_vsnprintf().

Referenced by SDL_memset4().

{
va_list ap;
int retval;
va_start(ap, fmt);
retval = SDL_vsnprintf(text, maxlen, fmt, ap);
va_end(ap);
return retval;
}
SDL_vsnprintf
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
Definition: SDL_string.c:1478
retval
SDL_bool retval
Definition: testgamecontroller.c:65
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34

double SDL_sqrt | ( | double | x | ) |

Definition at line 210 of file SDL_stdlib.c.

References SDL_uclibc_sqrt().

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

{
#if defined(HAVE_SQRT)
return sqrt(x);
#else
return SDL_uclibc_sqrt(x);
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_sqrt
double SDL_uclibc_sqrt(double x)

float SDL_sqrtf | ( | float | x | ) |

Definition at line 220 of file SDL_stdlib.c.

References SDL_sqrt().

Referenced by SDL_memset4().

{
#if defined(HAVE_SQRTF)
return sqrtf(x);
#else
return (float)SDL_sqrt((double)x);
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_sqrt
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:210

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

Definition at line 992 of file SDL_string.c.

References SDL_vsscanf(), and text.

Referenced by SDL_memset4().

{
int rc;
va_list ap;
va_start(ap, fmt);
rc = SDL_vsscanf(text, fmt, ap);
va_end(ap);
return rc;
}
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34
SDL_vsscanf
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
Definition: SDL_string.c:1010

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

Definition at line 939 of file SDL_string.c.

References SDL_toupper.

Referenced by SDL_memset4().

{
#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 */
}
SDL_toupper
#define SDL_toupper
Definition: SDL_dynapi_overrides.h:390
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

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

Definition at line 596 of file SDL_string.c.

References NULL, and SDL_const_cast.

Referenced by SDL_memset4().

{
#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 */
}
SDL_const_cast
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:110
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
index
GLuint index
Definition: SDL_opengl_glext.h:660
NULL
#define NULL
Definition: begin_code.h:143

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

Definition at line 903 of file SDL_string.c.

Referenced by SDL_memset4().

{
#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 532 of file SDL_string.c.

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

Referenced by SDL_memset4().

{
#if defined(HAVE_STRDUP)
return strdup(string);
#else
size_t len = SDL_strlen(string) + 1;
char *newstr = SDL_malloc(len);
if (newstr) {
SDL_strlcpy(newstr, string, len);
}
return newstr;
#endif /* HAVE_STRDUP */
}
SDL_strlcpy
size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:469
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:380

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

Definition at line 517 of file SDL_string.c.

References SDL_strlcpy(), and SDL_strlen().

Referenced by SDL_memset4().

{
#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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_strlcpy
size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:469
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

Definition at line 469 of file SDL_string.c.

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

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

{
#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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:345
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:314
src
GLenum src
Definition: SDL_opengl_glext.h:1737

size_t SDL_strlen | ( | const char * | str | ) |

Definition at line 410 of file SDL_string.c.

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

{
#if defined(HAVE_STRLEN)
return strlen(string);
#else
size_t len = 0;
while (*string++) {
++len;
}
return len;
#endif /* HAVE_STRLEN */
}
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926

char* SDL_strlwr | ( | char * | str | ) |

Definition at line 581 of file SDL_string.c.

References SDL_tolower.

Referenced by SDL_memset4(), and SDL_PrintString().

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
SDL_tolower
#define SDL_tolower
Definition: SDL_dynapi_overrides.h:391

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

Definition at line 963 of file SDL_string.c.

References SDL_tolower.

Referenced by SDL_memset4().

{
#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 */
}
SDL_tolower
#define SDL_tolower
Definition: SDL_dynapi_overrides.h:391
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

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

Definition at line 919 of file SDL_string.c.

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

{
#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 614 of file SDL_string.c.

References NULL, SDL_const_cast, and SDL_strlen().

Referenced by SDL_memset4().

{
#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 */
}
SDL_const_cast
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:110
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
NULL
#define NULL
Definition: begin_code.h:143

char* SDL_strrev | ( | char * | str | ) |

Definition at line 547 of file SDL_string.c.

References SDL_strlen().

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

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1109

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

Definition at line 633 of file SDL_string.c.

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

Referenced by SDL_memset4().

{
#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 */
}
SDL_const_cast
#define SDL_const_cast(type, expression)
Definition: SDL_stdinc.h:110
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
NULL
#define NULL
Definition: begin_code.h:143
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:669

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

Definition at line 886 of file SDL_string.c.

References SDL_ScanFloat().

Referenced by SDL_atof(), and SDL_memset4().

{
#if defined(HAVE_STRTOD)
return strtod(string, endp);
#else
size_t len;
double value;
len = SDL_ScanFloat(string, &value);
if (endp) {
*endp = (char *) string + len;
}
return value;
#endif /* HAVE_STRTOD */
}
SDL_ScanFloat
static size_t SDL_ScanFloat(const char *text, double *valuep)
Definition: SDL_string.c:235
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698

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

Definition at line 786 of file SDL_string.c.

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

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

{
#if defined(HAVE_STRTOL)
return strtol(string, endp, base);
#else
size_t len;
long value;
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 */
}
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
SDL_ScanLong
static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
Definition: SDL_string.c:57
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698

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

Definition at line 836 of file SDL_string.c.

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

Referenced by SDL_memset4().

{
#if defined(HAVE_STRTOLL)
return strtoll(string, endp, base);
#else
size_t len;
Sint64 value;
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 */
}
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ScanLongLong
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
Definition: SDL_string.c:162
Sint64
int64_t Sint64
A signed 64-bit integer type.
Definition: SDL_stdinc.h:160

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

Definition at line 811 of file SDL_string.c.

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

Referenced by SDL_memset4().

{
#if defined(HAVE_STRTOUL)
return strtoul(string, endp, base);
#else
size_t len;
unsigned long value;
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 */
}
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ScanUnsignedLong
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
Definition: SDL_string.c:98

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

Definition at line 861 of file SDL_string.c.

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

Referenced by SDL_memset4().

{
#if defined(HAVE_STRTOULL)
return strtoull(string, endp, base);
#else
size_t len;
Uint64 value;
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 */
}
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
Uint64
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:164
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ScanUnsignedLongLong
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
Definition: SDL_string.c:203

char* SDL_strupr | ( | char * | str | ) |

Definition at line 566 of file SDL_string.c.

References SDL_toupper.

Referenced by SDL_memset4(), and SDL_PrintString().

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
SDL_toupper
#define SDL_toupper
Definition: SDL_dynapi_overrides.h:390

double SDL_tan | ( | double | x | ) |

Definition at line 230 of file SDL_stdlib.c.

References SDL_uclibc_tan(), and tan().

Referenced by SDL_memset4(), and SDL_tanf().

{
#if defined(HAVE_TAN)
return tan(x);
#else
return SDL_uclibc_tan(x);
#endif
}
tan
double tan(double x)
Definition: s_tan.c:45
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_tan
double SDL_uclibc_tan(double x)

float SDL_tanf | ( | float | x | ) |

Definition at line 240 of file SDL_stdlib.c.

References SDL_tan().

Referenced by SDL_memset4().

{
#if defined(HAVE_TANF)
return tanf(x);
#else
return (float)SDL_tan((double)x);
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_tan
double SDL_tan(double x)
Definition: SDL_stdlib.c:230

int SDL_tolower | ( | int | x | ) |

Definition at line 267 of file SDL_stdlib.c.

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

Referenced by SDL_abs().

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

int SDL_toupper | ( | int | x | ) |

Definition at line 266 of file SDL_stdlib.c.

Referenced by SDL_abs().

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

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

Definition at line 670 of file SDL_string.c.

References SDL_ultoa().

Referenced by SDL_memset4().

{
#ifdef HAVE__UITOA
return _uitoa(value, string, radix);
#else
return SDL_ultoa((unsigned long)value, string, radix);
#endif /* HAVE__UITOA */
}
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
SDL_ultoa
char * SDL_ultoa(unsigned long value, char *string, int radix)
Definition: SDL_string.c:699

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

Definition at line 743 of file SDL_string.c.

References SDL_strrev().

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

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
ntoa_table
static const char ntoa_table[]
Definition: SDL_string.c:651
SDL_strrev
char * SDL_strrev(char *string)
Definition: SDL_string.c:547
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698

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

Definition at line 699 of file SDL_string.c.

References SDL_strrev().

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

{
#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 */
}
string
GLsizei const GLchar *const * string
Definition: SDL_opengl_glext.h:688
ntoa_table
static const char ntoa_table[]
Definition: SDL_string.c:651
SDL_strrev
char * SDL_strrev(char *string)
Definition: SDL_string.c:547
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698

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

Definition at line 484 of file SDL_string.c.

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

Referenced by SDL_memset4().

{
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];
if (UTF8_IsLeadByte(c))
--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;
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:345
SDL_strlen
size_t SDL_strlen(const char *string)
Definition: SDL_string.c:410
UTF8_IsLeadByte
#define UTF8_IsLeadByte(c)
Definition: SDL_string.c:40
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:314
UTF8_TrailingBytes
static int UTF8_TrailingBytes(unsigned char c)
Definition: SDL_string.c:43
src
GLenum src
Definition: SDL_opengl_glext.h:1737
UTF8_IsTrailingByte
#define UTF8_IsTrailingByte(c)
Definition: SDL_string.c:41

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

Definition at line 1478 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_min, SDL_PrintFloat(), SDL_PrintLong(), SDL_PrintLongLong(), SDL_PrintString(), SDL_PrintUnsignedLong(), SDL_PrintUnsignedLongLong(), SDL_strncmp(), SDL_strtol(), SDL_TRUE, SDL_zero, text, and SDL_FormatInfo::width.

Referenced by SDL_memset4(), and SDL_snprintf().

{
size_t left = maxlen;
char *textstart = text;
if (!fmt) {
fmt = "";
}
while (*fmt) {
if (*fmt == '%') {
SDL_bool done = SDL_FALSE;
size_t len = 0;
SDL_bool check_flag;
SDL_FormatInfo info;
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 '-':
info.left_justify = SDL_TRUE;
break;
case '+':
info.force_sign = SDL_TRUE;
break;
case '#':
info.force_type = SDL_TRUE;
break;
case '0':
info.pad_zeroes = SDL_TRUE;
break;
default:
check_flag = SDL_FALSE;
break;
}
}
if (*fmt >= '0' && *fmt <= '9') {
info.width = SDL_strtol(fmt, (char **)&fmt, 0);
}
if (*fmt == '.') {
++fmt;
if (*fmt >= '0' && *fmt <= '9') {
info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
} else {
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':
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':
info.force_case = SDL_CASE_LOWER;
/* Fall through to 'X' handling */
case 'X':
if (info.force_case == SDL_CASE_NOCHANGE) {
info.force_case = SDL_CASE_UPPER;
}
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':
info.pad_zeroes = SDL_TRUE;
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':
len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
done = SDL_TRUE;
break;
default:
done = SDL_TRUE;
break;
}
++fmt;
}
text += len;
if (len >= left) {
left = SDL_min(left, 1);
} else {
left -= len;
}
} else {
if (left > 1) {
*text = *fmt;
--left;
}
++fmt;
++text;
}
}
if (left > 0) {
*text = '\0';
}
return (int)(text - textstart);
}
SDL_FormatInfo::radix
int radix
Definition: SDL_string.c:1310
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:345
SDL_FormatInfo::left_justify
SDL_bool left_justify
Definition: SDL_string.c:1304
SDL_FormatInfo::pad_zeroes
SDL_bool pad_zeroes
Definition: SDL_string.c:1307
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
SDL_FormatInfo::force_type
SDL_bool force_type
Definition: SDL_string.c:1306
SDL_FormatInfo
Definition: SDL_string.c:1302
Uint64
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:164
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_strtol
long SDL_strtol(const char *string, char **endp, int base)
Definition: SDL_string.c:786
SDL_PrintLongLong
static size_t SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
Definition: SDL_string.c:1360
SDL_PrintLong
static size_t SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
Definition: SDL_string.c:1342
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_FormatInfo::force_sign
SDL_bool force_sign
Definition: SDL_string.c:1305
left
GLint left
Definition: SDL_opengl_glext.h:1949
done
int done
Definition: checkkeys.c:28
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:355
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_CASE_LOWER
Definition: SDL_string.c:1298
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_FormatInfo::force_case
SDL_letter_case force_case
Definition: SDL_string.c:1308
SDL_PrintUnsignedLongLong
static size_t SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
Definition: SDL_string.c:1369
SDL_CASE_NOCHANGE
Definition: SDL_string.c:1297
Sint64
int64_t Sint64
A signed 64-bit integer type.
Definition: SDL_stdinc.h:160
SDL_FormatInfo::width
int width
Definition: SDL_string.c:1309
SDL_PrintString
static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
Definition: SDL_string.c:1315
SDL_FormatInfo::precision
int precision
Definition: SDL_string.c:1311
SDL_CASE_UPPER
Definition: SDL_string.c:1299
SDL_PrintUnsignedLong
static size_t SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
Definition: SDL_string.c:1351
SDL_PrintFloat
static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg)
Definition: SDL_string.c:1378

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

Definition at line 1010 of file SDL_string.c.

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

Referenced by SDL_memset4(), and SDL_sscanf().

{
int retval = 0;
while (*fmt) {
if (*fmt == ' ') {
while (SDL_isspace((unsigned char) *text)) {
++text;
}
++fmt;
continue;
}
if (*fmt == '%') {
SDL_bool done = SDL_FALSE;
long count = 0;
int radix = 10;
enum
{
DO_SHORT,
DO_INT,
DO_LONG,
DO_LONGLONG
} inttype = DO_INT;
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) {
Sint64 value;
text += SDL_ScanLongLong(text, radix, &value);
if (!suppress) {
Sint64 *valuep = va_arg(ap, Sint64 *);
*valuep = value;
++retval;
}
} else {
long value;
text += SDL_ScanLong(text, radix, &value);
if (!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;
text += SDL_ScanUnsignedLongLong(text, radix, &value);
if (!suppress) {
Uint64 *valuep = va_arg(ap, Uint64 *);
*valuep = value;
++retval;
}
} else {
unsigned long value;
text += SDL_ScanUnsignedLong(text, radix, &value);
if (!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;
text += SDL_ScanUintPtrT(text, 16, &value);
if (!suppress) {
void **valuep = va_arg(ap, void **);
*valuep = (void *) value;
++retval;
}
}
done = SDL_TRUE;
break;
case 'f':
{
double value;
text += SDL_ScanFloat(text, &value);
if (!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;
}
SDL_ScanFloat
static size_t SDL_ScanFloat(const char *text, double *valuep)
Definition: SDL_string.c:235
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:919
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1564
SDL_tolower
#define SDL_tolower
Definition: SDL_dynapi_overrides.h:391
Uint64
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:164
SDL_ScanUintPtrT
static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
Definition: SDL_string.c:130
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_ScanLong
static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
Definition: SDL_string.c:57
retval
SDL_bool retval
Definition: testgamecontroller.c:65
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
done
int done
Definition: checkkeys.c:28
uintptr_t
unsigned int uintptr_t
Definition: SDL_config_windows.h:69
SDL_TRUE
Definition: SDL_stdinc.h:129
SDL_isspace
#define SDL_isspace
Definition: SDL_dynapi_overrides.h:389
index
GLuint index
Definition: SDL_opengl_glext.h:660
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:34
SDL_FALSE
Definition: SDL_stdinc.h:128
SDL_ScanLongLong
static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
Definition: SDL_string.c:162
Sint64
int64_t Sint64
A signed 64-bit integer type.
Definition: SDL_stdinc.h:160
SDL_ScanUnsignedLongLong
static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valuep)
Definition: SDL_string.c:203
SDL_ScanUnsignedLong
static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
Definition: SDL_string.c:98

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

Definition at line 454 of file SDL_string.c.

References SDL_wcslcpy(), and SDL_wcslen().

Referenced by SDL_memset4().

{
#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 */
}
SDL_wcslen
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:424
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_wcslcpy
size_t SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
Definition: SDL_string.c:438
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

Definition at line 438 of file SDL_string.c.

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

Referenced by SDL_memset4(), and SDL_wcslcat().

{
#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 */
}
SDL_wcslen
size_t SDL_wcslen(const wchar_t *string)
Definition: SDL_string.c:424
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_min
#define SDL_min(x, y)
Definition: SDL_stdinc.h:345
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:314
src
GLenum src
Definition: SDL_opengl_glext.h:1737

size_t SDL_wcslen | ( | const wchar_t * | wstr | ) |

Definition at line 424 of file SDL_string.c.

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

{
#if defined(HAVE_WCSLEN)
return wcslen(string);
#else
size_t len = 0;
while (*string++) {
++len;
}
return len;
#endif /* HAVE_WCSLEN */
}
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926