mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-17 19:31:01 +00:00
* Adjustment: Update libsdl to address a bug in compilation on MacOS devices.
This commit is contained in:
parent
516163fd5d
commit
eab544c8f3
270 changed files with 9531 additions and 3704 deletions
|
|
@ -126,7 +126,7 @@ static struct
|
|||
const char *name;
|
||||
int format;
|
||||
} encodings[] = {
|
||||
/* *INDENT-OFF* */
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
{ "ASCII", ENCODING_ASCII },
|
||||
{ "US-ASCII", ENCODING_ASCII },
|
||||
{ "8859-1", ENCODING_LATIN1 },
|
||||
|
|
@ -160,7 +160,7 @@ static struct
|
|||
{ "UCS-4LE", ENCODING_UCS4LE },
|
||||
{ "UCS-4BE", ENCODING_UCS4BE },
|
||||
{ "UCS-4-INTERNAL", ENCODING_UCS4NATIVE },
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
};
|
||||
|
||||
static const char *
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ extern "C"
|
|||
maximum supported value of n differs across systems, but is in all
|
||||
cases less than the maximum representable value of a size_t.
|
||||
*/
|
||||
void *dlmalloc(size_t);
|
||||
void * SDLCALL dlmalloc(size_t);
|
||||
|
||||
/*
|
||||
free(void* p)
|
||||
|
|
@ -742,14 +742,14 @@ extern "C"
|
|||
It has no effect if p is null. If p was not malloced or already
|
||||
freed, free(p) will by default cause the current program to abort.
|
||||
*/
|
||||
void dlfree(void *);
|
||||
void SDLCALL dlfree(void *);
|
||||
|
||||
/*
|
||||
calloc(size_t n_elements, size_t element_size);
|
||||
Returns a pointer to n_elements * element_size bytes, with all locations
|
||||
set to zero.
|
||||
*/
|
||||
void *dlcalloc(size_t, size_t);
|
||||
void * SDLCALL dlcalloc(size_t, size_t);
|
||||
|
||||
/*
|
||||
realloc(void* p, size_t n)
|
||||
|
|
@ -774,7 +774,7 @@ extern "C"
|
|||
to be used as an argument to realloc is not supported.
|
||||
*/
|
||||
|
||||
void *dlrealloc(void *, size_t);
|
||||
void * SDLCALL dlrealloc(void *, size_t);
|
||||
|
||||
/*
|
||||
memalign(size_t alignment, size_t n);
|
||||
|
|
@ -5305,10 +5305,10 @@ History:
|
|||
#endif /* !HAVE_MALLOC */
|
||||
|
||||
#ifdef HAVE_MALLOC
|
||||
#define real_malloc malloc
|
||||
#define real_calloc calloc
|
||||
#define real_realloc realloc
|
||||
#define real_free free
|
||||
static void* SDLCALL real_malloc(size_t s) { return malloc(s); }
|
||||
static void* SDLCALL real_calloc(size_t n, size_t s) { return calloc(n, s); }
|
||||
static void* SDLCALL real_realloc(void *p, size_t s) { return realloc(p,s); }
|
||||
static void SDLCALL real_free(void *p) { free(p); }
|
||||
#else
|
||||
#define real_malloc dlmalloc
|
||||
#define real_calloc dlcalloc
|
||||
|
|
|
|||
|
|
@ -534,5 +534,38 @@ extern void qsortG(void *base, size_t nmemb, size_t size,
|
|||
|
||||
#endif /* HAVE_QSORT */
|
||||
|
||||
void *
|
||||
SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *))
|
||||
{
|
||||
#if defined(HAVE_BSEARCH)
|
||||
return bsearch(key, base, nmemb, size, compare);
|
||||
#else
|
||||
/* SDL's replacement: Taken from the Public Domain C Library (PDCLib):
|
||||
Permission is granted to use, modify, and / or redistribute at will.
|
||||
*/
|
||||
const void *pivot;
|
||||
size_t corr;
|
||||
int rc;
|
||||
|
||||
while (nmemb) {
|
||||
/* algorithm needs -1 correction if remaining elements are an even number. */
|
||||
corr = nmemb % 2;
|
||||
nmemb /= 2;
|
||||
pivot = (const char *)base + (nmemb * size);
|
||||
rc = compare(key, pivot);
|
||||
|
||||
if (rc > 0) {
|
||||
base = (const char *)pivot + size;
|
||||
/* applying correction */
|
||||
nmemb -= (1 - corr);
|
||||
} else if (rc == 0) {
|
||||
return (void *)pivot;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
#endif /* HAVE_BSEARCH */
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
|
|
|
|||
|
|
@ -549,8 +549,9 @@ int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); }
|
|||
__declspec(selectany) int _fltused = 1;
|
||||
#endif
|
||||
|
||||
/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */
|
||||
#if _MSC_VER >= 1400
|
||||
/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls.
|
||||
Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */
|
||||
#if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT))
|
||||
extern void *memcpy(void* dst, const void* src, size_t len);
|
||||
#pragma intrinsic(memcpy)
|
||||
|
||||
|
|
@ -570,7 +571,7 @@ memset(void *dst, int c, size_t len)
|
|||
{
|
||||
return SDL_memset(dst, c, len);
|
||||
}
|
||||
#endif /* _MSC_VER >= 1400 */
|
||||
#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */
|
||||
|
||||
#ifdef _M_IX86
|
||||
|
||||
|
|
|
|||
|
|
@ -27,14 +27,7 @@
|
|||
/* This file contains portable string manipulation functions for SDL */
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
/* Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment */
|
||||
#undef va_copy
|
||||
#define va_copy(dst, src) dst = src
|
||||
#elif defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define va_copy(to, from) __va_copy(to, from)
|
||||
#endif
|
||||
#include "SDL_vacopy.h"
|
||||
|
||||
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL)
|
||||
#define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F'))
|
||||
|
|
|
|||
36
Engine/lib/sdl/src/stdlib/SDL_vacopy.h
Normal file
36
Engine/lib/sdl/src/stdlib/SDL_vacopy.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 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
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* Do our best to make sure va_copy is working */
|
||||
#if defined(__NGAGE__)
|
||||
#undef va_copy
|
||||
#define va_copy(dst, src) dst = src
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
/* Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment */
|
||||
#undef va_copy
|
||||
#define va_copy(dst, src) dst = src
|
||||
|
||||
#elif defined(__GNUC__) && (__GNUC__ < 3)
|
||||
#define va_copy(dst, src) __va_copy(dst, src)
|
||||
#endif
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
Loading…
Add table
Add a link
Reference in a new issue