diff options
Diffstat (limited to 'src')
30 files changed, 141 insertions, 138 deletions
diff --git a/src/core/attr.c b/src/core/attr.c index 9db04b6..d9e2b07 100644 --- a/src/core/attr.c +++ b/src/core/attr.c @@ -36,7 +36,7 @@ struct dom_attr { dom_attr_type type; /**< The type of this attribute */ union { - unsigned long lvalue; + uint32_t lvalue; unsigned short svalue; bool bvalue; } value; /**< The special type value of this attribute */ @@ -204,7 +204,7 @@ dom_attr_type dom_attr_get_type(dom_attr *a) * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a integer * attribute */ -dom_exception dom_attr_get_integer(dom_attr *a, unsigned long *value) +dom_exception dom_attr_get_integer(dom_attr *a, uint32_t *value) { if (a->type != DOM_ATTR_INTEGER) return DOM_ATTR_WRONG_TYPE_ERR; @@ -223,7 +223,7 @@ dom_exception dom_attr_get_integer(dom_attr *a, unsigned long *value) * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a integer * attribute */ -dom_exception dom_attr_set_integer(dom_attr *a, unsigned long value) +dom_exception dom_attr_set_integer(dom_attr *a, uint32_t value) { struct dom_document *doc; struct dom_node_internal *ele; @@ -507,7 +507,7 @@ dom_exception _dom_attr_get_value(struct dom_attr *attr, return err; } - /* No longer need textual representation */ + /* No int32_ter need textual representation */ dom_string_unref(tr); /* Finished with previous value */ diff --git a/src/core/characterdata.c b/src/core/characterdata.c index 0883444..c46a5c6 100644 --- a/src/core/characterdata.c +++ b/src/core/characterdata.c @@ -159,7 +159,7 @@ dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, * \return DOM_NO_ERR. */ dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, - unsigned long *length) + uint32_t *length) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; @@ -192,13 +192,13 @@ dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, * this implementation; dom_strings are unbounded. */ dom_exception _dom_characterdata_substring_data( - struct dom_characterdata *cdata, unsigned long offset, - unsigned long count, dom_string **data) + struct dom_characterdata *cdata, uint32_t offset, + uint32_t count, dom_string **data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; uint32_t len, end; - if ((signed long) offset < 0 || (signed long) count < 0) { + if ((int32_t) offset < 0 || (int32_t) count < 0) { return DOM_INDEX_SIZE_ERR; } @@ -273,7 +273,7 @@ dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, - unsigned long offset, dom_string *data) + uint32_t offset, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_string *temp; @@ -286,7 +286,7 @@ dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, return DOM_NO_MODIFICATION_ALLOWED_ERR; } - if ((signed long) offset < 0) { + if ((int32_t) offset < 0) { return DOM_INDEX_SIZE_ERR; } @@ -335,7 +335,7 @@ dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, - unsigned long offset, unsigned long count) + uint32_t offset, uint32_t count) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_string *temp; @@ -349,7 +349,7 @@ dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, return DOM_NO_MODIFICATION_ALLOWED_ERR; } - if ((signed long) offset < 0 || (signed long) count < 0) { + if ((int32_t) offset < 0 || (int32_t) count < 0) { return DOM_INDEX_SIZE_ERR; } @@ -404,7 +404,7 @@ dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, - unsigned long offset, unsigned long count, + uint32_t offset, uint32_t count, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; @@ -418,7 +418,7 @@ dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, return DOM_NO_MODIFICATION_ALLOWED_ERR; } - if ((signed long) offset < 0 || (signed long) count < 0) { + if ((int32_t) offset < 0 || (int32_t) count < 0) { return DOM_INDEX_SIZE_ERR; } diff --git a/src/core/characterdata.h b/src/core/characterdata.h index 23be9c9..0b0889c 100644 --- a/src/core/characterdata.h +++ b/src/core/characterdata.h @@ -34,18 +34,18 @@ dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, dom_string *data); dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, - unsigned long *length); + uint32_t *length); dom_exception _dom_characterdata_substring_data( - struct dom_characterdata *cdata, unsigned long offset, - unsigned long count, dom_string **data); + struct dom_characterdata *cdata, uint32_t offset, + uint32_t count, dom_string **data); dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, dom_string *data); dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, - unsigned long offset, dom_string *data); + uint32_t offset, dom_string *data); dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, - unsigned long offset, unsigned long count); + uint32_t offset, uint32_t count); dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, - unsigned long offset, unsigned long count, + uint32_t offset, uint32_t count, dom_string *data); dom_exception _dom_characterdata_get_text_content( dom_node_internal *node, diff --git a/src/core/element.c b/src/core/element.c index 8908968..cbdb6e1 100644 --- a/src/core/element.c +++ b/src/core/element.c @@ -485,7 +485,7 @@ static dom_exception _dom_element_set_id_attr(struct dom_element *element, /* The operation set for namednodemap */ static dom_exception attributes_get_length(void *priv, - unsigned long *length); + uint32_t *length); static dom_exception attributes_get_named_item(void *priv, dom_string *name, struct dom_node **node); static dom_exception attributes_set_named_item(void *priv, @@ -494,7 +494,7 @@ static dom_exception attributes_remove_named_item( void *priv, dom_string *name, struct dom_node **node); static dom_exception attributes_item(void *priv, - unsigned long index, struct dom_node **node); + uint32_t index, struct dom_node **node); static dom_exception attributes_get_named_item_ns( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node); @@ -2226,7 +2226,7 @@ dom_exception _dom_element_get_id(struct dom_element *ele, dom_string **id) /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ -dom_exception attributes_get_length(void *priv, unsigned long *length) +dom_exception attributes_get_length(void *priv, uint32_t *length) { dom_element *e = (dom_element *) priv; @@ -2283,7 +2283,7 @@ dom_exception attributes_remove_named_item( /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_item(void *priv, - unsigned long index, struct dom_node **node) + uint32_t index, struct dom_node **node) { dom_attr_list * match = NULL; unsigned int num = index + 1; diff --git a/src/core/implementation.c b/src/core/implementation.c index 26908f2..6041c22 100644 --- a/src/core/implementation.c +++ b/src/core/implementation.c @@ -266,7 +266,7 @@ dom_exception dom_implementation_create_document( return err; } - /* No longer interested in inserted node */ + /* No int32_ter interested in inserted node */ dom_node_unref(inserted); /* Done with element */ diff --git a/src/core/namednodemap.c b/src/core/namednodemap.c index f68cd3b..ada7e90 100644 --- a/src/core/namednodemap.c +++ b/src/core/namednodemap.c @@ -117,7 +117,7 @@ void dom_namednodemap_unref(dom_namednodemap *map) * \return DOM_NO_ERR. */ dom_exception dom_namednodemap_get_length(dom_namednodemap *map, - unsigned long *length) + uint32_t *length) { assert(map->opt != NULL); return map->opt->namednodemap_get_length(map->priv, length); @@ -209,7 +209,7 @@ dom_exception _dom_namednodemap_remove_named_item( * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_item(dom_namednodemap *map, - unsigned long index, dom_node **node) + uint32_t index, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_item(map->priv, index, node); diff --git a/src/core/namednodemap.h b/src/core/namednodemap.h index 079294c..62e5858 100644 --- a/src/core/namednodemap.h +++ b/src/core/namednodemap.h @@ -19,7 +19,7 @@ struct dom_namednodemap; struct nnm_operation { dom_exception (*namednodemap_get_length)(void *priv, - unsigned long *length); + uint32_t *length); dom_exception (*namednodemap_get_named_item)(void *priv, dom_string *name, struct dom_node **node); @@ -32,7 +32,7 @@ struct nnm_operation { struct dom_node **node); dom_exception (*namednodemap_item)(void *priv, - unsigned long index, struct dom_node **node); + uint32_t index, struct dom_node **node); dom_exception (*namednodemap_get_named_item_ns)( void *priv, dom_string *namespace, diff --git a/src/core/nodelist.c b/src/core/nodelist.c index 8ce9475..e2a1435 100644 --- a/src/core/nodelist.c +++ b/src/core/nodelist.c @@ -196,10 +196,10 @@ void dom_nodelist_unref(dom_nodelist *list) * \param length Pointer to location to receive length * \return DOM_NO_ERR. */ -dom_exception dom_nodelist_get_length(dom_nodelist *list, unsigned long *length) +dom_exception dom_nodelist_get_length(dom_nodelist *list, uint32_t *length) { dom_node_internal *cur = list->root->first_child; - unsigned long len = 0; + uint32_t len = 0; /* Traverse data structure */ while (cur != NULL) { @@ -300,10 +300,10 @@ dom_exception dom_nodelist_get_length(dom_nodelist *list, unsigned long *length) * should unref the node once it has finished with it. */ dom_exception _dom_nodelist_item(dom_nodelist *list, - unsigned long index, dom_node **node) + uint32_t index, dom_node **node) { dom_node_internal *cur = list->root->first_child; - unsigned long count = 0; + uint32_t count = 0; /* Traverse data structure */ while (cur != NULL) { diff --git a/src/core/text.c b/src/core/text.c index 532ee13..94718a2 100644 --- a/src/core/text.c +++ b/src/core/text.c @@ -178,12 +178,12 @@ void _dom_text_finalise(dom_text *text) * once it has finished with it. */ dom_exception _dom_text_split_text(dom_text *text, - unsigned long offset, dom_text **result) + uint32_t offset, dom_text **result) { dom_node_internal *t = (dom_node_internal *) text; dom_string *value; dom_text *res; - unsigned long len; + uint32_t len; dom_exception err; if (_dom_node_readonly(t)) { diff --git a/src/core/text.h b/src/core/text.h index 1cc5b1e..26424ce 100644 --- a/src/core/text.h +++ b/src/core/text.h @@ -43,7 +43,7 @@ void _dom_text_finalise(dom_text *text); /* Virtual functions for dom_text */ dom_exception _dom_text_split_text(dom_text *text, - unsigned long offset, dom_text **result); + uint32_t offset, dom_text **result); dom_exception _dom_text_get_is_element_content_whitespace( dom_text *text, bool *result); dom_exception _dom_text_get_whole_text(dom_text *text, diff --git a/src/events/mouse_event.c b/src/events/mouse_event.c index a2a97bb..3e76879 100644 --- a/src/events/mouse_event.c +++ b/src/events/mouse_event.c @@ -66,7 +66,7 @@ void _virtual_dom_mouse_event_destroy(struct dom_event *evt) * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_screen_x(dom_mouse_event *evt, - long *x) + int32_t *x) { *x = evt->sx; @@ -81,7 +81,7 @@ dom_exception _dom_mouse_event_get_screen_x(dom_mouse_event *evt, * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_screen_y(dom_mouse_event *evt, - long *y) + int32_t *y) { *y = evt->sy; @@ -96,7 +96,7 @@ dom_exception _dom_mouse_event_get_screen_y(dom_mouse_event *evt, * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_client_x(dom_mouse_event *evt, - long *x) + int32_t *x) { *x = evt->cx; @@ -111,7 +111,7 @@ dom_exception _dom_mouse_event_get_client_x(dom_mouse_event *evt, * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_client_y(dom_mouse_event *evt, - long *y) + int32_t *y) { *y = evt->cy; @@ -282,8 +282,8 @@ dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt, */ dom_exception _dom_mouse_event_init(dom_mouse_event *evt, dom_string *type, bool bubble, bool cancelable, - struct dom_abstract_view *view, long detail, long screen_x, - long screen_y, long client_x, long client_y, bool ctrl, + struct dom_abstract_view *view, int32_t detail, int32_t screen_x, + int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, unsigned short button, dom_event_target *et) { @@ -337,8 +337,8 @@ dom_exception _dom_mouse_event_init(dom_mouse_event *evt, dom_exception _dom_mouse_event_init_ns(dom_mouse_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, - long detail, long screen_x, long screen_y, long client_x, - long client_y, bool ctrl, bool alt, bool shift, bool meta, + int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, + int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, unsigned short button, dom_event_target *et) { evt->sx = screen_x; diff --git a/src/events/mouse_event.h b/src/events/mouse_event.h index 85246e7..e49bcd7 100644 --- a/src/events/mouse_event.h +++ b/src/events/mouse_event.h @@ -18,10 +18,10 @@ struct dom_mouse_event { struct dom_ui_event base; /**< Base class */ - long sx; /**< ScreenX */ - long sy; /**< ScreenY */ - long cx; /**< ClientX */ - long cy; /**< ClientY */ + int32_t sx; /**< ScreenX */ + int32_t sy; /**< ScreenY */ + int32_t cx; /**< ClientX */ + int32_t cy; /**< ClientY */ uint32_t modifier_state; /**< The modifier keys state */ diff --git a/src/events/mouse_multi_wheel_event.c b/src/events/mouse_multi_wheel_event.c index 8c4615b..35f91af 100644 --- a/src/events/mouse_multi_wheel_event.c +++ b/src/events/mouse_multi_wheel_event.c @@ -67,7 +67,7 @@ void _virtual_dom_mouse_multi_wheel_event_destroy(struct dom_event *evt) * \return DOM_NO_ERR. */ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_x( - dom_mouse_multi_wheel_event *evt, long *x) + dom_mouse_multi_wheel_event *evt, int32_t *x) { *x = evt->x; @@ -82,7 +82,7 @@ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_x( * \return DOM_NO_ERR. */ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_y( - dom_mouse_multi_wheel_event *evt, long *y) + dom_mouse_multi_wheel_event *evt, int32_t *y) { *y = evt->y; @@ -97,7 +97,7 @@ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_y( * \return DOM_NO_ERR. */ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_z( - dom_mouse_multi_wheel_event *evt, long *z) + dom_mouse_multi_wheel_event *evt, int32_t *z) { *z = evt->z; @@ -129,11 +129,11 @@ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_z( dom_exception _dom_mouse_multi_wheel_event_init_ns( dom_mouse_multi_wheel_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, - struct dom_abstract_view *view, long detail, long screen_x, - long screen_y, long client_x, long client_y, + struct dom_abstract_view *view, int32_t detail, int32_t screen_x, + int32_t screen_y, int32_t client_x, int32_t client_y, unsigned short button, dom_event_target *et, - dom_string *modifier_list, long wheel_delta_x, - long wheel_delta_y, long wheel_delta_z) + dom_string *modifier_list, int32_t wheel_delta_x, + int32_t wheel_delta_y, int32_t wheel_delta_z) { dom_exception err; dom_mouse_event *e = (dom_mouse_event *) evt; diff --git a/src/events/mouse_multi_wheel_event.h b/src/events/mouse_multi_wheel_event.h index 9b854c9..0476911 100644 --- a/src/events/mouse_multi_wheel_event.h +++ b/src/events/mouse_multi_wheel_event.h @@ -18,9 +18,9 @@ struct dom_mouse_multi_wheel_event { struct dom_mouse_event base; /**< The base class */ - long x; /**< The wheelDeltaX */ - long y; /**< The wheelDeltaY */ - long z; /**< The wheelDeltaZ */ + int32_t x; /**< The wheelDeltaX */ + int32_t y; /**< The wheelDeltaY */ + int32_t z; /**< The wheelDeltaZ */ }; /* Constructor */ diff --git a/src/events/mouse_wheel_event.c b/src/events/mouse_wheel_event.c index cce4fac..778a53b 100644 --- a/src/events/mouse_wheel_event.c +++ b/src/events/mouse_wheel_event.c @@ -65,7 +65,7 @@ void _virtual_dom_mouse_wheel_event_destroy(struct dom_event *evt) * \return DOM_NO_ERR. */ dom_exception _dom_mouse_wheel_event_get_wheel_delta( - dom_mouse_wheel_event *evt, long *d) + dom_mouse_wheel_event *evt, int32_t *d) { *d = evt->delta; @@ -95,10 +95,10 @@ dom_exception _dom_mouse_wheel_event_get_wheel_delta( dom_exception _dom_mouse_wheel_event_init_ns( dom_mouse_wheel_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, - struct dom_abstract_view *view, long detail, long screen_x, - long screen_y, long client_x, long client_y, + struct dom_abstract_view *view, int32_t detail, int32_t screen_x, + int32_t screen_y, int32_t client_x, int32_t client_y, unsigned short button, dom_event_target *et, - dom_string *modifier_list, long wheel_delta) + dom_string *modifier_list, int32_t wheel_delta) { dom_exception err; dom_mouse_event *e = (dom_mouse_event *) evt; diff --git a/src/events/mouse_wheel_event.h b/src/events/mouse_wheel_event.h index 9247d4a..e78abf6 100644 --- a/src/events/mouse_wheel_event.h +++ b/src/events/mouse_wheel_event.h @@ -18,7 +18,7 @@ struct dom_mouse_wheel_event { struct dom_mouse_event base; /**< The base class */ - long delta; /**< The wheelDelta */ + int32_t delta; /**< The wheelDelta */ }; /* Constructor */ diff --git a/src/events/ui_event.c b/src/events/ui_event.c index 0082332..911b0d0 100644 --- a/src/events/ui_event.c +++ b/src/events/ui_event.c @@ -84,7 +84,7 @@ dom_exception _dom_ui_event_get_view(dom_ui_event *evt, * \return DOM_NO_ERR. */ dom_exception _dom_ui_event_get_detail(dom_ui_event *evt, - long *detail) + int32_t *detail) { *detail = evt->detail; @@ -104,7 +104,7 @@ dom_exception _dom_ui_event_get_detail(dom_ui_event *evt, */ dom_exception _dom_ui_event_init(dom_ui_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, - long detail) + int32_t detail) { evt->view = view; evt->detail = detail; @@ -127,7 +127,7 @@ dom_exception _dom_ui_event_init(dom_ui_event *evt, dom_string *type, dom_exception _dom_ui_event_init_ns(dom_ui_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, - long detail) + int32_t detail) { evt->view = view; evt->detail = detail; diff --git a/src/events/ui_event.h b/src/events/ui_event.h index d90f6d7..e60ed35 100644 --- a/src/events/ui_event.h +++ b/src/events/ui_event.h @@ -32,7 +32,7 @@ typedef enum { struct dom_ui_event { struct dom_event base; /**< The base class */ struct dom_abstract_view *view; /**< The AbstractView */ - long detail; /**< Some private data for this event */ + int32_t detail; /**< Some private data for this event */ }; /* Constructor */ diff --git a/src/html/html_button_element.c b/src/html/html_button_element.c index 68cb1a5..95b5d31 100644 --- a/src/html/html_button_element.c +++ b/src/html/html_button_element.c @@ -196,16 +196,16 @@ SIMPLE_GET(type); SIMPLE_GET_SET(value); dom_exception dom_html_button_element_get_tab_index( - dom_html_button_element *button, unsigned long *tab_index) + dom_html_button_element *button, int32_t *tab_index) { - return dom_html_element_get_long_property(&button->base, "tabindex", + return dom_html_element_get_int32_t_property(&button->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_button_element_set_tab_index( - dom_html_button_element *button, unsigned long tab_index) + dom_html_button_element *button, uint32_t tab_index) { - return dom_html_element_set_long_property(&button->base, "tabindex", + return dom_html_element_set_int32_t_property(&button->base, "tabindex", SLEN("tabindex"), tab_index); } diff --git a/src/html/html_collection.c b/src/html/html_collection.c index f180286..a99297f 100644 --- a/src/html/html_collection.c +++ b/src/html/html_collection.c @@ -25,7 +25,7 @@ * \param doc The document * \param root The root element of the collection * \param ic The callback function used to determin whether certain node - * belongs to the collection + * beint32_ts to the collection * \param col The result collection object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ @@ -49,7 +49,7 @@ dom_exception _dom_html_collection_create(struct dom_html_document *doc, * \param col The collection object to be initialised * \param root The root element of the collection * \param ic The callback function used to determin whether certain node - * belongs to the collection + * beint32_ts to the collection * \return DOM_NO_ERR on success. */ dom_exception _dom_html_collection_initialise(struct dom_html_document *doc, @@ -113,7 +113,7 @@ void _dom_html_collection_destroy(struct dom_html_collection *col) * \return DOM_NO_ERR on success. */ dom_exception dom_html_collection_get_length(dom_html_collection *col, - unsigned long *len) + uint32_t *len) { struct dom_node_internal *node = col->root; *len = 0; @@ -157,10 +157,10 @@ dom_exception dom_html_collection_get_length(dom_html_collection *col, * \return DOM_NO_ERR on success. */ dom_exception dom_html_collection_item(dom_html_collection *col, - unsigned long index, struct dom_node **node) + uint32_t index, struct dom_node **node) { struct dom_node_internal *n = col->root; - unsigned long len = 0; + uint32_t len = 0; while (n != NULL) { if (n->type == DOM_ELEMENT_NODE && diff --git a/src/html/html_document.c b/src/html/html_document.c index 7f29a5d..a27fcaa 100644 --- a/src/html/html_document.c +++ b/src/html/html_document.c @@ -348,7 +348,7 @@ dom_exception _dom_html_document_get_title(dom_html_document *doc, } else { dom_element *node; dom_nodelist *nodes; - unsigned long len; + uint32_t len; exc = dom_document_get_elements_by_tag_name(doc, doc->memoised[hds_TITLE], diff --git a/src/html/html_element.c b/src/html/html_element.c index c2a4899..9dc3155 100644 --- a/src/html/html_element.c +++ b/src/html/html_element.c @@ -220,7 +220,7 @@ dom_exception _dom_html_element_get_elements_by_tag_name_ns( * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_element_get_bool_property(dom_html_element *ele, - const char *name, unsigned long len, bool *has) + const char *name, uint32_t len, bool *has) { dom_string *str = NULL; dom_attr *a = NULL; @@ -259,7 +259,7 @@ fail: * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_element_set_bool_property(dom_html_element *ele, - const char *name, unsigned long len, bool has) + const char *name, uint32_t len, bool has) { dom_string *str = NULL; dom_attr *a = NULL; @@ -325,16 +325,16 @@ static char *_strndup(const char *s, size_t n) } /** - * Get the a long property + * Get the a int32_t property * * \param ele The dom_html_element object * \param name The name of the attribute * \param len The length of ::name - * \param value The returned value + * \param value The returned value, or -1 if prop. not set * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ -dom_exception dom_html_element_get_long_property(dom_html_element *ele, - const char *name, unsigned long len, unsigned long *value) +dom_exception dom_html_element_get_int32_t_property(dom_html_element *ele, + const char *name, uint32_t len, int32_t *value) { dom_string *str = NULL, *s2 = NULL; dom_attr *a = NULL; @@ -358,7 +358,8 @@ dom_exception dom_html_element_get_long_property(dom_html_element *ele, dom_string_unref(s2); } } else { - *value = 0; + /* Property is not set on this node */ + *value = -1; } dom_node_unref(a); @@ -371,7 +372,7 @@ fail: } /** - * Set a long property + * Set a int32_t property * * \param ele The dom_html_element object * \param name The name of the attribute @@ -379,8 +380,8 @@ fail: * \param value The value * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ -dom_exception dom_html_element_set_long_property(dom_html_element *ele, - const char *name, unsigned long len, unsigned long value) +dom_exception dom_html_element_set_int32_t_property(dom_html_element *ele, + const char *name, uint32_t len, uint32_t value) { dom_string *str = NULL, *svalue = NULL; dom_exception err; @@ -390,7 +391,7 @@ dom_exception dom_html_element_set_long_property(dom_html_element *ele, if (err != DOM_NO_ERR) goto fail; - if (snprintf(numbuffer, 32, "%lu", value) == 32) + if (snprintf(numbuffer, 32, "%u", value) == 32) numbuffer[31] = '\0'; err = dom_string_create((const uint8_t *) numbuffer, diff --git a/src/html/html_element.h b/src/html/html_element.h index 2ac4b17..a1130cc 100644 --- a/src/html/html_element.h +++ b/src/html/html_element.h @@ -113,14 +113,14 @@ dom_exception _dom_html_element_set_class_name(dom_html_element *element, /* Some common functions used by all child classes */ dom_exception dom_html_element_get_bool_property(dom_html_element *ele, - const char *name, unsigned long len, bool *has); + const char *name, uint32_t len, bool *has); dom_exception dom_html_element_set_bool_property(dom_html_element *ele, - const char *name, unsigned long len, bool has); + const char *name, uint32_t len, bool has); -dom_exception dom_html_element_get_long_property(dom_html_element *ele, - const char *name, unsigned long len, unsigned long *value); -dom_exception dom_html_element_set_long_property(dom_html_element *ele, - const char *name, unsigned long len, unsigned long value); +dom_exception dom_html_element_get_int32_t_property(dom_html_element *ele, + const char *name, uint32_t len, int32_t *value); +dom_exception dom_html_element_set_int32_t_property(dom_html_element *ele, + const char *name, uint32_t len, uint32_t value); extern struct dom_html_element_vtable _dom_html_element_vtable; diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c index fcdf42e..55ec0e9 100644 --- a/src/html/html_form_element.c +++ b/src/html/html_form_element.c @@ -168,7 +168,7 @@ dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_form_element_get_length(dom_html_form_element *ele, - unsigned long *len) + uint32_t *len) { dom_exception err; diff --git a/src/html/html_input_element.c b/src/html/html_input_element.c index aa3e05f..9586abb 100644 --- a/src/html/html_input_element.c +++ b/src/html/html_input_element.c @@ -356,30 +356,30 @@ SIMPLE_GET_SET(use_map); SIMPLE_GET_SET(value); dom_exception dom_html_input_element_get_tab_index( - dom_html_input_element *input, unsigned long *tab_index) + dom_html_input_element *input, int32_t *tab_index) { - return dom_html_element_get_long_property(&input->base, "tabindex", + return dom_html_element_get_int32_t_property(&input->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_input_element_set_tab_index( - dom_html_input_element *input, unsigned long tab_index) + dom_html_input_element *input, uint32_t tab_index) { - return dom_html_element_set_long_property(&input->base, "tabindex", + return dom_html_element_set_int32_t_property(&input->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_input_element_get_max_length( - dom_html_input_element *input, unsigned long *max_length) + dom_html_input_element *input, int32_t *max_length) { - return dom_html_element_get_long_property(&input->base, "maxlength", + return dom_html_element_get_int32_t_property(&input->base, "maxlength", SLEN("maxlength"), max_length); } dom_exception dom_html_input_element_set_max_length( - dom_html_input_element *input, unsigned long max_length) + dom_html_input_element *input, uint32_t max_length) { - return dom_html_element_set_long_property(&input->base, "maxlength", + return dom_html_element_set_int32_t_property(&input->base, "maxlength", SLEN("maxlength"), max_length); } diff --git a/src/html/html_options_collection.c b/src/html/html_options_collection.c index e5b5f34..85001ad 100644 --- a/src/html/html_options_collection.c +++ b/src/html/html_options_collection.c @@ -26,7 +26,7 @@ * \param doc The document * \param root The root element of the collection * \param ic The callback function used to determin whether certain node - * belongs to the collection + * beint32_ts to the collection * \param col The result collection object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ @@ -51,7 +51,7 @@ dom_exception _dom_html_options_collection_create(struct dom_html_document *doc, * \param col The collection object to be initialised * \param root The root element of the collection * \param ic The callback function used to determin whether certain node - * belongs to the collection + * beint32_ts to the collection * \return DOM_NO_ERR on success. */ dom_exception _dom_html_options_collection_initialise(struct dom_html_document *doc, @@ -95,7 +95,7 @@ void _dom_html_options_collection_destroy(struct dom_html_options_collection *co * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_get_length(dom_html_options_collection *col, - unsigned long *len) + uint32_t *len) { return dom_html_collection_get_length(&col->base, len); } @@ -108,7 +108,7 @@ dom_exception dom_html_options_collection_get_length(dom_html_options_collection * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_set_length( - dom_html_options_collection *col, unsigned long len) + dom_html_options_collection *col, uint32_t len) { UNUSED(col); UNUSED(len); @@ -126,7 +126,7 @@ dom_exception dom_html_options_collection_set_length( * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_item(dom_html_options_collection *col, - unsigned long index, struct dom_node **node) + uint32_t index, struct dom_node **node) { return dom_html_collection_item(&col->base, index, node); } diff --git a/src/html/html_select_element.c b/src/html/html_select_element.c index 89e46a9..4efffb9 100644 --- a/src/html/html_select_element.c +++ b/src/html/html_select_element.c @@ -181,10 +181,10 @@ dom_exception dom_html_select_element_get_type( * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_get_selected_index( - dom_html_select_element *ele, unsigned long *index) + dom_html_select_element *ele, int32_t *index) { dom_exception err; - unsigned long idx, len; + uint32_t idx, len; dom_node *option; bool selected; @@ -225,7 +225,7 @@ dom_exception dom_html_select_element_get_selected_index( * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_set_selected_index( - dom_html_select_element *ele, unsigned long index) + dom_html_select_element *ele, int32_t index) { UNUSED(ele); UNUSED(index); @@ -245,7 +245,7 @@ dom_exception dom_html_select_element_get_value( dom_html_select_element *ele, dom_string **value) { dom_exception err; - unsigned long idx, len; + uint32_t idx, len; dom_node *option; bool selected; @@ -307,7 +307,7 @@ dom_exception dom_html_select_element_set_value( * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_get_length( - dom_html_select_element *ele, unsigned long *len) + dom_html_select_element *ele, uint32_t *len) { dom_exception err; @@ -328,7 +328,7 @@ dom_exception dom_html_select_element_get_length( * todo: how to deal with set the len of the children option objects? */ dom_exception dom_html_select_element_set_length( - dom_html_select_element *ele, unsigned long len) + dom_html_select_element *ele, uint32_t len) { UNUSED(ele); UNUSED(len); @@ -474,9 +474,9 @@ dom_exception dom_html_select_element_set_name( * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_size( - dom_html_select_element *ele, unsigned long *size) + dom_html_select_element *ele, int32_t *size) { - return dom_html_element_get_long_property(&ele->base, "size", + return dom_html_element_get_int32_t_property(&ele->base, "size", SLEN("size"), size); } @@ -488,9 +488,9 @@ dom_exception dom_html_select_element_get_size( * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_set_size( - dom_html_select_element *ele, unsigned long size) + dom_html_select_element *ele, int32_t size) { - return dom_html_element_set_long_property(&ele->base, "size", + return dom_html_element_set_int32_t_property(&ele->base, "size", SLEN("size"), size); } @@ -502,9 +502,9 @@ dom_exception dom_html_select_element_set_size( * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_tab_index( - dom_html_select_element *ele, unsigned long *tab_index) + dom_html_select_element *ele, int32_t *tab_index) { - return dom_html_element_get_long_property(&ele->base, "tabindex", + return dom_html_element_get_int32_t_property(&ele->base, "tabindex", SLEN("tabindex"), tab_index); } @@ -516,9 +516,9 @@ dom_exception dom_html_select_element_get_tab_index( * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_set_tab_index( - dom_html_select_element *ele, unsigned long tab_index) + dom_html_select_element *ele, int32_t tab_index) { - return dom_html_element_set_long_property(&ele->base, "tabindex", + return dom_html_element_set_int32_t_property(&ele->base, "tabindex", SLEN("tabindex"), tab_index); } @@ -539,7 +539,7 @@ dom_exception dom_html_select_element_remove(dom_html_select_element *ele, long index) { dom_exception err; - unsigned long len; + uint32_t len; dom_node *option; err = dom_html_select_element_get_length(ele, &len); @@ -547,7 +547,7 @@ dom_exception dom_html_select_element_remove(dom_html_select_element *ele, return err; /* Ensure index is in range */ - if ((unsigned long) index >= len) + if (index >= len) return DOM_NO_ERR; err = dom_html_options_collection_item(ele->options, index, &option); diff --git a/src/html/html_select_element.h b/src/html/html_select_element.h index 6fb7bf1..bd45614 100644 --- a/src/html/html_select_element.h +++ b/src/html/html_select_element.h @@ -16,6 +16,8 @@ struct dom_html_select_element { struct dom_html_element base; /**< The base class */ + int32_t selected; + /**< The selected element's index */ dom_html_form_element *form; /**< The form associated with select */ dom_html_options_collection *options; diff --git a/src/html/html_text_area_element.c b/src/html/html_text_area_element.c index cb95920..1c7534c 100644 --- a/src/html/html_text_area_element.c +++ b/src/html/html_text_area_element.c @@ -365,44 +365,44 @@ dom_exception dom_html_text_area_element_get_type( } dom_exception dom_html_text_area_element_get_tab_index( - dom_html_text_area_element *text_area, unsigned long *tab_index) + dom_html_text_area_element *text_area, int32_t *tab_index) { - return dom_html_element_get_long_property(&text_area->base, "tabindex", + return dom_html_element_get_int32_t_property(&text_area->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_text_area_element_set_tab_index( - dom_html_text_area_element *text_area, unsigned long tab_index) + dom_html_text_area_element *text_area, uint32_t tab_index) { - return dom_html_element_set_long_property(&text_area->base, "tabindex", + return dom_html_element_set_int32_t_property(&text_area->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_text_area_element_get_cols( - dom_html_text_area_element *text_area, unsigned long *cols) + dom_html_text_area_element *text_area, int32_t *cols) { - return dom_html_element_get_long_property(&text_area->base, "cols", + return dom_html_element_get_int32_t_property(&text_area->base, "cols", SLEN("cols"), cols); } dom_exception dom_html_text_area_element_set_cols( - dom_html_text_area_element *text_area, unsigned long cols) + dom_html_text_area_element *text_area, uint32_t cols) { - return dom_html_element_set_long_property(&text_area->base, "cols", + return dom_html_element_set_int32_t_property(&text_area->base, "cols", SLEN("cols"), cols); } dom_exception dom_html_text_area_element_get_rows( - dom_html_text_area_element *text_area, unsigned long *rows) + dom_html_text_area_element *text_area, int32_t *rows) { - return dom_html_element_get_long_property(&text_area->base, "rows", + return dom_html_element_get_int32_t_property(&text_area->base, "rows", SLEN("rows"), rows); } dom_exception dom_html_text_area_element_set_rows( - dom_html_text_area_element *text_area, unsigned long rows) + dom_html_text_area_element *text_area, uint32_t rows) { - return dom_html_element_set_long_property(&text_area->base, "rows", + return dom_html_element_set_int32_t_property(&text_area->base, "rows", SLEN("rows"), rows); } diff --git a/src/utils/character_valid.c b/src/utils/character_valid.c index e966ec1..81c3558 100644 --- a/src/utils/character_valid.c +++ b/src/utils/character_valid.c @@ -161,11 +161,11 @@ bool binary_search(unsigned int ch, int left, int right, } /** - * Test whether certain character belongs to some XML character group + * Test whether certain character beint32_ts to some XML character group * * \param ch The character being tested * \param group The character group - * \return true if the character belongs to the group, false otherwise. + * \return true if the character beint32_ts to the group, false otherwise. * * Generally, we use an algorithm like binary search to find the desired * character in the group. The time complexity is about lg(n) and here n is |