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:
Sam Lantinga
2024-09-18 07:52:28 -07:00
parent 9dd8859240
commit a90ad3b0e2
258 changed files with 4052 additions and 4057 deletions

View File

@@ -9,12 +9,12 @@
static int clipboard_update_count;
static SDL_bool SDLCALL ClipboardEventWatch(void *userdata, SDL_Event *event)
static bool SDLCALL ClipboardEventWatch(void *userdata, SDL_Event *event)
{
if (event->type == SDL_EVENT_CLIPBOARD_UPDATE) {
++clipboard_update_count;
}
return SDL_TRUE;
return true;
}
enum
@@ -82,7 +82,7 @@ static void SDLCALL ClipboardCleanupCallback(void *userdata)
static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
{
int result = -1;
SDL_bool boolResult;
bool boolResult;
int last_clipboard_update_count;
int last_clipboard_callback_count;
int last_clipboard_cleanup_count;
@@ -105,16 +105,16 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
/* Test clearing clipboard data */
result = SDL_ClearClipboardData();
SDLTest_AssertCheck(
result == SDL_TRUE,
"Validate SDL_ClearClipboardData result, expected SDL_TRUE, got %i",
result == true,
"Validate SDL_ClearClipboardData result, expected true, got %i",
result);
/* Test clearing clipboard data when it's already clear */
last_clipboard_update_count = clipboard_update_count;
result = SDL_ClearClipboardData();
SDLTest_AssertCheck(
result == SDL_TRUE,
"Validate SDL_ClearClipboardData result, expected SDL_TRUE, got %i",
result == true,
"Validate SDL_ClearClipboardData result, expected true, got %i",
result);
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count,
@@ -125,8 +125,8 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
last_clipboard_update_count = clipboard_update_count;
result = SDL_SetClipboardData(NULL, NULL, NULL, test_mime_types, SDL_arraysize(test_mime_types));
SDLTest_AssertCheck(
result == SDL_FALSE,
"Validate SDL_SetClipboardData(invalid) result, expected SDL_FALSE, got %i",
result == false,
"Validate SDL_SetClipboardData(invalid) result, expected false, got %i",
result);
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count,
@@ -136,8 +136,8 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
last_clipboard_update_count = clipboard_update_count;
result = SDL_SetClipboardData(ClipboardDataCallback, ClipboardCleanupCallback, NULL, NULL, 0);
SDLTest_AssertCheck(
result == SDL_FALSE,
"Validate SDL_SetClipboardData(invalid) result, expected SDL_FALSE, got %i",
result == false,
"Validate SDL_SetClipboardData(invalid) result, expected false, got %i",
result);
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count,
@@ -150,8 +150,8 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
last_clipboard_cleanup_count = clipboard_cleanup_count;
result = SDL_SetClipboardData(ClipboardDataCallback, ClipboardCleanupCallback, &test_data1, test_mime_types, SDL_arraysize(test_mime_types));
SDLTest_AssertCheck(
result == SDL_TRUE,
"Validate SDL_SetClipboardData(test_data1) result, expected SDL_TRUE, got %i",
result == true,
"Validate SDL_SetClipboardData(test_data1) result, expected true, got %i",
result);
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count + 1,
@@ -173,7 +173,7 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]);
SDLTest_AssertCheck(
boolResult,
"Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
"Verify has test text data, expected true, got false");
text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT], &size);
SDLTest_AssertCheck(
text != NULL,
@@ -198,7 +198,7 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]);
SDLTest_AssertCheck(
boolResult,
"Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
"Verify has test text data, expected true, got false");
text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT], &size);
SDLTest_AssertCheck(
text != NULL,
@@ -222,7 +222,7 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_DATA]);
SDLTest_AssertCheck(
boolResult,
"Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
"Verify has test text data, expected true, got false");
data = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_DATA], &size);
SDLTest_AssertCheck(
data && SDL_memcmp(data, test_data1.data, test_data1.data_size) == 0,
@@ -236,7 +236,7 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData("test/invalid");
SDLTest_AssertCheck(
!boolResult,
"Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
"Verify has test text data, expected false, got true");
data = SDL_GetClipboardData("test/invalid", &size);
SDLTest_AssertCheck(
data == NULL,
@@ -262,8 +262,8 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
last_clipboard_cleanup_count = clipboard_cleanup_count;
result = SDL_SetClipboardData(ClipboardDataCallback, ClipboardCleanupCallback, &test_data2, test_mime_types, SDL_arraysize(test_mime_types));
SDLTest_AssertCheck(
result == SDL_TRUE,
"Validate SDL_SetClipboardData(test_data2) result, expected SDL_TRUE, got %i",
result == true,
"Validate SDL_SetClipboardData(test_data2) result, expected true, got %i",
result);
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count + 1,
@@ -285,7 +285,7 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]);
SDLTest_AssertCheck(
boolResult,
"Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
"Verify has test text data, expected true, got false");
text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT], &size);
SDLTest_AssertCheck(
text != NULL,
@@ -310,7 +310,7 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT]);
SDLTest_AssertCheck(
boolResult,
"Verify has test text data, expected SDL_TRUE, got SDL_FALSE");
"Verify has test text data, expected true, got false");
text = SDL_GetClipboardData(test_mime_types[TEST_MIME_TYPE_CUSTOM_TEXT], &size);
SDLTest_AssertCheck(
text != NULL,
@@ -365,8 +365,8 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
last_clipboard_cleanup_count = clipboard_cleanup_count;
result = SDL_ClearClipboardData();
SDLTest_AssertCheck(
result == SDL_TRUE,
"Validate SDL_ClearClipboardData result, expected SDL_TRUE, got %i",
result == true,
"Validate SDL_ClearClipboardData result, expected true, got %i",
result);
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count + 1,
@@ -379,15 +379,15 @@ static int SDLCALL clipboard_testClipboardDataFunctions(void *arg)
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_TEXT]);
SDLTest_AssertCheck(
!boolResult,
"Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
"Verify has test text data, expected false, got true");
boolResult = SDL_HasClipboardData(test_mime_types[TEST_MIME_TYPE_DATA]);
SDLTest_AssertCheck(
!boolResult,
"Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
"Verify has test text data, expected false, got true");
boolResult = SDL_HasClipboardData("test/invalid");
SDLTest_AssertCheck(
!boolResult,
"Verify has test text data, expected SDL_FALSE, got SDL_TRUE");
"Verify has test text data, expected false, got true");
SDL_RemoveEventWatch(ClipboardEventWatch, NULL);
@@ -404,7 +404,7 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
{
char *textRef = SDLTest_RandomAsciiString();
char *text = SDL_strdup(textRef);
SDL_bool boolResult;
bool boolResult;
int intResult;
char *charResult;
int last_clipboard_update_count;
@@ -415,8 +415,8 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetClipboardText(NULL);
SDLTest_AssertCheck(
intResult == SDL_TRUE,
"Verify result from SDL_SetClipboardText(NULL), expected SDL_TRUE, got %i",
intResult == true,
"Verify result from SDL_SetClipboardText(NULL), expected true, got %i",
intResult);
charResult = SDL_GetClipboardText();
SDLTest_AssertCheck(
@@ -426,9 +426,9 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
SDL_free(charResult);
boolResult = SDL_HasClipboardText();
SDLTest_AssertCheck(
boolResult == SDL_FALSE,
"Verify SDL_HasClipboardText returned SDL_FALSE, got %s",
(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
boolResult == false,
"Verify SDL_HasClipboardText returned false, got %s",
(boolResult) ? "true" : "false");
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count,
"Verify clipboard update unchanged, got %d",
@@ -439,8 +439,8 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetClipboardText(text);
SDLTest_AssertCheck(
intResult == SDL_TRUE,
"Verify result from SDL_SetClipboardText(%s), expected SDL_TRUE, got %i", text,
intResult == true,
"Verify result from SDL_SetClipboardText(%s), expected true, got %i", text,
intResult);
SDLTest_AssertCheck(
SDL_strcmp(textRef, text) == 0,
@@ -448,9 +448,9 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
textRef, text);
boolResult = SDL_HasClipboardText();
SDLTest_AssertCheck(
boolResult == SDL_TRUE,
"Verify SDL_HasClipboardText returned SDL_TRUE, got %s",
(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
boolResult == true,
"Verify SDL_HasClipboardText returned true, got %s",
(boolResult) ? "true" : "false");
charResult = SDL_GetClipboardText();
SDLTest_AssertCheck(
charResult && SDL_strcmp(textRef, charResult) == 0,
@@ -465,8 +465,8 @@ static int SDLCALL clipboard_testClipboardTextFunctions(void *arg)
/* Reset clipboard text */
intResult = SDL_SetClipboardText(NULL);
SDLTest_AssertCheck(
intResult == SDL_TRUE,
"Verify result from SDL_SetClipboardText(NULL), expected SDL_TRUE, got %i",
intResult == true,
"Verify result from SDL_SetClipboardText(NULL), expected true, got %i",
intResult);
/* Cleanup */
@@ -488,7 +488,7 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
{
char *textRef = SDLTest_RandomAsciiString();
char *text = SDL_strdup(textRef);
SDL_bool boolResult;
bool boolResult;
int intResult;
char *charResult;
int last_clipboard_update_count;
@@ -499,8 +499,8 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetPrimarySelectionText(NULL);
SDLTest_AssertCheck(
intResult == SDL_TRUE,
"Verify result from SDL_SetPrimarySelectionText(NULL), expected SDL_TRUE, got %i",
intResult == true,
"Verify result from SDL_SetPrimarySelectionText(NULL), expected true, got %i",
intResult);
charResult = SDL_GetPrimarySelectionText();
SDLTest_AssertCheck(
@@ -510,9 +510,9 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
SDL_free(charResult);
boolResult = SDL_HasPrimarySelectionText();
SDLTest_AssertCheck(
boolResult == SDL_FALSE,
"Verify SDL_HasPrimarySelectionText returned SDL_FALSE, got %s",
(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
boolResult == false,
"Verify SDL_HasPrimarySelectionText returned false, got %s",
(boolResult) ? "true" : "false");
SDLTest_AssertCheck(
clipboard_update_count == last_clipboard_update_count + 1,
"Verify clipboard update count incremented by 1, got %d",
@@ -522,8 +522,8 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
last_clipboard_update_count = clipboard_update_count;
intResult = SDL_SetPrimarySelectionText(text);
SDLTest_AssertCheck(
intResult == SDL_TRUE,
"Verify result from SDL_SetPrimarySelectionText(%s), expected SDL_TRUE, got %i", text,
intResult == true,
"Verify result from SDL_SetPrimarySelectionText(%s), expected true, got %i", text,
intResult);
SDLTest_AssertCheck(
SDL_strcmp(textRef, text) == 0,
@@ -531,9 +531,9 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
textRef, text);
boolResult = SDL_HasPrimarySelectionText();
SDLTest_AssertCheck(
boolResult == SDL_TRUE,
"Verify SDL_HasPrimarySelectionText returned SDL_TRUE, got %s",
(boolResult) ? "SDL_TRUE" : "SDL_FALSE");
boolResult == true,
"Verify SDL_HasPrimarySelectionText returned true, got %s",
(boolResult) ? "true" : "false");
charResult = SDL_GetPrimarySelectionText();
SDLTest_AssertCheck(
charResult && SDL_strcmp(textRef, charResult) == 0,
@@ -548,8 +548,8 @@ static int SDLCALL clipboard_testPrimarySelectionTextFunctions(void *arg)
/* Reset primary selection */
intResult = SDL_SetPrimarySelectionText(NULL);
SDLTest_AssertCheck(
intResult == SDL_TRUE,
"Verify result from SDL_SetPrimarySelectionText(NULL), expected SDL_TRUE, got %i",
intResult == true,
"Verify result from SDL_SetPrimarySelectionText(NULL), expected true, got %i",
intResult);
/* Cleanup */