From 657dfe9615e7d818f3ce57dc2fc2d1d691eafff2 Mon Sep 17 00:00:00 2001 From: bjsylvia Date: Sun, 16 Jul 2023 02:08:25 +0800 Subject: [PATCH] fix: fix compiling warning on Mac (#4379) Signed-off-by: XiaoweiYan Co-authored-by: XiaoweiYan --- demos/music/lv_demo_music_main.c | 5 +++-- src/widgets/canvas/lv_canvas.c | 1 + src/widgets/roller/lv_roller.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/demos/music/lv_demo_music_main.c b/demos/music/lv_demo_music_main.c index 6c8a7924dc..3e61b319bb 100644 --- a/demos/music/lv_demo_music_main.c +++ b/demos/music/lv_demo_music_main.c @@ -828,7 +828,7 @@ static void spectrum_draw_event_cb(lv_event_t * e) } } - uint32_t amax = 20; + const int32_t amax = 20; int32_t animv = spectrum_i - spectrum_lane_ofs_start; if(animv > amax) animv = amax; for(i = 0; i < BAR_CNT; i++) { @@ -845,7 +845,7 @@ static void spectrum_draw_event_cb(lv_event_t * e) } if(v < BAR_COLOR1_STOP) draw_dsc.bg_color = BAR_COLOR1; - else if(v > BAR_COLOR3_STOP) draw_dsc.bg_color = BAR_COLOR3; + else if(v > (uint32_t)BAR_COLOR3_STOP) draw_dsc.bg_color = BAR_COLOR3; else if(v > BAR_COLOR2_STOP) draw_dsc.bg_color = lv_color_mix(BAR_COLOR3, BAR_COLOR2, ((v - BAR_COLOR2_STOP) * 255) / (BAR_COLOR3_STOP - BAR_COLOR2_STOP)); else draw_dsc.bg_color = lv_color_mix(BAR_COLOR2, BAR_COLOR1, @@ -953,6 +953,7 @@ static lv_obj_t * album_img_create(lv_obj_t * parent) static void album_gesture_event_cb(lv_event_t * e) { + LV_UNUSED(e); lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act()); if(dir == LV_DIR_LEFT) _lv_demo_music_album_next(true); if(dir == LV_DIR_RIGHT) _lv_demo_music_album_next(false); diff --git a/src/widgets/canvas/lv_canvas.c b/src/widgets/canvas/lv_canvas.c index 567a207fe4..78d13f5e96 100644 --- a/src/widgets/canvas/lv_canvas.c +++ b/src/widgets/canvas/lv_canvas.c @@ -187,6 +187,7 @@ lv_color32_t lv_canvas_get_px(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) break; } default: + lv_memzero(&ret, sizeof(lv_color32_t)); break; } diff --git a/src/widgets/roller/lv_roller.c b/src/widgets/roller/lv_roller.c index b22e271e0b..38dd9d3af1 100644 --- a/src/widgets/roller/lv_roller.c +++ b/src/widgets/roller/lv_roller.c @@ -179,7 +179,7 @@ void lv_roller_set_selected(lv_obj_t * obj, uint16_t sel_opt, lv_anim_enable_t a uint16_t act_opt = roller->sel_opt_id - current_page * real_option_cnt; int32_t sel_opt_signed = sel_opt; /*Huge jump? Probably from last to first or first to last option.*/ - if(LV_ABS((int16_t)act_opt - sel_opt) > real_option_cnt / 2) { + if((uint16_t)LV_ABS((int16_t)act_opt - sel_opt) > real_option_cnt / 2) { if(act_opt > sel_opt) sel_opt_signed += real_option_cnt; else sel_opt_signed -= real_option_cnt; }