r13581 mmu_man - in /trunk/libdom/src: core/ events/ html/

netsurf at semichrome.net netsurf at semichrome.net
Sat Mar 24 09:41:34 GMT 2012


Author: mmu_man
Date: Sat Mar 24 04:41:34 2012
New Revision: 13581

URL: http://source.netsurf-browser.org?rev=13581&view=rev
Log:
C89 for BeOS build.

Modified:
    trunk/libdom/src/core/attr.c
    trunk/libdom/src/core/characterdata.c
    trunk/libdom/src/core/document.c
    trunk/libdom/src/core/element.c
    trunk/libdom/src/core/node.c
    trunk/libdom/src/core/text.c
    trunk/libdom/src/events/document_event.c
    trunk/libdom/src/events/keyboard_event.c
    trunk/libdom/src/events/mouse_event.c
    trunk/libdom/src/events/mouse_multi_wheel_event.c
    trunk/libdom/src/events/mouse_wheel_event.c
    trunk/libdom/src/html/html_base_element.c
    trunk/libdom/src/html/html_body_element.c
    trunk/libdom/src/html/html_form_element.c
    trunk/libdom/src/html/html_head_element.c
    trunk/libdom/src/html/html_html_element.c
    trunk/libdom/src/html/html_isindex_element.c
    trunk/libdom/src/html/html_link_element.c
    trunk/libdom/src/html/html_meta_element.c
    trunk/libdom/src/html/html_select_element.c
    trunk/libdom/src/html/html_style_element.c
    trunk/libdom/src/html/html_title_element.c

