Updates SDL to 2.0.12

This commit is contained in:
Areloch 2020-08-12 11:56:18 -05:00
parent 3108a08650
commit a526029f2f
861 changed files with 25596 additions and 8904 deletions

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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
@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution.
*/
/* Ported from original test\common.c file. */
/* Ported from original test/common.c file. */
#include "SDL_config.h"
#include "SDL_test.h"
@ -35,7 +35,7 @@ static const char *video_usage[] = {
"[--min-geometry WxH]", "[--max-geometry WxH]", "[--logical WxH]",
"[--scale N]", "[--depth N]", "[--refresh R]", "[--vsync]", "[--noframe]",
"[--resize]", "[--minimize]", "[--maximize]", "[--grab]",
"[--allow-highdpi]"
"[--allow-highdpi]", "[--usable-bounds]"
};
static const char *audio_usage[] = {
@ -282,6 +282,15 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index)
state->window_y = SDL_atoi(y);
return 2;
}
if (SDL_strcasecmp(argv[index], "--usable-bounds") == 0) {
/* !!! FIXME: this is a bit of a hack, but I don't want to add a
!!! FIXME: flag to the public structure in 2.0.x */
state->window_x = -1;
state->window_y = -1;
state->window_w = -1;
state->window_h = -1;
return 1;
}
if (SDL_strcasecmp(argv[index], "--geometry") == 0) {
char *w, *h;
++index;
@ -512,6 +521,65 @@ SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const cha
}
}
static const char *
BuildCommonUsageString(char **pstr, const char **strlist, const int numitems, const char **strlist2, const int numitems2)
{
char *str = *pstr;
if (!str) {
size_t len = SDL_strlen("[--trackmem]") + 2;
int i;
for (i = 0; i < numitems; i++) {
len += SDL_strlen(strlist[i]) + 1;
}
if (strlist2) {
for (i = 0; i < numitems2; i++) {
len += SDL_strlen(strlist2[i]) + 1;
}
}
str = (char *) SDL_calloc(1, len);
if (!str) {
return ""; /* oh well. */
}
SDL_strlcat(str, "[--trackmem] ", len);
for (i = 0; i < numitems-1; i++) {
SDL_strlcat(str, strlist[i], len);
SDL_strlcat(str, " ", len);
}
SDL_strlcat(str, strlist[i], len);
if (strlist2) {
SDL_strlcat(str, " ", len);
for (i = 0; i < numitems2-1; i++) {
SDL_strlcat(str, strlist2[i], len);
SDL_strlcat(str, " ", len);
}
SDL_strlcat(str, strlist2[i], len);
}
*pstr = str;
}
return str;
}
static char *common_usage_video = NULL;
static char *common_usage_audio = NULL;
static char *common_usage_videoaudio = NULL;
const char *
SDLTest_CommonUsage(SDLTest_CommonState * state)
{
switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) {
case SDL_INIT_VIDEO:
return BuildCommonUsageString(&common_usage_video, video_usage, SDL_arraysize(video_usage), NULL, 0);
case SDL_INIT_AUDIO:
return BuildCommonUsageString(&common_usage_audio, audio_usage, SDL_arraysize(audio_usage), NULL, 0);
case (SDL_INIT_VIDEO | SDL_INIT_AUDIO):
return BuildCommonUsageString(&common_usage_videoaudio, video_usage, SDL_arraysize(video_usage), audio_usage, SDL_arraysize(audio_usage));
default:
return "[--trackmem]";
}
}
SDL_bool
SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
{
@ -577,6 +645,9 @@ SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format)
case SDL_PIXELFORMAT_RGB444:
SDL_snprintfcat(text, maxlen, "RGB444");
break;
case SDL_PIXELFORMAT_BGR444:
SDL_snprintfcat(text, maxlen, "BGR444");
break;
case SDL_PIXELFORMAT_RGB555:
SDL_snprintfcat(text, maxlen, "RGB555");
break;
@ -956,6 +1027,15 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
}
for (i = 0; i < state->num_windows; ++i) {
char title[1024];
SDL_Rect r = {
state->window_x, state->window_y,
state->window_w, state->window_h
};
/* !!! FIXME: hack to make --usable-bounds work for now. */
if ((r.x == -1) && (r.y == -1) && (r.w == -1) && (r.h == -1)) {
SDL_GetDisplayUsableBounds(state->display, &r);
}
if (state->num_windows > 1) {
SDL_snprintf(title, SDL_arraysize(title), "%s %d",
@ -964,9 +1044,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
}
state->windows[i] =
SDL_CreateWindow(title, state->window_x, state->window_y,
state->window_w, state->window_h,
state->window_flags);
SDL_CreateWindow(title, r.x, r.y, r.w, r.h, state->window_flags);
if (!state->windows[i]) {
SDL_Log("Couldn't create window: %s\n",
SDL_GetError());
@ -1072,7 +1150,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state)
SDL_GetError());
return SDL_FALSE;
}
if (state->verbose & VERBOSE_VIDEO) {
if (state->verbose & VERBOSE_AUDIO) {
SDL_Log("Audio driver: %s\n",
SDL_GetCurrentAudioDriver());
}
@ -1833,6 +1911,13 @@ SDLTest_CommonQuit(SDLTest_CommonState * state)
{
int i;
SDL_free(common_usage_video);
SDL_free(common_usage_audio);
SDL_free(common_usage_videoaudio);
common_usage_video = NULL;
common_usage_audio = NULL;
common_usage_videoaudio = NULL;
SDL_free(state->windows);
if (state->targets) {
for (i = 0; i < state->num_windows; ++i) {

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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
@ -307,7 +307,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
/* max value for Uint64 */
const Uint64 maxValue = UINT64_MAX;
return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
(Uint64) boundary1, (Uint64) boundary2,
boundary1, boundary2,
validDomain);
}
@ -457,7 +457,7 @@ SDLTest_RandomUnitFloat()
float
SDLTest_RandomFloat()
{
return (float) (SDLTest_RandomUnitDouble() * (double)2.0 * (double)FLT_MAX - (double)(FLT_MAX));
return (float) (SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX));
}
double

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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
@ -169,7 +169,7 @@ SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, in
* \return Timer id or -1 on failure.
*/
static SDL_TimerID
SDLTest_SetTestTimeout(int timeout, void (*callback)())
SDLTest_SetTestTimeout(int timeout, void (*callback)(void))
{
Uint32 timeoutInMilliseconds;
SDL_TimerID timerID;
@ -210,7 +210,7 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)())
#pragma aux SDLTest_BailOut aborts;
#endif
static SDL_NORETURN void
SDLTest_BailOut()
SDLTest_BailOut(void)
{
SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");
exit(TEST_ABORTED); /* bail out from the test */
@ -434,7 +434,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Count the total number of tests */
suiteCounter = 0;
while (testSuites[suiteCounter]) {
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
testSuite = testSuites[suiteCounter];
suiteCounter++;
testCounter = 0;
while (testSuite->testCases[testCounter])
@ -457,7 +457,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all suites to check if we have a filter match */
suiteCounter = 0;
while (testSuites[suiteCounter] && suiteFilter == 0) {
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
testSuite = testSuites[suiteCounter];
suiteCounter++;
if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
/* Matched a suite name */
@ -496,8 +496,8 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all suites */
suiteCounter = 0;
while(testSuites[suiteCounter]) {
testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
testSuite = testSuites[suiteCounter];
currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
suiteCounter++;
/* Filter suite if flag set and we have a name */
@ -527,7 +527,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
while(testSuite->testCases[testCounter])
{
testCase = testSuite->testCases[testCounter];
currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
testCounter++;
/* Filter tests if flag set and we have a name */

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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
@ -56,7 +56,7 @@
#include "SDL_test.h"
/* Forward declaration of static helper function */
static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in);
static void SDLTest_Md5Transform(MD5UINT4 * buf, const MD5UINT4 * in);
static unsigned char MD5PADDING[64] = {
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -229,7 +229,7 @@ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext)
/* Basic MD5 step. Transforms buf based on in.
*/
static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in)
static void SDLTest_Md5Transform(MD5UINT4 * buf, const MD5UINT4 * in)
{
MD5UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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
@ -90,7 +90,7 @@ static void SDL_TrackAllocation(void *mem, size_t size)
entry->size = size;
/* Generate the stack trace for the allocation */
SDL_zero(entry->stack);
SDL_zeroa(entry->stack);
#ifdef HAVE_LIBUNWIND_H
{
int stack_index;

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2020 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