refacter(conf): use defines for standard includes (#5767)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Michael Simon 2024-03-20 05:10:33 +01:00 committed by GitHub
parent 393c24c6e9
commit 352420cd54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
100 changed files with 210 additions and 167 deletions

View File

@ -20,7 +20,9 @@ extern "C" {
* DEFINES * DEFINES
*********************/ *********************/
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS

View File

@ -203,7 +203,7 @@ static void ta_event_cb(lv_event_t * e)
lv_keyboard_set_textarea(kb, ta); lv_keyboard_set_textarea(kb, ta);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN); lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_group_focus_obj(kb); lv_group_focus_obj(kb);
lv_group_set_editing(lv_obj_get_group(kb), kb); lv_group_set_editing(lv_obj_get_group(kb), kb != NULL);
lv_obj_set_height(tv, LV_VER_RES / 2); lv_obj_set_height(tv, LV_VER_RES / 2);
lv_obj_align(kb, LV_ALIGN_BOTTOM_MID, 0, 0); lv_obj_align(kb, LV_ALIGN_BOTTOM_MID, 0, 0);
} }

View File

@ -12,7 +12,7 @@
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#endif #endif
#if LV_USE_DEMO_MULTILANG #if defined(LV_USE_DEMO_MULTILANG) || defined(LV_USE_DEMO_TRANSFORM)
#ifndef LV_ATTRIBUTE_MEM_ALIGN #ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN #define LV_ATTRIBUTE_MEM_ALIGN

View File

