diff --git a/src/ecmascript/quickjs/attr.c b/src/ecmascript/quickjs/attr.c index 8c7b8eee..8c9d542f 100644 --- a/src/ecmascript/quickjs/attr.c +++ b/src/ecmascript/quickjs/attr.c @@ -72,7 +72,7 @@ js_attr_get_property_name(JSContext *ctx, JSValueConst this_val) return JS_EXCEPTION; } - xmlpp::AttributeNode *attr = JS_GetOpaque(this_val, js_attr_class_id); + xmlpp::AttributeNode *attr = static_cast(JS_GetOpaque(this_val, js_attr_class_id)); if (!attr) { return JS_NULL; @@ -101,7 +101,7 @@ js_attr_get_property_value(JSContext *ctx, JSValueConst this_val) return JS_EXCEPTION; } - xmlpp::AttributeNode *attr = JS_GetOpaque(this_val, js_attr_class_id); + xmlpp::AttributeNode *attr = static_cast(JS_GetOpaque(this_val, js_attr_class_id)); if (!attr) { return JS_NULL; diff --git a/src/ecmascript/quickjs/collection.c b/src/ecmascript/quickjs/collection.c index c1b06f66..d6cd1766 100644 --- a/src/ecmascript/quickjs/collection.c +++ b/src/ecmascript/quickjs/collection.c @@ -81,8 +81,7 @@ js_htmlCollection_get_property_length(JSContext *ctx, JSValueConst this_val) #ifdef ECMASCRIPT_DEBUG fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__); #endif - struct ecmascript_interpreter *interpreter = (struct ecmascript_interpreter *)JS_GetContextOpaque(ctx); - xmlpp::Node::NodeSet *ns = js_htmlCollection_GetOpaque(this_val); + xmlpp::Node::NodeSet *ns = static_cast(js_htmlCollection_GetOpaque(this_val)); if (!ns) { return JS_NewInt32(ctx, 0); @@ -97,7 +96,7 @@ js_htmlCollection_item2(JSContext *ctx, JSValueConst this_val, int idx) #ifdef ECMASCRIPT_DEBUG fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__); #endif - xmlpp::Node::NodeSet *ns = js_htmlCollection_GetOpaque(this_val); + xmlpp::Node::NodeSet *ns = static_cast(js_htmlCollection_GetOpaque(this_val)); if (!ns) { return JS_UNDEFINED; @@ -107,7 +106,7 @@ js_htmlCollection_item2(JSContext *ctx, JSValueConst this_val, int idx) try { element = dynamic_cast(ns->at(idx)); - } catch (std::out_of_range e) { return JS_UNDEFINED;} + } catch (std::out_of_range &e) { return JS_UNDEFINED;} if (!element) { return JS_UNDEFINED; @@ -138,7 +137,7 @@ js_htmlCollection_namedItem2(JSContext *ctx, JSValueConst this_val, const char * #ifdef ECMASCRIPT_DEBUG fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__); #endif - xmlpp::Node::NodeSet *ns = js_htmlCollection_GetOpaque(this_val); + xmlpp::Node::NodeSet *ns = static_cast(js_htmlCollection_GetOpaque(this_val)); if (!ns) { return JS_UNDEFINED; @@ -198,7 +197,7 @@ js_htmlCollection_set_items(JSContext *ctx, JSValue this_val, void *node) #endif int counter = 0; - xmlpp::Node::NodeSet *ns = js_htmlCollection_GetOpaque(this_val); + xmlpp::Node::NodeSet *ns = static_cast(js_htmlCollection_GetOpaque(this_val)); if (!ns) { return; @@ -209,7 +208,7 @@ js_htmlCollection_set_items(JSContext *ctx, JSValue this_val, void *node) while (1) { try { element = dynamic_cast(ns->at(counter)); - } catch (std::out_of_range e) { return;} + } catch (std::out_of_range &e) { return;} if (!element) { return; @@ -254,10 +253,12 @@ js_htmlCollection_finalizer(JSRuntime *rt, JSValue val) map_collections.erase(node); } +#if 0 static JSClassDef js_htmlCollection_class = { "htmlCollection", js_htmlCollection_finalizer }; +#endif #if 0 static JSValue diff --git a/src/ecmascript/quickjs/element.c b/src/ecmascript/quickjs/element.c index c1531fc9..fcae5ba7 100644 --- a/src/ecmascript/quickjs/element.c +++ b/src/ecmascript/quickjs/element.c @@ -1767,7 +1767,7 @@ static const JSCFunctionListEntry js_element_proto_funcs[] = { JS_CFUNC_DEF("toString", 0, js_element_toString) }; -static std::map map_elements; +static std::map map_elements; static void js_element_finalizer(JSRuntime *rt, JSValue val) @@ -1834,7 +1834,7 @@ js_element_init(JSContext *ctx) JSValue -getElement(JSContext *ctx, void *node) +getElement(JSContext *ctx, const void *node) { #ifdef ECMASCRIPT_DEBUG fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__); diff --git a/src/ecmascript/quickjs/element.h b/src/ecmascript/quickjs/element.h index 5ad3cd59..316b7464 100644 --- a/src/ecmascript/quickjs/element.h +++ b/src/ecmascript/quickjs/element.h @@ -3,7 +3,7 @@ #include -JSValue getElement(JSContext *ctx, void *node); +JSValue getElement(JSContext *ctx, const void *node); int js_element_init(JSContext *ctx); void walk_tree(struct string *buf, void *nod, bool start = true, bool toSortAttrs = false);