Update for SDL3 coding style (#6717)

I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594

(cherry picked from commit 5750bcb174)
This commit is contained in:
Sam Lantinga 2022-11-30 12:51:59 -08:00
parent 5c4bc807f7
commit b8d85c6939
764 changed files with 50598 additions and 54407 deletions

View file

@ -11,30 +11,36 @@
#define NUM_TEST_GUIDS 5
static struct {
static struct
{
char *str;
Uint64 upper, lower;
} test_guids[NUM_TEST_GUIDS] = {
{ "0000000000000000" "ffffffffffffffff",
0x0000000000000000, 0xfffffffffffffffflu },
{ "0011223344556677" "8091a2b3c4d5e6f0",
0x0011223344556677lu, 0x8091a2b3c4d5e6f0lu },
{ "a011223344556677" "8091a2b3c4d5e6f0",
0xa011223344556677lu, 0x8091a2b3c4d5e6f0lu },
{ "a011223344556677" "8091a2b3c4d5e6f1",
0xa011223344556677lu, 0x8091a2b3c4d5e6f1lu },
{ "a011223344556677" "8191a2b3c4d5e6f0",
0xa011223344556677lu, 0x8191a2b3c4d5e6f0lu },
{ "0000000000000000"
"ffffffffffffffff",
0x0000000000000000, 0xfffffffffffffffflu },
{ "0011223344556677"
"8091a2b3c4d5e6f0",
0x0011223344556677lu, 0x8091a2b3c4d5e6f0lu },
{ "a011223344556677"
"8091a2b3c4d5e6f0",
0xa011223344556677lu, 0x8091a2b3c4d5e6f0lu },
{ "a011223344556677"
"8091a2b3c4d5e6f1",
0xa011223344556677lu, 0x8091a2b3c4d5e6f1lu },
{ "a011223344556677"
"8191a2b3c4d5e6f0",
0xa011223344556677lu, 0x8191a2b3c4d5e6f0lu },
};
static void
upper_lower_to_bytestring(Uint8* out, Uint64 upper, Uint64 lower)
upper_lower_to_bytestring(Uint8 *out, Uint64 upper, Uint64 lower)
{
Uint64 values[2];
int i, k;
values[0] = upper;
values [1] = lower;
values[1] = lower;
for (i = 0; i < 2; ++i) {
Uint64 v = values[i];
@ -46,7 +52,6 @@ upper_lower_to_bytestring(Uint8* out, Uint64 upper, Uint64 lower)
}
}
/* Test case functions */
/**
@ -128,14 +133,16 @@ TestGuidToString(void *arg)
/* ================= Test References ================== */
/* GUID routine test cases */
static const SDLTest_TestCaseReference guidTest1 =
{ (SDLTest_TestCaseFp)TestGuidFromString, "TestGuidFromString", "Call to SDL_GUIDFromString", TEST_ENABLED };
static const SDLTest_TestCaseReference guidTest1 = {
(SDLTest_TestCaseFp)TestGuidFromString, "TestGuidFromString", "Call to SDL_GUIDFromString", TEST_ENABLED
};
static const SDLTest_TestCaseReference guidTest2 =
{ (SDLTest_TestCaseFp)TestGuidToString, "TestGuidToString", "Call to SDL_GUIDToString", TEST_ENABLED };
static const SDLTest_TestCaseReference guidTest2 = {
(SDLTest_TestCaseFp)TestGuidToString, "TestGuidToString", "Call to SDL_GUIDToString", TEST_ENABLED
};
/* Sequence of GUID routine test cases */
static const SDLTest_TestCaseReference *guidTests[] = {
static const SDLTest_TestCaseReference *guidTests[] = {
&guidTest1,
&guidTest2,
NULL