Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type. If your environment doesn't have stdbool.h, this simple replacement will suffice: typedef signed char bool;
This commit is contained in:
@@ -264,13 +264,13 @@ static int SDLCALL SDLTest_CommonStateParseVideoArguments(void *data, char **arg
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
|
||||
state->window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||
state->fullscreen_exclusive = SDL_TRUE;
|
||||
state->fullscreen_exclusive = true;
|
||||
state->num_windows = 1;
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
|
||||
state->window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||
state->fullscreen_exclusive = SDL_FALSE;
|
||||
state->fullscreen_exclusive = false;
|
||||
state->num_windows = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ static int SDLCALL SDLTest_CommonStateParseVideoArguments(void *data, char **arg
|
||||
return 2;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--usable-bounds") == 0) {
|
||||
state->fill_usable_bounds = SDL_TRUE;
|
||||
state->fill_usable_bounds = true;
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--geometry") == 0) {
|
||||
@@ -448,7 +448,7 @@ static int SDLCALL SDLTest_CommonStateParseVideoArguments(void *data, char **arg
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--auto-scale-content") == 0) {
|
||||
state->auto_scale_content = SDL_TRUE;
|
||||
state->auto_scale_content = true;
|
||||
|
||||
if (state->logical_presentation == SDL_LOGICAL_PRESENTATION_DISABLED) {
|
||||
state->logical_presentation = SDL_LOGICAL_PRESENTATION_STRETCH;
|
||||
@@ -562,7 +562,7 @@ static int SDLCALL SDLTest_CommonStateParseVideoArguments(void *data, char **arg
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--flash-on-focus-loss") == 0) {
|
||||
state->flash_on_focus_loss = SDL_TRUE;
|
||||
state->flash_on_focus_loss = true;
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--grab") == 0) {
|
||||
@@ -578,7 +578,7 @@ static int SDLCALL SDLTest_CommonStateParseVideoArguments(void *data, char **arg
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--hide-cursor") == 0) {
|
||||
state->hide_cursor = SDL_TRUE;
|
||||
state->hide_cursor = true;
|
||||
return 1;
|
||||
}
|
||||
if (SDL_strcasecmp(argv[index], "--gpu") == 0) {
|
||||
@@ -803,18 +803,18 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
|
||||
bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
|
||||
{
|
||||
int i = 1;
|
||||
while (i < argc) {
|
||||
const int consumed = SDLTest_CommonArg(state, i);
|
||||
if (consumed <= 0) {
|
||||
SDLTest_CommonLogUsage(state, argv[0], NULL);
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
i += consumed;
|
||||
}
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void SDLTest_PrintDisplayOrientation(char *text, size_t maxlen, SDL_DisplayOrientation orientation)
|
||||
@@ -1192,7 +1192,7 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win,
|
||||
return SDL_HITTEST_NORMAL;
|
||||
}
|
||||
|
||||
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
{
|
||||
int i, j, m, n, w, h;
|
||||
char text[1024];
|
||||
@@ -1216,7 +1216,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) {
|
||||
SDL_Log("Couldn't initialize video driver: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
if (state->verbose & VERBOSE_VIDEO) {
|
||||
SDL_Log("Video driver: %s\n",
|
||||
@@ -1367,9 +1367,9 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
}
|
||||
|
||||
{
|
||||
SDL_bool include_high_density_modes = SDL_FALSE;
|
||||
bool include_high_density_modes = false;
|
||||
if (state->window_flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) {
|
||||
include_high_density_modes = SDL_TRUE;
|
||||
include_high_density_modes = true;
|
||||
}
|
||||
SDL_GetClosestFullscreenDisplayMode(state->displayID, state->window_w, state->window_h, state->refresh_rate, include_high_density_modes, &state->fullscreen_mode);
|
||||
}
|
||||
@@ -1385,7 +1385,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
sizeof(*state->targets));
|
||||
if (!state->windows || !state->renderers) {
|
||||
SDL_Log("Out of memory!\n");
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
for (i = 0; i < state->num_windows; ++i) {
|
||||
char title[1024];
|
||||
@@ -1424,7 +1424,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
if (!state->windows[i]) {
|
||||
SDL_Log("Couldn't create window: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
if (state->window_minW || state->window_minH) {
|
||||
SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH);
|
||||
@@ -1445,7 +1445,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
if (state->fullscreen_exclusive) {
|
||||
SDL_SetWindowFullscreenMode(state->windows[i], &state->fullscreen_mode);
|
||||
}
|
||||
SDL_SetWindowFullscreen(state->windows[i], SDL_TRUE);
|
||||
SDL_SetWindowFullscreen(state->windows[i], true);
|
||||
}
|
||||
|
||||
/* Add resize/drag areas for windows that are borderless and resizable */
|
||||
@@ -1471,7 +1471,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
if (!state->renderers[i]) {
|
||||
SDL_Log("Couldn't create renderer: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
if (state->logical_w == 0 || state->logical_h == 0) {
|
||||
state->logical_w = state->window_w;
|
||||
@@ -1482,7 +1482,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
}
|
||||
if (!SDL_SetRenderLogicalPresentation(state->renderers[i], state->logical_w, state->logical_h, state->logical_presentation, state->logical_scale_mode)) {
|
||||
SDL_Log("Couldn't set logical presentation: %s\n", SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
if (state->scale != 0.0f) {
|
||||
SDL_SetRenderScale(state->renderers[i], state->scale, state->scale);
|
||||
@@ -1519,7 +1519,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) {
|
||||
SDL_Log("Couldn't initialize audio driver: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
if (state->verbose & VERBOSE_AUDIO) {
|
||||
SDL_Log("Audio driver: %s\n",
|
||||
@@ -1530,7 +1530,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
state->audio_id = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec);
|
||||
if (!state->audio_id) {
|
||||
SDL_Log("Couldn't open audio: %s\n", SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1538,7 +1538,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
SDL_InitSubSystem(SDL_INIT_CAMERA);
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char *SystemThemeName(void)
|
||||
@@ -2108,7 +2108,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId)
|
||||
|
||||
flags = SDL_GetWindowFlags(window);
|
||||
if (flags & SDL_WINDOW_FULLSCREEN) {
|
||||
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||
SDL_SetWindowFullscreen(window, false);
|
||||
SDL_Delay(15);
|
||||
}
|
||||
|
||||
@@ -2121,9 +2121,9 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId)
|
||||
new_mode.displayID = displays[index];
|
||||
if (!SDL_SetWindowFullscreenMode(window, &new_mode)) {
|
||||
/* Try again with a default mode */
|
||||
SDL_bool include_high_density_modes = SDL_FALSE;
|
||||
bool include_high_density_modes = false;
|
||||
if (state->window_flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) {
|
||||
include_high_density_modes = SDL_TRUE;
|
||||
include_high_density_modes = true;
|
||||
}
|
||||
if (SDL_GetClosestFullscreenDisplayMode(displays[index], state->window_w, state->window_h, state->refresh_rate, include_high_density_modes, &new_mode)) {
|
||||
SDL_SetWindowFullscreenMode(window, &new_mode);
|
||||
@@ -2133,7 +2133,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId)
|
||||
if (!mode) {
|
||||
SDL_SetWindowPosition(window, rect.x, rect.y);
|
||||
}
|
||||
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||
SDL_SetWindowFullscreen(window, true);
|
||||
}
|
||||
}
|
||||
SDL_free(displays);
|
||||
@@ -2184,9 +2184,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
|
||||
}
|
||||
case SDL_EVENT_KEY_DOWN:
|
||||
{
|
||||
SDL_bool withControl = !!(event->key.mod & SDL_KMOD_CTRL);
|
||||
SDL_bool withShift = !!(event->key.mod & SDL_KMOD_SHIFT);
|
||||
SDL_bool withAlt = !!(event->key.mod & SDL_KMOD_ALT);
|
||||
bool withControl = !!(event->key.mod & SDL_KMOD_CTRL);
|
||||
bool withShift = !!(event->key.mod & SDL_KMOD_SHIFT);
|
||||
bool withAlt = !!(event->key.mod & SDL_KMOD_ALT);
|
||||
|
||||
switch (event->key.key) {
|
||||
/* Add hotkeys here */
|
||||
@@ -2404,8 +2404,8 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
|
||||
if (withShift) {
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(event);
|
||||
if (window) {
|
||||
const SDL_bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE);
|
||||
const SDL_bool rc = SDL_CaptureMouse(shouldCapture);
|
||||
const bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE);
|
||||
const bool rc = SDL_CaptureMouse(shouldCapture);
|
||||
SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed");
|
||||
}
|
||||
}
|
||||
@@ -2426,9 +2426,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
|
||||
if (window) {
|
||||
SDL_WindowFlags flags = SDL_GetWindowFlags(window);
|
||||
if (flags & SDL_WINDOW_ALWAYS_ON_TOP) {
|
||||
SDL_SetWindowAlwaysOnTop(window, SDL_FALSE);
|
||||
SDL_SetWindowAlwaysOnTop(window, false);
|
||||
} else {
|
||||
SDL_SetWindowAlwaysOnTop(window, SDL_TRUE);
|
||||
SDL_SetWindowAlwaysOnTop(window, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2451,9 +2451,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
|
||||
if (!(flags & SDL_WINDOW_FULLSCREEN) ||
|
||||
!SDL_GetWindowFullscreenMode(window)) {
|
||||
SDL_SetWindowFullscreenMode(window, &state->fullscreen_mode);
|
||||
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||
SDL_SetWindowFullscreen(window, true);
|
||||
} else {
|
||||
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||
SDL_SetWindowFullscreen(window, false);
|
||||
}
|
||||
}
|
||||
} else if (withAlt) {
|
||||
@@ -2464,9 +2464,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
|
||||
if (!(flags & SDL_WINDOW_FULLSCREEN) ||
|
||||
SDL_GetWindowFullscreenMode(window)) {
|
||||
SDL_SetWindowFullscreenMode(window, NULL);
|
||||
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||
SDL_SetWindowFullscreen(window, true);
|
||||
} else {
|
||||
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||
SDL_SetWindowFullscreen(window, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2478,7 +2478,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
|
||||
SDL_Window *window = SDL_GetWindowFromEvent(event);
|
||||
if (window) {
|
||||
const SDL_WindowFlags flags = SDL_GetWindowFlags(window);
|
||||
const SDL_bool b = (flags & SDL_WINDOW_BORDERLESS) ? SDL_TRUE : SDL_FALSE;
|
||||
const bool b = (flags & SDL_WINDOW_BORDERLESS) ? true : false;
|
||||
SDL_SetWindowBordered(window, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
||||
SDL_bool SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
|
||||
bool SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
|
||||
{
|
||||
int i, j;
|
||||
CrcUint32 c;
|
||||
@@ -61,30 +61,30 @@ SDL_bool SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext)
|
||||
}
|
||||
#endif
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Complete CRC32 calculation on a memory block */
|
||||
SDL_bool SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
|
||||
bool SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
|
||||
{
|
||||
if (!SDLTest_Crc32CalcStart(crcContext, crc32)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SDLTest_Crc32CalcBuffer(crcContext, inBuf, inLen, crc32)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SDLTest_Crc32CalcEnd(crcContext, crc32)) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Start crc calculation */
|
||||
|
||||
SDL_bool SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32)
|
||||
bool SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32)
|
||||
{
|
||||
/* Sanity check pointers */
|
||||
if (!crcContext) {
|
||||
@@ -97,12 +97,12 @@ SDL_bool SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc
|
||||
*/
|
||||
*crc32 = 0xffffffff;
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Finish crc calculation */
|
||||
|
||||
SDL_bool SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32)
|
||||
bool SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32)
|
||||
{
|
||||
/* Sanity check pointers */
|
||||
if (!crcContext) {
|
||||
@@ -115,12 +115,12 @@ SDL_bool SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32
|
||||
*/
|
||||
*crc32 = (~(*crc32));
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Include memory block in crc */
|
||||
|
||||
SDL_bool SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
|
||||
bool SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32)
|
||||
{
|
||||
CrcUint8 *p;
|
||||
register CrcUint32 crc;
|
||||
@@ -147,14 +147,14 @@ SDL_bool SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inB
|
||||
}
|
||||
*crc32 = crc;
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
SDL_bool SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext)
|
||||
bool SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext)
|
||||
{
|
||||
if (!crcContext) {
|
||||
return SDL_InvalidParamError("crcContext");
|
||||
}
|
||||
|
||||
return SDL_TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3142,13 +3142,13 @@ static struct SDLTest_CharTextureCache *SDLTest_CharTextureCacheList;
|
||||
|
||||
int FONT_CHARACTER_SIZE = 8;
|
||||
|
||||
SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c)
|
||||
bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c)
|
||||
{
|
||||
const Uint32 charWidth = FONT_CHARACTER_SIZE;
|
||||
const Uint32 charHeight = FONT_CHARACTER_SIZE;
|
||||
SDL_FRect srect;
|
||||
SDL_FRect drect;
|
||||
SDL_bool result;
|
||||
bool result;
|
||||
Uint32 ix, iy;
|
||||
const unsigned char *charpos;
|
||||
Uint32 *curpos;
|
||||
@@ -3205,7 +3205,7 @@ SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32
|
||||
*/
|
||||
character = SDL_CreateSurface(charWidth, charHeight, SDL_PIXELFORMAT_RGBA8888);
|
||||
if (!character) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
charpos = SDLTest_FontData + ci * 8;
|
||||
@@ -3237,7 +3237,7 @@ SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32
|
||||
* Check pointer
|
||||
*/
|
||||
if (cache->charTextureCache[ci] == NULL) {
|
||||
return SDL_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_SetTextureScaleMode(cache->charTextureCache[ci], SDL_SCALEMODE_NEAREST);
|
||||
@@ -3246,7 +3246,7 @@ SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32
|
||||
/*
|
||||
* Set color
|
||||
*/
|
||||
result = SDL_TRUE;
|
||||
result = true;
|
||||
result &= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a);
|
||||
result &= SDL_SetTextureColorMod(cache->charTextureCache[ci], r, g, b);
|
||||
result &= SDL_SetTextureAlphaMod(cache->charTextureCache[ci], a);
|
||||
@@ -3267,8 +3267,8 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
const Uint8 *p = (const Uint8 *)src;
|
||||
size_t left = 0;
|
||||
size_t save_srclen = srclen;
|
||||
SDL_bool overlong = SDL_FALSE;
|
||||
SDL_bool underflow = SDL_FALSE;
|
||||
bool overlong = false;
|
||||
bool underflow = false;
|
||||
Uint32 ch = UNKNOWN_UNICODE;
|
||||
|
||||
if (srclen == 0) {
|
||||
@@ -3277,7 +3277,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
if (p[0] >= 0xFC) {
|
||||
if ((p[0] & 0xFE) == 0xFC) {
|
||||
if (p[0] == 0xFC && (p[1] & 0xFC) == 0x80) {
|
||||
overlong = SDL_TRUE;
|
||||
overlong = true;
|
||||
}
|
||||
ch = (Uint32)(p[0] & 0x01);
|
||||
left = 5;
|
||||
@@ -3285,7 +3285,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
} else if (p[0] >= 0xF8) {
|
||||
if ((p[0] & 0xFC) == 0xF8) {
|
||||
if (p[0] == 0xF8 && (p[1] & 0xF8) == 0x80) {
|
||||
overlong = SDL_TRUE;
|
||||
overlong = true;
|
||||
}
|
||||
ch = (Uint32)(p[0] & 0x03);
|
||||
left = 4;
|
||||
@@ -3293,7 +3293,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
} else if (p[0] >= 0xF0) {
|
||||
if ((p[0] & 0xF8) == 0xF0) {
|
||||
if (p[0] == 0xF0 && (p[1] & 0xF0) == 0x80) {
|
||||
overlong = SDL_TRUE;
|
||||
overlong = true;
|
||||
}
|
||||
ch = (Uint32)(p[0] & 0x07);
|
||||
left = 3;
|
||||
@@ -3301,7 +3301,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
} else if (p[0] >= 0xE0) {
|
||||
if ((p[0] & 0xF0) == 0xE0) {
|
||||
if (p[0] == 0xE0 && (p[1] & 0xE0) == 0x80) {
|
||||
overlong = SDL_TRUE;
|
||||
overlong = true;
|
||||
}
|
||||
ch = (Uint32)(p[0] & 0x0F);
|
||||
left = 2;
|
||||
@@ -3309,7 +3309,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
} else if (p[0] >= 0xC0) {
|
||||
if ((p[0] & 0xE0) == 0xC0) {
|
||||
if ((p[0] & 0xDE) == 0xC0) {
|
||||
overlong = SDL_TRUE;
|
||||
overlong = true;
|
||||
}
|
||||
ch = (Uint32)(p[0] & 0x1F);
|
||||
left = 1;
|
||||
@@ -3332,7 +3332,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
--left;
|
||||
}
|
||||
if (left > 0) {
|
||||
underflow = SDL_TRUE;
|
||||
underflow = true;
|
||||
}
|
||||
|
||||
if (overlong || underflow ||
|
||||
@@ -3348,10 +3348,10 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
|
||||
|
||||
#define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF)
|
||||
|
||||
SDL_bool SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s)
|
||||
bool SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s)
|
||||
{
|
||||
const Uint32 charWidth = FONT_CHARACTER_SIZE;
|
||||
SDL_bool result = SDL_TRUE;
|
||||
bool result = true;
|
||||
float curx = x;
|
||||
float cury = y;
|
||||
size_t len = SDL_strlen(s);
|
||||
@@ -3417,12 +3417,12 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, const char *fmt, ...
|
||||
void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len)
|
||||
{
|
||||
size_t existing;
|
||||
SDL_bool newline = SDL_FALSE;
|
||||
bool newline = false;
|
||||
char *line;
|
||||
|
||||
if (len > 0 && text[len - 1] == '\n') {
|
||||
--len;
|
||||
newline = SDL_TRUE;
|
||||
newline = true;
|
||||
}
|
||||
|
||||
if (textwin->lines[textwin->current]) {
|
||||
|
||||
@@ -170,7 +170,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max)
|
||||
*
|
||||
* \returns Returns a random boundary value for the domain or 0 in case of error
|
||||
*/
|
||||
static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
|
||||
static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, bool validDomain)
|
||||
{
|
||||
Uint64 b1, b2;
|
||||
Uint64 delta;
|
||||
@@ -187,7 +187,7 @@ static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint
|
||||
}
|
||||
|
||||
index = 0;
|
||||
if (validDomain == SDL_TRUE) {
|
||||
if (validDomain == true) {
|
||||
if (b1 == b2) {
|
||||
return b1;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint
|
||||
return tempBuf[SDLTest_RandomUint8() % index];
|
||||
}
|
||||
|
||||
Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain)
|
||||
Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, bool validDomain)
|
||||
{
|
||||
/* max value for Uint8 */
|
||||
const Uint64 maxValue = UCHAR_MAX;
|
||||
@@ -240,7 +240,7 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo
|
||||
validDomain);
|
||||
}
|
||||
|
||||
Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain)
|
||||
Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, bool validDomain)
|
||||
{
|
||||
/* max value for Uint16 */
|
||||
const Uint64 maxValue = USHRT_MAX;
|
||||
@@ -249,7 +249,7 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL
|
||||
validDomain);
|
||||
}
|
||||
|
||||
Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain)
|
||||
Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, bool validDomain)
|
||||
{
|
||||
/* max value for Uint32 */
|
||||
#if ((ULONG_MAX) == (UINT_MAX))
|
||||
@@ -262,7 +262,7 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL
|
||||
validDomain);
|
||||
}
|
||||
|
||||
Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain)
|
||||
Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, bool validDomain)
|
||||
{
|
||||
/* max value for Uint64 */
|
||||
const Uint64 maxValue = UINT64_MAX;
|
||||
@@ -296,7 +296,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL
|
||||
*
|
||||
* \returns Returns a random boundary value for the domain or 0 in case of error
|
||||
*/
|
||||
static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
|
||||
static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, bool validDomain)
|
||||
{
|
||||
Sint64 b1, b2;
|
||||
Sint64 delta;
|
||||
@@ -313,7 +313,7 @@ static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const
|
||||
}
|
||||
|
||||
index = 0;
|
||||
if (validDomain == SDL_TRUE) {
|
||||
if (validDomain == true) {
|
||||
if (b1 == b2) {
|
||||
return b1;
|
||||
}
|
||||
@@ -357,7 +357,7 @@ static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const
|
||||
return tempBuf[SDLTest_RandomUint8() % index];
|
||||
}
|
||||
|
||||
Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain)
|
||||
Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, bool validDomain)
|
||||
{
|
||||
/* min & max values for Sint8 */
|
||||
const Sint64 maxValue = SCHAR_MAX;
|
||||
@@ -367,7 +367,7 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo
|
||||
validDomain);
|
||||
}
|
||||
|
||||
Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain)
|
||||
Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, bool validDomain)
|
||||
{
|
||||
/* min & max values for Sint16 */
|
||||
const Sint64 maxValue = SHRT_MAX;
|
||||
@@ -377,7 +377,7 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL
|
||||
validDomain);
|
||||
}
|
||||
|
||||
Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain)
|
||||
Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, bool validDomain)
|
||||
{
|
||||
/* min & max values for Sint32 */
|
||||
#if ((ULONG_MAX) == (UINT_MAX))
|
||||
@@ -392,7 +392,7 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL
|
||||
validDomain);
|
||||
}
|
||||
|
||||
Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain)
|
||||
Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, bool validDomain)
|
||||
{
|
||||
/* min & max values for Sint64 */
|
||||
const Sint64 maxValue = INT64_MAX;
|
||||
|
||||
@@ -55,7 +55,7 @@ struct SDLTest_TestSuiteRunner {
|
||||
Uint64 execKey;
|
||||
char *filter;
|
||||
int testIterations;
|
||||
SDL_bool randomOrder;
|
||||
bool randomOrder;
|
||||
} user;
|
||||
|
||||
SDLTest_ArgumentParser argparser;
|
||||
@@ -229,7 +229,7 @@ static Uint32 SDLCALL SDLTest_BailOut(void *userdata, SDL_TimerID timerID, Uint3
|
||||
*
|
||||
* \returns Test case result.
|
||||
*/
|
||||
static int SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun)
|
||||
static int SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, bool forceTestRun)
|
||||
{
|
||||
SDL_TimerID timer = 0;
|
||||
int testCaseResult = 0;
|
||||
@@ -242,7 +242,7 @@ static int SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_
|
||||
return TEST_RESULT_SETUP_FAILURE;
|
||||
}
|
||||
|
||||
if (!testCase->enabled && forceTestRun == SDL_FALSE) {
|
||||
if (!testCase->enabled && forceTestRun == false) {
|
||||
SDLTest_Log(SDLTEST_FINAL_RESULT_FORMAT, "Test", testCase->name, "Skipped (Disabled)");
|
||||
return TEST_RESULT_SKIPPED;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ int SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner)
|
||||
const char *suiteFilterName = NULL;
|
||||
int testFilter = 0;
|
||||
const char *testFilterName = NULL;
|
||||
SDL_bool forceTestRun = SDL_FALSE;
|
||||
bool forceTestRun = false;
|
||||
int testResult = 0;
|
||||
int runResult = 0;
|
||||
int totalTestFailedCount = 0;
|
||||
@@ -505,7 +505,7 @@ int SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner)
|
||||
return 2;
|
||||
}
|
||||
|
||||
runner->user.randomOrder = SDL_FALSE;
|
||||
runner->user.randomOrder = false;
|
||||
}
|
||||
|
||||
/* Number of test suites */
|
||||
@@ -640,7 +640,7 @@ int SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner)
|
||||
/* Override 'disabled' flag if we specified a test filter (i.e. force run for debugging) */
|
||||
if (testFilter == 1 && !testCase->enabled) {
|
||||
SDLTest_Log("Force run of disabled test since test filter was set");
|
||||
forceTestRun = SDL_TRUE;
|
||||
forceTestRun = true;
|
||||
}
|
||||
|
||||
/* Take time - test start */
|
||||
@@ -812,7 +812,7 @@ static int SDLCALL SDLTest_TestSuiteCommonArg(void *data, char **argv, int index
|
||||
}
|
||||
}
|
||||
else if (SDL_strcasecmp(argv[index], "--random-order") == 0) {
|
||||
runner->user.randomOrder = SDL_TRUE;
|
||||
runner->user.randomOrder = true;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <libunwind.h>
|
||||
#ifndef unw_get_proc_name_by_ip
|
||||
#define SDLTEST_UNWIND_NO_PROC_NAME_BY_IP
|
||||
static SDL_bool s_unwind_symbol_names = SDL_TRUE;
|
||||
static bool s_unwind_symbol_names = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ static SDL_realloc_func SDL_realloc_orig = NULL;
|
||||
static SDL_free_func SDL_free_orig = NULL;
|
||||
static int s_previous_allocations = 0;
|
||||
static SDL_tracked_allocation *s_tracked_allocations[256];
|
||||
static SDL_bool s_randfill_allocations = SDL_FALSE;
|
||||
static bool s_randfill_allocations = false;
|
||||
static SDL_AtomicInt s_lock;
|
||||
|
||||
#define LOCK_ALLOCATOR() \
|
||||
@@ -82,7 +82,7 @@ static SDL_AtomicInt s_lock;
|
||||
break; \
|
||||
} \
|
||||
SDL_CPUPauseInstruction(); \
|
||||
} while (SDL_TRUE)
|
||||
} while (true)
|
||||
#define UNLOCK_ALLOCATOR() do { SDL_SetAtomicInt(&s_lock, 0); } while (0)
|
||||
|
||||
static unsigned int get_allocation_bucket(void *mem)
|
||||
@@ -116,7 +116,7 @@ static size_t SDL_GetTrackedAllocationSize(void *mem)
|
||||
return entry ? entry->size : SIZE_MAX;
|
||||
}
|
||||
|
||||
static SDL_bool SDL_IsAllocationTracked(void *mem)
|
||||
static bool SDL_IsAllocationTracked(void *mem)
|
||||
{
|
||||
return SDL_GetTrackedAllocation(mem) != NULL;
|
||||
}
|
||||
@@ -302,9 +302,9 @@ void SDLTest_TrackAllocations(void)
|
||||
const char *env_trackmem = SDL_getenv_unsafe("SDL_TRACKMEM_SYMBOL_NAMES");
|
||||
if (env_trackmem) {
|
||||
if (SDL_strcasecmp(env_trackmem, "1") == 0 || SDL_strcasecmp(env_trackmem, "yes") == 0 || SDL_strcasecmp(env_trackmem, "true") == 0) {
|
||||
s_unwind_symbol_names = SDL_TRUE;
|
||||
s_unwind_symbol_names = true;
|
||||
} else if (SDL_strcasecmp(env_trackmem, "0") == 0 || SDL_strcasecmp(env_trackmem, "no") == 0 || SDL_strcasecmp(env_trackmem, "false") == 0) {
|
||||
s_unwind_symbol_names = SDL_FALSE;
|
||||
s_unwind_symbol_names = false;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
@@ -348,7 +348,7 @@ void SDLTest_RandFillAllocations(void)
|
||||
{
|
||||
SDLTest_TrackAllocations();
|
||||
|
||||
s_randfill_allocations = SDL_TRUE;
|
||||
s_randfill_allocations = true;
|
||||
}
|
||||
|
||||
void SDLTest_LogAllocations(void)
|
||||
|
||||
Reference in New Issue
Block a user