mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
lv_label: change magic number 4 to sizeof(char *)
This commit is contained in:
parent
3d77137178
commit
30dcf68351
@ -1122,7 +1122,7 @@ static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y)
|
||||
static bool lv_label_set_dot_tmp(lv_obj_t *label, char *data, int len){
|
||||
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
|
||||
lv_label_dot_tmp_free( label ); /* Deallocate any existing space */
|
||||
if( len > 4 ){
|
||||
if( len > sizeof(char *) ){
|
||||
/* Memory needs to be allocated. Allocates an additional byte
|
||||
* for a NULL-terminator so it can be copied. */
|
||||
ext->dot_tmp_ptr = lv_mem_alloc(len + 1);
|
||||
|
@ -64,7 +64,7 @@ typedef struct
|
||||
char * text; /*Text of the label*/
|
||||
union{
|
||||
char * dot_tmp_ptr; /* Pointer to the allocated memory containing the character which are replaced by dots (Handled by the library)*/
|
||||
char dot_tmp[4]; /* Directly store the characters if <=4 characters */
|
||||
char dot_tmp[ sizeof(char *) ]; /* Directly store the characters if <=4 characters */
|
||||
};
|
||||
uint16_t dot_end; /*The text end position in dot mode (Handled by the library)*/
|
||||
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user