fix(examples) resolve string formatting compiler warnings (#3654)
This commit is contained in:
@@ -28,7 +28,7 @@ void lv_example_flex_1(void)
|
|||||||
lv_obj_set_size(obj, 100, LV_PCT(100));
|
lv_obj_set_size(obj, 100, LV_PCT(100));
|
||||||
|
|
||||||
label = lv_label_create(obj);
|
label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "Item: %u", i);
|
lv_label_set_text_fmt(label, "Item: %"LV_PRIu32"", i);
|
||||||
lv_obj_center(label);
|
lv_obj_center(label);
|
||||||
|
|
||||||
/*Add items to the column*/
|
/*Add items to the column*/
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ void lv_example_gridnav_1(void)
|
|||||||
lv_group_remove_obj(obj); /*Not needed, we use the gridnav instead*/
|
lv_group_remove_obj(obj); /*Not needed, we use the gridnav instead*/
|
||||||
|
|
||||||
lv_obj_t * label = lv_label_create(obj);
|
lv_obj_t * label = lv_label_create(obj);
|
||||||
lv_label_set_text_fmt(label, "%d", i);
|
lv_label_set_text_fmt(label, "%"LV_PRIu32"", i);
|
||||||
lv_obj_center(label);
|
lv_obj_center(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ static bool get_imgfont_path(const lv_font_t * font, void * img_src,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char * path = (char *)img_src;
|
char * path = (char *)img_src;
|
||||||
snprintf(path, len, "%s/%04X.%s", "A:lvgl/examples/assets/emoji", unicode, "png");
|
snprintf(path, len, "%s/%04"LV_PRIX32".%s", "A:lvgl/examples/assets/emoji", unicode, "png");
|
||||||
path[len - 1] = '\0';
|
path[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ static void label_event_cb(lv_event_t * e)
|
|||||||
if(code == LV_EVENT_MSG_RECEIVED) {
|
if(code == LV_EVENT_MSG_RECEIVED) {
|
||||||
lv_msg_t * m = lv_event_get_msg(e);
|
lv_msg_t * m = lv_event_get_msg(e);
|
||||||
const int32_t * v = lv_msg_get_payload(m);
|
const int32_t * v = lv_msg_get_payload(m);
|
||||||
lv_label_set_text_fmt(label, "%d %%", *v);
|
lv_label_set_text_fmt(label, "%"LV_PRId32" %%", *v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ static void float_btn_event_cb(lv_event_t * e)
|
|||||||
|
|
||||||
cont = lv_menu_cont_create(sub_page);
|
cont = lv_menu_cont_create(sub_page);
|
||||||
label = lv_label_create(cont);
|
label = lv_label_create(cont);
|
||||||
lv_label_set_text_fmt(label, "Hello, I am hiding inside %i", btn_cnt);
|
lv_label_set_text_fmt(label, "Hello, I am hiding inside %"LV_PRIu32"", btn_cnt);
|
||||||
|
|
||||||
cont = lv_menu_cont_create(main_page);
|
cont = lv_menu_cont_create(main_page);
|
||||||
label = lv_label_create(cont);
|
label = lv_label_create(cont);
|
||||||
lv_label_set_text_fmt(label, "Item %i", btn_cnt);
|
lv_label_set_text_fmt(label, "Item %"LV_PRIu32"", btn_cnt);
|
||||||
lv_menu_set_load_page_event(menu, cont, sub_page);
|
lv_menu_set_load_page_event(menu, cont, sub_page);
|
||||||
|
|
||||||
lv_obj_scroll_to_view_recursive(cont, LV_ANIM_ON);
|
lv_obj_scroll_to_view_recursive(cont, LV_ANIM_ON);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void lv_example_table_2(void)
|
|||||||
lv_obj_t * label = lv_label_create(lv_scr_act());
|
lv_obj_t * label = lv_label_create(lv_scr_act());
|
||||||
lv_label_set_text_fmt(label, "%"LV_PRIu32" items were created in %"LV_PRIu32" ms\n"
|
lv_label_set_text_fmt(label, "%"LV_PRIu32" items were created in %"LV_PRIu32" ms\n"
|
||||||
"using %"LV_PRIu32" bytes of memory",
|
"using %"LV_PRIu32" bytes of memory",
|
||||||
ITEM_CNT, elaps, mem_used);
|
(uint32_t)ITEM_CNT, elaps, mem_used);
|
||||||
|
|
||||||
lv_obj_align(label, LV_ALIGN_BOTTOM_MID, 0, -10);
|
lv_obj_align(label, LV_ALIGN_BOTTOM_MID, 0, -10);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user