mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Update to SDL2.0.10
This commit is contained in:
parent
600859bd63
commit
c932bda8dd
915 changed files with 116675 additions and 21754 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
iconv() may or may not use const char ** for the inbuf param.
|
||||
If we get this wrong, it's just a warning, so no big deal.
|
||||
*/
|
||||
#if defined(_XGP6) || defined(__APPLE__) || \
|
||||
#if defined(_XGP6) || defined(__APPLE__) || defined(__RISCOS__) || \
|
||||
defined(__EMSCRIPTEN__) || \
|
||||
(defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \
|
||||
(defined(_NEWLIB_VERSION)))
|
||||
|
|
@ -89,13 +89,13 @@ SDL_iconv(SDL_iconv_t cd,
|
|||
#else
|
||||
|
||||
/* Lots of useful information on Unicode at:
|
||||
http://www.cl.cam.ac.uk/~mgk25/unicode.html
|
||||
http://www.cl.cam.ac.uk/~mgk25/unicode.html
|
||||
*/
|
||||
|
||||
#define UNICODE_BOM 0xFEFF
|
||||
#define UNICODE_BOM 0xFEFF
|
||||
|
||||
#define UNKNOWN_ASCII '?'
|
||||
#define UNKNOWN_UNICODE 0xFFFD
|
||||
#define UNKNOWN_ASCII '?'
|
||||
#define UNKNOWN_UNICODE 0xFFFD
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -115,13 +115,13 @@ enum
|
|||
ENCODING_UCS4LE,
|
||||
};
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16BE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32BE
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16BE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32BE
|
||||
#define ENCODING_UCS2NATIVE ENCODING_UCS2BE
|
||||
#define ENCODING_UCS4NATIVE ENCODING_UCS4BE
|
||||
#else
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16LE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32LE
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16LE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32LE
|
||||
#define ENCODING_UCS2NATIVE ENCODING_UCS2LE
|
||||
#define ENCODING_UCS4NATIVE ENCODING_UCS4LE
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -502,6 +502,14 @@ DEFAULT_MMAP_THRESHOLD default: 256K
|
|||
#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __OS2__
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
#define HAVE_MMAP 1
|
||||
#define HAVE_MORECORE 0
|
||||
#define LACKS_SYS_MMAN_H
|
||||
#endif /* __OS2__ */
|
||||
|
||||
#if defined(DARWIN) || defined(_DARWIN)
|
||||
/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */
|
||||
#ifndef HAVE_MORECORE
|
||||
|
|
@ -1342,7 +1350,7 @@ extern size_t getpagesize();
|
|||
#define IS_MMAPPED_BIT (SIZE_T_ONE)
|
||||
#define USE_MMAP_BIT (SIZE_T_ONE)
|
||||
|
||||
#ifndef WIN32
|
||||
#if !defined(WIN32) && !defined (__OS2__)
|
||||
#define CALL_MUNMAP(a, s) munmap((a), (s))
|
||||
#define MMAP_PROT (PROT_READ|PROT_WRITE)
|
||||
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
|
||||
|
|
@ -1365,6 +1373,42 @@ static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
|
|||
#endif /* MAP_ANONYMOUS */
|
||||
|
||||
#define DIRECT_MMAP(s) CALL_MMAP(s)
|
||||
|
||||
#elif defined(__OS2__)
|
||||
|
||||
/* OS/2 MMAP via DosAllocMem */
|
||||
static void* os2mmap(size_t size) {
|
||||
void* ptr;
|
||||
if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) &&
|
||||
DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE))
|
||||
return MFAIL;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define os2direct_mmap(n) os2mmap(n)
|
||||
|
||||
/* This function supports releasing coalesed segments */
|
||||
static int os2munmap(void* ptr, size_t size) {
|
||||
while (size) {
|
||||
ULONG ulSize = size;
|
||||
ULONG ulFlags = 0;
|
||||
if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0)
|
||||
return -1;
|
||||
if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 ||
|
||||
ulSize > size)
|
||||
return -1;
|
||||
if (DosFreeMem(ptr) != 0)
|
||||
return -1;
|
||||
ptr = ( void * ) ( ( char * ) ptr + ulSize );
|
||||
size -= ulSize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CALL_MMAP(s) os2mmap(s)
|
||||
#define CALL_MUNMAP(a, s) os2munmap((a), (s))
|
||||
#define DIRECT_MMAP(s) os2direct_mmap(s)
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
/* Win32 MMAP via VirtualAlloc */
|
||||
|
|
@ -1448,7 +1492,7 @@ win32munmap(void *ptr, size_t size)
|
|||
unique mparams values are initialized only once.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#if !defined(WIN32) && !defined(__OS2__)
|
||||
/* By default use posix locks */
|
||||
#include <pthread.h>
|
||||
#define MLOCK_T pthread_mutex_t
|
||||
|
|
@ -1462,6 +1506,16 @@ static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|||
|
||||
static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
#elif defined(__OS2__)
|
||||
#define MLOCK_T HMTX
|
||||
#define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE)
|
||||
#define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT)
|
||||
#define RELEASE_LOCK(l) DosReleaseMutexSem(*l)
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex;
|
||||
#endif /* HAVE_MORECORE */
|
||||
static MLOCK_T magic_init_mutex;
|
||||
|
||||
#else /* WIN32 */
|
||||
/*
|
||||
Because lock-protected regions have bounded times, and there
|
||||
|
|
@ -2532,10 +2586,15 @@ init_mparams(void)
|
|||
}
|
||||
RELEASE_MAGIC_INIT_LOCK();
|
||||
|
||||
#ifndef WIN32
|
||||
#if !defined(WIN32) && !defined(__OS2__)
|
||||
mparams.page_size = malloc_getpagesize;
|
||||
mparams.granularity = ((DEFAULT_GRANULARITY != 0) ?
|
||||
DEFAULT_GRANULARITY : mparams.page_size);
|
||||
#elif defined (__OS2__)
|
||||
/* if low-memory is used, os2munmap() would break
|
||||
if it were anything other than 64k */
|
||||
mparams.page_size = 4096u;
|
||||
mparams.granularity = 65536u;
|
||||
#else /* WIN32 */
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -200,11 +200,31 @@ SDL_cosf(float x)
|
|||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
SDL_exp(double x)
|
||||
{
|
||||
#if defined(HAVE_EXP)
|
||||
return exp(x);
|
||||
#else
|
||||
return SDL_uclibc_exp(x);
|
||||
#endif
|
||||
}
|
||||
|
||||
float
|
||||
SDL_expf(float x)
|
||||
{
|
||||
#if defined(HAVE_EXPF)
|
||||
return expf(x);
|
||||
#else
|
||||
return (float)SDL_exp((double)x);
|
||||
#endif
|
||||
}
|
||||
|
||||
double
|
||||
SDL_fabs(double x)
|
||||
{
|
||||
#if defined(HAVE_FABS)
|
||||
return fabs(x);
|
||||
return fabs(x);
|
||||
#else
|
||||
return SDL_uclibc_fabs(x);
|
||||
#endif
|
||||
|
|
@ -214,7 +234,7 @@ float
|
|||
SDL_fabsf(float x)
|
||||
{
|
||||
#if defined(HAVE_FABSF)
|
||||
return fabsf(x);
|
||||
return fabsf(x);
|
||||
#else
|
||||
return (float)SDL_fabs((double)x);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -271,12 +271,16 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
|
|||
size_t left;
|
||||
Uint32 *dstp4;
|
||||
Uint8 *dstp1 = (Uint8 *) dst;
|
||||
Uint32 value4 = (c | (c << 8) | (c << 16) | (c << 24));
|
||||
Uint8 value1 = (Uint8) c;
|
||||
Uint8 value1;
|
||||
Uint32 value4;
|
||||
|
||||
/* The value used in memset() is a byte, passed as an int */
|
||||
c &= 0xff;
|
||||
|
||||
/* The destination pointer needs to be aligned on a 4-byte boundary to
|
||||
* execute a 32-bit set. Set first bytes manually if needed until it is
|
||||
* aligned. */
|
||||
value1 = (Uint8)c;
|
||||
while ((intptr_t)dstp1 & 0x3) {
|
||||
if (len--) {
|
||||
*dstp1++ = value1;
|
||||
|
|
@ -285,6 +289,7 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
value4 = (c | (c << 8) | (c << 16) | (c << 24));
|
||||
dstp4 = (Uint32 *) dstp1;
|
||||
left = (len % 4);
|
||||
len /= 4;
|
||||
|
|
@ -416,6 +421,17 @@ SDL_strlen(const char *string)
|
|||
#endif /* HAVE_STRLEN */
|
||||
}
|
||||
|
||||
wchar_t *
|
||||
SDL_wcsdup(const wchar_t *string)
|
||||
{
|
||||
size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t));
|
||||
wchar_t *newstr = (wchar_t *)SDL_malloc(len);
|
||||
if (newstr) {
|
||||
SDL_memcpy(newstr, string, len);
|
||||
}
|
||||
return newstr;
|
||||
}
|
||||
|
||||
size_t
|
||||
SDL_wcslen(const wchar_t * string)
|
||||
{
|
||||
|
|
@ -562,7 +578,7 @@ char *
|
|||
SDL_strdup(const char *string)
|
||||
{
|
||||
size_t len = SDL_strlen(string) + 1;
|
||||
char *newstr = SDL_malloc(len);
|
||||
char *newstr = (char *)SDL_malloc(len);
|
||||
if (newstr) {
|
||||
SDL_memcpy(newstr, string, len);
|
||||
}
|
||||
|
|
@ -1319,7 +1335,18 @@ SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_
|
|||
return retval;
|
||||
}
|
||||
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
#if defined(HAVE_LIBC) && defined(__WATCOMC__)
|
||||
/* _vsnprintf() doesn't ensure nul termination */
|
||||
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
|
||||
{
|
||||
int retval;
|
||||
if (!fmt) fmt = "";
|
||||
retval = _vsnprintf(text, maxlen, fmt, ap);
|
||||
if (maxlen > 0) text[maxlen-1] = '\0';
|
||||
if (retval < 0) retval = (int) maxlen;
|
||||
return retval;
|
||||
}
|
||||
#elif defined(HAVE_VSNPRINTF)
|
||||
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
|
||||
{
|
||||
if (!fmt) {
|
||||
|
|
@ -1338,9 +1365,9 @@ typedef enum
|
|||
|
||||
typedef struct
|
||||
{
|
||||
SDL_bool left_justify;
|
||||
SDL_bool left_justify; /* for now: ignored. */
|
||||
SDL_bool force_sign;
|
||||
SDL_bool force_type;
|
||||
SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */
|
||||
SDL_bool pad_zeroes;
|
||||
SDL_letter_case force_case;
|
||||
int width;
|
||||
|
|
@ -1352,15 +1379,18 @@ static size_t
|
|||
SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
|
||||
{
|
||||
size_t length = 0;
|
||||
size_t slen;
|
||||
size_t slen, sz;
|
||||
|
||||
if (string == NULL) {
|
||||
string = "(null)";
|
||||
}
|
||||
|
||||
if (info && info->width && (size_t)info->width > SDL_strlen(string)) {
|
||||
sz = SDL_strlen(string);
|
||||
if (info && info->width > 0 && (size_t)info->width > sz) {
|
||||
char fill = info->pad_zeroes ? '0' : ' ';
|
||||
size_t width = info->width - SDL_strlen(string);
|
||||
size_t width = info->width - sz;
|
||||
if (info->precision >= 0 && (size_t)info->precision < sz)
|
||||
width += sz - (size_t)info->precision;
|
||||
while (width-- > 0 && maxlen > 0) {
|
||||
*text++ = fill;
|
||||
++length;
|
||||
|
|
@ -1372,6 +1402,13 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str
|
|||
length += SDL_min(slen, maxlen);
|
||||
|
||||
if (info) {
|
||||
if (info->precision >= 0 && (size_t)info->precision < sz) {
|
||||
slen = (size_t)info->precision;
|
||||
if (slen < maxlen) {
|
||||
text[slen] = 0;
|
||||
length -= (sz - slen);
|
||||
}
|
||||
}
|
||||
if (info->force_case == SDL_CASE_LOWER) {
|
||||
SDL_strlwr(text);
|
||||
} else if (info->force_case == SDL_CASE_UPPER) {
|
||||
|
|
@ -1381,12 +1418,54 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str
|
|||
return length;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *info)
|
||||
{/* left-pad num with zeroes. */
|
||||
size_t sz, pad, have_sign;
|
||||
|
||||
if (!info)
|
||||
return;
|
||||
|
||||
have_sign = 0;
|
||||
if (*num == '-' || *num == '+') {
|
||||
have_sign = 1;
|
||||
++num;
|
||||
--maxlen;
|
||||
}
|
||||
sz = SDL_strlen(num);
|
||||
if (info->precision > 0 && sz < (size_t)info->precision) {
|
||||
pad = (size_t)info->precision - sz;
|
||||
if (pad + sz + 1 <= maxlen) { /* otherwise ignore the precision */
|
||||
SDL_memmove(num + pad, num, sz + 1);
|
||||
SDL_memset(num, '0', pad);
|
||||
}
|
||||
}
|
||||
info->precision = -1;/* so that SDL_PrintString() doesn't make a mess. */
|
||||
|
||||
if (info->pad_zeroes && info->width > 0 && (size_t)info->width > sz + have_sign) {
|
||||
/* handle here: spaces are added before the sign
|
||||
but zeroes must be placed _after_ the sign. */
|
||||
/* sz hasn't changed: we ignore pad_zeroes if a precision is given. */
|
||||
pad = (size_t)info->width - sz - have_sign;
|
||||
if (pad + sz + 1 <= maxlen) {
|
||||
SDL_memmove(num + pad, num, sz + 1);
|
||||
SDL_memset(num, '0', pad);
|
||||
}
|
||||
info->width = 0; /* so that SDL_PrintString() doesn't make a mess. */
|
||||
}
|
||||
}
|
||||
|
||||
static size_t
|
||||
SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
|
||||
{
|
||||
char num[130];
|
||||
char num[130], *p = num;
|
||||
|
||||
SDL_ltoa(value, num, info ? info->radix : 10);
|
||||
if (info->force_sign && value >= 0L) {
|
||||
*p++ = '+';
|
||||
}
|
||||
|
||||
SDL_ltoa(value, p, info ? info->radix : 10);
|
||||
SDL_IntPrecisionAdjust(num, maxlen, info);
|
||||
return SDL_PrintString(text, maxlen, info, num);
|
||||
}
|
||||
|
||||
|
|
@ -1396,15 +1475,21 @@ SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned
|
|||
char num[130];
|
||||
|
||||
SDL_ultoa(value, num, info ? info->radix : 10);
|
||||
SDL_IntPrecisionAdjust(num, maxlen, info);
|
||||
return SDL_PrintString(text, maxlen, info, num);
|
||||
}
|
||||
|
||||
static size_t
|
||||
SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
|
||||
{
|
||||
char num[130];
|
||||
char num[130], *p = num;
|
||||
|
||||
SDL_lltoa(value, num, info ? info->radix : 10);
|
||||
if (info->force_sign && value >= (Sint64)0) {
|
||||
*p++ = '+';
|
||||
}
|
||||
|
||||
SDL_lltoa(value, p, info ? info->radix : 10);
|
||||
SDL_IntPrecisionAdjust(num, maxlen, info);
|
||||
return SDL_PrintString(text, maxlen, info, num);
|
||||
}
|
||||
|
||||
|
|
@ -1414,6 +1499,7 @@ SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint6
|
|||
char num[130];
|
||||
|
||||
SDL_ulltoa(value, num, info ? info->radix : 10);
|
||||
SDL_IntPrecisionAdjust(num, maxlen, info);
|
||||
return SDL_PrintString(text, maxlen, info, num);
|
||||
}
|
||||
|
||||
|
|
@ -1571,14 +1657,24 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
|||
if (*fmt >= '0' && *fmt <= '9') {
|
||||
info.width = SDL_strtol(fmt, (char **)&fmt, 0);
|
||||
}
|
||||
else if (*fmt == '*') {
|
||||
++fmt;
|
||||
info.width = va_arg(ap, int);
|
||||
}
|
||||
|
||||
if (*fmt == '.') {
|
||||
++fmt;
|
||||
if (*fmt >= '0' && *fmt <= '9') {
|
||||
info.precision = SDL_strtol(fmt, (char **)&fmt, 0);
|
||||
} else if (*fmt == '*') {
|
||||
++fmt;
|
||||
info.precision = va_arg(ap, int);
|
||||
} else {
|
||||
info.precision = 0;
|
||||
}
|
||||
if (info.precision < 0) {
|
||||
info.precision = 0;
|
||||
}
|
||||
}
|
||||
|
||||
while (!done) {
|
||||
|
|
@ -1614,6 +1710,9 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
|||
break;
|
||||
case 'i':
|
||||
case 'd':
|
||||
if (info.precision >= 0) {
|
||||
info.pad_zeroes = SDL_FALSE;
|
||||
}
|
||||
switch (inttype) {
|
||||
case DO_INT:
|
||||
len = SDL_PrintLong(text, left, &info,
|
||||
|
|
@ -1651,7 +1750,10 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
|||
}
|
||||
/* Fall through to unsigned handling */
|
||||
case 'u':
|
||||
info.pad_zeroes = SDL_TRUE;
|
||||
info.force_sign = SDL_FALSE;
|
||||
if (info.precision >= 0) {
|
||||
info.pad_zeroes = SDL_FALSE;
|
||||
}
|
||||
switch (inttype) {
|
||||
case DO_INT:
|
||||
len = SDL_PrintUnsignedLong(text, left, &info,
|
||||
|
|
@ -1678,12 +1780,14 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
|||
/* In practice this is used on Windows for WCHAR strings */
|
||||
wchar_t *wide_arg = va_arg(ap, wchar_t *);
|
||||
char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg));
|
||||
info.pad_zeroes = SDL_FALSE;
|
||||
len = SDL_PrintString(text, left, &info, arg);
|
||||
SDL_free(arg);
|
||||
done = SDL_TRUE;
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
info.pad_zeroes = SDL_FALSE;
|
||||
len = SDL_PrintString(text, left, &info, va_arg(ap, char *));
|
||||
done = SDL_TRUE;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue