From 178cb5904f4f6c2482bceb4e3b59990fa6ed5878 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 30 Mar 2020 21:30:15 -0300 Subject: [PATCH 1/3] meson.build: Change c_std to gnu99 Since commit 301a556b8ece ("add fps reporting") the header is included, which causes build failures with c99 extension on ARM32: ../common.c: In function 'get_time_ns': ../common.c:376:18: error: storage size of 'tv' isn't known struct timespec tv; ^~ ../common.c:377:16: error: 'CLOCK_MONOTONIC' undeclared (first use in this function) clock_gettime(CLOCK_MONOTONIC, &tv); Change c_std to gnu99 to fix the build error as explained at: https://gcc-help.gcc.gnu.narkive.com/8xCaKI6r/problem-with-struct-timespec-and-c99-standard c99 has been used since commit 6cbd03ab9406 ("Makefile.am: Add -std=c99 to CFLAGS") to fix the following mips64el build failure: "cube-tex.c:230:2: note: use option -std=c99 or -std=gnu99 to compile your code" Use c_std=gnu99 to make both mips64el and ARM32 happy. Signed-off-by: Fabio Estevam --- meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index b8131db..4fca2f2 100644 --- a/meson.build +++ b/meson.build @@ -26,11 +26,11 @@ project( version : '0.0.1', license : 'MIT', meson_version : '>= 0.47', - default_options : ['c_std=c99', 'warning_level=2'] + default_options : ['c_std=gnu99', 'warning_level=2'] ) -if get_option('c_std') != 'c99' - error('c_std must be c99') +if get_option('c_std') != 'gnu99' + error('c_std must be gnu99') endif sources = files( -- GitLab From c60e990876588f8b2c48402d949d112bfa35d4b1 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 31 Mar 2020 08:50:42 -0300 Subject: [PATCH 2/3] texturator: Only define png variable when libpng is present When libpng is not present the following build warning is seen: ../texturator.c:98:13: warning: 'png' defined but not used [-Wunused-variable] static bool png; Fix it by only defining the png variable when HAVE_LIBPNG is defined. Signed-off-by: Fabio Estevam --- texturator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/texturator.c b/texturator.c index 2675244..a450dfe 100644 --- a/texturator.c +++ b/texturator.c @@ -95,7 +95,9 @@ static int error_frames; static int zoom = 1; static bool full; static bool stop; +#ifdef HAVE_LIBPNG static bool png; +#endif static GLenum target; static struct size { unsigned x, y, z; -- GitLab From 4660a7dca6512b6e658759d00cff7d4ad2a2059d Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 31 Mar 2020 18:43:46 -0300 Subject: [PATCH 3/3] texturator: Fix float to bool conversion warning The following build warning is seen: ../texturator.c:603:45: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context] *complemented = (((float)rgba[2]) / 255.0) / 0.25; Fix it by using the != 0.0f construction to properly convert from float to bool. Signed-off-by: Fabio Estevam --- texturator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/texturator.c b/texturator.c index a450dfe..8695a63 100644 --- a/texturator.c +++ b/texturator.c @@ -602,7 +602,7 @@ static void extract_pix(uint8_t *rgba, int *slice, int *level, bool *complemente { *slice = (((float)rgba[0]) / 255.0) * 8.0; *level = (((float)rgba[1]) / 255.0) * 16.0; - *complemented = (((float)rgba[2]) / 255.0) / 0.25; + *complemented = (((float)rgba[2]) / 255.0) / 0.25 != 0.0f; } static bool probe_pix(int x, int y, int w, int h, int s, int m) -- GitLab