mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
fix xml_theme_gen
This commit is contained in:
parent
e0d8e2419b
commit
887cfbc458
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
|
||||
2020/12/05
|
||||
* 修复theme\_gen可能存在没有初始化变量的问题(感谢朝泽提供补丁)。
|
||||
|
||||
2020/12/04
|
||||
* fscript 支持注册全局函数。
|
||||
|
||||
|
@ -199,9 +199,7 @@ static void xml_gen_on_text(XmlBuilder* thiz, const char* text, size_t length) {
|
||||
xml_builder_t* b = (xml_builder_t*)thiz;
|
||||
|
||||
if (b->is_property) {
|
||||
Style* s;
|
||||
value_t v;
|
||||
ENSURE(style_normalize_value(b->property_name, text, &v) == RET_OK);
|
||||
Style* s = NULL;
|
||||
|
||||
if (b->level == 1) {
|
||||
s = &(b->widget_style);
|
||||
@ -211,6 +209,10 @@ static void xml_gen_on_text(XmlBuilder* thiz, const char* text, size_t length) {
|
||||
s = &(b->state_style);
|
||||
}
|
||||
|
||||
if (s != NULL) {
|
||||
value_t v;
|
||||
ENSURE(style_normalize_value(b->property_name, text, &v) == RET_OK);
|
||||
|
||||
if (v.type == VALUE_TYPE_STRING) {
|
||||
s->AddString(b->property_name, value_str(&v));
|
||||
} else {
|
||||
@ -218,6 +220,7 @@ static void xml_gen_on_text(XmlBuilder* thiz, const char* text, size_t length) {
|
||||
}
|
||||
value_reset(&v);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@ -267,6 +270,8 @@ uint32_t xml_gen_buff(const char* xml, uint8_t* output, uint32_t max_size) {
|
||||
xml_builder_t b;
|
||||
return_value_if_fail(xml != NULL && output != NULL, 0);
|
||||
|
||||
memset(&b, 0x00, sizeof(b));
|
||||
|
||||
XmlParser* parser = xml_parser_create();
|
||||
xml_parser_set_builder(parser, builder_init(b));
|
||||
xml_parser_parse(parser, xml, strlen(xml));
|
||||
@ -288,6 +293,8 @@ bool xml_gen(const char* input_file, const char* output_file, const char* theme,
|
||||
wbuffer_t wbuffer;
|
||||
return_value_if_fail(input_file != NULL && output_file != NULL, false);
|
||||
|
||||
memset(&b, 0x00, sizeof(b));
|
||||
|
||||
wbuffer_init_extendable(&wbuffer);
|
||||
XmlParser* parser = xml_parser_create();
|
||||
xml_parser_set_builder(parser, builder_init(b));
|
||||
|
Loading…
Reference in New Issue
Block a user