From 30e5f1dfef5b70ee584ffc5153e09deb69e5847d Mon Sep 17 00:00:00 2001 From: orbea Date: Sun, 16 Dec 2018 19:13:23 -0800 Subject: [PATCH 1/4] Fix gcc -Wformat warnings with C89_BUILD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gfx/display_servers/dispserv_x11.c: In function ‘x11_display_server_set_resolution’: gfx/display_servers/dispserv_x11.c:221:76: warning: ISO C90 does not support the ‘%lf’ gnu_printf format [-Wformat=] snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock, ^ gfx/display_servers/dispserv_x11.c:228:76: warning: ISO C90 does not support the ‘%lf’ gnu_printf format [-Wformat=] snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock, ^ --- gfx/display_servers/dispserv_x11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/display_servers/dispserv_x11.c b/gfx/display_servers/dispserv_x11.c index a4d727ddc1..a8698998f2 100644 --- a/gfx/display_servers/dispserv_x11.c +++ b/gfx/display_servers/dispserv_x11.c @@ -218,14 +218,14 @@ static bool x11_display_server_set_resolution(void *data, /* create interlaced newmode from modline variables */ if (height < 300) { - snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock, + snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %f %d %d %d %d %d %d %d %d -hsync -vsync", width, height, hz, pixel_clock, width, hfp, hsp, hbp, height, vfp, vsp, vbp); system(xrandr); } /* create interlaced newmode from modline variables */ if (height > 300) { - snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %lf %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock, + snprintf(xrandr, sizeof(xrandr), "xrandr --newmode \"%dx%d_%0.2f\" %f %d %d %d %d %d %d %d %d interlace -hsync -vsync", width, height, hz, pixel_clock, width, hfp, hsp, hbp, height, vfp, vsp, vbp); system(xrandr); } From 169002ef7f10d0eb6731f5b169c8eb666cd8ace7 Mon Sep 17 00:00:00 2001 From: orbea Date: Sun, 16 Dec 2018 19:13:33 -0800 Subject: [PATCH 2/4] Fix a gcc -Wformat= warning with C89_BUILD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The posix spec claims "%r" is equivelent to "%I : %M : %S %p". Source: http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html menu/menu_driver.c:395:15: warning: ISO C90 does not support the ‘%r’ gnu_strftime format [-Wformat=] "%r", localtime(&time_)); ^ --- menu/menu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/menu_driver.c b/menu/menu_driver.c index f6d575538a..dcd2e2af25 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -392,7 +392,7 @@ void menu_display_timedate(menu_display_ctx_datetime_t *datetime) case 7: /* Time (hours-minutes), in 12 hour AM-PM designation */ #if defined(__linux__) && !defined(ANDROID) strftime(datetime->s, datetime->len, - "%r", localtime(&time_)); + "%I : %M : %S %p", localtime(&time_)); #else { char *local; From 14905e33e142eec591c3908167f3d0a5a8015054 Mon Sep 17 00:00:00 2001 From: orbea Date: Sun, 16 Dec 2018 19:38:04 -0800 Subject: [PATCH 3/4] Fix more gcc -Wformat= warnings with C89_BUILD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "z" modifier was introduced in c99, but using "l" instead seems to work. setting_list.c: In function ‘setting_get_string_representation_size’: setting_list.c:175:24: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=] snprintf(s, len, "%" PRI_SIZET, ^~~ setting_list.c: In function ‘setting_get_string_representation_size_in_mb’: setting_list.c:183:24: warning: ISO C90 does not support the ‘z’ gnu_printf length modifier [-Wformat=] snprintf(s, len, "%" PRI_SIZET, ^~~ setting_list.c: In function ‘setting_set_with_string_representation’: setting_list.c:508:24: warning: ISO C90 does not support the ‘z’ gnu_scanf length modifier [-Wformat=] sscanf(value, "%" PRI_SIZET, setting->value.target.sizet); ^~~ libretro-common/file/config_file.c: In function ‘config_get_size_t’: libretro-common/file/config_file.c:692:32: warning: ISO C90 does not support the ‘z’ gnu_scanf length modifier [-Wformat=] if (sscanf(entry->value, "%" PRI_SIZET, &val) == 1 --- libretro-common/include/retro_miscellaneous.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretro-common/include/retro_miscellaneous.h b/libretro-common/include/retro_miscellaneous.h index 5972c1796f..629ce12c34 100644 --- a/libretro-common/include/retro_miscellaneous.h +++ b/libretro-common/include/retro_miscellaneous.h @@ -166,7 +166,7 @@ typedef struct #endif # endif #else -# define PRI_SIZET "zu" +# define PRI_SIZET "lu" #endif #endif From d557ab09ceaa83e163e7f273134d838f0f745583 Mon Sep 17 00:00:00 2001 From: orbea Date: Sun, 16 Dec 2018 19:54:53 -0800 Subject: [PATCH 4/4] Fix a gcc -Wformat= warning with C89_BUILD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit network/netplay/netplay_frontend.c: In function ‘netplay_announce_cb’: network/netplay/netplay_frontend.c:734:32: warning: format ‘%X’ expects argument of type ‘unsigned int *’, but argument 3 has type ‘int *’ [-Wformat=] sscanf(val, "%08X", &host_room->gamecrc); ~~~^ ~~~~~~~~~~~~~~~~~~~ %08X --- network/netplay/netplay_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/netplay/netplay_frontend.c b/network/netplay/netplay_frontend.c index 2fcc934247..db201ae222 100644 --- a/network/netplay/netplay_frontend.c +++ b/network/netplay/netplay_frontend.c @@ -731,7 +731,7 @@ static void netplay_announce_cb(void *task_data, void *user_data, const char *er if (string_is_equal(key, "game_name")) strlcpy(host_room->gamename, val, sizeof(host_room->gamename)); if (string_is_equal(key, "game_crc")) - sscanf(val, "%08X", &host_room->gamecrc); + sscanf(val, "%08d", &host_room->gamecrc); if (string_is_equal(key, "host_method")) sscanf(val, "%i", &host_room->host_method); if (string_is_equal(key, "has_password"))