From 8bfea0322f74062c42abab061db97cbff5c25c6f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 26 Jun 2015 19:37:03 +0200 Subject: [PATCH] More C89 build fixes --- file_path_special.c | 11 +++++++---- menu/menu_shader.c | 9 ++++----- runloop.c | 3 ++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/file_path_special.c b/file_path_special.c index 7b4eb549dc..3f7ef66995 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -199,14 +199,17 @@ void fill_pathname_application_path(char *buf, size_t size) } #else { - *buf = '\0'; - pid_t pid = getpid(); - char link_path[PATH_MAX_LENGTH] = {0}; - /* Linux, BSD and Solaris paths. Not standardized. */ static const char *exts[] = { "exe", "file", "path/a.out" }; + char link_path[PATH_MAX_LENGTH] = {0}; + + *buf = '\0'; + pid_t pid = getpid(); + + /* Linux, BSD and Solaris paths. Not standardized. */ for (i = 0; i < ARRAY_SIZE(exts); i++) { ssize_t ret; + snprintf(link_path, sizeof(link_path), "/proc/%u/%s", (unsigned)pid, exts[i]); ret = readlink(link_path, buf, size - 1); diff --git a/menu/menu_shader.c b/menu/menu_shader.c index 62dd7797bb..ede4fe10ff 100644 --- a/menu/menu_shader.c +++ b/menu/menu_shader.c @@ -191,6 +191,7 @@ void menu_shader_manager_save_preset( #ifdef HAVE_SHADER_MANAGER char buffer[PATH_MAX_LENGTH], config_directory[PATH_MAX_LENGTH], preset_path[PATH_MAX_LENGTH]; unsigned d, type = RARCH_SHADER_NONE; + const char *dirs[3] = {0}; config_file_t *conf = NULL; bool ret = false; global_t *global = global_get_ptr(); @@ -239,11 +240,9 @@ void menu_shader_manager_save_preset( fill_pathname_basedir(config_directory, global->config_path, sizeof(config_directory)); - const char *dirs[] = { - settings->video.shader_dir, - settings->menu_config_directory, - config_directory, - }; + dirs[0] = settings->video.shader_dir; + dirs[1] = settings->menu_config_directory; + dirs[2] = config_directory; if (!(conf = (config_file_t*)config_file_new(NULL))) return; diff --git a/runloop.c b/runloop.c index 41c8dfe438..2db6e2b05c 100644 --- a/runloop.c +++ b/runloop.c @@ -1121,12 +1121,13 @@ int rarch_main_iterate(void) static retro_input_t last_input = 0; retro_input_t old_input = last_input; retro_input_t input = input_keys_pressed(); - last_input = input; driver_t *driver = driver_get_ptr(); settings_t *settings = config_get_ptr(); global_t *global = global_get_ptr(); rarch_system_info_t *system = rarch_system_info_get_ptr(); + last_input = input; + if (driver->flushing_input) driver->flushing_input = (input) ? input_flush(&input) : false;