1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(refresh) switch to portable format specifiers (#2781)

Some platforms define uint32_t as "unsigned long" rather than "unsigned int".
The %d format specifier is mismatched and the C99 format macros are the only
portable way to handle these types.

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Kevin Thibedeau 2021-11-09 10:03:06 -05:00 committed by GitHub
parent 462fbcbf49
commit 09e19bb687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -48,6 +48,7 @@
- fix(msgbox) add declaration for lv_msgbox_content_class
- fix(txt) skip basic arabic vowel characters when processing conjunction
- fix(proto) Remove redundant prototype declarations
- fix(refresh) Switch to portable format specifiers
- fix(stm32) Mark unused variable in stm32 DMA2D driver
## v8.0.2 (16.07.2021)

View File

@ -307,7 +307,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
uint32_t used_size = mon.total_size - mon.free_size;;
uint32_t used_kb = used_size / 1024;
uint32_t used_kb_tenth = (used_size - (used_kb * 1024)) / 102;
lv_label_set_text_fmt(mem_label, "%d.%d kB used (%d %%)\n%d%% frag.", used_kb, used_kb_tenth, mon.used_pct,
lv_label_set_text_fmt(mem_label, "%" LV_PRIu32 ".%" LV_PRIu32 " kB used (%d %%)\n" \
"%d%% frag.", used_kb, used_kb_tenth, mon.used_pct,
mon.frag_pct);
}
#endif

View File

@ -39,12 +39,15 @@
# include <inttypes.h>
/* platform-specific printf format for int32_t, usually "d" or "ld" */
# define LV_PRId32 PRId32
# define LV_PRIu32 PRIu32
# else
# define LV_PRId32 "d"
# define LV_PRIu32 "u"
# endif
#else
/* hope this is correct for ports without __has_include or without inttypes.h */
# define LV_PRId32 "d"
# define LV_PRIu32 "u"
#endif
#ifdef __cplusplus