1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00
Commit Graph

25 Commits

Author SHA1 Message Date
Witold Filipczyk
e5ce3faf31 [dom] enum dom_node_type -> uint16_t 2022-01-28 13:47:42 +01:00
Witold Filipczyk
8999a19593 [cast] Explicit casts for narrowing conversions 2022-01-17 17:07:46 +01:00
Witold Filipczyk
881f896e85 [mem_calloc] Cast 2022-01-16 21:08:50 +01:00
Witold Filipczyk
be8a030fa7 [mem_realloc] cast return value 2022-01-16 19:38:30 +01:00
Witold Filipczyk
57c996c383 [dom] compilation fixes 2021-12-08 17:17:50 +01:00
Witold Filipczyk
0fea79cc8f [cflags] Removed -Wno-pointer-sign
Likely some new bugs were introduced by this change.
The long term goal is clean compilation by g++.
2021-01-02 16:20:27 +01:00
Kalle Olavi Niemitalo
b4567b402b Bug 1071: Add precautionary assertions and recovery 2009-04-05 20:59:41 +03:00
Kalle Olavi Niemitalo
b7f45ca80b Bug 1071: Add NULL check in get_dom_node_list_index
If the parent parameter of get_dom_node_list_index referred to a node
that did not have children, then get_dom_node_list called by it could
return the address of a null pointer, and get_dom_node_list_index would
then pass that null pointer to get_dom_node_list_pos, which would crash.
That would be the same kind of crash as the one in get_dom_node_child.
It never happened in practice though: because all calls are in the form
get_dom_node_list_index(node->parent, node), the list must contain at
least the given node, and the pointer cannot be null.  The documentation
of get_dom_node_list_index allows arbitrary nodes as arguments however,
so it's best to add a check.
2009-04-04 22:41:43 +03:00
Kalle Olavi Niemitalo
8465b19d0c Bug 1071: Fix null-ptr crash in get_dom_node_child
struct dom_node contains a union that contains various structs that
have members of type struct dom_node * in them.
get_dom_node_list_by_type returns the address (struct dom_node **) of
one of those members, or NULL.  However the member itself can also be
NULL if no nodes have been added to the list and the list has thus not
yet been allocated.  (add_to_dom_node_list lazily allocates the lists.)
get_dom_node_child did not expect a null pointer there and crashed, as
shown in bug 1071.  Fix by adding a check so that it treats a NULL list
as an empty list.
2009-04-04 21:56:53 +03:00
Kalle Olavi Niemitalo
eb820a57a6 bug 1067: Assertions and comments about done_dom_node().
In bug 1067, dom_rss_pop_document() freed a node with done_dom_node()
even though call_dom_node_callbacks() was still using that node.  This
made call_dom_node_callbacks() read a function pointer from beyond the
end of an array and call that.  Add assertions to detect out-of-range
node types, and comments to warn about the bug.
2009-02-15 03:39:00 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Jonas Fonseca
47d27a4d39 DOM: rename init_dom_node_ to init_dom_node_at and cleanup the declaration
Only use the __FILE__ and __LINE__ parameters when DEBUG_MEMLEAK is defined
so that they do not end up in the generated documentation.
2006-12-11 21:21:30 +01:00
Jonas Fonseca
4a27637529 DOM: Cleanup the unused parts of the node interface
Take a quick stroll through the unchartered corners of the DOM node data
structures:

 - Remove ununsed struct dom_node_id_item.
 - Make the document node reference a future struct dom_document.
 - Describe ideas for node data, e.g. the entity reference node should use
 it for storing the unicode_val_T.
2006-02-03 10:44:27 +01:00
Jonas Fonseca
bc50084475 DOM: Add get_dom_node_next() 2006-01-30 06:03:36 +01:00
Jonas Fonseca
ea675cbb6e DOM: Fix get_dom_node_map_index() so it returns the correct ordered index
This was cause by the recent change to allocate string during incremental
parsing where the node string was set after insertion. Test for this in the
works.

Fixes: b6b6d3c67e
2006-01-30 06:02:02 +01:00
Jonas Fonseca
2918e3f595 DOM: Add STATIC_DOM_STRING macro and make INIT_DOM_STRING cleaner 2006-01-28 22:55:15 +01:00
Jonas Fonseca
b6b6d3c67e DOM: Allocate all node strings when doing incremental rendering
This changes init_dom_node_() to take an allocated argument saying whether
to allocate or not. If the value is -1, node->allocated will be set to the
value of node->parent->allocated. This way the value is inherited like we
do it in the menu code. It should be a sane default since we eventually
want not to rely on the 'underlying' source of the document and there will
be less variables to pass around.
2006-01-28 04:51:25 +01:00
Jonas Fonseca
24a9d103b4 DOM: Add allocated flag to struct dom_node; replaces subtype flags
Prepare for handling of allocated strings in the various nodes.
2006-01-28 04:50:04 +01:00
Jonas Fonseca
1d52d67e50 Add get_dom_node_child() which searches for a node with given type 2006-01-16 07:11:02 +01:00
Jonas Fonseca
768f97c38e Add get_dom_node_prev() which gets the previous sibling of a DOM node 2006-01-16 05:10:22 +01:00
Laurent MONIN
54997c506f Drop trailing whitespaces. 2006-01-02 00:15:20 +01:00
Jonas Fonseca
f1015f8a6a Make files include dom/string.h instead of util/string.h directly 2005-12-28 20:45:55 +01:00
Jonas Fonseca
1bd0c8758e Make the DOM node creators take dom_string structs 2005-12-28 16:47:28 +01:00
Jonas Fonseca
73785bee02 Remove some unneeded #includes 2005-12-28 15:36:58 +01:00
Jonas Fonseca
71533eef9a Elute all DOM-related code and put it in src/dom 2005-12-28 14:05:14 +01:00