@ -1,5 +1,6 @@
#include "../../lv_examples.h" #include "../../lv_examples.h"
#if LV_USE_QRCODE && LV_BUILD_EXAMPLES #if LV_USE_QRCODE && LV_BUILD_EXAMPLES
#include <string.h>
/** /**
* Create a QR Code * Create a QR Code

View File

@ -59,7 +59,7 @@ static lv_subject_t auth_state_subject;
static void textarea_event_cb(lv_event_t * e) static void textarea_event_cb(lv_event_t * e)
{ {
lv_obj_t * ta = lv_event_get_target(e); lv_obj_t * ta = lv_event_get_target(e);
if(strcmp(lv_textarea_get_text(ta), "hello") == 0) { if(lv_strcmp(lv_textarea_get_text(ta), "hello") == 0) {
lv_subject_set_int(&auth_state_subject, LOGGED_IN); lv_subject_set_int(&auth_state_subject, LOGGED_IN);
} }
else { else {

View File

@ -14,8 +14,8 @@ static void btnm_event_handler(lv_event_t * e)
lv_obj_t * ta = lv_event_get_user_data(e); lv_obj_t * ta = lv_event_get_user_data(e);
const char * txt = lv_buttonmatrix_get_button_text(obj, lv_buttonmatrix_get_selected_button(obj)); const char * txt = lv_buttonmatrix_get_button_text(obj, lv_buttonmatrix_get_selected_button(obj));
if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_delete_char(ta); if(lv_strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_delete_char(ta);
else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_obj_send_event(ta, LV_EVENT_READY, NULL); else if(lv_strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_obj_send_event(ta, LV_EVENT_READY, NULL);
else lv_textarea_add_text(ta, txt); else lv_textarea_add_text(ta, txt);
} }

View File

@ -44,6 +44,12 @@
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN #define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#define LV_STDINT_INCLUDE <stdint.h>
#define LV_STDDEF_INCLUDE <stddef.h>
#define LV_STDBOOL_INCLUDE <stdbool.h>
#define LV_INTTYPES_INCLUDE <inttypes.h>
#define LV_LIMITS_INCLUDE <limits.h>
#define LV_STDARG_INCLUDE <stdarg.h>
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/

View File

@ -15,8 +15,6 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdbool.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include "../draw/lv_draw.h" #include "../draw/lv_draw.h"
#if LV_USE_DRAW_SW #if LV_USE_DRAW_SW
@ -39,6 +37,8 @@ extern "C" {
#include "../tick/lv_tick.h" #include "../tick/lv_tick.h"
#include "../layouts/lv_layout.h" #include "../layouts/lv_layout.h"
#include "../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -6,12 +6,11 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include "lv_group.h" #include "lv_group.h"
#include "../core/lv_obj.h" #include "../core/lv_obj.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
#include "../indev/lv_indev.h" #include "../indev/lv_indev.h"
#include "../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,11 +13,8 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include "../misc/lv_ll.h" #include "../misc/lv_ll.h"

View File

@ -17,10 +17,9 @@
#include "../misc/lv_assert.h" #include "../misc/lv_assert.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../misc/lv_log.h" #include "../misc/lv_log.h"
#include "../misc/lv_types.h"
#include "../tick/lv_tick.h" #include "../tick/lv_tick.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
#include <stdint.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -15,8 +15,6 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include "../misc/lv_style.h" #include "../misc/lv_style.h"
#include "../misc/lv_area.h" #include "../misc/lv_area.h"

View File

@ -13,8 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include "../misc/lv_area.h" #include "../misc/lv_area.h"
#include "lv_obj_property.h" #include "lv_obj_property.h"

View File

@ -13,7 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include "../misc/lv_event.h" #include "../misc/lv_event.h"
#include "../indev/lv_indev.h" #include "../indev/lv_indev.h"

View File

@ -13,10 +13,9 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_bidi.h" #include "../misc/lv_bidi.h"
#include "../misc/lv_style.h" #include "../misc/lv_style.h"
#include "../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -6,8 +6,6 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdlib.h>
#include "lv_obj.h" #include "lv_obj.h"
#include "../indev/lv_indev.h" #include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h" #include "../indev/lv_indev_private.h"

View File

@ -13,8 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include "../misc/lv_anim.h" #include "../misc/lv_anim.h"
#include "../display/lv_display.h" #include "../display/lv_display.h"

View File

@ -6,7 +6,6 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include "lv_refr.h" #include "lv_refr.h"
#include "../display/lv_display.h" #include "../display/lv_display.h"
#include "../display/lv_display_private.h" #include "../display/lv_display_private.h"
@ -14,6 +13,7 @@
#include "../misc/lv_timer.h" #include "../misc/lv_timer.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../misc/lv_profiler.h" #include "../misc/lv_profiler.h"
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h" #include "../draw/lv_draw.h"
#include "../font/lv_font_fmt_txt.h" #include "../font/lv_font_fmt_txt.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"

View File

@ -15,7 +15,7 @@ extern "C" {
*********************/ *********************/
#include "lv_obj.h" #include "lv_obj.h"
#include "../display/lv_display.h" #include "../display/lv_display.h"
#include <stdbool.h> #include "../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -6,9 +6,9 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include "../core/lv_refr.h" #include "../core/lv_refr.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
/********************* /*********************

View File

@ -6,10 +6,10 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include "lv_draw_mask.h" #include "lv_draw_mask.h"
#include "../core/lv_refr.h" #include "../core/lv_refr.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
/********************* /*********************

View File

@ -11,8 +11,8 @@
#if LV_USE_VECTOR_GRAPHIC #if LV_USE_VECTOR_GRAPHIC
#include "../misc/lv_ll.h" #include "../misc/lv_ll.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
#include <stdbool.h>
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>

View File

@ -15,7 +15,6 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_draw_buf.h" #include "lv_draw_buf.h"
#include "../misc/lv_fs.h" #include "../misc/lv_fs.h"
#include "../misc/lv_types.h" #include "../misc/lv_types.h"

View File

@ -6,11 +6,12 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include "lv_draw_sw.h" #include "lv_draw_sw.h"
#if LV_USE_DRAW_SW #if LV_USE_DRAW_SW
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"

View File

@ -13,10 +13,10 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include "../../misc/lv_area.h" #include "../../misc/lv_area.h"
#include "../../misc/lv_color.h" #include "../../misc/lv_color.h"
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -12,6 +12,7 @@
#if LV_USE_DRAW_VG_LITE #if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h" #include "lv_vg_lite_utils.h"
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -12,6 +12,8 @@
#if LV_USE_DRAW_VG_LITE #if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h" #include "lv_vg_lite_utils.h"
#include <stdlib.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,6 +13,8 @@
#include "lv_draw_vg_lite_type.h" #include "lv_draw_vg_lite_type.h"
#include "lv_vg_lite_pending.h" #include "lv_vg_lite_pending.h"
#include "../../misc/lv_types.h"
#include "../../stdlib/lv_string.h"
/********************* /*********************
* DEFINES * DEFINES
@ -236,8 +238,8 @@ static lv_cache_compare_res_t grad_compare_cb(const grad_item_t * lhs, const gra
return lhs->lv_grad.stops_count > rhs->lv_grad.stops_count ? 1 : -1; return lhs->lv_grad.stops_count > rhs->lv_grad.stops_count ? 1 : -1;
} }
int cmp_res = memcmp(lhs->lv_grad.stops, rhs->lv_grad.stops, int cmp_res = lv_memcmp(lhs->lv_grad.stops, rhs->lv_grad.stops,
sizeof(lv_gradient_stop_t) * lhs->lv_grad.stops_count); sizeof(lv_gradient_stop_t) * lhs->lv_grad.stops_count);
if(cmp_res != 0) { if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1; return cmp_res > 0 ? 1 : -1;
} }

View File

@ -15,6 +15,7 @@
#include <stdint.h> #include <stdint.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include <xf86drm.h> #include <xf86drm.h>
#include <xf86drmMode.h> #include <xf86drmMode.h>

View File

@ -22,6 +22,7 @@
#include <dirent.h> #include <dirent.h>
#include <libinput.h> #include <libinput.h>
#include <pthread.h> #include <pthread.h>
#include <string.h>
#if LV_LIBINPUT_BSD #if LV_LIBINPUT_BSD
#include <dev/evdev/input.h> #include <dev/evdev/input.h>

View File

@ -6,12 +6,10 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdint.h>
#include <stdbool.h>
#include "../lvgl.h" #include "../lvgl.h"
#include "../misc/lv_fs.h" #include "../misc/lv_fs.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include "lv_binfont_loader.h" #include "lv_binfont_loader.h"
/********************** /**********************
@ -208,7 +206,7 @@ static int read_label(lv_fs_file_t * fp, int start, const char * label)
if(lv_fs_read(fp, &length, 4, NULL) != LV_FS_RES_OK if(lv_fs_read(fp, &length, 4, NULL) != LV_FS_RES_OK
|| lv_fs_read(fp, buf, 4, NULL) != LV_FS_RES_OK || lv_fs_read(fp, buf, 4, NULL) != LV_FS_RES_OK
|| memcmp(label, buf, 4) != 0) { || lv_memcmp(label, buf, 4) != 0) {
LV_LOG_WARN("Error reading '%s' label.", label); LV_LOG_WARN("Error reading '%s' label.", label);
return -1; return -1;
} }
@ -298,7 +296,7 @@ static int32_t load_cmaps(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, u
lv_font_fmt_txt_cmap_t * cmaps = lv_font_fmt_txt_cmap_t * cmaps =
lv_malloc(cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t)); lv_malloc(cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t)); lv_memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
font_dsc->cmaps = cmaps; font_dsc->cmaps = cmaps;
font_dsc->cmap_num = cmaps_subtables_count; font_dsc->cmap_num = cmaps_subtables_count;
@ -323,7 +321,7 @@ static int32_t load_glyph(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = (lv_font_fmt_txt_glyph_dsc_t *) lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = (lv_font_fmt_txt_glyph_dsc_t *)
lv_malloc(loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t)); lv_malloc(loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t)); lv_memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
font_dsc->glyph_dsc = glyph_dsc; font_dsc->glyph_dsc = glyph_dsc;
@ -462,7 +460,7 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
lv_font_fmt_txt_dsc_t * font_dsc = (lv_font_fmt_txt_dsc_t *) lv_font_fmt_txt_dsc_t * font_dsc = (lv_font_fmt_txt_dsc_t *)
lv_malloc(sizeof(lv_font_fmt_txt_dsc_t)); lv_malloc(sizeof(lv_font_fmt_txt_dsc_t));
memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t)); lv_memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t));
font->dsc = font_dsc; font->dsc = font_dsc;
@ -579,7 +577,7 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
if(0 == kern_format_type) { /*sorted pairs*/ if(0 == kern_format_type) { /*sorted pairs*/
lv_font_fmt_txt_kern_pair_t * kern_pair = lv_malloc(sizeof(lv_font_fmt_txt_kern_pair_t)); lv_font_fmt_txt_kern_pair_t * kern_pair = lv_malloc(sizeof(lv_font_fmt_txt_kern_pair_t));
memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t)); lv_memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t));
font_dsc->kern_dsc = kern_pair; font_dsc->kern_dsc = kern_pair;
font_dsc->kern_classes = 0; font_dsc->kern_classes = 0;
@ -617,7 +615,7 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
lv_font_fmt_txt_kern_classes_t * kern_classes = lv_malloc(sizeof(lv_font_fmt_txt_kern_classes_t)); lv_font_fmt_txt_kern_classes_t * kern_classes = lv_malloc(sizeof(lv_font_fmt_txt_kern_classes_t));
memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t)); lv_memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t));
font_dsc->kern_dsc = kern_classes; font_dsc->kern_dsc = kern_classes;
font_dsc->kern_classes = 1; font_dsc->kern_classes = 1;

