diff --git a/src/document/dom/stack.c b/src/document/dom/stack.c index e760a88f4..e61fe954c 100644 --- a/src/document/dom/stack.c +++ b/src/document/dom/stack.c @@ -177,13 +177,13 @@ pop_dom_node(struct dom_stack *stack) void pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type, - unsigned char *string, uint16_t length) + struct dom_string *string) { struct dom_stack_state *state; if (!dom_stack_has_parents(stack)) return; - state = search_dom_stack(stack, type, string, length); + state = search_dom_stack(stack, type, string); if (state) pop_dom_state(stack, type, state); } diff --git a/src/document/dom/stack.h b/src/document/dom/stack.h index 87494b0ea..831237d86 100644 --- a/src/document/dom/stack.h +++ b/src/document/dom/stack.h @@ -86,7 +86,7 @@ get_dom_stack_state(struct dom_stack *stack, int top_offset) /* Dive through the stack states in search for the specified match. */ static inline struct dom_stack_state * search_dom_stack(struct dom_stack *stack, enum dom_node_type type, - unsigned char *string, uint16_t length) + struct dom_string *string) { struct dom_stack_state *state; int pos; @@ -96,8 +96,8 @@ search_dom_stack(struct dom_stack *stack, enum dom_node_type type, struct dom_node *parent = state->node; if (parent->type == type - && parent->string.length == length - && !strncasecmp(parent->string.string, string, length)) + && parent->string.length == string->length + && !strncasecmp(parent->string.string, string->string, string->length)) return state; } @@ -125,7 +125,7 @@ void pop_dom_node(struct dom_stack *stack); /* Ascends the stack looking for specific parent */ void pop_dom_nodes(struct dom_stack *stack, enum dom_node_type type, - unsigned char *string, uint16_t length); + struct dom_string *string); /* Pop all stack states until a specific state is reached. */ void diff --git a/src/document/sgml/parser.c b/src/document/sgml/parser.c index f28ccfa79..ef026078e 100644 --- a/src/document/sgml/parser.c +++ b/src/document/sgml/parser.c @@ -243,10 +243,12 @@ parse_sgml_document(struct dom_stack *stack, struct scanner *scanner) if (!token->length) { pop_dom_node(stack); } else { + struct dom_string string; struct dom_stack_state *state; + set_dom_string(&string, token->string, token->length); state = search_dom_stack(stack, DOM_NODE_ELEMENT, - token->string, token->length); + &string); if (state) { struct sgml_parser_state *pstate;