fix(xml): minor fixes in parsers

This commit is contained in:
Gabor Kiss-Vamosi
2025-08-20 20:59:54 +02:00
committed by Felipe Neves
parent b4c9d2e690
commit dea37bd32f
5 changed files with 20 additions and 12 deletions
@@ -372,7 +372,7 @@ integer value:
- Drop-Down
- Roller
- Slider
+ - Scale Section Min/Max values
- Scale Section Min/Max values
Any number of Observers can be created for a single Widget, each bound to ONE of
the above properties.
+3 -3
View File
@@ -545,7 +545,7 @@ lv_observer_t * lv_obj_bind_checked(lv_obj_t * obj, lv_subject_t * subject);
lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const char * fmt);
#endif
#if LV_USE_LABEL
#if LV_USE_SPAN
/**
* Bind an integer, string, or pointer Subject to a Spangroup's Span.
@@ -556,8 +556,8 @@ lv_observer_t * lv_label_bind_text(lv_obj_t * obj, lv_subject_t * subject, const
* or NULL to bind to the value directly.
* @return pointer to newly-created Observer
* @note `fmt == NULL` can be used only with string and pointer Subjects.
* @note If Subject is a pointer and `fmt == NULL`, pointer must point
* to a `\0` terminated string.
* @note If `fmt == NULL` strings and pointers (`\0` terminated string) will be shown
* as text as they are, integers as %d, floats as %0.1f
*/
lv_observer_t * lv_spangroup_bind_span_text(lv_obj_t * obj, lv_span_t * span, lv_subject_t * subject, const char * fmt);
+2
View File
@@ -290,6 +290,8 @@ lv_result_t lv_xml_style_register(lv_xml_component_scope_t * scope, const char *
if(value[c] == ' ') item_cnt++;
}
/*This not freed automatically as the styles doesn't have any mechanisms to detect
* removal of properties. It's assumed that the styles are created once and never freed. */
int32_t * dsc_array = lv_malloc((item_cnt + 2) * sizeof(int32_t)); /*+2 for LV_GRID_TEMPLATE_LAST*/
char * value_buf = (char *)value;
+9 -4
View File
@@ -83,8 +83,8 @@ int32_t lv_xml_atoi_split(const char ** str, char delimiter)
int32_t result = 0;
int sign = 1;
/* Skip leading whitespace */
while(*s == ' ' || *s == '\t') s++;
/* Skip leading whitespace and repeated delimiters */
while(*s == delimiter || *s == ' ' || *s == '\t') s++;
/* Handle optional sign */
if(*s == '-') {
@@ -128,8 +128,8 @@ float lv_xml_atof_split(const char ** str, char delimiter)
float result = 0.0f;
int sign = 1;
/* Skip leading whitespace */
while(*s == ' ' || *s == '\t') s++;
/* Skip leading whitespace and repeated delimiters */
while(*s == delimiter || *s == ' ' || *s == '\t') s++;
/* Handle optional sign */
if(*s == '-') {
@@ -263,6 +263,11 @@ int32_t lv_xml_strtol(const char * str, char ** endptr, int32_t base)
char * lv_xml_split_str(char ** src, char delimiter)
{
/*Skip multiple delimiters*/
while(*src[0] == delimiter) {
src++;
}
if(*src[0] == '\0') return NULL;
char * src_first = *src;
@@ -98,13 +98,14 @@ void * lv_xml_tabview_tab_button_create(lv_xml_parser_state_t * state, const cha
const char * index_str = lv_xml_get_value_of(attrs, "index");
int32_t index_int = index_str ? lv_xml_atoi(index_str) : 0;
if(LV_ABS(index_int) >= btn_cnt) {
LV_LOG_WARN("tabindex is out of range, using the first tab instead");
index_int = 0;
}
void * item = lv_tabview_get_tab_button(tv, index_int);
if(item == NULL) {
LV_LOG_WARN("tabindex is out of range, using the first tab instead");
item = lv_tabview_get_tab_button(tv, 0);
}
return item;
}