View File

@ -14,14 +14,11 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h> #include "../misc/lv_types.h"
#include <stddef.h>
#include <stdbool.h>
#include "lv_symbol_def.h" #include "lv_symbol_def.h"
#include "../draw/lv_draw_buf.h" #include "../draw/lv_draw_buf.h"
#include "../misc/lv_area.h" #include "../misc/lv_area.h"
#include "../misc/lv_types.h"
#include "../misc/cache/lv_cache.h" #include "../misc/cache/lv_cache.h"
/********************* /*********************

View File

@ -13,10 +13,8 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_font.h" #include "lv_font.h"
#include "../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -11,6 +11,7 @@
#include "lv_libpng.h" #include "lv_libpng.h"
#include <png.h> #include <png.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -10,6 +10,7 @@
#if LV_USE_RLOTTIE #if LV_USE_RLOTTIE
#include <rlottie_capi.h> #include <rlottie_capi.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,6 +13,7 @@
#include "tjpgd.h" #include "tjpgd.h"
#include "lv_tjpgd.h" #include "lv_tjpgd.h"
#include "../../misc/lv_fs.h" #include "../../misc/lv_fs.h"
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -124,6 +124,48 @@
#endif #endif
#endif #endif
#ifndef LV_STDINT_INCLUDE
#ifdef CONFIG_LV_STDINT_INCLUDE
#define LV_STDINT_INCLUDE CONFIG_LV_STDINT_INCLUDE
#else
#define LV_STDINT_INCLUDE <stdint.h>
#endif
#endif
#ifndef LV_STDDEF_INCLUDE
#ifdef CONFIG_LV_STDDEF_INCLUDE
#define LV_STDDEF_INCLUDE CONFIG_LV_STDDEF_INCLUDE
#else
#define LV_STDDEF_INCLUDE <stddef.h>
#endif
#endif
#ifndef LV_STDBOOL_INCLUDE
#ifdef CONFIG_LV_STDBOOL_INCLUDE
#define LV_STDBOOL_INCLUDE CONFIG_LV_STDBOOL_INCLUDE
#else
#define LV_STDBOOL_INCLUDE <stdbool.h>
#endif
#endif
#ifndef LV_INTTYPES_INCLUDE
#ifdef CONFIG_LV_INTTYPES_INCLUDE
#define LV_INTTYPES_INCLUDE CONFIG_LV_INTTYPES_INCLUDE
#else
#define LV_INTTYPES_INCLUDE <inttypes.h>
#endif
#endif
#ifndef LV_LIMITS_INCLUDE
#ifdef CONFIG_LV_LIMITS_INCLUDE
#define LV_LIMITS_INCLUDE CONFIG_LV_LIMITS_INCLUDE
#else
#define LV_LIMITS_INCLUDE <limits.h>
#endif
#endif
#ifndef LV_STDARG_INCLUDE
#ifdef CONFIG_LV_STDARG_INCLUDE
#define LV_STDARG_INCLUDE CONFIG_LV_STDARG_INCLUDE
#else
#define LV_STDARG_INCLUDE <stdarg.h>
#endif
#endif
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/

View File

@ -13,8 +13,8 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include "lv_conf_internal.h" #include "lv_conf_internal.h"
#include "misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -15,8 +15,7 @@ extern "C" {
*********************/ *********************/
#include "lv_cache_entry.h" #include "lv_cache_entry.h"
#include "lv_cache_private.h" #include "lv_cache_private.h"
#include <stdbool.h> #include "../lv_types.h"
#include <stdlib.h>
#include "_lv_cache_lru_rb.h" #include "_lv_cache_lru_rb.h"

View File

