mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-21 04:15:36 +00:00
Revert "Updated SDL, Bullet and OpenAL soft libs"
This reverts commit 370161cfb1.
This commit is contained in:
parent
63be684474
commit
bc77ff0833
1102 changed files with 62741 additions and 204988 deletions
|
|
@ -271,16 +271,12 @@ SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
|
|||
size_t left;
|
||||
Uint32 *dstp4;
|
||||
Uint8 *dstp1 = (Uint8 *) dst;
|
||||
Uint8 value1;
|
||||
Uint32 value4;
|
||||
|
||||
/* The value used in memset() is a byte, passed as an int */
|
||||
c &= 0xff;
|
||||
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. */
|
||||
value1 = (Uint8)c;
|
||||
while ((intptr_t)dstp1 & 0x3) {
|
||||
if (len--) {
|
||||
*dstp1++ = value1;
|
||||
|
|
@ -289,7 +285,6 @@ 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;
|
||||
|
|
@ -421,17 +416,6 @@ 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)
|
||||
{
|
||||
|
|
@ -578,7 +562,7 @@ char *
|
|||
SDL_strdup(const char *string)
|
||||
{
|
||||
size_t len = SDL_strlen(string) + 1;
|
||||
char *newstr = (char *)SDL_malloc(len);
|
||||
char *newstr = SDL_malloc(len);
|
||||
if (newstr) {
|
||||
SDL_memcpy(newstr, string, len);
|
||||
}
|
||||
|
|
@ -1335,18 +1319,7 @@ SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_
|
|||
return retval;
|
||||
}
|
||||
|
||||
#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)
|
||||
#ifdef HAVE_VSNPRINTF
|
||||
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
|
||||
{
|
||||
if (!fmt) {
|
||||
|
|
@ -1365,9 +1338,9 @@ typedef enum
|
|||
|
||||
typedef struct
|
||||
{
|
||||
SDL_bool left_justify; /* for now: ignored. */
|
||||
SDL_bool left_justify;
|
||||
SDL_bool force_sign;
|
||||
SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */
|
||||
SDL_bool force_type;
|
||||
SDL_bool pad_zeroes;
|
||||
SDL_letter_case force_case;
|
||||
int width;
|
||||
|
|
@ -1379,18 +1352,15 @@ static size_t
|
|||
SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
|
||||
{
|
||||
size_t length = 0;
|
||||
size_t slen, sz;
|
||||
size_t slen;
|
||||
|
||||
if (string == NULL) {
|
||||
string = "(null)";
|
||||
}
|
||||
|
||||
sz = SDL_strlen(string);
|
||||
if (info && info->width > 0 && (size_t)info->width > sz) {
|
||||
if (info && info->width && (size_t)info->width > SDL_strlen(string)) {
|
||||
char fill = info->pad_zeroes ? '0' : ' ';
|
||||
size_t width = info->width - sz;
|
||||
if (info->precision >= 0 && (size_t)info->precision < sz)
|
||||
width += sz - (size_t)info->precision;
|
||||
size_t width = info->width - SDL_strlen(string);
|
||||
while (width-- > 0 && maxlen > 0) {
|
||||
*text++ = fill;
|
||||
++length;
|
||||
|
|
@ -1402,13 +1372,6 @@ 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) {
|
||||
|
|
@ -1418,54 +1381,12 @@ 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], *p = num;
|
||||
char num[130];
|
||||
|
||||
if (info->force_sign && value >= 0L) {
|
||||
*p++ = '+';
|
||||
}
|
||||
|
||||
SDL_ltoa(value, p, info ? info->radix : 10);
|
||||
SDL_IntPrecisionAdjust(num, maxlen, info);
|
||||
SDL_ltoa(value, num, info ? info->radix : 10);
|
||||
return SDL_PrintString(text, maxlen, info, num);
|
||||
}
|
||||
|
||||
|
|
@ -1475,21 +1396,15 @@ 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], *p = num;
|
||||
char num[130];
|
||||
|
||||
if (info->force_sign && value >= (Sint64)0) {
|
||||
*p++ = '+';
|
||||
}
|
||||
|
||||
SDL_lltoa(value, p, info ? info->radix : 10);
|
||||
SDL_IntPrecisionAdjust(num, maxlen, info);
|
||||
SDL_lltoa(value, num, info ? info->radix : 10);
|
||||
return SDL_PrintString(text, maxlen, info, num);
|
||||
}
|
||||
|
||||
|
|
@ -1499,7 +1414,6 @@ 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);
|
||||
}
|
||||
|
||||
|
|
@ -1657,24 +1571,14 @@ 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) {
|
||||
|
|
@ -1710,9 +1614,6 @@ 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,
|
||||
|
|
@ -1750,10 +1651,7 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt,
|
|||
}
|
||||
/* Fall through to unsigned handling */
|
||||
case 'u':
|
||||
info.force_sign = SDL_FALSE;
|
||||
if (info.precision >= 0) {
|
||||
info.pad_zeroes = SDL_FALSE;
|
||||
}
|
||||
info.pad_zeroes = SDL_TRUE;
|
||||
switch (inttype) {
|
||||
case DO_INT:
|
||||
len = SDL_PrintUnsignedLong(text, left, &info,
|
||||
|
|
@ -1780,14 +1678,12 @@ 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