From 7c52aa69328dd386c87a39defbfe1ab035e5b6e1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 25 Sep 2018 23:33:17 +0200 Subject: [PATCH] fix warnings --- lv_draw/lv_draw_img.c | 10 ++++++++-- lv_objx/lv_btn.c | 12 +++++++----- lv_objx/lv_btn.h | 6 +++--- lv_objx/lv_calendar.c | 4 ++-- lv_objx/lv_calendar.h | 4 ++-- lv_objx/lv_img.c | 8 ++++---- lv_objx/lv_ta.c | 2 +- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/lv_draw/lv_draw_img.c b/lv_draw/lv_draw_img.c index ad3309737..bc16f80d7 100644 --- a/lv_draw/lv_draw_img.c +++ b/lv_draw/lv_draw_img.c @@ -367,19 +367,20 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t * return LV_IMG_DECODER_OPEN_FAIL; } -#if USE_LV_FILESYSTEM /*Open the file if it's a file*/ if(decoder_src_type == LV_IMG_SRC_FILE) { +#if USE_LV_FILESYSTEM lv_fs_res_t res = lv_fs_open(&decoder_file, src, LV_FS_MODE_RD); if(res != LV_FS_RES_OK) { LV_LOG_WARN("Built-in image decoder can't open the file"); return LV_IMG_DECODER_OPEN_FAIL; } - } #else LV_LOG_WARN("Image built-in decoder can read file because USE_LV_FILESYSTEM = 0"); return LV_IMG_DECODER_OPEN_FAIL; #endif + } + /*Process the different color formats*/ lv_img_cf_t cf = decoder_header.cf; @@ -408,12 +409,17 @@ static const uint8_t * lv_img_decoder_open(const void * src, const lv_style_t * uint32_t palette_size = 1 << px_size; if(decoder_src_type == LV_IMG_SRC_FILE) { + /*Read the palette from file*/ #if USE_LV_FILESYSTEM lv_fs_seek(&decoder_file, 4); /*Skip the header*/ lv_fs_read(&decoder_file, palette_file, palette_size * sizeof(lv_color32_t), NULL); palette_p = palette_file; +#else + LV_LOG_WARN("Image built-in decoder can read the palette because USE_LV_FILESYSTEM = 0"); + return LV_IMG_DECODER_OPEN_FAIL; #endif } else { + /*The palette begins in the beginning of the image data. Just point to it.*/ palette_p = (lv_color32_t *)((lv_img_dsc_t *)decoder_src)->data; } diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index 2adcac2f2..16dd407a5 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -346,7 +346,7 @@ lv_action_t lv_btn_get_action(const lv_obj_t * btn, lv_btn_action_t type) * @param btn pointer to a button object * @return the time of the ink animation */ -uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn, uint16_t time) +uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn) { #if USE_LV_ANIMATION && LV_BTN_INK_EFFECT lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); @@ -362,7 +362,7 @@ uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn, uint16_t time) * @param btn pointer to a button object * @return the time of the ink animation */ -uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn, uint16_t time) +uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn) { #if USE_LV_ANIMATION && LV_BTN_INK_EFFECT lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); @@ -376,7 +376,7 @@ uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn, uint16_t time) * @param btn pointer to a button object * @return the time of the ink animation */ -uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn, uint16_t time) +uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn) { #if USE_LV_ANIMATION && LV_BTN_INK_EFFECT lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn); @@ -703,9 +703,9 @@ static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) */ static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val) { - if(ink_obj) { + if(btn) { ink_act_value = val; - lv_obj_invalidate(ink_obj); + lv_obj_invalidate(btn); } } @@ -715,6 +715,8 @@ static void lv_btn_ink_effect_anim(lv_obj_t * btn, int32_t val) */ static void lv_btn_ink_effect_anim_ready(void * p) { + (void) p; /*Unused*/ + lv_btn_ext_t * ext = lv_obj_get_ext_attr(ink_obj); lv_btn_state_t state = lv_btn_get_state(ink_obj); diff --git a/lv_objx/lv_btn.h b/lv_objx/lv_btn.h index 7ec6ed9ce..07e927ff3 100644 --- a/lv_objx/lv_btn.h +++ b/lv_objx/lv_btn.h @@ -242,21 +242,21 @@ static inline bool lv_btn_get_ver_fit(const lv_obj_t * btn) * @param btn pointer to a button object * @return the time of the ink animation */ -uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn, uint16_t time); +uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn); /** * Get the wait time before the ink disappears * @param btn pointer to a button object * @return the time of the ink animation */ -uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn, uint16_t time); +uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn); /** * Get time of the ink out effect (animate to the releases state) * @param btn pointer to a button object * @return the time of the ink animation */ -uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn, uint16_t time); +uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn); /** * Get style of a button. diff --git a/lv_objx/lv_calendar.c b/lv_objx/lv_calendar.c index a29a6881a..451a2b607 100644 --- a/lv_objx/lv_calendar.c +++ b/lv_objx/lv_calendar.c @@ -349,7 +349,7 @@ uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar) * @param calendar pointer to a calendar object * @return pointer to the array of day names */ -const char ** lv_calendar_get_day_names(const lv_obj_t * calendar, const char ** day_names) +const char ** lv_calendar_get_day_names(const lv_obj_t * calendar) { lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); return ext->day_names; @@ -360,7 +360,7 @@ const char ** lv_calendar_get_day_names(const lv_obj_t * calendar, const char ** * @param calendar pointer to a calendar object * @return pointer to the array of month names */ -const char ** lv_calendar_get_month_names(const lv_obj_t * calendar, const char ** day_names) +const char ** lv_calendar_get_month_names(const lv_obj_t * calendar) { lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); return ext->month_names; diff --git a/lv_objx/lv_calendar.h b/lv_objx/lv_calendar.h index 952fce8e2..537f6e8f4 100644 --- a/lv_objx/lv_calendar.h +++ b/lv_objx/lv_calendar.h @@ -180,14 +180,14 @@ uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar); * @param calendar pointer to a calendar object * @return pointer to the array of day names */ -const char ** lv_calendar_get_day_names(const lv_obj_t * calendar, const char ** day_names); +const char ** lv_calendar_get_day_names(const lv_obj_t * calendar); /** * Get the name of the month * @param calendar pointer to a calendar object * @return pointer to the array of month names */ -const char ** lv_calendar_get_month_names(const lv_obj_t * calendar, const char ** day_names); +const char ** lv_calendar_get_month_names(const lv_obj_t * calendar); /** * Get style of a calendar. diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index 061bde12c..c64f3d37b 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -126,10 +126,10 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img) #if LV_LOG_LEVEL >= LV_LOG_LEVEL_INFO switch(src_type) { - case LV_IMG_SRC_FILE: LV_LOG_INFO("lv_img_set_src: `LV_IMG_SRC_FILE` type found"); break; - case LV_IMG_SRC_VARIABLE: LV_LOG_INFO("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found"); break; - case LV_IMG_SRC_SYMBOL: LV_LOG_INFO("lv_img_set_src: `LV_IMG_SRC_SYMBOL` type found"); break; - default: LV_LOG_WARN("lv_img_set_src: unknown type"); + case LV_IMG_SRC_FILE: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_FILE` type found"); break; + case LV_IMG_SRC_VARIABLE: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found"); break; + case LV_IMG_SRC_SYMBOL: LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_SYMBOL` type found"); break; + default: LV_LOG_WARN("lv_img_set_src: unknown type"); } #endif diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 23f940580..b19c8e3df 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -210,7 +210,7 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c) ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 2); /*+2: the new char + \0 */ lv_mem_assert(ext->pwd_tmp); - if(ext->pwd_tmp== NULL) return; + if(ext->pwd_tmp == NULL) return; lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, (const char *)letter_buf);