@ -16,8 +16,6 @@ extern "C" {
#include "../../osal/lv_os.h" #include "../../osal/lv_os.h"
#include "../lv_types.h" #include "../lv_types.h"
#include "lv_cache_private.h" #include "lv_cache_private.h"
#include <stdbool.h>
#include <stdlib.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -14,8 +14,6 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_types.h" #include "../lv_types.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../../osal/lv_os.h" #include "../../osal/lv_os.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -14,8 +14,6 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_types.h" #include "../lv_types.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../../osal/lv_os.h" #include "../../osal/lv_os.h"
/********************* /*********************

View File

@ -19,10 +19,6 @@ extern "C" {
#include "lv_timer.h" #include "lv_timer.h"
#include "lv_ll.h" #include "lv_ll.h"
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -15,9 +15,6 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include "lv_types.h" #include "lv_types.h"
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,10 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_types.h" #include "lv_types.h"
/********************* /*********************

View File

@ -6,9 +6,9 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include "lv_bidi.h" #include "lv_bidi.h"
#include "lv_text.h" #include "lv_text.h"
#include "lv_types.h"
#include "../stdlib/lv_mem.h" #include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"

View File

@ -14,9 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include "lv_types.h"
#include <stdbool.h>
#include <stdint.h>
#include "lv_text.h" #include "lv_text.h"
/********************* /*********************

View File

@ -17,8 +17,6 @@ extern "C" {
#include "lv_assert.h" #include "lv_assert.h"
#include "lv_math.h" #include "lv_math.h"
#include "lv_types.h" #include "lv_types.h"
#include <stdint.h>
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -16,7 +16,7 @@ extern "C" {
#include "lv_assert.h" #include "lv_assert.h"
#include "lv_math.h" #include "lv_math.h"
#include "lv_color.h" #include "lv_color.h"
#include <stdint.h> #include "lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -10,7 +10,7 @@
#include "../core/lv_global.h" #include "../core/lv_global.h"
#include "../stdlib/lv_mem.h" #include "../stdlib/lv_mem.h"
#include "lv_assert.h" #include "lv_assert.h"
#include <stddef.h> #include "lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,8 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include <stdint.h>
#include "lv_types.h" #include "lv_types.h"
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"

View File

@ -8,7 +8,6 @@
*********************/ *********************/
#include "lv_fs.h" #include "lv_fs.h"
#include <string.h>
#include "../misc/lv_assert.h" #include "../misc/lv_assert.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
#include "lv_ll.h" #include "lv_ll.h"

View File

@ -14,9 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include "lv_types.h"
#include <stdint.h>
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,9 +13,8 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdint.h> #include "../lv_conf_internal.h"
#include <stddef.h> #include "lv_types.h"
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -9,8 +9,7 @@
#include "lv_log.h" #include "lv_log.h"
#if LV_USE_LOG #if LV_USE_LOG
#include <stdarg.h> #include "../misc/lv_types.h"
#include <string.h>
#include "../stdlib/lv_sprintf.h" #include "../stdlib/lv_sprintf.h"
#include "../stdlib/lv_mem.h" #include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"

View File

@ -14,7 +14,6 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_types.h" #include "lv_types.h"

View File

@ -164,7 +164,7 @@ lv_lru_res_t lv_lru_set(lv_lru_t * cache, const void * key, size_t key_length, v
item = lv_lru_pop_or_create_item(cache); item = lv_lru_pop_or_create_item(cache);
item->value = value; item->value = value;
item->key = lv_malloc(key_length); item->key = lv_malloc(key_length);
memcpy(item->key, key, key_length); lv_memcpy(item->key, key, key_length);
item->value_length = value_length; item->value_length = value_length;
item->key_length = key_length; item->key_length = key_length;
required = (int) value_length; required = (int) value_length;
@ -303,7 +303,7 @@ static int lv_lru_cmp_keys(lv_lru_item_t * item, const void * key, uint32_t key_
return 1; return 1;
} }
else { else {
return memcmp(key, item->key, key_length); return lv_memcmp(key, item->key, key_length);
} }
} }

View File

