Solivng a fatal bug with unmatched quotes on the last param

This commit is contained in:
Anonymus Raccoon
2020-05-01 19:36:32 +02:00
parent 828f4170b8
commit 6540df07df
2 changed files with 10 additions and 10 deletions

View File

@@ -16,5 +16,5 @@ char *trimstr(char *str);
int xml_getstringdata(node *n, char **nodestr);
int xml_checkclosing(node *n, char **nodestr);
dictionary *property_add(dictionary *list, dictionary *property);
node *xml_parsenode(char **nodestr);
node *xml_parsenode(char **str);
int get_int_size(int n);

View File

@@ -74,25 +74,25 @@ node *xml_parseproperties(node *n, char **str, bool has_params, bool has_childs)
return (n);
}
node *xml_parsenode(char **nodestr)
node *xml_parsenode(char **str)
{
node *n = malloc(sizeof(node));
bool has_param;
bool has_childs;
char *p = my_strchr(*nodestr, '>');
char *p = my_strchr(*str, '>');
if (!n)
return (NULL);
if ((*nodestr)[0] == '<') {
if (p && (*nodestr)[1] != '/') {
if ((*str)[0] == '<') {
if (p && (*str)[1] != '/') {
*p = '\0';
*nodestr += 1;
n->name = xml_getname(nodestr, &has_param, &has_childs);
*str += 1;
n->name = xml_getname(str, &has_param, &has_childs);
if (n->name)
return (xml_parseproperties(n, nodestr, has_param, has_childs));
return (xml_parseproperties(n, str, has_param, has_childs));
}
} else if ((*nodestr)[1] != '/' && xml_getstringdata(n, nodestr) == 0) {
n->next = xml_parsenode(nodestr);
} else if (**str && (*str)[1] != '/' && !xml_getstringdata(n, str)) {
n->next = xml_parsenode(str);
return (n);
}
free(n);