1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[spidermonkey] casts in element.c

This commit is contained in:
Witold Filipczyk 2022-02-25 19:13:07 +01:00
parent c275863e1e
commit b8a35ee7aa

View File

@ -178,7 +178,7 @@ element_get_property_attributes(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -198,7 +198,7 @@ element_get_property_attributes(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -238,7 +238,7 @@ element_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -258,7 +258,7 @@ element_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -314,7 +314,7 @@ element_get_property_childElementCount(JSContext *ctx, unsigned int argc, JS::Va
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -334,7 +334,7 @@ element_get_property_childElementCount(JSContext *ctx, unsigned int argc, JS::Va
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -365,7 +365,7 @@ element_get_property_childNodes(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -385,7 +385,7 @@ element_get_property_childNodes(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -425,7 +425,7 @@ element_get_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -445,7 +445,7 @@ element_get_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -478,7 +478,7 @@ element_get_property_dir(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -498,7 +498,7 @@ element_get_property_dir(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -534,7 +534,7 @@ element_get_property_firstChild(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -554,7 +554,7 @@ element_get_property_firstChild(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -593,7 +593,7 @@ element_get_property_firstElementChild(JSContext *ctx, unsigned int argc, JS::Va
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -613,7 +613,7 @@ element_get_property_firstElementChild(JSContext *ctx, unsigned int argc, JS::Va
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -630,7 +630,7 @@ element_get_property_firstElementChild(JSContext *ctx, unsigned int argc, JS::Va
auto end = nodes.end();
for (; it != end; ++it) {
const auto element = dynamic_cast<const xmlpp::Element*>(*it);
auto element = dynamic_cast<xmlpp::Element*>(*it);
if (element) {
JSObject *elem = getElement(ctx, element);
@ -661,7 +661,7 @@ element_get_property_id(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -681,7 +681,7 @@ element_get_property_id(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -713,7 +713,7 @@ element_get_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -733,7 +733,7 @@ element_get_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -765,7 +765,7 @@ element_get_property_lastChild(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -785,7 +785,7 @@ element_get_property_lastChild(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -823,7 +823,7 @@ element_get_property_lastElementChild(JSContext *ctx, unsigned int argc, JS::Val
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -843,7 +843,7 @@ element_get_property_lastElementChild(JSContext *ctx, unsigned int argc, JS::Val
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -860,7 +860,7 @@ element_get_property_lastElementChild(JSContext *ctx, unsigned int argc, JS::Val
auto end = nodes.rend();
for (; it != end; ++it) {
const auto element = dynamic_cast<const xmlpp::Element*>(*it);
auto element = dynamic_cast<xmlpp::Element*>(*it);
if (element) {
JSObject *elem = getElement(ctx, element);
@ -891,7 +891,7 @@ element_get_property_nextElementSibling(JSContext *ctx, unsigned int argc, JS::V
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -911,7 +911,7 @@ element_get_property_nextElementSibling(JSContext *ctx, unsigned int argc, JS::V
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -927,7 +927,7 @@ element_get_property_nextElementSibling(JSContext *ctx, unsigned int argc, JS::V
args.rval().setNull();
return true;
}
xmlpp::Element *next = dynamic_cast<const xmlpp::Element*>(node);
xmlpp::Element *next = dynamic_cast<xmlpp::Element*>(node);
if (next) {
JSObject *elem = getElement(ctx, next);
@ -959,7 +959,7 @@ element_get_property_nodeName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -979,7 +979,7 @@ element_get_property_nodeName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Node *node = JS_GetPrivate(hobj);
xmlpp::Node *node = static_cast<xmlpp::Node *>(JS_GetPrivate(hobj));
xmlpp::ustring v;
@ -1027,7 +1027,7 @@ element_get_property_nodeType(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1047,7 +1047,7 @@ element_get_property_nodeType(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Node *node = JS_GetPrivate(hobj);
xmlpp::Node *node = static_cast<xmlpp::Node *>(JS_GetPrivate(hobj));
if (!node) {
args.rval().setNull();
@ -1089,7 +1089,7 @@ element_get_property_nodeValue(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1109,7 +1109,7 @@ element_get_property_nodeValue(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Node *node = JS_GetPrivate(hobj);
xmlpp::Node *node = static_cast<xmlpp::Node *>(JS_GetPrivate(hobj));
if (!node) {
args.rval().setNull();
@ -1168,7 +1168,7 @@ element_get_property_nextSibling(JSContext *ctx, unsigned int argc, JS::Value *v
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1188,7 +1188,7 @@ element_get_property_nextSibling(JSContext *ctx, unsigned int argc, JS::Value *v
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1227,7 +1227,7 @@ element_get_property_ownerDocument(JSContext *ctx, unsigned int argc, JS::Value
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1270,7 +1270,7 @@ element_get_property_parentElement(JSContext *ctx, unsigned int argc, JS::Value
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1290,7 +1290,7 @@ element_get_property_parentElement(JSContext *ctx, unsigned int argc, JS::Value
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1329,7 +1329,7 @@ element_get_property_parentNode(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1349,7 +1349,7 @@ element_get_property_parentNode(JSContext *ctx, unsigned int argc, JS::Value *vp
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1388,7 +1388,7 @@ element_get_property_previousElementSibling(JSContext *ctx, unsigned int argc, J
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1408,7 +1408,7 @@ element_get_property_previousElementSibling(JSContext *ctx, unsigned int argc, J
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1424,7 +1424,7 @@ element_get_property_previousElementSibling(JSContext *ctx, unsigned int argc, J
args.rval().setNull();
return true;
}
xmlpp::Element *next = dynamic_cast<const xmlpp::Element*>(node);
xmlpp::Element *next = dynamic_cast<xmlpp::Element*>(node);
if (next) {
JSObject *elem = getElement(ctx, next);
@ -1456,7 +1456,7 @@ element_get_property_previousSibling(JSContext *ctx, unsigned int argc, JS::Valu
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1476,7 +1476,7 @@ element_get_property_previousSibling(JSContext *ctx, unsigned int argc, JS::Valu
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1515,7 +1515,7 @@ element_get_property_tagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1535,7 +1535,7 @@ element_get_property_tagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1568,7 +1568,7 @@ element_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1588,7 +1588,7 @@ element_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1630,9 +1630,9 @@ dump_element(struct string *buf, xmlpp::Element *element, bool toSort = false)
}
void
walk_tree(struct string *buf, void *nod, bool start = true, bool toSortAttrs = false)
walk_tree(struct string *buf, void *nod, bool start, bool toSortAttrs)
{
xmlpp::Node *node = nod;
xmlpp::Node *node = static_cast<xmlpp::Node *>(nod);
if (!start) {
const auto textNode = dynamic_cast<const xmlpp::ContentNode*>(node);
@ -1640,7 +1640,7 @@ walk_tree(struct string *buf, void *nod, bool start = true, bool toSortAttrs = f
if (textNode) {
add_to_string(buf, textNode->get_content().c_str());
} else {
const auto element = dynamic_cast<const xmlpp::Element*>(node);
auto element = dynamic_cast<xmlpp::Element*>(node);
if (element) {
dump_element(buf, element, toSortAttrs);
@ -1703,7 +1703,7 @@ element_get_property_innerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1723,7 +1723,7 @@ element_get_property_innerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1760,7 +1760,7 @@ element_get_property_outerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1780,7 +1780,7 @@ element_get_property_outerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1817,7 +1817,7 @@ element_get_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1836,7 +1836,7 @@ element_get_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
#endif
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -1874,7 +1874,7 @@ element_set_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1891,7 +1891,7 @@ element_set_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -1923,7 +1923,7 @@ element_set_property_dir(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1940,7 +1940,7 @@ element_set_property_dir(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -1976,7 +1976,7 @@ element_set_property_id(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1993,7 +1993,7 @@ element_set_property_id(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -2026,7 +2026,7 @@ element_set_property_innerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2043,7 +2043,7 @@ element_set_property_innerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -2097,7 +2097,7 @@ element_set_property_innerText(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2114,7 +2114,7 @@ element_set_property_innerText(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -2152,7 +2152,7 @@ element_set_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2169,7 +2169,7 @@ element_set_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -2202,7 +2202,7 @@ element_set_property_outerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2240,7 +2240,7 @@ element_set_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2279,7 +2279,7 @@ element_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2296,7 +2296,7 @@ element_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
}
@ -2404,7 +2404,7 @@ element_appendChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
@ -2413,7 +2413,7 @@ element_appendChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -2421,7 +2421,7 @@ element_appendChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
}
JS::RootedObject node(ctx, &args[0].toObject());
xmlpp::Node *el2 = JS_GetPrivate(node);
xmlpp::Node *el2 = static_cast<xmlpp::Node *>(JS_GetPrivate(node));
el->import_node(el2);
interpreter->changed = true;
@ -2453,7 +2453,7 @@ element_cloneNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
@ -2462,7 +2462,7 @@ element_cloneNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -2472,7 +2472,7 @@ element_cloneNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
xmlpp::Document *doc2 = document->dom;
xmlpp::Document *doc2 = static_cast<xmlpp::Document *>(document->dom);
xmlDoc *docu = doc2->cobj();
xmlNode *xmlnode = xmlNewDocFragment(docu);
@ -2496,7 +2496,7 @@ element_cloneNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
}
args.rval().setObject(*obj);
return true;
} catch (xmlpp::exception e) {
} catch (xmlpp::exception &e) {
args.rval().setNull();
return true;
}
@ -2536,7 +2536,7 @@ element_closest(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setNull();
@ -2556,7 +2556,7 @@ element_closest(JSContext *ctx, unsigned int argc, JS::Value *vp)
try {
elements = el->find(xpath);
} catch (xmlpp::exception) {
} catch (xmlpp::exception &e) {
args.rval().setNull();
return true;
@ -2571,7 +2571,7 @@ element_closest(JSContext *ctx, unsigned int argc, JS::Value *vp)
{
for (auto node: elements)
{
if (isAncestor(el, node))
if (isAncestor(el, static_cast<xmlpp::Element *>(node)))
{
JSObject *elem = getElement(ctx, node);
args.rval().setObject(*elem);
@ -2604,8 +2604,6 @@ element_contains(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -2613,7 +2611,7 @@ element_contains(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2622,7 +2620,7 @@ element_contains(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject node(ctx, &args[0].toObject());
xmlpp::Element *el2 = JS_GetPrivate(node);
xmlpp::Element *el2 = static_cast<xmlpp::Element *>(JS_GetPrivate(node));
if (!el2) {
args.rval().setBoolean(false);
@ -2656,8 +2654,6 @@ element_getAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -2665,7 +2661,7 @@ element_getAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2709,8 +2705,6 @@ element_getAttributeNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -2718,7 +2712,7 @@ element_getAttributeNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setUndefined();
@ -2753,8 +2747,6 @@ element_hasAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -2762,7 +2754,7 @@ element_hasAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2800,7 +2792,7 @@ element_hasAttributes(JSContext *ctx, unsigned int argc, JS::Value *rval)
args.rval().setBoolean(false);
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2834,7 +2826,7 @@ element_hasChildNodes(JSContext *ctx, unsigned int argc, JS::Value *rval)
args.rval().setBoolean(false);
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2861,7 +2853,7 @@ element_insertBefore(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
@ -2870,7 +2862,7 @@ element_insertBefore(JSContext *ctx, unsigned int argc, JS::Value *rval)
args.rval().setBoolean(false);
return true;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
@ -2879,13 +2871,14 @@ element_insertBefore(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject next_sibling1(ctx, &args[1].toObject());
JS::RootedObject child1(ctx, &args[0].toObject());
xmlpp::Node *next_sibling = JS_GetPrivate(next_sibling1);
xmlpp::Node *next_sibling = static_cast<xmlpp::Node *>(JS_GetPrivate(next_sibling1));
if (!next_sibling) {
return nullptr;
args.rval().setNull();
return true;
}
xmlpp::Node *child = JS_GetPrivate(child1);
xmlpp::Node *child = static_cast<xmlpp::Node *>(JS_GetPrivate(child1));
auto node = xmlAddPrevSibling(next_sibling->cobj(), child->cobj());
auto res = el_add_child_element_common(child->cobj(), node);
@ -2914,8 +2907,6 @@ element_isEqualNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -2923,7 +2914,7 @@ element_isEqualNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2932,7 +2923,7 @@ element_isEqualNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject node(ctx, &args[0].toObject());
xmlpp::Element *el2 = JS_GetPrivate(node);
xmlpp::Element *el2 = static_cast<xmlpp::Element *>(JS_GetPrivate(node));
struct string first;
struct string second;
@ -2974,8 +2965,6 @@ element_isSameNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s %d\n", __FILE__, __FUNCTION__, __LINE__);
@ -2983,7 +2972,7 @@ element_isSameNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -2992,7 +2981,7 @@ element_isSameNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::RootedObject node(ctx, &args[0].toObject());
xmlpp::Element *el2 = JS_GetPrivate(node);
xmlpp::Element *el2 = static_cast<xmlpp::Element *>(JS_GetPrivate(node));
args.rval().setBoolean(el == el2);
return true;
@ -3019,7 +3008,7 @@ element_matches(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -3039,7 +3028,7 @@ element_matches(JSContext *ctx, unsigned int argc, JS::Value *vp)
try {
elements = el->find(xpath);
} catch (xmlpp::exception) {
} catch (xmlpp::exception &e) {
args.rval().setBoolean(false);
return true;
}
@ -3076,7 +3065,7 @@ element_querySelector(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -3096,14 +3085,14 @@ element_querySelector(JSContext *ctx, unsigned int argc, JS::Value *vp)
try {
elements = el->find(xpath);
} catch (xmlpp::exception) {
} catch (xmlpp::exception &e) {
args.rval().setNull();
return true;
}
for (auto node: elements)
{
if (isAncestor(el, node))
if (isAncestor(el, static_cast<xmlpp::Element *>(node)))
{
JSObject *elem = getElement(ctx, node);
@ -3139,7 +3128,7 @@ element_querySelectorAll(JSContext *ctx, unsigned int argc, JS::Value *vp)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
args.rval().setBoolean(false);
@ -3165,11 +3154,11 @@ element_querySelectorAll(JSContext *ctx, unsigned int argc, JS::Value *vp)
try {
elements = el->find(xpath);
} catch (xmlpp::exception) {}
} catch (xmlpp::exception &e) {}
for (auto node : elements)
{
if (isAncestor(el, node)) {
if (isAncestor(el, static_cast<xmlpp::Element *>(node))) {
res->push_back(node);
}
}
@ -3202,7 +3191,7 @@ element_remove(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
@ -3211,7 +3200,7 @@ element_remove(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;
@ -3241,7 +3230,7 @@ element_removeChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
@ -3250,7 +3239,7 @@ element_removeChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el || !args[0].isObject()) {
args.rval().setNull();
@ -3262,7 +3251,7 @@ element_removeChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
auto children = el->get_children();
auto it = children.begin();
auto end = children.end();
xmlpp::Element *el2 = JS_GetPrivate(node);
xmlpp::Element *el2 = static_cast<xmlpp::Element *>(JS_GetPrivate(node));
for (;it != end; ++it) {
if (*it == el2) {
@ -3299,7 +3288,7 @@ element_setAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
#ifdef ECMASCRIPT_DEBUG
@ -3308,7 +3297,7 @@ element_setAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
return false;
}
xmlpp::Element *el = JS_GetPrivate(hobj);
xmlpp::Element *el = static_cast<xmlpp::Element *>(JS_GetPrivate(hobj));
if (!el) {
return true;