From 6c8b0c44beacdb1236b35f224d188240b5a9596c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 2 Dec 2019 12:20:01 +0100 Subject: [PATCH] fix conversation warnings --- src/lv_core/lv_debug.c | 2 +- src/lv_core/lv_debug.h | 2 +- src/lv_draw/lv_draw_img.c | 8 ++++---- src/lv_draw/lv_img_decoder.c | 2 +- src/lv_font/lv_font_fmt_txt.c | 14 +++++++------- src/lv_misc/lv_fs.c | 6 +++--- src/lv_misc/lv_mem.c | 4 ++-- src/lv_misc/lv_mem.h | 4 ++-- src/lv_misc/lv_txt.c | 6 +++--- src/lv_objx/lv_btn.c | 2 +- src/lv_objx/lv_btnm.c | 2 +- src/lv_objx/lv_calendar.c | 2 +- src/lv_objx/lv_calendar.h | 2 +- src/lv_objx/lv_canvas.c | 2 +- src/lv_objx/lv_cpicker.c | 2 +- src/lv_objx/lv_ddlist.c | 4 ++-- src/lv_objx/lv_imgbtn.c | 12 ++++++------ src/lv_objx/lv_label.c | 10 +++++----- src/lv_objx/lv_list.c | 2 +- src/lv_objx/lv_lmeter.c | 2 +- src/lv_objx/lv_lmeter.h | 4 ++-- src/lv_objx/lv_roller.c | 2 +- src/lv_objx/lv_spinbox.c | 6 +++--- src/lv_objx/lv_ta.c | 2 +- src/lv_objx/lv_tabview.c | 4 ++-- 25 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/lv_core/lv_debug.c b/src/lv_core/lv_debug.c index f5b02d541..83071af53 100644 --- a/src/lv_core/lv_debug.c +++ b/src/lv_core/lv_debug.c @@ -131,7 +131,7 @@ void lv_debug_log_error(const char * msg, uint64_t value) { static const char hex[] = "0123456789ABCDEF"; - uint32_t msg_len = strlen(msg); + size_t msg_len = strlen(msg); uint32_t value_len = sizeof(unsigned long int); if(msg_len < 230) { diff --git a/src/lv_core/lv_debug.h b/src/lv_core/lv_debug.h index f225f766a..72eb3367a 100644 --- a/src/lv_core/lv_debug.h +++ b/src/lv_core/lv_debug.h @@ -49,7 +49,7 @@ void lv_debug_log_error(const char * msg, uint64_t value); { \ if(!(expr)) { \ LV_LOG_ERROR(__func__); \ - lv_debug_log_error(msg, (unsigned long int)value); \ + lv_debug_log_error(msg, (uint64_t)value); \ while(1); \ } \ } diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c index 0f1f692d2..e19ba0152 100644 --- a/src/lv_draw/lv_draw_img.c +++ b/src/lv_draw/lv_draw_img.c @@ -79,7 +79,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, const lv_style_t * style) { lv_color_t p_color = LV_COLOR_BLACK; - if(x >= dsc->header.w) { + if(x >= (lv_coord_t)dsc->header.w) { x = dsc->header.w - 1; LV_LOG_WARN("lv_canvas_get_px: x is too large (out of canvas)"); } else if(x < 0) { @@ -87,7 +87,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t LV_LOG_WARN("lv_canvas_get_px: x is < 0 (out of canvas)"); } - if(y >= dsc->header.h) { + if(y >= (lv_coord_t)dsc->header.h) { y = dsc->header.h - 1; LV_LOG_WARN("lv_canvas_get_px: y is too large (out of canvas)"); } else if(y < 0) { @@ -158,7 +158,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t */ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y) { - if(x >= dsc->header.w) { + if(x >= (lv_coord_t)dsc->header.w) { x = dsc->header.w - 1; LV_LOG_WARN("lv_canvas_get_px: x is too large (out of canvas)"); } else if(x < 0) { @@ -166,7 +166,7 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y) LV_LOG_WARN("lv_canvas_get_px: x is < 0 (out of canvas)"); } - if(y >= dsc->header.h) { + if(y >= (lv_coord_t)dsc->header.h) { y = dsc->header.h - 1; LV_LOG_WARN("lv_canvas_get_px: y is too large (out of canvas)"); } else if(y < 0) { diff --git a/src/lv_draw/lv_img_decoder.c b/src/lv_draw/lv_img_decoder.c index b71624ceb..5505b90e2 100644 --- a/src/lv_draw/lv_img_decoder.c +++ b/src/lv_draw/lv_img_decoder.c @@ -124,7 +124,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const dsc->user_data = NULL; if(dsc->src_type == LV_IMG_SRC_FILE) { - uint16_t fnlen = strlen(src); + size_t fnlen = strlen(src); dsc->src = lv_mem_alloc(fnlen + 1); strcpy((char *)dsc->src, src); } else { diff --git a/src/lv_font/lv_font_fmt_txt.c b/src/lv_font/lv_font_fmt_txt.c index 6ca3bd015..f1490a919 100644 --- a/src/lv_font/lv_font_fmt_txt.c +++ b/src/lv_font/lv_font_fmt_txt.c @@ -107,7 +107,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic if(buf == NULL) return NULL; } - decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, fdsc->bpp); + decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w , gdsc->box_h, (uint8_t)fdsc->bpp); return buf; } @@ -150,7 +150,7 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out->box_w = gdsc->box_w; dsc_out->ofs_x = gdsc->ofs_x; dsc_out->ofs_y = gdsc->ofs_y; - dsc_out->bpp = fdsc->bpp; + dsc_out->bpp = (uint8_t)fdsc->bpp; return true; } @@ -186,7 +186,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter) uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare); if(p) { - uint32_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list; + lv_uintptr_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list; ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/ glyph_id = fdsc->cmaps[i].glyph_id_start + ofs; } @@ -195,7 +195,7 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter) uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length, sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare); if(p) { - uint32_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list; + lv_uintptr_t ofs = (lv_uintptr_t)p - (lv_uintptr_t) fdsc->cmaps[i].unicode_list; ofs = ofs >> 1; /*The list stores `uint16_t` so the get the index divide by 2*/ const uint8_t * gid_ofs_16 = fdsc->cmaps[i].glyph_id_ofs_list; glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_16[ofs]; @@ -232,7 +232,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t /*If the `g_id_both` were found get its index from the pointer*/ if(kid_p) { - uint32_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids; + lv_uintptr_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids; ofs = ofs >> 1; /*ofs is for pair, divide by 2 to refer as a single value*/ value = kdsc->values[ofs]; } @@ -240,12 +240,12 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t /* Use binary search to find the kern value. * The pairs are ordered left_id first, then right_id secondly. */ const uint16_t * g_ids = kdsc->glyph_ids; - uint32_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/ + lv_uintptr_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/ uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare); /*If the `g_id_both` were found get its index from the pointer*/ if(kid_p) { - uint32_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids; + lv_uintptr_t ofs = (lv_uintptr_t)kid_p - (lv_uintptr_t)g_ids; ofs = ofs >> 4; /*ofs is 4 byte pairs, divide by 4 to refer as a single value*/ value = kdsc->values[ofs]; } diff --git a/src/lv_misc/lv_fs.c b/src/lv_misc/lv_fs.c index 5723943f0..d4343c411 100644 --- a/src/lv_misc/lv_fs.c +++ b/src/lv_misc/lv_fs.c @@ -539,7 +539,7 @@ char * lv_fs_get_letters(char * buf) */ const char * lv_fs_get_ext(const char * fn) { - uint16_t i; + size_t i; for(i = strlen(fn); i > 0; i--) { if(fn[i] == '.') { return &fn[i + 1]; @@ -558,7 +558,7 @@ const char * lv_fs_get_ext(const char * fn) */ char * lv_fs_up(char * path) { - uint16_t len = strlen(path); + size_t len = strlen(path); if(len == 0) return path; len--; /*Go before the trailing '\0'*/ @@ -589,7 +589,7 @@ char * lv_fs_up(char * path) */ const char * lv_fs_get_last(const char * path) { - uint16_t len = strlen(path); + size_t len = strlen(path); if(len == 0) return path; len--; /*Go before the trailing '\0'*/ diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c index 116208ea8..f129c639f 100644 --- a/src/lv_misc/lv_mem.c +++ b/src/lv_misc/lv_mem.c @@ -107,7 +107,7 @@ void lv_mem_init(void) * @param size size of the memory to allocate in bytes * @return pointer to the allocated memory */ -void * lv_mem_alloc(uint32_t size) +void * lv_mem_alloc(size_t size) { if(size == 0) { return &zero_mem; @@ -222,7 +222,7 @@ void lv_mem_free(const void * data) #if LV_ENABLE_GC == 0 -void * lv_mem_realloc(void * data_p, uint32_t new_size) +void * lv_mem_realloc(void * data_p, size_t new_size) { /*data_p could be previously freed pointer (in this case it is invalid)*/ if(data_p != NULL) { diff --git a/src/lv_misc/lv_mem.h b/src/lv_misc/lv_mem.h index 2353122ee..d2c5f45d7 100644 --- a/src/lv_misc/lv_mem.h +++ b/src/lv_misc/lv_mem.h @@ -70,7 +70,7 @@ void lv_mem_init(void); * @param size size of the memory to allocate in bytes * @return pointer to the allocated memory */ -void * lv_mem_alloc(uint32_t size); +void * lv_mem_alloc(size_t size); /** * Free an allocated data @@ -85,7 +85,7 @@ void lv_mem_free(const void * data); * @param new_size the desired new size in byte * @return pointer to the new memory */ -void * lv_mem_realloc(void * data_p, uint32_t new_size); +void * lv_mem_realloc(void * data_p, size_t new_size); /** * Join the adjacent free memory blocks diff --git a/src/lv_misc/lv_txt.c b/src/lv_misc/lv_txt.c index 9255223ae..cee156434 100644 --- a/src/lv_misc/lv_txt.c +++ b/src/lv_misc/lv_txt.c @@ -416,8 +416,8 @@ bool lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c) */ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt) { - uint32_t old_len = strlen(txt_buf); - uint32_t ins_len = strlen(ins_txt); + size_t old_len = strlen(txt_buf); + size_t ins_len = strlen(ins_txt); uint32_t new_len = ins_len + old_len; pos = lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/ @@ -441,7 +441,7 @@ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt) void lv_txt_cut(char * txt, uint32_t pos, uint32_t len) { - uint32_t old_len = strlen(txt); + size_t old_len = strlen(txt); pos = lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/ len = lv_txt_encoded_get_byte_id(&txt[pos], len); diff --git a/src/lv_objx/lv_btn.c b/src/lv_objx/lv_btn.c index fa7880ef5..4cfe9527e 100644 --- a/src/lv_objx/lv_btn.c +++ b/src/lv_objx/lv_btn.c @@ -138,7 +138,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy) ext->ink_wait_time = copy_ext->ink_wait_time; ext->ink_out_time = copy_ext->ink_out_time; #endif - memcpy(ext->styles, copy_ext->styles, sizeof(ext->styles)); + memcpy((void*) ext->styles, copy_ext->styles, sizeof(ext->styles)); /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_btn); diff --git a/src/lv_objx/lv_btnm.c b/src/lv_objx/lv_btnm.c index 32869007a..b54436d5c 100644 --- a/src/lv_objx/lv_btnm.c +++ b/src/lv_objx/lv_btnm.c @@ -122,7 +122,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy) /*Copy an existing object*/ else { lv_btnm_ext_t * copy_ext = lv_obj_get_ext_attr(copy); - memcpy(ext->styles_btn, copy_ext->styles_btn, sizeof(ext->styles_btn)); + memcpy((void*)ext->styles_btn, copy_ext->styles_btn, sizeof(ext->styles_btn)); lv_btnm_set_map(new_btnm, lv_btnm_get_map_array(copy)); } diff --git a/src/lv_objx/lv_calendar.c b/src/lv_objx/lv_calendar.c index 8e4ceb584..53f32a225 100644 --- a/src/lv_objx/lv_calendar.c +++ b/src/lv_objx/lv_calendar.c @@ -700,7 +700,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask) /*Add the right arrow*/ arrow_style = ext->btn_pressing > 0 ? ext->style_header_pr : ext->style_header; header_area.x1 = header_area.x2 - ext->style_header->body.padding.right - - lv_txt_get_width(LV_SYMBOL_RIGHT, strlen(LV_SYMBOL_RIGHT), arrow_style->text.font, + lv_txt_get_width(LV_SYMBOL_RIGHT, (uint16_t)strlen(LV_SYMBOL_RIGHT), arrow_style->text.font, arrow_style->text.line_space, LV_TXT_FLAG_NONE); lv_draw_label(&header_area, mask, arrow_style, opa_scale, LV_SYMBOL_RIGHT, LV_TXT_FLAG_NONE, NULL, NULL, NULL, bidi_dir); } diff --git a/src/lv_objx/lv_calendar.h b/src/lv_objx/lv_calendar.h index 8d6c57ffa..21317bbd7 100644 --- a/src/lv_objx/lv_calendar.h +++ b/src/lv_objx/lv_calendar.h @@ -50,8 +50,8 @@ typedef struct lv_calendar_date_t showed_date; /*Currently visible month (day is ignored)*/ lv_calendar_date_t * highlighted_dates; /*Apply different style on these days (pointer to an array defined by the user)*/ - uint8_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/ int8_t btn_pressing; /*-1: prev month pressing, +1 next month pressing on the header*/ + uint16_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/ lv_calendar_date_t pressed_date; const char ** day_names; /*Pointer to an array with the name of the days (NULL: use default names)*/ const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/ diff --git a/src/lv_objx/lv_canvas.c b/src/lv_objx/lv_canvas.c index 58cd65cb2..8d2275aa5 100644 --- a/src/lv_objx/lv_canvas.c +++ b/src/lv_objx/lv_canvas.c @@ -254,7 +254,7 @@ void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, l LV_ASSERT_NULL(to_copy); lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas); - if(x + w >= ext->dsc.header.w || y + h >= ext->dsc.header.h) { + if(x + w >= (lv_coord_t)ext->dsc.header.w || y + h >= (lv_coord_t)ext->dsc.header.h) { LV_LOG_WARN("lv_canvas_copy_buf: x or y out of the canvas"); return; } diff --git a/src/lv_objx/lv_cpicker.c b/src/lv_objx/lv_cpicker.c index 2371cd04b..fa574bf90 100644 --- a/src/lv_objx/lv_cpicker.c +++ b/src/lv_objx/lv_cpicker.c @@ -889,7 +889,7 @@ static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * p if(ext->type == LV_CPICKER_TYPE_RECT) { /*If pressed long enough without change go to next color mode*/ uint32_t diff = lv_tick_elaps(ext->last_change_time); - if(diff > indev->driver.long_press_time * 2 && !ext->color_mode_fixed) { + if(diff > (uint32_t)indev->driver.long_press_time * 2 && !ext->color_mode_fixed) { next_color_mode(cpicker); lv_indev_wait_release(lv_indev_get_act()); return res; diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index a0100a74a..27855d637 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -388,7 +388,7 @@ void lv_ddlist_get_selected_str(const lv_obj_t * ddlist, char * buf, uint16_t bu uint16_t i; uint16_t line = 0; const char * opt_txt = lv_label_get_text(ext->label); - uint16_t txt_len = strlen(opt_txt); + size_t txt_len = strlen(opt_txt); for(i = 0; i < txt_len && line != ext->sel_opt_id; i++) { if(opt_txt[i] == '\n') line++; @@ -626,7 +626,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig new_style.text.color = sel_style->text.color; new_style.text.opa = sel_style->text.opa; lv_area_t area_arrow; - lv_coord_t arrow_width = lv_txt_get_width(LV_SYMBOL_DOWN, strlen(LV_SYMBOL_DOWN), sel_style->text.font, 0, 0); + lv_coord_t arrow_width = lv_txt_get_width(LV_SYMBOL_DOWN, (uint16_t)strlen(LV_SYMBOL_DOWN), sel_style->text.font, 0, 0); if(lv_label_get_align(ext->label) != LV_LABEL_ALIGN_RIGHT) { area_arrow.x2 = ddlist->coords.x2 - style->body.padding.right; area_arrow.x1 = area_arrow.x2 - arrow_width; diff --git a/src/lv_objx/lv_imgbtn.c b/src/lv_objx/lv_imgbtn.c index 69f97f450..23e15eb61 100644 --- a/src/lv_objx/lv_imgbtn.c +++ b/src/lv_objx/lv_imgbtn.c @@ -68,7 +68,7 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy) /*Initialize the allocated 'ext' */ #if LV_IMGBTN_TILED == 0 - memset(ext->img_src, 0, sizeof(ext->img_src)); + memset((void*)ext->img_src, 0, sizeof(ext->img_src)); #else memset(ext->img_src_left, 0, sizeof(ext->img_src_left)); memset(ext->img_src_mid, 0, sizeof(ext->img_src_mid)); @@ -89,11 +89,11 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy) else { lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy); #if LV_IMGBTN_TILED == 0 - memcpy(ext->img_src, copy_ext->img_src, sizeof(ext->img_src)); + memcpy(ext->img_src, (void*)copy_ext->img_src, sizeof(ext->img_src)); #else - memcpy(ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left)); - memcpy(ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid)); - memcpy(ext->img_src_right, copy_ext->img_src_right, sizeof(ext->img_src_right)); + memcpy(ext->img_src_left, (void*)copy_ext->img_src_left, sizeof(ext->img_src_left)); + memcpy(ext->img_src_mid, (void*)copy_ext->img_src_mid, sizeof(ext->img_src_mid)); + memcpy(ext->img_src_right, (void*)copy_ext->img_src_right, sizeof(ext->img_src_right)); #endif /*Refresh the style with new signal function*/ lv_obj_refresh_style(new_imgbtn); @@ -413,7 +413,7 @@ static void refr_img(lv_obj_t * imgbtn) if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) { const lv_style_t * style = ext->btn.styles[state]; header.h = lv_font_get_line_height(style->text.font); - header.w = lv_txt_get_width(src, strlen(src), style->text.font, style->text.letter_space, LV_TXT_FLAG_NONE); + header.w = lv_txt_get_width(src, (uint16_t)strlen(src), style->text.font, style->text.letter_space, LV_TXT_FLAG_NONE); header.always_zero = 0; header.cf = LV_IMG_CF_ALPHA_1BIT; } else { diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index 9d7072006..aa677b094 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -146,7 +146,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy) } if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr) { - int len = strlen(copy_ext->dot.tmp_ptr); + uint16_t len = (uint16_t )strlen(copy_ext->dot.tmp_ptr); lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len); } else { memcpy(ext->dot.tmp, copy_ext->dot.tmp, sizeof(ext->dot.tmp)); @@ -195,7 +195,7 @@ void lv_label_set_text(lv_obj_t * label, const char * text) if(ext->text == NULL) return; } else { /*Allocate space for the new text*/ - uint32_t len = strlen(text) + 1; + size_t len = strlen(text) + 1; if(ext->text != NULL && ext->static_txt == 0) { lv_mem_free(ext->text); ext->text = NULL; @@ -947,9 +947,9 @@ void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt) lv_obj_invalidate(label); /*Allocate space for the new text*/ - uint32_t old_len = strlen(ext->text); - uint32_t ins_len = strlen(txt); - uint32_t new_len = ins_len + old_len; + size_t old_len = strlen(ext->text); + size_t ins_len = strlen(txt); + size_t new_len = ins_len + old_len; ext->text = lv_mem_realloc(ext->text, new_len + 1); LV_ASSERT_MEM(ext->text); if(ext->text == NULL) return; diff --git a/src/lv_objx/lv_list.c b/src/lv_objx/lv_list.c index 2732428c9..cf18e73fa 100644 --- a/src/lv_objx/lv_list.c +++ b/src/lv_objx/lv_list.c @@ -319,7 +319,7 @@ void lv_list_set_btn_selected(lv_obj_t * list, lv_obj_t * btn) else if(s == LV_BTN_STATE_TGL_REL) lv_btn_set_state(ext->selected_btn, LV_BTN_STATE_TGL_PR); - lv_page_focus(list, ext->selected_btn, lv_list_get_anim_time(list)); + lv_page_focus(list, ext->selected_btn, LV_ANIM_ON); } } diff --git a/src/lv_objx/lv_lmeter.c b/src/lv_objx/lv_lmeter.c index 5843a7d34..d5d215770 100644 --- a/src/lv_objx/lv_lmeter.c +++ b/src/lv_objx/lv_lmeter.c @@ -165,7 +165,7 @@ void lv_lmeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max) * @param angle angle of the scale (0..360) * @param line_cnt number of lines */ -void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt) +void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt) { LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME); diff --git a/src/lv_objx/lv_lmeter.h b/src/lv_objx/lv_lmeter.h index bc098e1b8..b90b6ba40 100644 --- a/src/lv_objx/lv_lmeter.h +++ b/src/lv_objx/lv_lmeter.h @@ -37,7 +37,7 @@ typedef struct /*New data for this type */ uint16_t scale_angle; /*Angle of the scale in deg. (0..360)*/ uint16_t angle_ofs; - uint8_t line_cnt; /*Count of lines */ + uint16_t line_cnt; /*Count of lines */ int16_t cur_value; int16_t min_value; int16_t max_value; @@ -87,7 +87,7 @@ void lv_lmeter_set_range(lv_obj_t * lmeter, int16_t min, int16_t max); * @param angle angle of the scale (0..360) * @param line_cnt number of lines */ -void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt); +void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt); /** * Set the set an offset for the line meter's angles to rotate it. diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index 2798a7fbd..558610cda 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -154,7 +154,7 @@ void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mo } else { ext->mode = LV_ROLLER_MODE_INIFINITE; - uint32_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/ + size_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/ char * opt_extra = lv_mem_alloc(opt_len * LV_ROLLER_INF_PAGES); uint8_t i; for(i = 0; i < LV_ROLLER_INF_PAGES; i++) { diff --git a/src/lv_objx/lv_spinbox.c b/src/lv_objx/lv_spinbox.c index e5dcc1374..2f2aa4983 100644 --- a/src/lv_objx/lv_spinbox.c +++ b/src/lv_objx/lv_spinbox.c @@ -412,7 +412,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox) buf_p++; } - int i; + int32_t i; /*padding left*/ for(i = 0; i < ext->digit_padding_left; i++) { (*buf_p) = ' '; @@ -426,7 +426,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox) /*Add leading zeros*/ int lz_cnt = ext->digit_count - (int)strlen(digits); if(lz_cnt > 0) { - for(i = strlen(digits); i >= 0; i--) { + for(i = (uint16_t)strlen(digits); i >= 0; i--) { digits[i + lz_cnt] = digits[i]; } for(i = 0; i < lz_cnt; i++) { @@ -459,7 +459,7 @@ static void lv_spinbox_updatevalue(lv_obj_t * spinbox) /*Set the cursor position*/ int32_t step = ext->step; - uint8_t cur_pos = ext->digit_count; + uint8_t cur_pos = (uint8_t)ext->digit_count; while(step >= 10) { step /= 10; cur_pos--; diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index 1c6932f9e..b79f2ae81 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -689,7 +689,7 @@ void lv_ta_set_pwd_mode(lv_obj_t * ta, bool en) /*Pwd mode is now enabled*/ if(ext->pwd_mode == 0 && en != false) { char * txt = lv_label_get_text(ext->label); - uint16_t len = strlen(txt); + size_t len = strlen(txt); ext->pwd_tmp = lv_mem_alloc(len + 1); LV_ASSERT_MEM(ext->pwd_tmp); if(ext->pwd_tmp == NULL) return; diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index 8f323facb..79727b157 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -242,11 +242,11 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name) switch(ext->btns_pos) { case LV_TABVIEW_BTNS_POS_TOP: case LV_TABVIEW_BTNS_POS_BOTTOM: - ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1)); + ext->tab_name_ptr = lv_mem_realloc((void*)ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1)); break; case LV_TABVIEW_BTNS_POS_LEFT: case LV_TABVIEW_BTNS_POS_RIGHT: - ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt * 2)); + ext->tab_name_ptr = lv_mem_realloc((void*)ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt * 2)); break; }