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

chore(stdlib): replace strcmp with lv_strcmp (#4875)

Signed-off-by: lhdjply <lhdjply@126.com>
This commit is contained in:
lhdjply 2023-11-28 17:37:00 +08:00 committed by GitHub
parent b42cb43074
commit e2646e0f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 75 additions and 70 deletions

View File

@ -176,7 +176,7 @@ static uint32_t get_plane_property_id(drm_dev_t * drm_dev, const char * name)
LV_LOG_TRACE("Find plane property: %s", name);
for(i = 0; i < drm_dev->count_plane_props; ++i)
if(!strcmp(drm_dev->plane_props[i]->name, name))
if(!lv_strcmp(drm_dev->plane_props[i]->name, name))
return drm_dev->plane_props[i]->prop_id;
LV_LOG_TRACE("Unknown plane property: %s", name);
@ -191,7 +191,7 @@ static uint32_t get_crtc_property_id(drm_dev_t * drm_dev, const char * name)
LV_LOG_TRACE("Find crtc property: %s", name);
for(i = 0; i < drm_dev->count_crtc_props; ++i)
if(!strcmp(drm_dev->crtc_props[i]->name, name))
if(!lv_strcmp(drm_dev->crtc_props[i]->name, name))
return drm_dev->crtc_props[i]->prop_id;
LV_LOG_TRACE("Unknown crtc property: %s", name);
@ -206,7 +206,7 @@ static uint32_t get_conn_property_id(drm_dev_t * drm_dev, const char * name)
LV_LOG_TRACE("Find conn property: %s", name);
for(i = 0; i < drm_dev->count_conn_props; ++i)
if(!strcmp(drm_dev->conn_props[i]->name, name))
if(!lv_strcmp(drm_dev->conn_props[i]->name, name))
return drm_dev->conn_props[i]->prop_id;
LV_LOG_TRACE("Unknown conn property: %s", name);

View File

@ -93,7 +93,7 @@ lv_result_t lv_bin_decoder_info(lv_image_decoder_t * decoder, const void * src,
}
else if(src_type == LV_IMAGE_SRC_FILE) {
/*Support only "*.bin" files*/
if(strcmp(lv_fs_get_ext(src), "bin")) return LV_RESULT_INVALID;
if(lv_strcmp(lv_fs_get_ext(src), "bin")) return LV_RESULT_INVALID;
lv_fs_file_t f;
lv_fs_res_t res = lv_fs_open(&f, src, LV_FS_MODE_RD);
@ -147,7 +147,7 @@ lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
/*Open the file if it's a file*/
if(dsc->src_type == LV_IMAGE_SRC_FILE) {
/*Support only "*.bin" files*/
if(strcmp(lv_fs_get_ext(dsc->src), "bin")) return LV_RESULT_INVALID;
if(lv_strcmp(lv_fs_get_ext(dsc->src), "bin")) return LV_RESULT_INVALID;
/*If the file was open successfully save the file descriptor*/
decoder_data_t * decoder_data = get_decoder_data(dsc);

View File

@ -90,7 +90,7 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src,
/*If it's a BMP file...*/
if(src_type == LV_IMAGE_SRC_FILE) {
const char * fn = src;
if(strcmp(lv_fs_get_ext(fn), "bmp") == 0) { /*Check the extension*/
if(lv_strcmp(lv_fs_get_ext(fn), "bmp") == 0) { /*Check the extension*/
/*Save the data in the header*/
lv_fs_file_t f;
lv_fs_res_t res = lv_fs_open(&f, src, LV_FS_MODE_RD);
@ -100,14 +100,14 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src,
lv_fs_read(&f, headers, 54, NULL);
uint32_t w;
uint32_t h;
memcpy(&w, headers + 18, 4);
memcpy(&h, headers + 22, 4);
lv_memcpy(&w, headers + 18, 4);
lv_memcpy(&h, headers + 22, 4);
header->w = w;
header->h = h;
lv_fs_close(&f);
uint16_t bpp;
memcpy(&bpp, headers + 28, 2);
lv_memcpy(&bpp, headers + 28, 2);
switch(bpp) {
case 16:
header->cf = LV_COLOR_FORMAT_RGB565;
@ -150,12 +150,12 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
if(dsc->src_type == LV_IMAGE_SRC_FILE) {
const char * fn = dsc->src;
if(strcmp(lv_fs_get_ext(fn), "bmp") != 0) {
if(lv_strcmp(lv_fs_get_ext(fn), "bmp") != 0) {
return LV_RESULT_INVALID; /*Check the extension*/
}
bmp_dsc_t b;
memset(&b, 0x00, sizeof(b));
lv_memset(&b, 0x00, sizeof(b));
lv_fs_res_t res = lv_fs_open(&b.f, dsc->src, LV_FS_MODE_RD);
if(res == LV_RESULT_OK) return LV_RESULT_INVALID;
@ -168,16 +168,16 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
return LV_RESULT_INVALID;
}
memcpy(&b.px_offset, header + 10, 4);
memcpy(&b.px_width, header + 18, 4);
memcpy(&b.px_height, header + 22, 4);
memcpy(&b.bpp, header + 28, 2);
lv_memcpy(&b.px_offset, header + 10, 4);
lv_memcpy(&b.px_width, header + 18, 4);
lv_memcpy(&b.px_height, header + 22, 4);
lv_memcpy(&b.bpp, header + 28, 2);
b.row_size_bytes = ((b.bpp * b.px_width + 31) / 32) * 4;
dsc->user_data = lv_malloc(sizeof(bmp_dsc_t));
LV_ASSERT_MALLOC(dsc->user_data);
if(dsc->user_data == NULL) return LV_RESULT_INVALID;
memcpy(dsc->user_data, &b, sizeof(b));
lv_memcpy(dsc->user_data, &b, sizeof(b));
dsc->img_data = NULL;
return LV_RESULT_OK;
}

View File

@ -262,7 +262,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
}
else lv_strcpy(fn, fno.fname);
} while(strcmp(fn, "/.") == 0 || strcmp(fn, "/..") == 0);
} while(lv_strcmp(fn, "/.") == 0 || lv_strcmp(fn, "/..") == 0);
return LV_FS_RES_OK;
}

View File

@ -248,7 +248,7 @@ static void * fs_dir_open(lv_fs_drv_t * drv, const char * path)
lv_strcpy(next_fn, "");
d = FindFirstFile(buf, &fdata);
do {
if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) {
if(lv_strcmp(fdata.cFileName, ".") == 0 || lv_strcmp(fdata.cFileName, "..") == 0) {
continue;
}
else {
@ -289,7 +289,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
else {
lv_strcpy(fn, "");
}
} while(strcmp(fn, "/.") == 0 || strcmp(fn, "/..") == 0);
} while(lv_strcmp(fn, "/.") == 0 || lv_strcmp(fn, "/..") == 0);
#else
lv_strcpy(fn, next_fn);
@ -298,7 +298,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
if(FindNextFile(dir_p, &fdata) == false) return LV_FS_RES_OK;
do {
if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) {
if(lv_strcmp(fdata.cFileName, ".") == 0 || lv_strcmp(fdata.cFileName, "..") == 0) {
continue;
}
else {

View File

@ -243,7 +243,7 @@ static void * fs_dir_open(lv_fs_drv_t * drv, const char * path)
lv_strcpy(handle->next_fn, "");
handle->dir_p = FindFirstFileA(buf, &fdata);
do {
if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) {
if(lv_strcmp(fdata.cFileName, ".") == 0 || lv_strcmp(fdata.cFileName, "..") == 0) {
continue;
}
else {
@ -288,7 +288,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
else {
lv_strcpy(fn, "");
}
} while(strcmp(fn, "/.") == 0 || strcmp(fn, "/..") == 0);
} while(lv_strcmp(fn, "/.") == 0 || lv_strcmp(fn, "/..") == 0);
#else
lv_strcpy(fn, handle->next_fn);
@ -297,7 +297,7 @@ static lv_fs_res_t fs_dir_read(lv_fs_drv_t * drv, void * dir_p, char * fn)
if(FindNextFileA(handle->dir_p, &fdata) == false) return LV_FS_RES_OK;
do {
if(strcmp(fdata.cFileName, ".") == 0 || strcmp(fdata.cFileName, "..") == 0) {
if(lv_strcmp(fdata.cFileName, ".") == 0 || lv_strcmp(fdata.cFileName, "..") == 0) {
continue;
}
else {

View File

@ -113,8 +113,8 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src,
return LV_RESULT_INVALID;
}
bool is_jpeg_ext = (strcmp(lv_fs_get_ext(fn), "jpg") == 0)
|| (strcmp(lv_fs_get_ext(fn), "jpeg") == 0);
bool is_jpeg_ext = (lv_strcmp(lv_fs_get_ext(fn), "jpg") == 0)
|| (lv_strcmp(lv_fs_get_ext(fn), "jpeg") == 0);
if(!IS_JPEG_SIGNATURE(jpg_signature)) {
if(is_jpeg_ext) {

View File

@ -90,7 +90,7 @@ static lv_result_t decoder_info(struct _lv_image_decoder_t * decoder, const void
/*If it's a PNG file...*/
if(src_type == LV_IMAGE_SRC_FILE) {
const char * fn = src;
if(strcmp(lv_fs_get_ext(fn), "png") == 0) { /*Check the extension*/
if(lv_strcmp(lv_fs_get_ext(fn), "png") == 0) { /*Check the extension*/
/* Read the width and height from the file. They have a constant location:
* [16..23]: width
@ -168,7 +168,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
size_t png_data_size = 0;
if(dsc->src_type == LV_IMAGE_SRC_FILE) {
const char * fn = dsc->src;
if(strcmp(lv_fs_get_ext(fn), "png") == 0) { /*Check the extension*/
if(lv_strcmp(lv_fs_get_ext(fn), "png") == 0) { /*Check the extension*/
unsigned error;
error = lodepng_load_file((void *)&png_data, &png_data_size, fn); /*Load the file*/
if(error) {

View File

@ -212,7 +212,7 @@ static lv_res_t decoder_info(struct _lv_image_decoder_t * decoder,
lv_fs_file_t f;
lv_rle_file_header_t file_header = { 0 };
/*Support only "*.rle" files*/
if(strcmp(lv_fs_get_ext(src), "rle") != 0)
if(lv_strcmp(lv_fs_get_ext(src), "rle") != 0)
return LV_RES_INV;
res = lv_fs_open(&f, src, LV_FS_MODE_RD);

View File

@ -98,7 +98,7 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src,
}
else if(src_type == LV_IMAGE_SRC_FILE) {
const char * fn = src;
if((strcmp(lv_fs_get_ext(fn), "jpg") == 0) || (strcmp(lv_fs_get_ext(fn), "jpeg") == 0)) {
if((lv_strcmp(lv_fs_get_ext(fn), "jpg") == 0) || (lv_strcmp(lv_fs_get_ext(fn), "jpeg") == 0)) {
lv_fs_file_t f;
lv_fs_res_t res;
res = lv_fs_open(&f, fn, LV_FS_MODE_RD);
@ -169,7 +169,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
}
else if(dsc->src_type == LV_IMAGE_SRC_FILE) {
const char * fn = dsc->src;
if((strcmp(lv_fs_get_ext(fn), "jpg") == 0) || (strcmp(lv_fs_get_ext(fn), "jpeg") == 0)) {
if((lv_strcmp(lv_fs_get_ext(fn), "jpg") == 0) || (lv_strcmp(lv_fs_get_ext(fn), "jpeg") == 0)) {
lv_fs_res_t res;
res = lv_fs_open(f, fn, LV_FS_MODE_RD);
if(res != LV_FS_RES_OK) {

View File

@ -430,22 +430,22 @@ static void quick_access_event_handler(lv_event_t * e)
lv_obj_t * label = lv_obj_get_child(btn, -1);
char * label_text = lv_label_get_text(label);
if((strcmp(label_text, LV_SYMBOL_HOME " HOME") == 0)) {
if((lv_strcmp(label_text, LV_SYMBOL_HOME " HOME") == 0)) {
path = &(explorer->home_dir);
}
else if((strcmp(label_text, LV_SYMBOL_VIDEO " Video") == 0)) {
else if((lv_strcmp(label_text, LV_SYMBOL_VIDEO " Video") == 0)) {
path = &(explorer->video_dir);
}
else if((strcmp(label_text, LV_SYMBOL_IMAGE " Pictures") == 0)) {
else if((lv_strcmp(label_text, LV_SYMBOL_IMAGE " Pictures") == 0)) {
path = &(explorer->pictures_dir);
}
else if((strcmp(label_text, LV_SYMBOL_AUDIO " Music") == 0)) {
else if((lv_strcmp(label_text, LV_SYMBOL_AUDIO " Music") == 0)) {
path = &(explorer->music_dir);
}
else if((strcmp(label_text, LV_SYMBOL_FILE " Documents") == 0)) {
else if((lv_strcmp(label_text, LV_SYMBOL_FILE " Documents") == 0)) {
path = &(explorer->docs_dir);
}
else if((strcmp(label_text, LV_SYMBOL_DRIVE " File System") == 0)) {
else if((lv_strcmp(label_text, LV_SYMBOL_DRIVE " File System") == 0)) {
path = &(explorer->fs_dir);
}
@ -489,16 +489,16 @@ static void browser_file_event_handler(lv_event_t * e)
str_fn = lv_table_get_cell_value(explorer->file_table, row, col);
str_fn = str_fn + 5;
if((strcmp(str_fn, ".") == 0)) return;
if((lv_strcmp(str_fn, ".") == 0)) return;
if((strcmp(str_fn, "..") == 0) && (lv_strlen(explorer->current_path) > 3)) {
if((lv_strcmp(str_fn, "..") == 0) && (lv_strlen(explorer->current_path) > 3)) {
strip_ext(explorer->current_path);
/*Remove the last '/' character*/
strip_ext(explorer->current_path);
lv_snprintf((char *)file_name, sizeof(file_name), "%s", explorer->current_path);
}
else {
if(strcmp(str_fn, "..") != 0) {
if(lv_strcmp(str_fn, "..") != 0) {
lv_snprintf((char *)file_name, sizeof(file_name), "%s%s", explorer->current_path, str_fn);
}
}
@ -509,7 +509,7 @@ static void browser_file_event_handler(lv_event_t * e)
show_dir(obj, (char *)file_name);
}
else {
if(strcmp(str_fn, "..") != 0) {
if(lv_strcmp(str_fn, "..") != 0) {
explorer->sel_fn = str_fn;
lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
}
@ -668,9 +668,9 @@ static void sort_by_file_kind(lv_obj_t * tb, int16_t lo, int16_t hi)
int16_t gt = hi;
const char * v = lv_table_get_cell_value(tb, lo, 1);
while(i <= gt) {
if(strcmp(lv_table_get_cell_value(tb, i, 1), v) < 0)
if(lv_strcmp(lv_table_get_cell_value(tb, i, 1), v) < 0)
exch_table_item(tb, lt++, i++);
else if(strcmp(lv_table_get_cell_value(tb, i, 1), v) > 0)
else if(lv_strcmp(lv_table_get_cell_value(tb, i, 1), v) > 0)
exch_table_item(tb, i, gt--);
else
i++;

View File

@ -668,11 +668,11 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
}
#endif
if(strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) {
if(lv_strcmp(txt, "Enter") == 0 || lv_strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) {
pinyin_ime_clear_data(obj);
lv_obj_add_flag(pinyin_ime->cand_panel, LV_OBJ_FLAG_HIDDEN);
}
else if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) {
// del input char
if(pinyin_ime->ta_count > 0) {
if(pinyin_ime->mode == LV_IME_PINYIN_MODE_K26)
@ -701,12 +701,12 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
#endif
}
}
else if((strcmp(txt, "ABC") == 0) || (strcmp(txt, "abc") == 0) || (strcmp(txt, "1#") == 0) ||
(strcmp(txt, LV_SYMBOL_OK) == 0)) {
else if((lv_strcmp(txt, "ABC") == 0) || (lv_strcmp(txt, "abc") == 0) || (lv_strcmp(txt, "1#") == 0) ||
(lv_strcmp(txt, LV_SYMBOL_OK) == 0)) {
pinyin_ime_clear_data(obj);
return;
}
else if(strcmp(txt, "123") == 0) {
else if(lv_strcmp(txt, "123") == 0) {
for(uint16_t i = 0; i < lv_strlen(txt); i++)
lv_textarea_delete_char(ta);
@ -716,7 +716,7 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
lv_keyboard_set_mode(kb, LV_KEYBOARD_MODE_NUMBER);
lv_obj_add_flag(pinyin_ime->cand_panel, LV_OBJ_FLAG_HIDDEN);
}
else if(strcmp(txt, LV_SYMBOL_KEYBOARD) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_KEYBOARD) == 0) {
if(pinyin_ime->mode == LV_IME_PINYIN_MODE_K26) {
lv_ime_pinyin_set_mode(obj, LV_IME_PINYIN_MODE_K9);
}
@ -738,8 +738,8 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
#if LV_IME_PINYIN_USE_K9_MODE
else if((pinyin_ime->mode == LV_IME_PINYIN_MODE_K9) && (txt[0] >= 'a' && txt[0] <= 'z')) {
for(uint16_t i = 0; i < 8; i++) {
if((strcmp(txt, k9_py_map[i]) == 0) || (strcmp(txt, "abc ") == 0)) {
if(strcmp(txt, "abc ") == 0) pinyin_ime->k9_input_str_len += lv_strlen(k9_py_map[i]) + 1;
if((lv_strcmp(txt, k9_py_map[i]) == 0) || (lv_strcmp(txt, "abc ") == 0)) {
if(lv_strcmp(txt, "abc ") == 0) pinyin_ime->k9_input_str_len += lv_strlen(k9_py_map[i]) + 1;
else pinyin_ime->k9_input_str_len += lv_strlen(k9_py_map[i]);
pinyin_ime->k9_input_str[pinyin_ime->ta_count] = 50 + i;
pinyin_ime->k9_input_str[pinyin_ime->ta_count + 1] = '\0';
@ -751,10 +751,10 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e)
pinyin_k9_fill_cand(obj);
pinyin_input_proc(obj);
}
else if(strcmp(txt, LV_SYMBOL_LEFT) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_LEFT) == 0) {
pinyin_k9_cand_page_proc(obj, 0);
}
else if(strcmp(txt, LV_SYMBOL_RIGHT) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_RIGHT) == 0) {
pinyin_k9_cand_page_proc(obj, 1);
}
#endif

View File

@ -75,8 +75,8 @@ int32_t lv_strcmp(const char * s1, const char * s2)
char * lv_strdup(const char * src)
{
/*strdup uses malloc, so use the built in malloc if it's enabled */
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*strdup uses malloc, so use the lv_malloc when LV_USE_STDLIB_MALLOC is not LV_STDLIB_CLIB */
#if LV_USE_STDLIB_MALLOC != LV_STDLIB_CLIB
size_t len = lv_strlen(src) + 1;
char * dst = lv_malloc(len);
if(dst == NULL) return NULL;

View File

@ -84,9 +84,9 @@ char * lv_strncpy(char * dst, const char * src, size_t dest_size);
char * lv_strcpy(char * dst, const char * src);
/**
* Compare 2 strings
* @brief This function will compare two strings without specified length.
* @param s1 pointer to the first string
* @param s2 pointer to the first string
* @param s2 pointer to the second string
* @return the difference between the value of the first unmatching character.
*/
int32_t lv_strcmp(const char * s1, const char * s2);

View File

@ -63,10 +63,15 @@ char * lv_strcpy(char * dst, const char * src)
return rt_strcpy(dst, src);
}
int32_t lv_strcmp(const char * s1, const char * s2)
{
return rt_strcmp(s1, s2);
}
char * lv_strdup(const char * src)
{
/*strdup uses malloc, so use the built in malloc if it's enabled */
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*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;
char * dst = lv_malloc(len);
if(dst == NULL) return NULL;

View File

@ -331,33 +331,33 @@ void lv_keyboard_def_event_cb(lv_event_t * e)
const char * txt = lv_buttonmatrix_get_button_text(obj, btn_id);
if(txt == NULL) return;
if(strcmp(txt, "abc") == 0) {
if(lv_strcmp(txt, "abc") == 0) {
keyboard->mode = LV_KEYBOARD_MODE_TEXT_LOWER;
lv_buttonmatrix_set_map(obj, kb_map[LV_KEYBOARD_MODE_TEXT_LOWER]);
lv_keyboard_update_ctrl_map(obj);
return;
}
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
else if(strcmp(txt, "أب") == 0) {
else if(lv_strcmp(txt, "أب") == 0) {
keyboard->mode = LV_KEYBOARD_MODE_TEXT_ARABIC;
lv_buttonmatrix_set_map(obj, kb_map[LV_KEYBOARD_MODE_TEXT_ARABIC]);
lv_keyboard_update_ctrl_map(obj);
return;
}
#endif
else if(strcmp(txt, "ABC") == 0) {
else if(lv_strcmp(txt, "ABC") == 0) {
keyboard->mode = LV_KEYBOARD_MODE_TEXT_UPPER;
lv_buttonmatrix_set_map(obj, kb_map[LV_KEYBOARD_MODE_TEXT_UPPER]);
lv_keyboard_update_ctrl_map(obj);
return;
}
else if(strcmp(txt, "1#") == 0) {
else if(lv_strcmp(txt, "1#") == 0) {
keyboard->mode = LV_KEYBOARD_MODE_SPECIAL;
lv_buttonmatrix_set_map(obj, kb_map[LV_KEYBOARD_MODE_SPECIAL]);
lv_keyboard_update_ctrl_map(obj);
return;
}
else if(strcmp(txt, LV_SYMBOL_CLOSE) == 0 || strcmp(txt, LV_SYMBOL_KEYBOARD) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_CLOSE) == 0 || lv_strcmp(txt, LV_SYMBOL_KEYBOARD) == 0) {
lv_result_t res = lv_obj_send_event(obj, LV_EVENT_CANCEL, NULL);
if(res != LV_RESULT_OK) return;
@ -367,7 +367,7 @@ void lv_keyboard_def_event_cb(lv_event_t * e)
}
return;
}
else if(strcmp(txt, LV_SYMBOL_OK) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_OK) == 0) {
lv_result_t res = lv_obj_send_event(obj, LV_EVENT_READY, NULL);
if(res != LV_RESULT_OK) return;
@ -381,23 +381,23 @@ void lv_keyboard_def_event_cb(lv_event_t * e)
/*Add the characters to the text area if set*/
if(keyboard->ta == NULL) return;
if(strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) {
if(lv_strcmp(txt, "Enter") == 0 || lv_strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) {
lv_textarea_add_char(keyboard->ta, '\n');
if(lv_textarea_get_one_line(keyboard->ta)) {
lv_result_t res = lv_obj_send_event(keyboard->ta, LV_EVENT_READY, NULL);
if(res != LV_RESULT_OK) return;
}
}
else if(strcmp(txt, LV_SYMBOL_LEFT) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_LEFT) == 0) {
lv_textarea_cursor_left(keyboard->ta);
}
else if(strcmp(txt, LV_SYMBOL_RIGHT) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_RIGHT) == 0) {
lv_textarea_cursor_right(keyboard->ta);
}
else if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) {
else if(lv_strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) {
lv_textarea_delete_char(keyboard->ta);
}
else if(strcmp(txt, "+/-") == 0) {
else if(lv_strcmp(txt, "+/-") == 0) {
uint32_t cur = lv_textarea_get_cursor_pos(keyboard->ta);
const char * ta_txt = lv_textarea_get_text(keyboard->ta);
if(ta_txt[0] == '-') {

View File

@ -1268,7 +1268,7 @@ static lv_result_t insert_handler(lv_obj_t * obj, const char * txt)
if(ta_insert_replace) {
/*Add the replaced text directly it's different from the original*/
if(strcmp(ta_insert_replace, txt)) {
if(lv_strcmp(ta_insert_replace, txt)) {
lv_textarea_add_text(obj, ta_insert_replace);
return LV_RESULT_INVALID;
}