From c23655a0d7d04b3cfcfd3f0c838dc2933d207ba5 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 3 Dec 2019 18:42:56 +0100 Subject: [PATCH] fix warnings --- src/lv_font/lv_font_fmt_txt.c | 8 ++++---- src/lv_misc/lv_fs.c | 4 ++-- src/lv_misc/lv_mem.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lv_font/lv_font_fmt_txt.c b/src/lv_font/lv_font_fmt_txt.c index f1490a919..fb02c743c 100644 --- a/src/lv_font/lv_font_fmt_txt.c +++ b/src/lv_font/lv_font_fmt_txt.c @@ -186,7 +186,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter) uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare); if(p) { - lv_uintptr_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list; + lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list); ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/ glyph_id = fdsc->cmaps[i].glyph_id_start + ofs; } @@ -195,7 +195,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter) uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare); if(p) { - lv_uintptr_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list; + lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t*) fdsc->cmaps[i].unicode_list); ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/ const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list; glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs]; @@ -232,7 +232,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t /*If the `g_id_both` were found get its index from the pointer*/ if(kid_p) { - lv_uintptr_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids; + lv_uintptr_t ofs = (lv_uintptr_t)(kid_p - g_ids); ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/ value = kdsc->values[ofs]; } @@ -245,7 +245,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t /*If the `g_id_both` were found get its index from the pointer*/ if(kid_p) { - lv_uintptr_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids; + lv_uintptr_t ofs = (lv_uintptr_t) (kid_p - (const uint8_t *)g_ids); ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/ value = kdsc->values[ofs]; } diff --git a/src/lv_misc/lv_fs.c b/src/lv_misc/lv_fs.c index d4343c411..a23081ceb 100644 --- a/src/lv_misc/lv_fs.c +++ b/src/lv_misc/lv_fs.c @@ -572,7 +572,7 @@ char * lv_fs_up(char * path) return path; } - uint16_t i; + size_t i; for(i = len; i > 0; i--) { if(path[i] == '/' || path[i] == '\\') break; } @@ -602,7 +602,7 @@ const char * lv_fs_get_last(const char * path) return path; } - uint16_t i; + size_t i; for(i = len; i > 0; i--) { if(path[i] == '/' || path[i] == '\\') break; } diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c index f129c639f..461a24055 100644 --- a/src/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -59,8 +59,8 @@ typedef struct **********************/ #if LV_MEM_CUSTOM == 0 static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e); -static void * ent_alloc(lv_mem_ent_t * e, uint32_t size); -static void ent_trunc(lv_mem_ent_t * e, uint32_t size); +static void * ent_alloc(lv_mem_ent_t * e, size_t size); +static void ent_trunc(lv_mem_ent_t * e, size_t size); #endif /********************** @@ -407,7 +407,7 @@ static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e) * @param size size of the new memory in bytes * @return pointer to the allocated memory or NULL if not enough memory in the entry */ -static void * ent_alloc(lv_mem_ent_t * e, uint32_t size) +static void * ent_alloc(lv_mem_ent_t * e, size_t size) { void * alloc = NULL; @@ -430,7 +430,7 @@ static void * ent_alloc(lv_mem_ent_t * e, uint32_t size) * @param e Pointer to an entry * @param size new size in bytes */ -static void ent_trunc(lv_mem_ent_t * e, uint32_t size) +static void ent_trunc(lv_mem_ent_t * e, size_t size) { #ifdef LV_MEM_ENV64 /*Round the size up to 8*/