fix(printf) add (int) casts to log messages to avoid warnings on %d

This commit is contained in:
Gabor Kiss-Vamosi
2021-11-03 11:52:56 +01:00
parent 63ff80192b
commit d9d3f27126
10 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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)