From c0a7eff9c1fedfc23e47795484f83f88e42ccd3c Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 26 Mar 2025 15:03:24 +0100 Subject: [PATCH] fix(xml): minor fixes of typos and cleanups --- .../src/details/auxiliary-modules/xml/subjects.rst | 2 -- src/others/xml/lv_xml_component.c | 14 +++++++++----- src/others/xml/parsers/lv_xml_keyboard_parser.h | 6 +++--- src/others/xml/parsers/lv_xml_textarea_parser.h | 6 +++--- xmls/lv_keyboard.xml | 4 ++-- xmls/lv_textarea.xml | 14 +++++++------- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/docs/src/details/auxiliary-modules/xml/subjects.rst b/docs/src/details/auxiliary-modules/xml/subjects.rst index 8d1b35a167..813dbab5fc 100644 --- a/docs/src/details/auxiliary-modules/xml/subjects.rst +++ b/docs/src/details/auxiliary-modules/xml/subjects.rst @@ -4,8 +4,6 @@ Subjects ======== -T -Subjects To connect values of the widget internally or to external data, subjects can be used. For example, an internally connected value could be a slider's value mapped to a label. Externally connected data could be the current number of users shown on a label. To handle internal connections, local subjects can be created like this: diff --git a/src/others/xml/lv_xml_component.c b/src/others/xml/lv_xml_component.c index 6996532357..7778f2cc9e 100644 --- a/src/others/xml/lv_xml_component.c +++ b/src/others/xml/lv_xml_component.c @@ -127,9 +127,9 @@ lv_result_t lv_xml_component_register_from_data(const char * name, const char * XML_SetElementHandler(parser, start_metadata_handler, end_metadata_handler); if(XML_Parse(parser, xml_def, lv_strlen(xml_def), XML_TRUE) == XML_STATUS_ERROR) { - LV_LOG_WARN("XML parsing error: %s on line %lu", - XML_ErrorString(XML_GetErrorCode(parser)), - (unsigned long)XML_GetCurrentLineNumber(parser)); + LV_LOG_ERROR("XML parsing error: %s on line %lu", + XML_ErrorString(XML_GetErrorCode(parser)), + (unsigned long)XML_GetCurrentLineNumber(parser)); XML_ParserFree(parser); return LV_RESULT_INVALID; } @@ -249,7 +249,7 @@ lv_result_t lv_xml_component_unregister(const char * name) LV_LL_READ(&ctx->font_ll, font) { lv_free((char *)font->name); } - lv_ll_clear(&ctx->image_ll); + lv_ll_clear(&ctx->font_ll); lv_xml_image_t * image; LV_LL_READ(&ctx->image_ll, image) { @@ -325,7 +325,7 @@ static void process_font_element(lv_xml_parser_state_t * state, const char * typ } const char * as_file = lv_xml_get_value_of(attrs, "as_file"); - if(as_file == NULL || as_file == false) { + if(as_file == NULL || lv_streq(as_file, "false")) { LV_LOG_INFO("Ignore non-file based font `%s`", name); return; } @@ -346,9 +346,11 @@ static void process_font_element(lv_xml_parser_state_t * state, const char * typ lv_result_t res = lv_xml_register_font(&state->ctx, name, font); if(res == LV_RESULT_INVALID) { LV_LOG_WARN("Failed to register `%s` tiny_ttf font", name); + lv_tiny_ttf_destroy(font); return; } + /*Get the font which was just created and add a destroy_cb*/ lv_xml_font_t * f = lv_ll_get_head(&state->ctx.font_ll); f->font_destroy_cb = lv_tiny_ttf_destroy; @@ -367,9 +369,11 @@ static void process_font_element(lv_xml_parser_state_t * state, const char * typ lv_result_t res = lv_xml_register_font(&state->ctx, name, font); if(res == LV_RESULT_INVALID) { LV_LOG_WARN("Failed to register `%s` bin font", name); + lv_binfont_destroy(font); return; } + /*Get the font which was just created and add a destroy_cb*/ lv_xml_font_t * f = lv_ll_get_head(&state->ctx.font_ll); f->font_destroy_cb = lv_binfont_destroy; } diff --git a/src/others/xml/parsers/lv_xml_keyboard_parser.h b/src/others/xml/parsers/lv_xml_keyboard_parser.h index b00e998562..cfd80f999c 100644 --- a/src/others/xml/parsers/lv_xml_keyboard_parser.h +++ b/src/others/xml/parsers/lv_xml_keyboard_parser.h @@ -3,8 +3,8 @@ * */ -#ifndef LV_KEYBOARD_XML_PARSER_H -#define LV_KEYBOARD_XML_PARSER_H +#ifndef LV_XML_KEYBOARD_PARSER_H +#define LV_XML_KEYBOARD_PARSER_H #ifdef __cplusplus extern "C" { @@ -38,4 +38,4 @@ void lv_xml_keyboard_apply(lv_xml_parser_state_t * state, const char ** attrs); } /*extern "C"*/ #endif -#endif /*LV_KEYBOARD_XML_PARSE_H*/ +#endif /*LV_XML_KEYBOARD_PARSER_H*/ diff --git a/src/others/xml/parsers/lv_xml_textarea_parser.h b/src/others/xml/parsers/lv_xml_textarea_parser.h index 6269cac03a..630696ad4d 100644 --- a/src/others/xml/parsers/lv_xml_textarea_parser.h +++ b/src/others/xml/parsers/lv_xml_textarea_parser.h @@ -3,8 +3,8 @@ * */ -#ifndef LV_TEXTAREA_XML_PARSER_H -#define LV_TEXTAREA_XML_PARSER_H +#ifndef LV_XML_TEXTAREA_PARSER_H +#define LV_XML_TEXTAREA_PARSER_H #ifdef __cplusplus extern "C" { @@ -38,4 +38,4 @@ void lv_xml_textarea_apply(lv_xml_parser_state_t * state, const char ** attrs); } /*extern "C"*/ #endif -#endif /*LV_TEXTAREA_XML_PARSE_H*/ +#endif /*LV_XML_TEXTAREA_PARSER_H*/ diff --git a/xmls/lv_keyboard.xml b/xmls/lv_keyboard.xml index 5eeb3a8fb9..d600749dce 100644 --- a/xmls/lv_keyboard.xml +++ b/xmls/lv_keyboard.xml @@ -1,6 +1,6 @@ @@ -16,6 +16,6 @@ Example - + \ No newline at end of file diff --git a/xmls/lv_textarea.xml b/xmls/lv_textarea.xml index fb66f5d486..82eee8df0c 100644 --- a/xmls/lv_textarea.xml +++ b/xmls/lv_textarea.xml @@ -5,12 +5,12 @@ Example - - - - - - - + + + + + + + \ No newline at end of file