Skip to content

Commit

Permalink
fix(printf) add (int) casts to log messages to avoid warnings on %d
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Nov 3, 2021
1 parent 63ff801 commit d9d3f27
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions examples/scroll/lv_example_scroll_3.c
Expand Up @@ -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++;

Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/bar/lv_example_bar_6.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/chart/lv_example_chart_4.c
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions examples/widgets/checkbox/lv_example_checkbox_2.c
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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);

}
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/slider/lv_example_slider_1.c
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/slider/lv_example_slider_3.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/widgets/win/lv_example_win_1.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/draw/lv_draw_label.c
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/extra/widgets/tileview/lv_tileview.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/misc/lv_mem.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit d9d3f27

Please sign in to comment.