Skip to content

Commit

Permalink
Fix compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
zyc9012 committed Sep 1, 2024
1 parent 33f95e5 commit 44b899f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ext/nokolexbor/libxml/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern "C" {
#endif

static size_t tmp_len;
#define NODE_NAME(node) lxb_dom_node_name_qualified((node), &tmp_len)
#define NODE_NAME(node) lxb_dom_node_name_qualified((lxb_dom_node_t *)(node), &tmp_len)
#define NODE_NS_HREF(node) ((node)->prefix ? lxb_ns_by_id((node)->owner_document->ns, (node)->ns, &tmp_len) : NULL)
#define NODE_NS_PREFIX(node) lxb_ns_by_id((node)->owner_document->prefix, (node)->prefix, &tmp_len)

Expand Down
8 changes: 4 additions & 4 deletions ext/nokolexbor/nl_attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ nl_attribute_parent(VALUE self)
if (attr->owner == NULL) {
return Qnil;
}
return nl_rb_node_create(attr->owner, nl_rb_document_get(self));
return nl_rb_node_create((lxb_dom_node_t *)attr->owner, nl_rb_document_get(self));
}

/**
Expand All @@ -158,7 +158,7 @@ nl_attribute_previous(VALUE self)
if (attr->prev == NULL) {
return Qnil;
}
return nl_rb_node_create(attr->prev, nl_rb_document_get(self));
return nl_rb_node_create((lxb_dom_node_t *)attr->prev, nl_rb_document_get(self));
}

/**
Expand All @@ -175,7 +175,7 @@ nl_attribute_next(VALUE self)
if (attr->next == NULL) {
return Qnil;
}
return nl_rb_node_create(attr->next, nl_rb_document_get(self));
return nl_rb_node_create((lxb_dom_node_t *)attr->next, nl_rb_document_get(self));
}

static VALUE
Expand All @@ -189,7 +189,7 @@ nl_attribute_inspect(VALUE self)

return rb_sprintf("#<%" PRIsVALUE " %s=\"%s\">", c,
lxb_dom_attr_qualified_name(attr, &len),
attr_value == NULL ? "" : attr_value);
attr_value == NULL ? "" : (char *)attr_value);
}

void Init_nl_attribute(void)
Expand Down
4 changes: 2 additions & 2 deletions ext/nokolexbor/nl_document.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static VALUE
nl_document_get_title(VALUE self)
{
size_t len;
lxb_char_t *str = lxb_html_document_title(nl_rb_document_unwrap(self), &len);
lxb_char_t *str = lxb_html_document_title((lxb_html_document_t *)nl_rb_document_unwrap(self), &len);
return str == NULL ? rb_str_new("", 0) : rb_utf8_str_new(str, len);
}

Expand All @@ -126,7 +126,7 @@ nl_document_set_title(VALUE self, VALUE rb_title)
{
const char *c_title = StringValuePtr(rb_title);
size_t len = RSTRING_LEN(rb_title);
lxb_html_document_title_set(nl_rb_document_unwrap(self), (const lxb_char_t *)c_title, len);
lxb_html_document_title_set((lxb_html_document_t *)nl_rb_document_unwrap(self), (const lxb_char_t *)c_title, len);
return rb_title;
}

Expand Down
4 changes: 2 additions & 2 deletions ext/nokolexbor/nl_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ nl_node_attribute(VALUE self, VALUE rb_name)
if (attr->owner == NULL) {
attr->owner = lxb_dom_interface_element(node);
}
return nl_rb_node_create(attr, nl_rb_document_get(self));
return nl_rb_node_create((lxb_dom_node_t *)attr, nl_rb_document_get(self));
}

/**
Expand All @@ -191,7 +191,7 @@ nl_node_attribute_nodes(VALUE self)
if (attr->owner == NULL) {
attr->owner = lxb_dom_interface_element(node);
}
rb_ary_push(ary, nl_rb_node_create(attr, rb_doc));
rb_ary_push(ary, nl_rb_node_create((lxb_dom_node_t *)attr, rb_doc));
attr = attr->next;
}

Expand Down
4 changes: 2 additions & 2 deletions ext/nokolexbor/xml_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ nl_xmlGetNodePath(const lxb_dom_node_t *node)

} else if (cur->type == LXB_DOM_NODE_TYPE_ATTRIBUTE) {
sep = "/@";
name = (const char *) lxb_dom_attr_qualified_name(cur, &tmp_len);
next = ((lxb_dom_attr_t_ptr)cur)->owner;
name = (const char *) lxb_dom_attr_qualified_name((lxb_dom_attr_t_ptr)cur, &tmp_len);
next = (lxb_dom_node_t *)((lxb_dom_attr_t_ptr)cur)->owner;
} else {
nl_xmlFree(buf);
nl_xmlFree(buffer);
Expand Down
6 changes: 3 additions & 3 deletions ext/nokolexbor/xml_xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -6389,7 +6389,7 @@ xmlXPathNodeValHash(lxb_dom_node_t_ptr node) {
return(0);
return(string[0] + (string[1] << 8));
case LXB_DOM_NODE_TYPE_ATTRIBUTE:
string = lxb_dom_attr_value(node, &tmp_len);
string = lxb_dom_attr_value((lxb_dom_attr_t_ptr)node, &tmp_len);
if (string == NULL)
return(0);
if (string[0] == 0)
Expand Down Expand Up @@ -8452,9 +8452,9 @@ nl_xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, lxb_dom_node_t_ptr cur)
if (cur == NULL) {
if (ctxt->context->node == (lxb_dom_node_t_ptr) ctxt->context->doc)
return(NULL);
return lxb_dom_element_first_attribute(ctxt->context->node);
return (lxb_dom_node_t_ptr)lxb_dom_element_first_attribute((lxb_dom_element_t *)ctxt->context->node);
}
return(((lxb_dom_attr_t *)cur)->next);
return (lxb_dom_node_t_ptr)(((lxb_dom_attr_t *)cur)->next);
}

/************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion patches/0004-lexbor-fix-template-clone.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ index a2153f4..8a9c69f 100755

+ if (curr->local_name == LXB_TAG_TEMPLATE && curr->first_child != NULL && cnode->type == LXB_DOM_NODE_TYPE_DOCUMENT_FRAGMENT) {
+ lxb_dom_node_remove(curr->first_child);
+ lxb_html_interface_template(curr)->content = cnode;
+ lxb_html_interface_template(curr)->content = (lxb_dom_document_fragment_t *)cnode;
+ }
+
lxb_dom_node_insert_child(curr, cnode);
Expand Down

0 comments on commit 44b899f

Please sign in to comment.