mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-11 13:05:16 +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
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
|
||||
char *
|
||||
SDL_GetBasePath(void)
|
||||
{
|
||||
@@ -39,14 +38,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 */
|
||||
@@ -65,14 +64,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);
|
||||
@@ -93,8 +92,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;
|
||||
|
||||
@@ -185,5 +184,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