Skip to content

Commit

Permalink
Fixed compilation with C89 (thanks @d-s-a!)
Browse files Browse the repository at this point in the history
Closes #9564
  • Loading branch information
slouken committed Apr 17, 2024
1 parent effc169 commit 4e29be8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/video/kmsdrm/SDL_kmsdrmvideo.c
Expand Up @@ -77,6 +77,7 @@ static int get_driindex(void)
int devindex = -1;
DIR *folder;
const char *hint;
struct dirent *res;

hint = SDL_GetHint(SDL_HINT_KMSDRM_DEVICE_INDEX);
if (hint && *hint) {
Expand All @@ -96,7 +97,7 @@ static int get_driindex(void)

SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname,
sizeof(device) - kmsdrm_dri_devnamesize);
for (struct dirent *res; (res = readdir(folder));) {
while((res = readdir(folder)) != NULL) {
if (SDL_memcmp(res->d_name, kmsdrm_dri_devname,
kmsdrm_dri_devnamesize) == 0) {
SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize,
Expand Down
6 changes: 4 additions & 2 deletions src/video/wayland/SDL_waylandevents.c
Expand Up @@ -1178,7 +1178,8 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
const SDL_Scancode scancode = Wayland_get_scancode_from_key(input, *key + 8);

if (scancode != SDL_SCANCODE_UNKNOWN) {
for (uint32_t i = 0; i < SDL_arraysize(mod_scancodes); ++i) {
uint32_t i;
for (i = 0; i < SDL_arraysize(mod_scancodes); ++i) {
if (mod_scancodes[i] == scancode) {
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
break;
Expand Down Expand Up @@ -1831,7 +1832,8 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
char **paths = SDL_DBus_DocumentsPortalRetrieveFiles(buffer, &path_count);
/* If dropped files contain a directory the list is empty */
if (paths && path_count > 0) {
for (int i = 0; i < path_count; i++) {
int i;
for (i = 0; i < path_count; i++) {
SDL_SendDropFile(data_device->dnd_window, paths[i]);
}
dbus->free_string_array(paths);
Expand Down

0 comments on commit 4e29be8

Please sign in to comment.