mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(printf) add (int) casts to log messages to avoid warnings on %d
This commit is contained in:
parent
63ff80192b
commit
d9d3f27126
@ -11,7 +11,7 @@ static void float_btn_event_cb(lv_event_t * e)
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
lv_obj_t * list = lv_event_get_user_data(e);
|
||||
char buf[32];
|
||||
lv_snprintf(buf, sizeof(buf), "Track %d", btn_cnt);
|
||||
lv_snprintf(buf, sizeof(buf), "Track %d", (int)btn_cnt);
|
||||
lv_obj_t * list_btn = lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf);
|
||||
btn_cnt++;
|
||||
|
||||
@ -32,7 +32,7 @@ void lv_example_scroll_3(void)
|
||||
|
||||
for(btn_cnt = 1; btn_cnt <= 2; btn_cnt++) {
|
||||
char buf[32];
|
||||
lv_snprintf(buf, sizeof(buf), "Track %d", btn_cnt);
|
||||
lv_snprintf(buf, sizeof(buf), "Track %d", (int)btn_cnt);
|
||||
lv_list_add_btn(list, LV_SYMBOL_AUDIO, buf);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ static void event_cb(lv_event_t * e)
|
||||
label_dsc.font = LV_FONT_DEFAULT;
|
||||
|
||||
char buf[8];
|
||||
lv_snprintf(buf, sizeof(buf), "%d", lv_bar_get_value(obj));
|
||||
lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj));
|
||||
|
||||
lv_point_t txt_size;
|
||||
lv_txt_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, label_dsc.flag);
|
||||
|
@ -18,7 +18,7 @@ static void event_cb(lv_event_t * e)
|
||||
int32_t id = lv_chart_get_pressed_point(chart);
|
||||
if(id == LV_CHART_POINT_NONE) return;
|
||||
|
||||
LV_LOG_USER("Selected point %d", id);
|
||||
LV_LOG_USER("Selected point %d", (int)id);
|
||||
|
||||
lv_chart_series_t * ser = lv_chart_get_series_next(chart, NULL);
|
||||
while(ser) {
|
||||
|
@ -21,7 +21,7 @@ static void radio_event_handler(lv_event_t * e)
|
||||
|
||||
*active_id = lv_obj_get_index(act_cb);
|
||||
|
||||
LV_LOG_USER("Selected radio buttons: %d, %d", active_index_1, active_index_2);
|
||||
LV_LOG_USER("Selected radio buttons: %d, %d", (int)active_index_1, (int)active_index_2);
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ void lv_example_checkbox_2(void)
|
||||
lv_obj_add_event_cb(cont1, radio_event_handler, LV_EVENT_CLICKED, &active_index_1);
|
||||
|
||||
for (i = 0;i < 5;i++) {
|
||||
lv_snprintf(buf, sizeof(buf), "A %d", i + 1);
|
||||
lv_snprintf(buf, sizeof(buf), "A %d", (int)i + 1);
|
||||
radiobutton_create(cont1, buf);
|
||||
|
||||
}
|
||||
@ -74,7 +74,7 @@ void lv_example_checkbox_2(void)
|
||||
lv_obj_add_event_cb(cont2, radio_event_handler, LV_EVENT_CLICKED, &active_index_2);
|
||||
|
||||
for (i = 0;i < 3;i++) {
|
||||
lv_snprintf(buf, sizeof(buf), "B %d", i + 1);
|
||||
lv_snprintf(buf, sizeof(buf), "B %d", (int)i + 1);
|
||||
radiobutton_create(cont2, buf);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ static void slider_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * slider = lv_event_get_target(e);
|
||||
char buf[8];
|
||||
lv_snprintf(buf, sizeof(buf), "%d%%", lv_slider_get_value(slider));
|
||||
lv_snprintf(buf, sizeof(buf), "%d%%", (int)lv_slider_get_value(slider));
|
||||
lv_label_set_text(slider_label, buf);
|
||||
lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ static void slider_event_cb(lv_event_t * e)
|
||||
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
|
||||
if(dsc->part == LV_PART_INDICATOR) {
|
||||
char buf[16];
|
||||
lv_snprintf(buf, sizeof(buf), "%d - %d", lv_slider_get_left_value(obj), lv_slider_get_value(obj));
|
||||
lv_snprintf(buf, sizeof(buf), "%d - %d", (int)lv_slider_get_left_value(obj), (int)lv_slider_get_value(obj));
|
||||
|
||||
lv_point_t label_size;
|
||||
lv_txt_get_size(&label_size, buf, LV_FONT_DEFAULT, 0, 0, LV_COORD_MAX, 0);
|
||||
|
@ -5,7 +5,7 @@
|
||||
static void event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
LV_LOG_USER("Button %d clicked", lv_obj_get_index(obj));
|
||||
LV_LOG_USER("Button %d clicked", (int)lv_obj_get_index(obj));
|
||||
}
|
||||
|
||||
void lv_example_win_1(void)
|
||||
|
@ -430,7 +430,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_are
|
||||
if(letter >= 0x20 &&
|
||||
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", letter);
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", (unsigned int)letter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim
|
||||
}
|
||||
}
|
||||
|
||||
LV_LOG_WARN("No tile found with at (%d,%d) index", col_id, row_id);
|
||||
LV_LOG_WARN("No tile found with at (%d,%d) index", (int)col_id, (int)row_id);
|
||||
}
|
||||
|
||||
lv_obj_t * lv_tileview_get_tile_act(lv_obj_t * obj)
|
||||
|
@ -143,7 +143,7 @@ void * lv_mem_alloc(size_t size)
|
||||
lv_mem_monitor_t mon;
|
||||
lv_mem_monitor(&mon);
|
||||
LV_LOG_ERROR("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d",
|
||||
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
|
||||
(int)(mon.total_size - mon.free_size), mon.used_pct, mon.frag_pct,
|
||||
(int)mon.free_biggest_size);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user