From 52ef8612623a540ed094672c4737373484eaf0af Mon Sep 17 00:00:00 2001 From: zyc9012 Date: Sun, 1 Sep 2024 17:28:34 +0800 Subject: [PATCH] Fix compilation error --- ext/nokolexbor/nl_attribute.c | 8 ++++---- ext/nokolexbor/nl_document.c | 4 ++-- patches/0004-lexbor-fix-template-clone.patch | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ext/nokolexbor/nl_attribute.c b/ext/nokolexbor/nl_attribute.c index 5ea7e19..c48a87d 100644 --- a/ext/nokolexbor/nl_attribute.c +++ b/ext/nokolexbor/nl_attribute.c @@ -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)); } /** @@ -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)); } /** @@ -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 @@ -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) diff --git a/ext/nokolexbor/nl_document.c b/ext/nokolexbor/nl_document.c index c877cb5..f019157 100644 --- a/ext/nokolexbor/nl_document.c +++ b/ext/nokolexbor/nl_document.c @@ -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); } @@ -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; } diff --git a/patches/0004-lexbor-fix-template-clone.patch b/patches/0004-lexbor-fix-template-clone.patch index 405e2d0..2a6f425 100644 --- a/patches/0004-lexbor-fix-template-clone.patch +++ b/patches/0004-lexbor-fix-template-clone.patch @@ -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);