Modified: trunk/libdom/src/core/attr.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/attr.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/core/attr.c (original)
+++ trunk/libdom/src/core/attr.c Sat Mar 24 04:41:34 2012
@@ -225,6 +225,11 @@
  */
 dom_exception dom_attr_set_integer(dom_attr *a, unsigned long value)
 {
+	struct dom_document *doc;
+	struct dom_node_internal *ele;
+	bool success = true;
+	dom_exception err;
+
 	/* If this is the first set method, we should fix this attribute
 	 * type */
 	if (a->type == DOM_ATTR_UNSET)
@@ -238,10 +243,8 @@
 	
 	a->value.lvalue = value;
 
-	struct dom_document *doc = dom_node_get_owner(a);
-	struct dom_node_internal *ele = dom_node_get_parent(a);
-	bool success = true;
-	dom_exception err;
+	doc = dom_node_get_owner(a);
+	ele = dom_node_get_parent(a);
 	err = _dom_dispatch_attr_modified_event(doc, ele, NULL, NULL,
 			(dom_event_target *) a, NULL,
 			DOM_MUTATION_MODIFICATION, &success);
@@ -284,6 +287,11 @@
  */
 dom_exception dom_attr_set_short(dom_attr *a, unsigned short value)
 {
+	struct dom_document *doc;
+	struct dom_node_internal *ele;
+	bool success = true;
+	dom_exception err;
+
 	/* If this is the first set method, we should fix this attribute
 	 * type */
 	if (a->type == DOM_ATTR_UNSET)
@@ -297,10 +305,8 @@
 	
 	a->value.svalue = value;
 
-	struct dom_document *doc = dom_node_get_owner(a);
-	struct dom_node_internal *ele = dom_node_get_parent(a);
-	bool success = true;
-	dom_exception err;
+	doc = dom_node_get_owner(a);
+	ele = dom_node_get_parent(a);
 	err = _dom_dispatch_attr_modified_event(doc, ele, NULL, NULL,
 			(dom_event_target *) a, NULL,
 			DOM_MUTATION_MODIFICATION, &success);
@@ -343,6 +349,11 @@
  */
 dom_exception dom_attr_set_bool(dom_attr *a, bool value)
 {
+	struct dom_document *doc;
+	struct dom_node_internal *ele;
+	bool success = true;
+	dom_exception err;
+
 	/* If this is the first set method, we should fix this attribute
 	 * type */
 	if (a->type == DOM_ATTR_UNSET)
@@ -356,10 +367,8 @@
 	
 	a->value.bvalue = value;
 
-	struct dom_document *doc = dom_node_get_owner(a);
-	struct dom_node_internal *ele = dom_node_get_parent(a);
-	bool success = true;
-	dom_exception err;
+	doc = dom_node_get_owner(a);
+	ele = dom_node_get_parent(a);
 	err = _dom_dispatch_attr_modified_event(doc, ele, NULL, NULL,
 			(dom_event_target *) a, NULL,
 			DOM_MUTATION_MODIFICATION, &success);
@@ -520,6 +529,8 @@
 	struct dom_node_internal *c, *d;
 	struct dom_text *text;
 	dom_exception err;
+	dom_string *name = NULL;
+	dom_string *parsed = NULL;
 
 	/* Ensure attribute is writable */
 	if (_dom_node_readonly(a))
@@ -533,13 +544,10 @@
 	if (attr->type != DOM_ATTR_STRING)
 		return DOM_ATTR_WRONG_TYPE_ERR;
 	
-	dom_string *name = NULL;
-
 	err = _dom_attr_get_name(attr, &name);
 	if (err != DOM_NO_ERR)
 		return err;
 	
-	dom_string *parsed = NULL;
 	err = dom_element_parse_attribute(a->parent, name, value, &parsed);
 	dom_string_unref(name);
 	if (err != DOM_NO_ERR) {

Modified: trunk/libdom/src/core/characterdata.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/characterdata.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/core/characterdata.c (original)
+++ trunk/libdom/src/core/characterdata.c Sat Mar 24 04:41:34 2012
@@ -125,15 +125,16 @@
 		dom_string *data)
 {
 	struct dom_node_internal *c = (struct dom_node_internal *) cdata;
+	dom_exception err;
+	struct dom_document *doc;
+	bool success = true;
 
 	if (_dom_node_readonly(c)) {
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
 	}
 
 	/* Dispatch a DOMCharacterDataModified event */
-	dom_exception err;
-	struct dom_document *doc = dom_node_get_owner(cdata);
-	bool success = true;
+	doc = dom_node_get_owner(cdata);
 	err = _dom_dispatch_characterdata_modified_event(doc, c, c->value,
 			data, &success);
 	if (err != DOM_NO_ERR)
@@ -230,6 +231,8 @@
 	struct dom_node_internal *c = (struct dom_node_internal *) cdata;
 	dom_string *temp;
 	dom_exception err;
+	struct dom_document *doc;
+	bool success = true;
 
 	if (_dom_node_readonly(c)) {
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
@@ -241,8 +244,7 @@
 	}
 
 	/* Dispatch a DOMCharacterDataModified event */
-	struct dom_document *doc = dom_node_get_owner(cdata);
-	bool success = true;
+	doc = dom_node_get_owner(cdata);
 	err = _dom_dispatch_characterdata_modified_event(doc, c, c->value,
 			temp, &success);
 	if (err != DOM_NO_ERR)
@@ -277,6 +279,8 @@
 	dom_string *temp;
 	uint32_t len;
 	dom_exception err;
+	struct dom_document *doc;
+	bool success = true;
 
 	if (_dom_node_readonly(c)) {
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
@@ -302,8 +306,7 @@
 	}
 
 	/* Dispatch a DOMCharacterDataModified event */
-	struct dom_document *doc = dom_node_get_owner(cdata);
-	bool success = true;
+	doc = dom_node_get_owner(cdata);
 	err = _dom_dispatch_characterdata_modified_event(doc, c, c->value,
 			temp, &success);
 	if (err != DOM_NO_ERR)
@@ -338,6 +341,8 @@
 	dom_string *temp;
 	uint32_t len, end;
 	dom_exception err;
+	struct dom_document *doc;
+	bool success = true;
 
 	if (_dom_node_readonly(c)) {
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
@@ -365,8 +370,7 @@
 	}
 
 	/* Dispatch a DOMCharacterDataModified event */
-	struct dom_document *doc = dom_node_get_owner(cdata);
-	bool success = true;
+	doc = dom_node_get_owner(cdata);
 	err = _dom_dispatch_characterdata_modified_event(doc, c, c->value,
 			temp, &success);
 	if (err != DOM_NO_ERR)
@@ -403,6 +407,8 @@
 	dom_string *temp;
 	uint32_t len, end;
 	dom_exception err;
+	struct dom_document *doc;
+	bool success = true;
 
 	if (_dom_node_readonly(c)) {
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
@@ -430,8 +436,7 @@
 	}
 
 	/* Dispatch a DOMCharacterDataModified event */
-	struct dom_document *doc = dom_node_get_owner(cdata);
-	bool success = true;
+	doc = dom_node_get_owner(cdata);
 	err = _dom_dispatch_characterdata_modified_event(doc, c, c->value, temp,
 			&success);
 	if (err != DOM_NO_ERR)

Modified: trunk/libdom/src/core/document.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/document.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/core/document.c (original)
+++ trunk/libdom/src/core/document.c Sat Mar 24 04:41:34 2012
@@ -916,6 +916,8 @@
 {
 	dom_node_internal *n = (dom_node_internal *) node;
 	dom_exception err;
+	dom_node_internal *parent;
+	dom_node_internal *tmp;
 	
 	*result = NULL;
 
@@ -945,8 +947,7 @@
 		return err;
 	}
 
-	dom_node_internal *parent = n->parent;
-	dom_node_internal *tmp;
+	parent = n->parent;
 	if (parent != NULL) {
 		err = dom_node_remove_child(parent, node, (void *) &tmp);
 		if (err != DOM_NO_ERR) {
@@ -1243,6 +1244,8 @@
 	dom_node_internal *n = (dom_node_internal *) node;
 	dom_node_internal *ret;
 	dom_exception err;
+	dom_node_internal *child, *r;
+	dom_user_data *ud;
 
 	if (opt == DOM_NODE_ADOPTED && _dom_node_readonly(n))
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
@@ -1276,7 +1279,6 @@
 		return DOM_NOT_SUPPORTED_ERR;
 	}
 
-	dom_node_internal *child, *r;
 	if (deep == true) {
 		child = ((dom_node_internal *) node)->first_child;
 		while (child != NULL) {
@@ -1300,7 +1302,6 @@
 	}
 
 	/* Call the dom_user_data_handlers */
-	dom_user_data *ud;
 	ud = n->user_data;
 	while (ud != NULL) {
 		if (ud->handler != NULL) {

Modified: trunk/libdom/src/core/element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/core/element.c (original)
+++ trunk/libdom/src/core/element.c Sat Mar 24 04:41:34 2012
@@ -1125,14 +1125,15 @@
 	struct dom_element *ele = (struct dom_element *) node;
 	dom_string *value;
 	dom_exception err;
+	bool has;
+	dom_string *xmlns;
 
 	if (node->prefix == NULL) {
 		*result = dom_string_isequal(node->namespace, namespace);
 		return DOM_NO_ERR;
 	}
 
-	bool has;
-	dom_string *xmlns = _dom_namespace_get_xmlns_prefix();
+	xmlns = _dom_namespace_get_xmlns_prefix();
 	err = dom_element_has_attribute(ele, xmlns, &has);
 	if (err != DOM_NO_ERR)
 		return err;
@@ -1164,6 +1165,8 @@
 		dom_string *prefix, dom_string **result)
 {
 	dom_exception err;
+	bool has;
+	dom_string *xmlns;
 
 	if (node->namespace != NULL && 
 			dom_string_isequal(node->prefix, prefix)) {
@@ -1171,8 +1174,7 @@
 		return DOM_NO_ERR;
 	}
 	
-	bool has;
-	dom_string *xmlns = _dom_namespace_get_xmlns_prefix();
+	xmlns = _dom_namespace_get_xmlns_prefix();
 	err = dom_element_has_attribute_ns(node, xmlns, prefix, &has);
 	if (err != DOM_NO_ERR)
 		return err;
@@ -1376,6 +1378,8 @@
 		/* No existing attribute, so create one */
 		struct dom_attr *attr;
 		struct dom_attr_list *list_node;
+		struct dom_document *doc;
+		bool success = true;
 
 		err = _dom_attr_create(e->owner, name, namespace, NULL,
 				true, &attr);
@@ -1394,8 +1398,7 @@
 		}
 
 		/* Dispatch a DOMAttrModified event */
-		struct dom_document *doc = dom_node_get_owner(element);
-		bool success = true;
+		doc = dom_node_get_owner(element);
 		err = _dom_dispatch_attr_modified_event(doc, e, NULL, value,
 				(dom_event_target *) attr, name, 
 				DOM_MUTATION_ADDITION, &success);
@@ -1473,6 +1476,7 @@
 		bool success = true;
 		dom_attr *a = match->attr;
 		struct dom_document *doc = dom_node_get_owner(element);
+		dom_string *old = NULL;
 
 		err = dom_node_dispatch_node_change_event(doc, match->attr,
 				element, DOM_MUTATION_REMOVAL, &success);
@@ -1497,7 +1501,6 @@
 
 		/* Dispatch a DOMAttrModified event */
 		success = true;
-		dom_string *old = NULL;
 		err = dom_attr_get_value(a, &old);
 		/* TODO: We did not support some node type such as entity
 		 * reference, in that case, we should ignore the error to
@@ -1583,6 +1586,9 @@
 	dom_node_internal *e = (dom_node_internal *) element;
 	dom_node_internal *attr_node = (dom_node_internal *) attr;
 	dom_attr *old_attr;
+	dom_string *new = NULL;
+	struct dom_document *doc;
+	bool success = true;
 
 	/** \todo validate name */
 
@@ -1608,8 +1614,8 @@
 	*result = NULL;
 	if (match != NULL) {
 		/* Disptach DOMNodeRemoval event */
-		bool success = true;
-		struct dom_document *doc = dom_node_get_owner(element);
+		dom_string *old = NULL;
+		doc = dom_node_get_owner(element);
 		old_attr = match->attr;
 
 		err = dom_node_dispatch_node_change_event(doc, old_attr, 
@@ -1625,7 +1631,6 @@
 		_dom_element_attr_list_node_destroy(match);
 
 		/* Dispatch a DOMAttrModified event */
-		dom_string *old = NULL;
 		success = true;
 		err = dom_attr_get_value(old_attr, &old);
 		/* TODO: We did not support some node type such as entity
@@ -1669,9 +1674,8 @@
 	dom_node_remove_pending(attr);
 
 	/* Dispatch a DOMAttrModified event */
-	dom_string *new = NULL;
-	struct dom_document *doc = dom_node_get_owner(element);
-	bool success = true;
+	doc = dom_node_get_owner(element);
+	success = true;
 	err = dom_attr_get_value(attr, &new);
 	/* TODO: We did not support some node type such as entity reference, in
 	 * that case, we should ignore the error to make sure the event model
@@ -1732,6 +1736,9 @@
 	dom_string *name;
 	dom_node_internal *e = (dom_node_internal *) element;
 	dom_attr *a;
+	bool success = true;
+	struct dom_document *doc;
+	dom_string *old = NULL;
 	
 	/* Ensure element can be written to */
 	if (_dom_node_readonly(e))
@@ -1754,8 +1761,7 @@
 	a = match->attr;
 
 	/* Dispatch a DOMNodeRemoved event */
-	bool success = true;
-	struct dom_document *doc = dom_node_get_owner(element);
+	doc = dom_node_get_owner(element);
 	err = dom_node_dispatch_node_change_event(doc, a, element, 
 			DOM_MUTATION_REMOVAL, &success);
 	if (err != DOM_NO_ERR) {
@@ -1780,7 +1786,6 @@
 	dom_string_unref(name);
 
 	/* Dispatch a DOMAttrModified event */
-	dom_string *old = NULL;
 	success = true;
 	err = dom_attr_get_value(a, &old);
 	/* TODO: We did not support some node type such as entity reference, in
@@ -1891,6 +1896,8 @@
 {
 	dom_exception err;
 	dom_string *ret = NULL;
+	dom_document *doc;
+	dom_string *name;
 
 	*id = NULL;
 
@@ -1906,10 +1913,8 @@
 		return err;
 	}
 
-	dom_document *doc;
 	doc = dom_node_get_owner(ele);
 	assert(doc != NULL);
-	dom_string *name;
 
 	if (ele->id_name != NULL) {
 		name = ele->id_name;

Modified: trunk/libdom/src/core/node.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/node.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/core/node.c (original)
+++ trunk/libdom/src/core/node.c Sat Mar 24 04:41:34 2012
@@ -220,6 +220,8 @@
 void _dom_node_finalise(dom_node_internal *node)
 {
 	struct dom_user_data *u, *v;
+	struct dom_node_internal *p;
+	struct dom_node_internal *n = NULL;
 
 	/* Destroy user data */
 	for (u = node->user_data; u != NULL; u = v) {
@@ -236,8 +238,7 @@
 		dom_string_unref(node->namespace);
 
 	/* Destroy all the child nodes of this node */
-	struct dom_node_internal *p = node->first_child;
-	struct dom_node_internal *n = NULL;
+	p = node->first_child;
 	while (p != NULL) {
 		n = p->next;
 		p->parent = NULL;
@@ -716,6 +717,7 @@
 		dom_node_internal **result)
 {
 	dom_exception err;
+	dom_node_internal *n;
 
 	/* Ensure that new_child and node are owned by the same document */
 	if ((new_child->type == DOM_DOCUMENT_TYPE_NODE && 
@@ -734,7 +736,7 @@
 		return DOM_NOT_FOUND_ERR;
 
 	/* Ensure that new_child is not an ancestor of node, nor node itself */
-	for (dom_node_internal *n = node; n != NULL; n = n->parent) {
+	for (n = node; n != NULL; n = n->parent) {
 		if (n == new_child)
 			return DOM_HIERARCHY_REQUEST_ERR;
 	}
@@ -855,6 +857,8 @@
 		dom_node_internal *new_child, dom_node_internal *old_child,
 		dom_node_internal **result)
 {
+	dom_node_internal *n;
+
 	/* We don't support replacement of DocumentType or root Elements */
 	if (node->type == DOM_DOCUMENT_NODE && 
 			(new_child->type == DOM_DOCUMENT_TYPE_NODE || 
@@ -874,7 +878,7 @@
 		return DOM_NOT_FOUND_ERR;
 
 	/* Ensure that new_child is not an ancestor of node, nor node itself */
-	for (dom_node_internal *n = node; n != NULL; n = n->parent) {
+	for (n = node; n != NULL; n = n->parent) {
 		if (n == new_child)
 			return DOM_HIERARCHY_REQUEST_ERR;
 	}
@@ -951,6 +955,9 @@
 		dom_node_internal *old_child,
 		dom_node_internal **result)
 {
+	dom_exception err;
+	bool success = true;
+
 	/* We don't support removal of DocumentType or root Element nodes */
 	if (node->type == DOM_DOCUMENT_NODE &&
 			(old_child->type == DOM_DOCUMENT_TYPE_NODE ||
@@ -966,8 +973,6 @@
 		return DOM_NO_MODIFICATION_ALLOWED_ERR;
 
 	/* Dispatch a DOMNodeRemoval event */
-	dom_exception err;
-	bool success = true;
 	err = dom_node_dispatch_node_change_event(node->owner, old_child, node,
 			DOM_MUTATION_REMOVAL, &success);
 	if (err != DOM_NO_ERR)
@@ -1929,7 +1934,8 @@
 		/* Ensure that the document doesn't already 
 		 * have a root element */
 		if (child->type == DOM_ELEMENT_NODE) {
-			for (dom_node_internal *n = parent->first_child; 
+			dom_node_internal *n;
+			for (n = parent->first_child; 
 					n != NULL; n = n->next) {
 				if (n->type == DOM_ELEMENT_NODE)
 					valid = false;
@@ -1939,7 +1945,8 @@
 		/* Ensure that the document doesn't already 
 		 * have a document type */
 		if (child->type == DOM_DOCUMENT_TYPE_NODE) {
-			for (dom_node_internal *n = parent->first_child;
+			dom_node_internal *n;
+			for (n = parent->first_child;
 					n != NULL; n = n->next) {
 				if (n->type == DOM_DOCUMENT_TYPE_NODE)
 					valid = false;
@@ -2030,6 +2037,10 @@
 		dom_node_internal *previous, 
 		dom_node_internal *next)
 {
+	dom_exception err;
+	bool success = true;
+	dom_node_internal *n;
+
 	first->previous = previous;
 	last->next = next;
 
@@ -2043,9 +2054,7 @@
 	else
 		parent->last_child = last;
 
-	dom_exception err;
-	bool success = true;
-	for (dom_node_internal *n = first; n != last->next; n = n->next) {
+	for (n = first; n != last->next; n = n->next) {
 		n->parent = parent;
 		/* Dispatch a DOMNodeInserted event */
 		err = dom_node_dispatch_node_change_event(parent->owner, 
@@ -2074,6 +2083,10 @@
 void _dom_node_detach_range(dom_node_internal *first, 
 		dom_node_internal *last)
 {
+	bool success = true;
+	dom_node_internal *parent;
+	dom_node_internal *n;
+
 	if (first->previous != NULL)
 		first->previous->next = last->next;
 	else
@@ -2084,9 +2097,8 @@
 	else
 		last->parent->last_child = first->previous;
 
-	bool success = true;
-	dom_node_internal *parent = first->parent;
-	for (dom_node_internal *n = first; n != last->next; n = n->next) {
+	parent = first->parent;
+	for (n = first; n != last->next; n = n->next) {
 		/* Dispatch a DOMNodeRemoval event */
 		dom_node_dispatch_node_change_event(n->owner, n, n->parent, 
 				DOM_MUTATION_REMOVAL, &success);
@@ -2116,6 +2128,7 @@
 		dom_node_internal *replacement)
 {
 	dom_node_internal *first, *last;
+	dom_node_internal *n;
 
 	if (replacement->type == DOM_DOCUMENT_FRAGMENT_NODE) {
 		first = replacement->first_child;
@@ -2140,7 +2153,7 @@
 	else
 		old->parent->last_child = last;
 
-	for (dom_node_internal *n = first; n != last->next; n = n->next) {
+	for (n = first; n != last->next; n = n->next) {
 		n->parent = old->parent;
 	}
 
@@ -2157,11 +2170,11 @@
 dom_exception _dom_merge_adjacent_text(dom_node_internal *p,
 		dom_node_internal *n)
 {
+	dom_string *str;
+	dom_exception err;
+
 	assert(p->type = DOM_TEXT_NODE);
 	assert(n->type = DOM_TEXT_NODE);
-
-	dom_string *str;
-	dom_exception err;
 
 	err = dom_text_get_whole_text(n, &str);
 	if (err != DOM_NO_ERR)
@@ -2310,6 +2323,12 @@
 		struct dom_event *evt, bool *success)
 {
 	dom_exception err, ret = DOM_NO_ERR;
+	dom_event_target_entry list;
+	dom_node_internal *target = (dom_node_internal *) et;
+	dom_document *doc;
+	dom_document_event_internal *dei;
+	void *pw = NULL;
+	struct list_entry *e;
 
 	assert(et != NULL);
 	assert(evt != NULL);
@@ -2328,7 +2347,7 @@
 	if (evt->doc == NULL)
 		return DOM_NOT_SUPPORTED_ERR;
 	
-	dom_document *doc = dom_node_get_owner(et);
+	doc = dom_node_get_owner(et);
 	if (doc == NULL) {
 		/* TODO: In the progress of parsing, many Nodes in the DTD has
 		 * no document at all, do nothing for this kind of node */
@@ -2338,9 +2357,6 @@
 	if (_dom_validate_ncname(evt->type) == false) {
 		return DOM_INVALID_CHARACTER_ERR;
 	}
-
-	dom_event_target_entry list;
-	dom_node_internal *target = (dom_node_internal *) et;
 
 	*success = true;
 
@@ -2368,8 +2384,7 @@
 	evt->phase = DOM_CAPTURING_PHASE;
 
 	/* The started callback of default action */
-	dom_document_event_internal *dei = &doc->dei;
-	void *pw = NULL; 
+	dei = &doc->dei;
 	if (dei->actions != NULL) {
 		dom_default_action_callback cb = dei->actions(evt->type,
 				DOM_DEFAULT_ACTION_STARTED, &pw);
@@ -2379,7 +2394,7 @@
 	}
 
 	/* The capture phase */
-	struct list_entry *e = list.entry.prev;
+	e = list.entry.prev;
 	for (; e != &list.entry; e = e->prev) {
 		dom_event_target_entry *l = (dom_event_target_entry *) e;
 		dom_node_internal *node = (dom_node_internal *) l->et;

Modified: trunk/libdom/src/core/text.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/text.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/core/text.c (original)
+++ trunk/libdom/src/core/text.c Sat Mar 24 04:41:34 2012
@@ -350,6 +350,10 @@
 		dom_node_internal *node, walk_operation opt,
 		walk_order order, dom_string **ret, bool *cont)
 {
+	dom_exception err;
+	dom_string *data, *tmp;
+	dom_node_internal *parent;
+
 	/* If we reach the leaf of the DOM tree, just return to continue
 	 * to next sibling of our parent */
 	if (node == NULL) {
@@ -357,11 +361,11 @@
 		return DOM_NO_ERR;
 	}
 
-	dom_exception err;
-	dom_string *data, *tmp;
-	dom_node_internal *parent = dom_node_get_parent(node);
+	parent = dom_node_get_parent(node);
 
 	while (node != NULL) {
+		dom_node_internal *p;
+
 		/* If we reach the boundary of logical-adjacent text, we stop */
 		if (node->type == DOM_ELEMENT_NODE || 
 				node->type == DOM_COMMENT_NODE ||
@@ -411,7 +415,7 @@
 			}
 		}
 
-		dom_node_internal *p = dom_node_get_parent(node);
+		p = dom_node_get_parent(node);
 		if (order == LEFT) {
 			if (node->last_child != NULL) {
 				node = node->last_child;

Modified: trunk/libdom/src/events/document_event.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/events/document_event.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/events/document_event.c (original)
+++ trunk/libdom/src/events/document_event.c Sat Mar 24 04:41:34 2012
@@ -103,6 +103,8 @@
 	lwc_string *t = NULL;
 	dom_exception err;
 	struct dom_document *doc = de;
+	int i, et = 0;
+	dom_document_event_internal *dei;
 
 	err = dom_string_intern(type, &t);
 	if (err != DOM_NO_ERR)
@@ -110,8 +112,7 @@
 
 	assert(t != NULL);
 	
-	int i, et = 0;
-	dom_document_event_internal *dei = &de->dei;
+	dei = &de->dei;
 	for (i = 0; i < DOM_EVENT_COUNT; i++) {
 		if (dei->event_types[i] == t) {
 			et = i;

Modified: trunk/libdom/src/events/keyboard_event.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/events/keyboard_event.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/events/keyboard_event.c (original)
+++ trunk/libdom/src/events/keyboard_event.c Sat Mar 24 04:41:34 2012
@@ -172,13 +172,16 @@
 dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt,
 		dom_string *m, bool *state)
 {
+	const char *data;
+	size_t len;
+
 	if (m == NULL) {
 		*state = false;
 		return DOM_NO_ERR;
 	}
 
-	const char *data = dom_string_data(m);
-	size_t len = dom_string_byte_length(m);
+	data = dom_string_data(m);
+	len = dom_string_byte_length(m);
 
 	if (len == SLEN("AltGraph") && strncmp(data, "AltGraph", len) == 0) {
 		*state = ((evt->modifier_state & DOM_MOD_ALT_GRAPH) != 0);
@@ -286,14 +289,17 @@
 dom_exception _dom_parse_modifier_list(dom_string *modifier_list,
 		uint32_t *modifier_state)
 {
+	const char *data;
+	const char *m;
+	size_t len = 0;
+
 	*modifier_state = 0;
 
 	if (modifier_list == NULL)
 		return DOM_NO_ERR;
 	
-	const char *data = dom_string_data(modifier_list);
-	const char *m = data;
-	size_t len = 0;
+	data = dom_string_data(modifier_list);
+	m = data;
 
 	while (true) {
 		/* If we reach a space or end of the string, we should parse

Modified: trunk/libdom/src/events/mouse_event.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/events/mouse_event.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/events/mouse_event.c (original)
+++ trunk/libdom/src/events/mouse_event.c Sat Mar 24 04:41:34 2012
@@ -224,13 +224,16 @@
 dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt,
 		dom_string *m, bool *state)
 {
+	const char *data;
+	size_t len;
+
 	if (m == NULL) {
 		*state = false;
 		return DOM_NO_ERR;
 	}
 
-	const char *data = dom_string_data(m);
-	size_t len = dom_string_byte_length(m);
+	data = dom_string_data(m);
+	len = dom_string_byte_length(m);
 
 	if (len == SLEN("AltGraph") && strncmp(data, "AltGraph", len) == 0) {
 		*state = ((evt->modifier_state & DOM_MOD_ALT_GRAPH) != 0);

Modified: trunk/libdom/src/events/mouse_multi_wheel_event.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/events/mouse_multi_wheel_event.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/events/mouse_multi_wheel_event.c (original)
+++ trunk/libdom/src/events/mouse_multi_wheel_event.c Sat Mar 24 04:41:34 2012
@@ -136,11 +136,11 @@
 		long wheel_delta_y, long wheel_delta_z)
 {
 	dom_exception err;
+	dom_mouse_event *e = (dom_mouse_event *) evt;
+
 	evt->x = wheel_delta_x;
 	evt->y = wheel_delta_y;
 	evt->z = wheel_delta_z;
-
-	dom_mouse_event *e = (dom_mouse_event *) evt;
 
 	err = _dom_parse_modifier_list(modifier_list, &e->modifier_state);
 	if (err != DOM_NO_ERR)

Modified: trunk/libdom/src/events/mouse_wheel_event.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/events/mouse_wheel_event.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/events/mouse_wheel_event.c (original)
+++ trunk/libdom/src/events/mouse_wheel_event.c Sat Mar 24 04:41:34 2012
@@ -101,8 +101,8 @@
 		dom_string *modifier_list, long wheel_delta)
 {
 	dom_exception err;
+	dom_mouse_event *e = (dom_mouse_event *) evt;
 	evt->delta = wheel_delta;
-	dom_mouse_event *e = (dom_mouse_event *) evt;
 
 	err = _dom_parse_modifier_list(modifier_list, &e->modifier_state);
 	if (err != DOM_NO_ERR)

Modified: trunk/libdom/src/html/html_base_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_base_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_base_element.c (original)
+++ trunk/libdom/src/html/html_base_element.c Sat Mar 24 04:41:34 2012
@@ -29,12 +29,14 @@
 dom_exception _dom_html_base_element_create(struct dom_html_document *doc,
 		struct dom_html_base_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_base_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_body_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_body_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_body_element.c (original)
+++ trunk/libdom/src/html/html_body_element.c Sat Mar 24 04:41:34 2012
@@ -29,12 +29,14 @@
 dom_exception _dom_html_body_element_create(struct dom_html_document *doc,
 		struct dom_html_body_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_body_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_form_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_form_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_form_element.c (original)
+++ trunk/libdom/src/html/html_form_element.c Sat Mar 24 04:41:34 2012
@@ -35,12 +35,14 @@
 dom_exception _dom_html_form_element_create(struct dom_html_document *doc,
 		struct dom_html_form_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_form_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_head_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_head_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_head_element.c (original)
+++ trunk/libdom/src/html/html_head_element.c Sat Mar 24 04:41:34 2012
@@ -29,12 +29,14 @@
 dom_exception _dom_html_head_element_create(struct dom_html_document *doc,
 		struct dom_html_head_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_head_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_html_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_html_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_html_element.c (original)
+++ trunk/libdom/src/html/html_html_element.c Sat Mar 24 04:41:34 2012
@@ -29,12 +29,14 @@
 dom_exception _dom_html_html_element_create(struct dom_html_document *doc,
 		struct dom_html_html_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_html_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_isindex_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_isindex_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_isindex_element.c (original)
+++ trunk/libdom/src/html/html_isindex_element.c Sat Mar 24 04:41:34 2012
@@ -31,12 +31,14 @@
 		struct dom_html_form_element *form, 
 		struct dom_html_isindex_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_isindex_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_link_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_link_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_link_element.c (original)
+++ trunk/libdom/src/html/html_link_element.c Sat Mar 24 04:41:34 2012
@@ -31,12 +31,14 @@
 dom_exception _dom_html_link_element_create(struct dom_html_document *doc,
 		struct dom_html_link_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_link_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_meta_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_meta_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_meta_element.c (original)
+++ trunk/libdom/src/html/html_meta_element.c Sat Mar 24 04:41:34 2012
@@ -29,12 +29,14 @@
 dom_exception _dom_html_meta_element_create(struct dom_html_document *doc,
 		struct dom_html_meta_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_meta_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_select_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_select_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_select_element.c (original)
+++ trunk/libdom/src/html/html_select_element.c Sat Mar 24 04:41:34 2012
@@ -33,12 +33,14 @@
 dom_exception _dom_html_select_element_create(struct dom_html_document *doc,
 		struct dom_html_select_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_select_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_style_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_style_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_style_element.c (original)
+++ trunk/libdom/src/html/html_style_element.c Sat Mar 24 04:41:34 2012
@@ -29,12 +29,14 @@
 dom_exception _dom_html_style_element_create(struct dom_html_document *doc,
 		struct dom_html_style_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_style_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 

Modified: trunk/libdom/src/html/html_title_element.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_title_element.c?rev=13581&r1=13580&r2=13581&view=diff
==============================================================================
--- trunk/libdom/src/html/html_title_element.c (original)
+++ trunk/libdom/src/html/html_title_element.c Sat Mar 24 04:41:34 2012
@@ -33,12 +33,14 @@
 dom_exception _dom_html_title_element_create(struct dom_html_document *doc,
 		struct dom_html_title_element **ele)
 {
+	struct dom_node_internal *node;
+
 	*ele = malloc(sizeof(dom_html_title_element));
 	if (*ele == NULL)
 		return DOM_NO_MEM_ERR;
 	
 	/* Set up vtables */
-	struct dom_node_internal *node = (struct dom_node_internal *) *ele;
+	node = (struct dom_node_internal *) *ele;
 	node->base.vtable = &_dom_element_vtable;
 	node->vtable = &_protect_vtable;
 




More information about the netsurf-commits mailing list