mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-20 00:31:44 +00:00
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:
@@ -42,14 +42,14 @@ SDL_GetBasePath(void)
|
||||
int i;
|
||||
|
||||
while (SDL_TRUE) {
|
||||
void *ptr = SDL_realloc(path, buflen * sizeof (WCHAR));
|
||||
void *ptr = SDL_realloc(path, buflen * sizeof(WCHAR));
|
||||
if (ptr == NULL) {
|
||||
SDL_free(path);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
path = (WCHAR *) ptr;
|
||||
path = (WCHAR *)ptr;
|
||||
|
||||
len = GetModuleFileNameW(NULL, path, buflen);
|
||||
/* if it truncated, then len >= buflen - 1 */
|
||||
@@ -68,14 +68,14 @@ SDL_GetBasePath(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = len-1; i > 0; i--) {
|
||||
for (i = len - 1; i > 0; i--) {
|
||||
if (path[i] == '\\') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert(i > 0); /* Should have been an absolute path. */
|
||||
path[i+1] = '\0'; /* chop off filename. */
|
||||
SDL_assert(i > 0); /* Should have been an absolute path. */
|
||||
path[i + 1] = '\0'; /* chop off filename. */
|
||||
|
||||
retval = WIN_StringToUTF8W(path);
|
||||
SDL_free(path);
|
||||
@@ -96,8 +96,8 @@ SDL_GetPrefPath(const char *org, const char *app)
|
||||
|
||||
WCHAR path[MAX_PATH];
|
||||
char *retval = NULL;
|
||||
WCHAR* worg = NULL;
|
||||
WCHAR* wapp = NULL;
|
||||
WCHAR *worg = NULL;
|
||||
WCHAR *wapp = NULL;
|
||||
size_t new_wpath_len = 0;
|
||||
BOOL api_result = FALSE;
|
||||
|
||||
@@ -190,5 +190,4 @@ SDL_GetPrefPath(const char *org, const char *app)
|
||||
}
|
||||
#endif /* SDL_FILESYSTEM_XBOX */
|
||||
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user