@ -18,9 +18,6 @@ extern "C" {
#include "lv_types.h" #include "lv_types.h"
#include <stdint.h>
#include <stddef.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -14,7 +14,6 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_types.h" #include "lv_types.h"
/********************* /*********************

View File

@ -14,8 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_color.h" #include "lv_color.h"
#include <stdint.h> #include "lv_types.h"
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -18,9 +18,7 @@ extern "C" {
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN #if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
#include <stdbool.h> #include "lv_types.h"
#include <stddef.h>
#include <stdint.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -14,8 +14,8 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_types.h" #include "lv_types.h"
#include "stdbool.h"
#include "lv_assert.h" #include "lv_assert.h"
#include "lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -13,8 +13,6 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdbool.h>
#include <stdint.h>
#include "../font/lv_font.h" #include "../font/lv_font.h"
#include "lv_color.h" #include "lv_color.h"
#include "lv_area.h" #include "lv_area.h"

View File

@ -6,7 +6,6 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stdarg.h>
#include "lv_text.h" #include "lv_text.h"
#include "lv_text_ap.h" #include "lv_text_ap.h"
#include "lv_math.h" #include "lv_math.h"
@ -14,6 +13,7 @@
#include "lv_assert.h" #include "lv_assert.h"
#include "../stdlib/lv_mem.h" #include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
#include "../misc/lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -15,12 +15,10 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdbool.h> #include "lv_types.h"
#include <stdarg.h>
#include "lv_area.h" #include "lv_area.h"
#include "../font/lv_font.h" #include "../font/lv_font.h"
#include "../stdlib/lv_sprintf.h" #include "../stdlib/lv_sprintf.h"
#include "lv_types.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@ -6,10 +6,10 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include "lv_bidi.h" #include "lv_bidi.h"
#include "lv_text.h" #include "lv_text.h"
#include "lv_text_ap.h" #include "lv_text_ap.h"
#include "lv_types.h"
#include "../stdlib/lv_mem.h" #include "../stdlib/lv_mem.h"
#include "../draw/lv_draw.h" #include "../draw/lv_draw.h"

View File

@ -13,8 +13,8 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include "lv_text.h" #include "lv_text.h"
#include "lv_types.h"
#include "../draw/lv_draw.h" #include "../draw/lv_draw.h"
#if LV_USE_ARABIC_PERSIAN_CHARS == 1 #if LV_USE_ARABIC_PERSIAN_CHARS == 1

View File

@ -17,9 +17,6 @@ extern "C" {
#include "lv_types.h" #include "lv_types.h"
#include "lv_ll.h" #include "lv_ll.h"
#include <stdint.h>
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -16,7 +16,12 @@ extern "C" {
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <stdint.h> #include LV_STDINT_INCLUDE
#include LV_STDDEF_INCLUDE
#include LV_STDBOOL_INCLUDE
#include LV_INTTYPES_INCLUDE
#include LV_LIMITS_INCLUDE
#include LV_STDARG_INCLUDE
#endif #endif
/********************* /*********************

View File

@ -6,10 +6,9 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include <stddef.h>
#include "lv_utils.h" #include "lv_utils.h"
#include "lv_fs.h" #include "lv_fs.h"
#include "lv_types.h"
#include "cache/lv_image_cache.h" #include "cache/lv_image_cache.h"
/********************* /*********************

View File

@ -17,8 +17,6 @@ extern "C" {
#include "lv_types.h" #include "lv_types.h"
#include "../draw/lv_draw_buf.h" #include "../draw/lv_draw_buf.h"
#include <stdint.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -20,7 +20,6 @@ extern "C" {
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include "../misc/lv_types.h" #include "../misc/lv_types.h"
#include <stddef.h>
#if LV_USE_OS == LV_OS_NONE #if LV_USE_OS == LV_OS_NONE
#include "lv_os_none.h" #include "lv_os_none.h"

View File

@ -9,7 +9,6 @@
#include "lv_ime_pinyin.h" #include "lv_ime_pinyin.h"
#if LV_USE_IME_PINYIN != 0 #if LV_USE_IME_PINYIN != 0
#include <stdio.h>
#include "../../lvgl.h" #include "../../lvgl.h"
/********************* /*********************
@ -627,7 +626,7 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
uint16_t tmp_button_str_len = lv_strlen(pinyin_ime->input_char); uint16_t tmp_button_str_len = lv_strlen(pinyin_ime->input_char);
if((btn_id >= 16) && (tmp_button_str_len > 0) && (btn_id < (16 + LV_IME_PINYIN_K9_CAND_TEXT_NUM))) { if((btn_id >= 16) && (tmp_button_str_len > 0) && (btn_id < (16 + LV_IME_PINYIN_K9_CAND_TEXT_NUM))) {
lv_memzero(pinyin_ime->input_char, sizeof(pinyin_ime->input_char)); lv_memzero(pinyin_ime->input_char, sizeof(pinyin_ime->input_char));
strcat(pinyin_ime->input_char, txt); lv_strcat(pinyin_ime->input_char, txt);
pinyin_input_proc(obj); pinyin_input_proc(obj);
for(int index = 0; index < (pinyin_ime->ta_count + tmp_button_str_len); index++) { for(int index = 0; index < (pinyin_ime->ta_count + tmp_button_str_len); index++) {
@ -706,7 +705,7 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
} }
else if((pinyin_ime->mode == LV_IME_PINYIN_MODE_K26) && ((txt[0] >= 'a' && txt[0] <= 'z') || (txt[0] >= 'A' && else if((pinyin_ime->mode == LV_IME_PINYIN_MODE_K26) && ((txt[0] >= 'a' && txt[0] <= 'z') || (txt[0] >= 'A' &&
txt[0] <= 'Z'))) { txt[0] <= 'Z'))) {
strcat(pinyin_ime->input_char, txt); lv_strcat(pinyin_ime->input_char, txt);
pinyin_input_proc(obj); pinyin_input_proc(obj);
pinyin_ime->ta_count++; pinyin_ime->ta_count++;
} }

View File

@ -171,6 +171,17 @@ void * LV_ATTRIBUTE_FAST_MEM lv_memmove(void * dst, const void * src, size_t len
return dst; return dst;
} }
int32_t lv_memcmp(const void * p1, const void * p2, size_t len)
{
const char * s1 = (const char *) p1;
const char * s2 = (const char *) p2;
while(--len > 0 && (*s1 == *s2)) {
s1++;
s2++;
}
return *s1 - *s2;
}
/* See https://en.cppreference.com/w/c/string/byte/strlen for reference */ /* See https://en.cppreference.com/w/c/string/byte/strlen for reference */
size_t lv_strlen(const char * str) size_t lv_strlen(const char * str)
{ {
@ -212,10 +223,20 @@ char * lv_strdup(const char * src)
char * dst = lv_malloc(len); char * dst = lv_malloc(len);
if(dst == NULL) return NULL; if(dst == NULL) return NULL;
lv_memcpy(dst, src, len); /*do memcpy is faster than strncpy when length is known*/ lv_memcpy(dst, src, len); /*memcpy is faster than strncpy when length is known*/
return dst; return dst;
} }
char * lv_strcat(char * dst, const char * src)
{
char * tmp = dst;
while(*dst != '\0') {
dst++;
}
lv_strcpy(dst, src);
return tmp;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/

View File

@ -1,11 +1,11 @@
#include "../../lv_conf_internal.h" #include "../../lv_conf_internal.h"
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
#include <limits.h>
#include "lv_tlsf.h" #include "lv_tlsf.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"
#include "../../misc/lv_log.h" #include "../../misc/lv_log.h"
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../../misc/lv_types.h"
#undef printf #undef printf
#define printf LV_LOG_ERROR #define printf LV_LOG_ERROR

View File

@ -41,10 +41,9 @@
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stddef.h>
#include "../../osal/lv_os.h" #include "../../osal/lv_os.h"
#include "../../misc/lv_ll.h" #include "../../misc/lv_ll.h"
#include "../../misc/lv_types.h"
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {

View File

@ -50,6 +50,11 @@ void * LV_ATTRIBUTE_FAST_MEM lv_memmove(void * dst, const void * src, size_t len
return memmove(dst, src, len); return memmove(dst, src, len);
} }
int32_t lv_memcmp(const void * p1, const void * p2, size_t len)
{
return memcmp(p1, p2, len);
}
size_t lv_strlen(const char * str) size_t lv_strlen(const char * str)
{ {
return strlen(str); return strlen(str);
@ -86,6 +91,11 @@ char * lv_strdup(const char * src)
return dst; return dst;
} }
char * lv_strcat(char * dst, const char * src)
{
return strcat(dst, src);
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/

View File

@ -15,9 +15,7 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h> #include "lv_string.h"
#include <stddef.h>
#include <string.h>
#include "../misc/lv_types.h" #include "../misc/lv_types.h"

View File

@ -7,8 +7,8 @@
#define _LV_SPRINTF_H_ #define _LV_SPRINTF_H_
#if defined(__has_include) #if defined(__has_include)
#if __has_include(<inttypes.h>) #if __has_include(LV_INTTYPES_INCLUDE)
#include <inttypes.h> #include LV_INTTYPES_INCLUDE
/* platform-specific printf format for int32_t, usually "d" or "ld" */ /* platform-specific printf format for int32_t, usually "d" or "ld" */
#define LV_PRId32 PRId32 #define LV_PRId32 PRId32
#define LV_PRIu32 PRIu32 #define LV_PRIu32 PRIu32
@ -28,9 +28,7 @@
#define LV_PRIX32 "X" #define LV_PRIX32 "X"
#endif #endif
#include <stdbool.h> #include "../misc/lv_types.h"
#include <stdarg.h>
#include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -14,8 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h> #include "../misc/lv_types.h"
#include <stddef.h>
/********************* /*********************
* DEFINES * DEFINES
@ -57,6 +56,15 @@ void lv_memset(void * dst, uint8_t v, size_t len);
*/ */
void * lv_memmove(void * dst, const void * src, size_t len); void * lv_memmove(void * dst, const void * src, size_t len);
/**
* @brief This function will compare two memory blocks
* @param p1 Pointer to the first memory block
* @param p2 Pointer to the second memory block
* @param len Number of bytes to compare
* @return The difference between the value of the first unmatching byte.
*/
int32_t lv_memcmp(const void * p1, const void * p2, size_t len);
/** /**
* Same as `memset(dst, 0x00, len)`. * Same as `memset(dst, 0x00, len)`.
* @param dst pointer to the destination buffer * @param dst pointer to the destination buffer
@ -107,6 +115,15 @@ int32_t lv_strcmp(const char * s1, const char * s2);
*/ */
char * lv_strdup(const char * src); char * lv_strdup(const char * src);
/**
* @brief Copies the string pointed to by src, including the terminating null character,
* to the end of the string pointed to by dst.
* @param dst Pointer to the destination string where the content is to be appended.
* @param src Pointer to the source of data to be copied.
* @return A pointer to the destination string, which is dst.
*/
char * lv_strcat(char * dst, const char * src);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@ -55,6 +55,11 @@ size_t lv_strlen(const char * str)
return rt_strlen(str); return rt_strlen(str);
} }
int32_t lv_memcmp(const void * p1, const void * p2, size_t len)
{
return rt_memcmp(p1, p2, len);
}
char * lv_strncpy(char * dst, const char * src, size_t dest_size) char * lv_strncpy(char * dst, const char * src, size_t dest_size)
{ {
return rt_strncpy(dst, src, dest_size); return rt_strncpy(dst, src, dest_size);
@ -72,17 +77,17 @@ int32_t lv_strcmp(const char * s1, const char * s2)
char * lv_strdup(const char * src) char * lv_strdup(const char * src)
{ {
/*strdup uses rt_malloc, so use the lv_malloc when LV_USE_STDLIB_MALLOC is not LV_STDLIB_RTTHREAD */
#if LV_USE_STDLIB_MALLOC != LV_STDLIB_RTTHREAD
size_t len = lv_strlen(src) + 1; size_t len = lv_strlen(src) + 1;
char * dst = lv_malloc(len); char * dst = lv_malloc(len);
if(dst == NULL) return NULL; if(dst == NULL) return NULL;
lv_memcpy(dst, src, len); /*do memcpy is faster than strncpy when length is known*/ lv_memcpy(dst, src, len); /*memcpy is faster than strncpy when length is known*/
return dst; return dst;
#else }
return rt_strdup(src);
#endif char * lv_strcat(char * dst, const char * src)
{
return strcat(dst, src);
} }
/********************** /**********************

View File

@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_tick.h" #include "lv_tick.h"
#include <stddef.h> #include "../misc/lv_types.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
/********************* /*********************

View File

@ -15,8 +15,7 @@ extern "C" {
*********************/ *********************/
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include <stdint.h> #include "../misc/lv_types.h"
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -130,7 +130,7 @@ void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * map[])
uint32_t unit_cnt = 0; /*Number of units in a row*/ uint32_t unit_cnt = 0; /*Number of units in a row*/
uint32_t btn_cnt = 0; /*Number of buttons in a row*/ uint32_t btn_cnt = 0; /*Number of buttons in a row*/
/*Count the buttons and units in this row*/ /*Count the buttons and units in this row*/
while(map_row[btn_cnt] && strcmp(map_row[btn_cnt], "\n") != 0 && map_row[btn_cnt][0] != '\0') { while(map_row[btn_cnt] && lv_strcmp(map_row[btn_cnt], "\n") != 0 && map_row[btn_cnt][0] != '\0') {
unit_cnt += get_button_width(btnm->ctrl_bits[btn_tot_i + btn_cnt]); unit_cnt += get_button_width(btnm->ctrl_bits[btn_tot_i + btn_cnt]);
btn_cnt++; btn_cnt++;
} }
@ -325,7 +325,7 @@ const char * lv_buttonmatrix_get_button_text(const lv_obj_t * obj, uint32_t btn_
while(btn_i != btn_id) { while(btn_i != btn_id) {
btn_i++; btn_i++;
txt_i++; txt_i++;
if(strcmp(btnm->map_p[txt_i], "\n") == 0) txt_i++; if(lv_strcmp(btnm->map_p[txt_i], "\n") == 0) txt_i++;
} }
if(btn_i == btnm->btn_cnt) return NULL; if(btn_i == btnm->btn_cnt) return NULL;
@ -703,7 +703,7 @@ static void draw_main(lv_event_t * e)
for(btn_i = 0; btn_i < btnm->btn_cnt; btn_i++, txt_i++) { for(btn_i = 0; btn_i < btnm->btn_cnt; btn_i++, txt_i++) {
/*Search the next valid text in the map*/ /*Search the next valid text in the map*/
while(strcmp(btnm->map_p[txt_i], "\n") == 0) { while(lv_strcmp(btnm->map_p[txt_i], "\n") == 0) {
txt_i++; txt_i++;
} }
@ -818,7 +818,7 @@ static void allocate_button_areas_and_controls(const lv_obj_t * obj, const char
uint32_t btn_cnt = 0; uint32_t btn_cnt = 0;
uint32_t i = 0; uint32_t i = 0;
while(map[i] && map[i][0] != '\0') { while(map[i] && map[i][0] != '\0') {
if(strcmp(map[i], "\n") != 0) { /*Do not count line breaks*/ if(lv_strcmp(map[i], "\n") != 0) { /*Do not count line breaks*/
btn_cnt++; btn_cnt++;
} }
else { else {
@ -1029,7 +1029,7 @@ static bool has_popovers_in_top_row(lv_obj_t * obj)
const char ** map_row = btnm->map_p; const char ** map_row = btnm->map_p;
uint32_t btn_cnt = 0; uint32_t btn_cnt = 0;
while(map_row[btn_cnt] && strcmp(map_row[btn_cnt], "\n") != 0 && map_row[btn_cnt][0] != '\0') { while(map_row[btn_cnt] && lv_strcmp(map_row[btn_cnt], "\n") != 0 && map_row[btn_cnt][0] != '\0') {
if(button_is_popover(btnm->ctrl_bits[btn_cnt])) { if(button_is_popover(btnm->ctrl_bits[btn_cnt])) {
return true; return true;
} }

View File

@ -20,7 +20,6 @@
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_text_ap.h" #include "../../misc/lv_text_ap.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES
@ -246,7 +245,7 @@ void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos)
#else #else
_lv_text_ap_proc(option, ins_buf); _lv_text_ap_proc(option, ins_buf);
#endif #endif
if(pos < dropdown->option_cnt) strcat(ins_buf, "\n"); if(pos < dropdown->option_cnt) lv_strcat(ins_buf, "\n");
_lv_text_ins(dropdown->options, _lv_text_encoded_get_char_id(dropdown->options, insert_pos), ins_buf); _lv_text_ins(dropdown->options, _lv_text_encoded_get_char_id(dropdown->options, insert_pos), ins_buf);
lv_free(ins_buf); lv_free(ins_buf);
@ -412,7 +411,7 @@ int32_t lv_dropdown_get_option_index(lv_obj_t * obj, const char * option)
while(start[0] != '\0') { while(start[0] != '\0') {
for(char_i = 0; (start[char_i] != '\n') && (start[char_i] != '\0'); char_i++); for(char_i = 0; (start[char_i] != '\n') && (start[char_i] != '\0'); char_i++);
if(option_len == char_i && memcmp(start, option, LV_MIN(option_len, char_i)) == 0) { if(option_len == char_i && lv_memcmp(start, option, LV_MIN(option_len, char_i)) == 0) {
return opt_i; return opt_i;
} }

View File

@ -14,8 +14,6 @@
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"
#include <stdlib.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/

View File

@ -17,7 +17,7 @@ extern "C" {
#if LV_USE_LABEL != 0 #if LV_USE_LABEL != 0
#include <stdarg.h> #include "../../misc/lv_types.h"
#include "../../core/lv_obj.h" #include "../../core/lv_obj.h"
#include "../../font/lv_font.h" #include "../../font/lv_font.h"
#include "../../font/lv_symbol_def.h" #include "../../font/lv_symbol_def.h"

View File

@ -11,10 +11,8 @@
#if LV_USE_LINE != 0 #if LV_USE_LINE != 0
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
#include "../../draw/lv_draw.h" #include "../../draw/lv_draw.h"
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES

View File

@ -440,7 +440,7 @@ int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width)
span_text_check(&cur_txt); span_text_check(&cur_txt);
uint32_t cur_txt_ofs = 0; uint32_t cur_txt_ofs = 0;
lv_snippet_t snippet; /* use to save cur_span info and push it to stack */ lv_snippet_t snippet; /* use to save cur_span info and push it to stack */
memset(&snippet, 0, sizeof(snippet)); lv_memset(&snippet, 0, sizeof(snippet));
int32_t line_cnt = 0; int32_t line_cnt = 0;
int32_t lines = spans->lines < 0 ? INT32_MAX : spans->lines; int32_t lines = spans->lines < 0 ? INT32_MAX : spans->lines;
@ -656,7 +656,7 @@ static void lv_snippet_push(lv_snippet_t * item)
{ {
struct _snippet_stack * stack_p = snippet_stack; struct _snippet_stack * stack_p = snippet_stack;
if(stack_p->index < LV_SPAN_SNIPPET_STACK_SIZE) { if(stack_p->index < LV_SPAN_SNIPPET_STACK_SIZE) {
memcpy(&stack_p->stack[stack_p->index], item, sizeof(lv_snippet_t)); lv_memcpy(&stack_p->stack[stack_p->index], item, sizeof(lv_snippet_t));
stack_p->index++; stack_p->index++;
} }
else { else {

View File

@ -1019,7 +1019,7 @@ static size_t get_cell_txt_len(const char * txt)
#if LV_USE_ARABIC_PERSIAN_CHARS #if LV_USE_ARABIC_PERSIAN_CHARS
retval = sizeof(lv_table_cell_t) + _lv_text_ap_calc_bytes_count(txt) + 1; retval = sizeof(lv_table_cell_t) + _lv_text_ap_calc_bytes_count(txt) + 1;
#else #else
retval = sizeof(lv_table_cell_t) + strlen(txt) + 1; retval = sizeof(lv_table_cell_t) + lv_strlen(txt) + 1;
#endif #endif
return retval; return retval;
@ -1031,7 +1031,7 @@ static void copy_cell_txt(lv_table_cell_t * dst, const char * txt)
#if LV_USE_ARABIC_PERSIAN_CHARS #if LV_USE_ARABIC_PERSIAN_CHARS
_lv_text_ap_proc(txt, dst->txt); _lv_text_ap_proc(txt, dst->txt);
#else #else
strcpy(dst->txt, txt); lv_strcpy(dst->txt, txt);
#endif #endif
} }

View File

@ -9,7 +9,6 @@
#include "lv_textarea.h" #include "lv_textarea.h"
#if LV_USE_TEXTAREA != 0 #if LV_USE_TEXTAREA != 0
#include <string.h>
#include "../../core/lv_group.h" #include "../../core/lv_group.h"
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "../../indev/lv_indev.h" #include "../../indev/lv_indev.h"

View File

@ -1,6 +1,5 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#if LV_BUILD_TEST #if LV_BUILD_TEST
/*TestKERNOne.otf from https://github.com/unicode-org/text-rendering-tests*/ /*TestKERNOne.otf from https://github.com/unicode-org/text-rendering-tests*/

View File

@ -4,6 +4,7 @@
#include "unity/unity.h" #include "unity/unity.h"
#if LV_USE_QRCODE #if LV_USE_QRCODE
#include <string.h>
static lv_obj_t * active_screen = NULL; static lv_obj_t * active_screen = NULL;

View File

@ -2,6 +2,7 @@
#include "../lvgl.h" #include "../lvgl.h"
#include "unity/unity.h" #include "unity/unity.h"
#include <string.h>
const char * read_exp = const char * read_exp =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sed maximus orci. Morbi massa nisi, varius eu convallis ac, venenatis at metus. In in nibh id urna pretium feugiat vitae eu libero. Ut eget fringilla eros. Nunc ullamcorper lectus mauris, vel rhoncus velit volutpat et. Phasellus sed molestie massa. Maecenas quis dui sollicitudin, vulputate nunc ut, dictum quam. Nam a congue lorem. Nulla non facilisis sapien. Ut luctus nulla nibh, sed finibus urna porta non. Duis aliquet augue id urna euismod auctor. Integer pellentesque vulputate enim non mattis. Donec finibus mattis dolor, et feugiat nisi pharetra porta. Mauris ullamcorper cursus magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus."; "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sed maximus orci. Morbi massa nisi, varius eu convallis ac, venenatis at metus. In in nibh id urna pretium feugiat vitae eu libero. Ut eget fringilla eros. Nunc ullamcorper lectus mauris, vel rhoncus velit volutpat et. Phasellus sed molestie massa. Maecenas quis dui sollicitudin, vulputate nunc ut, dictum quam. Nam a congue lorem. Nulla non facilisis sapien. Ut luctus nulla nibh, sed finibus urna porta non. Duis aliquet augue id urna euismod auctor. Integer pellentesque vulputate enim non mattis. Donec finibus mattis dolor, et feugiat nisi pharetra porta. Mauris ullamcorper cursus magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.";

View File

@ -2,6 +2,7 @@
#include "../lvgl.h" #include "../lvgl.h"
#include "unity/unity.h" #include "unity/unity.h"
#include <string.h>
#define OUTPUT_LINE_MAX 8 #define OUTPUT_LINE_MAX 8
#define OUTPUT_BUF_MAX 128 #define OUTPUT_BUF_MAX 128

View File

@ -2,6 +2,7 @@
#include "../lvgl.h" #include "../lvgl.h"
#include "unity/unity.h" #include "unity/unity.h"
#include <string.h>
void test_txt_should_insert_string_into_another(void) void test_txt_should_insert_string_into_another(void)
{ {

View File

@ -3,6 +3,7 @@
#include "unity/unity.h" #include "unity/unity.h"
#include "lv_test_indev.h" #include "lv_test_indev.h"
#include <string.h>
void setUp(void) void setUp(void)
{ {

View File

@ -2,6 +2,7 @@
#include "../lvgl.h" #include "../lvgl.h"
#include "unity/unity.h" #include "unity/unity.h"
#include <string.h>
static const char * long_text = static const char * long_text =
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada ultrices magna in rutrum."; "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras malesuada ultrices magna in rutrum.";

View File

@ -2,6 +2,7 @@
#include "../lvgl.h" #include "../lvgl.h"
#include "unity/unity.h" #include "unity/unity.h"
#include <string.h>
void test_obj_id_should_match_class_name(void) void test_obj_id_should_match_class_name(void)
{ {

View File

@ -3,6 +3,7 @@
#include "unity/unity.h" #include "unity/unity.h"
#include "lv_test_indev.h" #include "lv_test_indev.h"
#include <string.h>
#define OPTION_BUFFER_SZ (20U) #define OPTION_BUFFER_SZ (20U)
#define OPTION_SMALL_BUFFER_SZ (3U) #define OPTION_SMALL_BUFFER_SZ (3U)