From fc29f58754f84c8d9e9cb59b8b5f7e0a2a6b8f8b Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 9 Dec 2019 14:34:53 +0100 Subject: [PATCH 1/3] fix _WIN64 test (has only on underscore) --- src/lv_misc/lv_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_misc/lv_types.h b/src/lv_misc/lv_types.h index c588e2451..2c28bca1e 100644 --- a/src/lv_misc/lv_types.h +++ b/src/lv_misc/lv_types.h @@ -18,7 +18,7 @@ extern "C" { * DEFINES *********************/ // Check windows -#ifdef __WIN64 +#ifdef _WIN64 #define LV_ARCH_64 #endif From efeec7d3b6ae9d69648eca5f0f75953518f3067b Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 9 Dec 2019 14:35:13 +0100 Subject: [PATCH 2/3] minor conversion fixes to eliminate warnings --- src/lv_misc/lv_mem.c | 4 ++-- src/lv_objx/lv_gauge.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c index 71e6a1b1d..da38554e4 100644 --- a/src/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -456,11 +456,11 @@ static void ent_trunc(lv_mem_ent_t * e, size_t size) uint8_t * e_data = &e->first_data; lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size]; after_new_e->header.s.used = 0; - after_new_e->header.s.d_size = e->header.s.d_size - size - sizeof(lv_mem_header_t); + after_new_e->header.s.d_size = (uint32_t)e->header.s.d_size - size - sizeof(lv_mem_header_t); } /* Set the new size for the original entry */ - e->header.s.d_size = size; + e->header.s.d_size = (uint32_t)size; } #endif diff --git a/src/lv_objx/lv_gauge.h b/src/lv_objx/lv_gauge.h index fb7cf366a..408c1125a 100644 --- a/src/lv_objx/lv_gauge.h +++ b/src/lv_objx/lv_gauge.h @@ -193,7 +193,7 @@ uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge); * @param gauge pointer to a gauge object * @return number of the scale units */ -static inline uint8_t lv_gauge_get_line_count(const lv_obj_t * gauge) +static inline uint16_t lv_gauge_get_line_count(const lv_obj_t * gauge) { return lv_lmeter_get_line_count(gauge); } From cdc2cf90ce66fc4f309ae7564f61fdce33dc7257 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 10 Dec 2019 15:06:26 +0100 Subject: [PATCH 3/3] lv_color.h: fix Wconversion warnings --- src/lv_misc/lv_color.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h index dc861690c..b98ec0b61 100644 --- a/src/lv_misc/lv_color.h +++ b/src/lv_misc/lv_color.h @@ -104,9 +104,9 @@ enum { # define LV_COLOR_GET_B1(c) (c).ch.blue # define LV_COLOR_GET_A1(c) 1 -# define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)((v) & 0x7); -# define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)((v) & 0x7); -# define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)((v) & 0x3); +# define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)(v) & 0x7U; +# define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)(v) & 0x7U; +# define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)(v) & 0x3U; # define LV_COLOR_SET_A8(c, v) do {} while(0) # define LV_COLOR_GET_R8(c) (c).ch.red @@ -114,10 +114,10 @@ enum { # define LV_COLOR_GET_B8(c) (c).ch.blue # define LV_COLOR_GET_A8(c) 0xFF -# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(((uint8_t)(v)) & 0x1F); -# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)((v) & 0x3F); +# define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(v) & 0x1FU; +# define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)(v) & 0x3FU; # define LV_COLOR_SET_G16_SWAP(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);} -# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)((v) & 0x1F); +# define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)(v) & 0x1FU; # define LV_COLOR_SET_A16(c, v) do {} while(0) # define LV_COLOR_GET_R16(c) (c).ch.red @@ -464,14 +464,14 @@ static inline uint8_t lv_color_brightness(lv_color_t color) /* The most simple macro to create a color from R,G and B values */ #if LV_COLOR_DEPTH == 1 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = (b8 >> 7 | g8 >> 7 | r8 >> 7)}) +#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = ((b8 >> 7) | (g8 >> 7) | (r8 >> 7))}) #elif LV_COLOR_DEPTH == 8 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 6, g8 >> 5, r8 >> 5}}) +#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(b8 >> 6) & 0x3U, (g8 >> 5) & 0x7U, (r8 >> 5) & 0x7U}}) #elif LV_COLOR_DEPTH == 16 #if LV_COLOR_16_SWAP == 0 -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8 >> 3, g8 >> 2, r8 >> 3}}) +#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(b8 >> 3) & 0x1FU, (g8 >> 2) & 0x3FU, (r8 >> 3) & 0x1FU}}) #else -#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{g8 >> 5, r8 >> 3, b8 >> 3, (g8 >> 2) & 0x7}}) +#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(g8 >> 5) & 0x7U, (r8 >> 3) & 0x1FU, (b8 >> 3) & 0x1FU, (g8 >> 2) & 0x7U}}) #endif #elif LV_COLOR_DEPTH == 32 #define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/