From 3ae9a7839a74d410e74758023071e534b9d16f36 Mon Sep 17 00:00:00 2001 From: Pavel Brychta Date: Sun, 8 Dec 2019 14:04:20 +0100 Subject: [PATCH] LVgl 6.1.1 used --- library.json | 2 +- library.properties | 2 +- src/library.json | 2 +- src/src/lv_core/lv_debug.c | 2 +- src/src/lv_core/lv_debug.h | 2 +- src/src/lv_core/lv_disp.h | 2 +- src/src/lv_core/lv_obj.c | 20 ++++++++-------- src/src/lv_core/lv_obj.h | 16 ++++++------- src/src/lv_draw/lv_draw_basic.c | 2 +- src/src/lv_draw/lv_draw_img.c | 8 +++---- src/src/lv_draw/lv_img_decoder.c | 2 +- src/src/lv_font/lv_font.h | 2 +- src/src/lv_font/lv_font_fmt_txt.c | 16 ++++++------- src/src/lv_font/lv_font_fmt_txt.h | 1 - src/src/lv_misc/lv_color.h | 2 +- src/src/lv_misc/lv_fs.c | 10 ++++---- src/src/lv_misc/lv_ll.c | 8 ------- src/src/lv_misc/lv_mem.c | 12 +++++----- src/src/lv_misc/lv_mem.h | 16 +++---------- src/src/lv_misc/lv_txt.c | 14 +++++------ src/src/lv_misc/lv_types.h | 17 +++++++++++++- src/src/lv_objx/lv_btn.c | 2 +- src/src/lv_objx/lv_btnm.c | 2 +- src/src/lv_objx/lv_calendar.c | 2 +- src/src/lv_objx/lv_calendar.h | 2 +- src/src/lv_objx/lv_canvas.c | 2 +- src/src/lv_objx/lv_cpicker.c | 2 +- src/src/lv_objx/lv_ddlist.c | 4 ++-- src/src/lv_objx/lv_imgbtn.c | 12 +++++----- src/src/lv_objx/lv_label.c | 10 ++++---- src/src/lv_objx/lv_list.c | 2 +- src/src/lv_objx/lv_lmeter.c | 4 ++-- src/src/lv_objx/lv_lmeter.h | 6 ++--- src/src/lv_objx/lv_roller.c | 2 +- src/src/lv_objx/lv_spinbox.c | 12 +++++----- src/src/lv_objx/lv_ta.c | 3 +-- src/src/lv_objx/lv_table.c | 39 ++++++++++++++++--------------- src/src/lv_objx/lv_tabview.c | 4 ++-- src/src/lv_objx/lv_tileview.c | 3 ++- src/src/lv_version.h | 2 +- 40 files changed, 135 insertions(+), 138 deletions(-) diff --git a/library.json b/library.json index e7eccee..bc20b02 100644 --- a/library.json +++ b/library.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://github.com/littlevgl/arduino" }, - "version": "2.0.4", + "version": "2.1.4", "license": "MIT", "frameworks": "arduino", "build": { diff --git a/library.properties b/library.properties index 1f6ff64..f2702b7 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=lv_arduino -version=2.0.4 +version=2.1.4 author=Gabor Kiss-Vamosi maintainer=Pavel Brychta sentence=Full-featured Graphics Library for embedded systems diff --git a/src/library.json b/src/library.json index f634590..23ecc3f 100644 --- a/src/library.json +++ b/src/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "6.0.2", + "version": "6.1.1", "keywords": "graphics, gui, embedded, littlevgl", "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", "repository": diff --git a/src/src/lv_core/lv_debug.c b/src/src/lv_core/lv_debug.c index f5b02d5..83071af 100644 --- a/src/src/lv_core/lv_debug.c +++ b/src/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/src/lv_core/lv_debug.h b/src/src/lv_core/lv_debug.h index f225f76..72eb336 100644 --- a/src/src/lv_core/lv_debug.h +++ b/src/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/src/lv_core/lv_disp.h b/src/src/lv_core/lv_disp.h index 8f8f512..3047154 100644 --- a/src/src/lv_core/lv_disp.h +++ b/src/src/lv_core/lv_disp.h @@ -109,7 +109,7 @@ static inline lv_obj_t * lv_layer_top(void) } /** - * Get the active screen of the deafult display + * Get the active screen of the default display * @return pointer to the sys layer */ static inline lv_obj_t * lv_layer_sys(void) diff --git a/src/src/lv_core/lv_obj.c b/src/src/lv_core/lv_obj.c index dc4ff18..089c5e3 100644 --- a/src/src/lv_core/lv_obj.c +++ b/src/src/lv_core/lv_obj.c @@ -1839,7 +1839,7 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj) * @param obj pointer to an object * @return the width which still fits into the container */ -lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj) +lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -1853,7 +1853,7 @@ lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj) * @param obj pointer to an object * @return the height which still fits into the container */ -lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj) +lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -1867,7 +1867,7 @@ lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj) * @param obj pointer to an object * @return true: auto realign is enabled; false: auto realign is disabled */ -bool lv_obj_get_auto_realign(lv_obj_t * obj) +bool lv_obj_get_auto_realign(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -2250,7 +2250,7 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj) * @param obj pointer to an object which type should be get * @param buf pointer to an `lv_obj_type_t` buffer to store the types */ -void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf) +void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf) { LV_ASSERT_NULL(buf); LV_ASSERT_NULL(obj); @@ -2260,7 +2260,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf) memset(buf, 0, sizeof(lv_obj_type_t)); memset(&tmp, 0, sizeof(lv_obj_type_t)); - obj->signal_cb(obj, LV_SIGNAL_GET_TYPE, &tmp); + obj->signal_cb((lv_obj_t *)obj, LV_SIGNAL_GET_TYPE, &tmp); uint8_t cnt; for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) { @@ -2281,7 +2281,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf) * @param obj pointer to an object * @return user data */ -lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj) +lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); @@ -2293,11 +2293,11 @@ lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj) * @param obj pointer to an object * @return pointer to the user data */ -lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj) +lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, LV_OBJX_NAME); - return &obj->user_data; + return (lv_obj_user_data_t *)&obj->user_data; } /** @@ -2351,8 +2351,8 @@ bool lv_obj_is_focused(const lv_obj_t * obj) /** * Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal * @param obj pointer to an object - * @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback) - * @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved) + * @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback) + * @param name name of the object. E.g. "lv_btn". (Only the pointer is saved) * @return LV_RES_OK */ lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name) diff --git a/src/src/lv_core/lv_obj.h b/src/src/lv_core/lv_obj.h index 201dbc6..8698718 100644 --- a/src/src/lv_core/lv_obj.h +++ b/src/src/lv_core/lv_obj.h @@ -732,21 +732,21 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj); * @param obj pointer to an object * @return the width which still fits into the container */ -lv_coord_t lv_obj_get_width_fit(lv_obj_t * obj); +lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj); /** * Get that height reduced by the top an bottom padding. * @param obj pointer to an object * @return the height which still fits into the container */ -lv_coord_t lv_obj_get_height_fit(lv_obj_t * obj); +lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj); /** * Get the automatic realign property of the object. * @param obj pointer to an object * @return true: auto realign is enabled; false: auto realign is disabled */ -bool lv_obj_get_auto_realign(lv_obj_t * obj); +bool lv_obj_get_auto_realign(const lv_obj_t * obj); /** * Get the left padding of extended clickable area @@ -925,7 +925,7 @@ void * lv_obj_get_ext_attr(const lv_obj_t * obj); * @param obj pointer to an object which type should be get * @param buf pointer to an `lv_obj_type_t` buffer to store the types */ -void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf); +void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf); #if LV_USE_USER_DATA /** @@ -933,14 +933,14 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf); * @param obj pointer to an object * @return user data */ -lv_obj_user_data_t lv_obj_get_user_data(lv_obj_t * obj); +lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj); /** * Get a pointer to the object's user data * @param obj pointer to an object * @return pointer to the user data */ -lv_obj_user_data_t * lv_obj_get_user_data_ptr(lv_obj_t * obj); +lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj); /** * Set the object's user data. The data will be copied. @@ -974,8 +974,8 @@ bool lv_obj_is_focused(const lv_obj_t * obj); /** * Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal - * @param buf pointer to `lv_obj_type_t`. (`param` i nteh signal callback) - * @param name name of the object. E.g. "lv_btn". (Only teh pointer is saved) + * @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback) + * @param name name of the object. E.g. "lv_btn". (Only the pointer is saved) * @return LV_RES_OK */ lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name); diff --git a/src/src/lv_draw/lv_draw_basic.c b/src/src/lv_draw/lv_draw_basic.c index 6a0593b..462e152 100644 --- a/src/src/lv_draw/lv_draw_basic.c +++ b/src/src/lv_draw/lv_draw_basic.c @@ -333,7 +333,7 @@ void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv map_p += bit_ofs >> 3; uint8_t letter_px; - lv_opa_t px_opa; + lv_opa_t px_opa = 0; uint16_t col_bit; col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */ diff --git a/src/src/lv_draw/lv_draw_img.c b/src/src/lv_draw/lv_draw_img.c index 0f1f692..e19ba01 100644 --- a/src/src/lv_draw/lv_draw_img.c +++ b/src/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/src/lv_draw/lv_img_decoder.c b/src/src/lv_draw/lv_img_decoder.c index b71624c..5505b90 100644 --- a/src/src/lv_draw/lv_img_decoder.c +++ b/src/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/src/lv_font/lv_font.h b/src/src/lv_font/lv_font.h index e6433b8..50be635 100644 --- a/src/src/lv_font/lv_font.h +++ b/src/src/lv_font/lv_font.h @@ -77,7 +77,7 @@ typedef struct _lv_font_struct uint8_t line_height; /**< The real line height where any text fits*/ uint8_t base_line; /**< Base line measured from the top of the line_height*/ uint8_t subpx :2; /**< An element of `lv_font_subpx_t`*/ - void * dsc; /**< Store implementation specific data here*/ + void * dsc; /**< Store implementation specific or run_time data or caching here*/ #if LV_USE_USER_DATA lv_font_user_data_t user_data; /**< Custom user data for font. */ #endif diff --git a/src/src/lv_font/lv_font_fmt_txt.c b/src/src/lv_font/lv_font_fmt_txt.c index 6f350ed..fb02c74 100644 --- a/src/src/lv_font/lv_font_fmt_txt.c +++ b/src/src/lv_font/lv_font_fmt_txt.c @@ -78,7 +78,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic { lv_font_fmt_txt_dsc_t * fdsc = (lv_font_fmt_txt_dsc_t *) font->dsc; uint32_t gid = get_glyph_dsc_id(font, unicode_letter); - if(!gid) return false; + if(!gid) return NULL; const lv_font_fmt_txt_glyph_dsc_t * gdsc = &fdsc->glyph_dsc[gid]; @@ -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 - (uint8_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 - (uint8_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 - 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 - (const uint8_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/src/lv_font/lv_font_fmt_txt.h b/src/src/lv_font/lv_font_fmt_txt.h index ab15834..58c8b59 100644 --- a/src/src/lv_font/lv_font_fmt_txt.h +++ b/src/src/lv_font/lv_font_fmt_txt.h @@ -191,7 +191,6 @@ typedef struct { * from `lv_font_fmt_txt_bitmap_format_t` */ uint16_t bitmap_format :2; - uint16_t subpx :1; /*Cache the last letter and is glyph id*/ uint32_t last_letter; diff --git a/src/src/lv_misc/lv_color.h b/src/src/lv_misc/lv_color.h index e5f456f..dc86169 100644 --- a/src/src/lv_misc/lv_color.h +++ b/src/src/lv_misc/lv_color.h @@ -390,7 +390,7 @@ static inline uint32_t lv_color_to32(lv_color_t color) LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/ LV_COLOR_SET_G32(ret, LV_COLOR_GET_G(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/ LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/ - LV_COLOR_SET_A32(color, 0xFF); + LV_COLOR_SET_A32(ret, 0xFF); return ret.full; #elif LV_COLOR_DEPTH == 16 /** diff --git a/src/src/lv_misc/lv_fs.c b/src/src/lv_misc/lv_fs.c index 5723943..a23081c 100644 --- a/src/src/lv_misc/lv_fs.c +++ b/src/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'*/ @@ -572,7 +572,7 @@ char * lv_fs_up(char * path) return path; } - uint16_t i; + size_t i; for(i = len; i > 0; i--) { if(path[i] == '/' || path[i] == '\\') break; } @@ -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'*/ @@ -602,7 +602,7 @@ const char * lv_fs_get_last(const char * path) return path; } - uint16_t i; + size_t i; for(i = len; i > 0; i--) { if(path[i] == '/' || path[i] == '\\') break; } diff --git a/src/src/lv_misc/lv_ll.c b/src/src/lv_misc/lv_ll.c index 7077fff..9952665 100644 --- a/src/src/lv_misc/lv_ll.c +++ b/src/src/lv_misc/lv_ll.c @@ -335,14 +335,6 @@ uint32_t lv_ll_get_len(const lv_ll_t * ll_p) return len; } -void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p) -{ - (void)(ll_p); - (void)(n1_p); - (void)(n2_p); - /*TODO*/ -} - /** * Move a nodw before an other node in the same linked list * @param ll_p pointer to a linked list diff --git a/src/src/lv_misc/lv_mem.c b/src/src/lv_misc/lv_mem.c index 116208e..461a240 100644 --- a/src/src/lv_misc/lv_mem.c +++ b/src/src/lv_misc/lv_mem.c @@ -59,8 +59,8 @@ typedef struct **********************/ #if LV_MEM_CUSTOM == 0 static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e); -static void * ent_alloc(lv_mem_ent_t * e, uint32_t size); -static void ent_trunc(lv_mem_ent_t * e, uint32_t size); +static void * ent_alloc(lv_mem_ent_t * e, size_t size); +static void ent_trunc(lv_mem_ent_t * e, size_t size); #endif /********************** @@ -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) { @@ -407,7 +407,7 @@ static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e) * @param size size of the new memory in bytes * @return pointer to the allocated memory or NULL if not enough memory in the entry */ -static void * ent_alloc(lv_mem_ent_t * e, uint32_t size) +static void * ent_alloc(lv_mem_ent_t * e, size_t size) { void * alloc = NULL; @@ -430,7 +430,7 @@ static void * ent_alloc(lv_mem_ent_t * e, uint32_t size) * @param e Pointer to an entry * @param size new size in bytes */ -static void ent_trunc(lv_mem_ent_t * e, uint32_t size) +static void ent_trunc(lv_mem_ent_t * e, size_t size) { #ifdef LV_MEM_ENV64 /*Round the size up to 8*/ diff --git a/src/src/lv_misc/lv_mem.h b/src/src/lv_misc/lv_mem.h index 2353122..34ca3e9 100644 --- a/src/src/lv_misc/lv_mem.h +++ b/src/src/lv_misc/lv_mem.h @@ -22,21 +22,11 @@ extern "C" { #include #include #include "lv_log.h" +#include "lv_types.h" /********************* * DEFINES *********************/ -// Check windows -#ifdef __WIN64 -#define LV_MEM_ENV64 -#endif - -// Check GCC -#ifdef __GNUC__ -#if defined(__x86_64__) || defined(__ppc64__) -#define LV_MEM_ENV64 -#endif -#endif /********************** * TYPEDEFS @@ -70,7 +60,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 +75,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/src/lv_misc/lv_txt.c b/src/src/lv_misc/lv_txt.c index 9255223..929fb75 100644 --- a/src/src/lv_misc/lv_txt.c +++ b/src/src/lv_misc/lv_txt.c @@ -303,9 +303,9 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, i += advance; - if(txt[0] == '\n') break; + if(txt[0] == '\n' || txt[0] == '\r') break; - if(txt[i] == '\n'){ + if(txt[i] == '\n' || txt[i] == '\r'){ i++; /* Include the following newline in the current line */ break; } @@ -416,13 +416,13 @@ 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); - uint32_t new_len = ins_len + old_len; + size_t old_len = strlen(txt_buf); + size_t ins_len = strlen(ins_txt); + size_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*/ /*Copy the second part into the end to make place to text to insert*/ - uint32_t i; + size_t i; for(i = new_len; i >= pos + ins_len; i--) { txt_buf[i] = txt_buf[i - ins_len]; } @@ -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/src/lv_misc/lv_types.h b/src/src/lv_misc/lv_types.h index 89f04aa..c588e24 100644 --- a/src/src/lv_misc/lv_types.h +++ b/src/src/lv_misc/lv_types.h @@ -17,6 +17,17 @@ extern "C" { /********************* * DEFINES *********************/ +// Check windows +#ifdef __WIN64 +#define LV_ARCH_64 +#endif + +// Check GCC +#ifdef __GNUC__ +#if defined(__x86_64__) || defined(__ppc64__) +#define LV_ARCH_64 +#endif +#endif /********************** * TYPEDEFS @@ -32,7 +43,11 @@ enum { }; typedef uint8_t lv_res_t; -typedef unsigned long int lv_uintptr_t; +#ifdef LV_ARCH_64 +typedef uint64_t lv_uintptr_t; +#else +typedef uint32_t lv_uintptr_t; +#endif /********************** * GLOBAL PROTOTYPES diff --git a/src/src/lv_objx/lv_btn.c b/src/src/lv_objx/lv_btn.c index fa7880e..4cfe952 100644 --- a/src/src/lv_objx/lv_btn.c +++ b/src/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/src/lv_objx/lv_btnm.c b/src/src/lv_objx/lv_btnm.c index 3286900..b54436d 100644 --- a/src/src/lv_objx/lv_btnm.c +++ b/src/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/src/lv_objx/lv_calendar.c b/src/src/lv_objx/lv_calendar.c index 8e4ceb5..53f32a2 100644 --- a/src/src/lv_objx/lv_calendar.c +++ b/src/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/src/lv_objx/lv_calendar.h b/src/src/lv_objx/lv_calendar.h index 8d6c57f..21317bb 100644 --- a/src/src/lv_objx/lv_calendar.h +++ b/src/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/src/lv_objx/lv_canvas.c b/src/src/lv_objx/lv_canvas.c index 58cd65c..8d2275a 100644 --- a/src/src/lv_objx/lv_canvas.c +++ b/src/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/src/lv_objx/lv_cpicker.c b/src/src/lv_objx/lv_cpicker.c index 2371cd0..fa574bf 100644 --- a/src/src/lv_objx/lv_cpicker.c +++ b/src/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/src/lv_objx/lv_ddlist.c b/src/src/lv_objx/lv_ddlist.c index a0100a7..27855d6 100644 --- a/src/src/lv_objx/lv_ddlist.c +++ b/src/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/src/lv_objx/lv_imgbtn.c b/src/src/lv_objx/lv_imgbtn.c index 69f97f4..522df30 100644 --- a/src/src/lv_objx/lv_imgbtn.c +++ b/src/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((void*)ext->img_src, 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((void*)ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left)); + memcpy((void*)ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid)); + memcpy((void*)ext->img_src_right, 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/src/lv_objx/lv_label.c b/src/src/lv_objx/lv_label.c index 9d70720..aa677b0 100644 --- a/src/src/lv_objx/lv_label.c +++ b/src/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/src/lv_objx/lv_list.c b/src/src/lv_objx/lv_list.c index 2732428..cf18e73 100644 --- a/src/src/lv_objx/lv_list.c +++ b/src/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/src/lv_objx/lv_lmeter.c b/src/src/lv_objx/lv_lmeter.c index 5843a7d..d1f2101 100644 --- a/src/src/lv_objx/lv_lmeter.c +++ b/src/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); @@ -241,7 +241,7 @@ int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter) * @param lmeter pointer to a line meter object * @return number of the scale units */ -uint8_t lv_lmeter_get_line_count(const lv_obj_t * lmeter) +uint16_t lv_lmeter_get_line_count(const lv_obj_t * lmeter) { LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME); diff --git a/src/src/lv_objx/lv_lmeter.h b/src/src/lv_objx/lv_lmeter.h index bc098e1..6deac8c 100644 --- a/src/src/lv_objx/lv_lmeter.h +++ b/src/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. @@ -138,7 +138,7 @@ int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter); * @param lmeter pointer to a line meter object * @return number of the scale units */ -uint8_t lv_lmeter_get_line_count(const lv_obj_t * lmeter); +uint16_t lv_lmeter_get_line_count(const lv_obj_t * lmeter); /** * Get the scale angle of a line meter diff --git a/src/src/lv_objx/lv_roller.c b/src/src/lv_objx/lv_roller.c index 2798a7f..558610c 100644 --- a/src/src/lv_objx/lv_roller.c +++ b/src/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/src/lv_objx/lv_spinbox.c b/src/src/lv_objx/lv_spinbox.c index bd46b99..42c229c 100644 --- a/src/src/lv_objx/lv_spinbox.c +++ b/src/src/lv_objx/lv_spinbox.c @@ -97,7 +97,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) lv_spinbox_ext_t * copy_ext = lv_obj_get_ext_attr(copy); lv_spinbox_set_value(new_spinbox, copy_ext->value); - lv_spinbox_set_digit_format(new_spinbox, copy_ext->digit_count, copy_ext->dec_point_pos); + lv_spinbox_set_digit_format(new_spinbox, (uint8_t)copy_ext->digit_count, (uint8_t)copy_ext->dec_point_pos); lv_spinbox_set_range(new_spinbox, copy_ext->range_min, copy_ext->range_max); lv_spinbox_set_step(new_spinbox, copy_ext->step); @@ -330,8 +330,6 @@ void lv_spinbox_decrement(lv_obj_t * spinbox) static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param) { - lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox); - lv_res_t res = LV_RES_OK; /* Include the ancient signal function */ @@ -341,6 +339,8 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p } if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME); + + lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox); if(sign == LV_SIGNAL_CLEANUP) { /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ } else if(sign == LV_SIGNAL_GET_TYPE) { @@ -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/src/lv_objx/lv_ta.c b/src/src/lv_objx/lv_ta.c index 0b57fc8..b79f2ae 100644 --- a/src/src/lv_objx/lv_ta.c +++ b/src/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; @@ -1707,7 +1707,6 @@ static void get_cursor_style(lv_obj_t * ta, lv_style_t * style_res) style_res->body.padding.top = 0; style_res->body.padding.bottom = 0; style_res->line.width = 1; - style_res->body.opa = LV_OPA_COVER; } } diff --git a/src/src/lv_objx/lv_table.c b/src/src/lv_objx/lv_table.c index 79cdc77..1410cc3 100644 --- a/src/src/lv_objx/lv_table.c +++ b/src/src/lv_objx/lv_table.c @@ -650,7 +650,6 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ lv_table_ext_t * ext = lv_obj_get_ext_attr(table); const lv_style_t * bg_style = lv_obj_get_style(table); - const lv_style_t * cell_style; lv_coord_t h_row; lv_point_t txt_size; lv_area_t cell_area; @@ -666,8 +665,8 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ for(row = 0; row < ext->row_cnt; row++) { h_row = get_row_height(table, row); - cell_area.y1 = cell_area.y2; - cell_area.y2 = cell_area.y1 + h_row; + cell_area.y1 = cell_area.y2 + 1; + cell_area.y2 = cell_area.y1 + h_row - 1; cell_area.x2 = table->coords.x1 + bg_style->body.padding.left; @@ -683,9 +682,11 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ format.s.crop = 1; } - cell_style = ext->cell_style[format.s.type]; - cell_area.x1 = cell_area.x2; - cell_area.x2 = cell_area.x1 + ext->col_w[col]; + + lv_style_t cell_style; + lv_style_copy(&cell_style, ext->cell_style[format.s.type]); + cell_area.x1 = cell_area.x2 + 1; + cell_area.x2 = cell_area.x1 + ext->col_w[col] - 1; uint16_t col_merge = 0; for(col_merge = 0; col_merge + col < ext->col_cnt - 1; col_merge++) { @@ -701,14 +702,14 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ } } - lv_draw_rect(&cell_area, mask, cell_style, opa_scale); + lv_draw_rect(&cell_area, mask, &cell_style, opa_scale); if(ext->cell_data[cell]) { - txt_area.x1 = cell_area.x1 + cell_style->body.padding.left; - txt_area.x2 = cell_area.x2 - cell_style->body.padding.right; - txt_area.y1 = cell_area.y1 + cell_style->body.padding.top; - txt_area.y2 = cell_area.y2 - cell_style->body.padding.bottom; + txt_area.x1 = cell_area.x1 + cell_style.body.padding.left; + txt_area.x2 = cell_area.x2 - cell_style.body.padding.right; + txt_area.y1 = cell_area.y1 + cell_style.body.padding.top; + txt_area.y2 = cell_area.y2 - cell_style.body.padding.bottom; /*Align the content to the middle if not cropped*/ if(format.s.crop == 0) { txt_flags = LV_TXT_FLAG_NONE; @@ -716,8 +717,8 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ txt_flags = LV_TXT_FLAG_EXPAND; } - lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, - cell_style->text.letter_space, cell_style->text.line_space, + lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style.text.font, + cell_style.text.letter_space, cell_style.text.line_space, lv_area_get_width(&txt_area), txt_flags); /*Align the content to the middle if not cropped*/ @@ -737,7 +738,7 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ bool label_mask_ok; label_mask_ok = lv_area_intersect(&label_mask, mask, &cell_area); if(label_mask_ok) { - lv_draw_label(&txt_area, &label_mask, cell_style, opa_scale, ext->cell_data[cell] + 1, + lv_draw_label(&txt_area, &label_mask, &cell_style, opa_scale, ext->cell_data[cell] + 1, txt_flags, NULL, NULL, NULL, lv_obj_get_base_dir(table)); } /*Draw lines after '\n's*/ @@ -749,13 +750,13 @@ static bool lv_table_design(lv_obj_t * table, const lv_area_t * mask, lv_design_ for(i = 1; ext->cell_data[cell][i] != '\0'; i++) { if(ext->cell_data[cell][i] == '\n') { ext->cell_data[cell][i] = '\0'; - lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style->text.font, - cell_style->text.letter_space, cell_style->text.line_space, + lv_txt_get_size(&txt_size, ext->cell_data[cell] + 1, cell_style.text.font, + cell_style.text.letter_space, cell_style.text.line_space, lv_area_get_width(&txt_area), txt_flags); - p1.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2; - p2.y = txt_area.y1 + txt_size.y + cell_style->text.line_space / 2; - lv_draw_line(&p1, &p2, mask, cell_style, opa_scale); + p1.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2; + p2.y = txt_area.y1 + txt_size.y + cell_style.text.line_space / 2; + lv_draw_line(&p1, &p2, mask, &cell_style, opa_scale); ext->cell_data[cell][i] = '\n'; } diff --git a/src/src/lv_objx/lv_tabview.c b/src/src/lv_objx/lv_tabview.c index 8f323fa..79727b1 100644 --- a/src/src/lv_objx/lv_tabview.c +++ b/src/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; } diff --git a/src/src/lv_objx/lv_tileview.c b/src/src/lv_objx/lv_tileview.c index 7913c99..184bcbd 100644 --- a/src/src/lv_objx/lv_tileview.c +++ b/src/src/lv_objx/lv_tileview.c @@ -183,7 +183,7 @@ void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t valid /*If valid pos. is selected do nothing*/ uint16_t i; for(i = 0; i < valid_pos_cnt; i++) { - if(valid_pos->x == ext->act_id.x && valid_pos->y == ext->act_id.y) { + if(valid_pos[i].x == ext->act_id.x && valid_pos[i].y == ext->act_id.y) { return; } } @@ -358,6 +358,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void /* Include the ancient signal function */ res = ancestor_scrl_signal(scrl, sign, param); if(res != LV_RES_OK) return res; + if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, ""); lv_obj_t * tileview = lv_obj_get_parent(scrl); const lv_style_t * style_bg = lv_tileview_get_style(tileview, LV_TILEVIEW_STYLE_MAIN); diff --git a/src/src/lv_version.h b/src/src/lv_version.h index 7a5a757..886966f 100644 --- a/src/src/lv_version.h +++ b/src/src/lv_version.h @@ -16,7 +16,7 @@ extern "C" { /*Current version of LittlevGL*/ #define LVGL_VERSION_MAJOR 6 #define LVGL_VERSION_MINOR 1 -#define LVGL_VERSION_PATCH 0 +#define LVGL_VERSION_PATCH 1 #define LVGL_VERSION_INFO ""