summaryrefslogtreecommitdiff
path: root/libs/files/domc-library.patch
diff options
context:
space:
mode:
Diffstat (limited to 'libs/files/domc-library.patch')
-rw-r--r--libs/files/domc-library.patch289
1 files changed, 281 insertions, 8 deletions
diff --git a/libs/files/domc-library.patch b/libs/files/domc-library.patch
index f9133a5..477823a 100644
--- a/libs/files/domc-library.patch
+++ b/libs/files/domc-library.patch
@@ -1,6 +1,6 @@
diff -r -U3 domc-0.7.1/Makefile domc/Makefile
--- domc-0.7.1/Makefile 2004-08-05 22:32:24.000000000 -0600
-+++ domc/Makefile 2004-08-31 17:05:22.326058272 -0600
++++ domc/Makefile 2004-08-31 17:14:03.254164327 -0600
@@ -1,7 +1,8 @@
-prefix = /usr/local
-includedir = $(prefix)/include
@@ -41,7 +41,7 @@ diff -r -U3 domc-0.7.1/Makefile domc/Makefile
diff -r -U3 domc-0.7.1/Makefile.msvc domc/Makefile.msvc
--- domc-0.7.1/Makefile.msvc 2004-08-04 17:20:02.000000000 -0600
-+++ domc/Makefile.msvc 2004-08-31 17:07:15.622292073 -0600
++++ domc/Makefile.msvc 2004-08-31 17:14:03.254164327 -0600
@@ -1,22 +1,26 @@
!include <win32.mak>
-LIBMBA=..\libmba-0.8.9
@@ -77,7 +77,7 @@ diff -r -U3 domc-0.7.1/Makefile.msvc domc/Makefile.msvc
del domc.dll domc.lib domc.exp $(OBJS)
diff -r -U3 domc-0.7.1/src/defines.h domc/src/defines.h
--- domc-0.7.1/src/defines.h 2003-03-22 16:35:36.000000000 -0700
-+++ domc/src/defines.h 2004-08-31 17:07:36.699545018 -0600
++++ domc/src/defines.h 2004-08-31 18:28:48.547584113 -0600
@@ -7,7 +7,7 @@
#define HAVE_ENCDEC 0
#define HAVE_STRDUP 1
@@ -107,8 +107,22 @@ diff -r -U3 domc-0.7.1/src/defines.h domc/src/defines.h
#define HAVE_SNPRINTF 1
diff -r -U3 domc-0.7.1/src/domc.h domc/src/domc.h
--- domc-0.7.1/src/domc.h 2004-08-04 17:32:30.000000000 -0600
-+++ domc/src/domc.h 2004-08-31 17:11:39.228935518 -0600
-@@ -185,6 +185,8 @@
++++ domc/src/domc.h 2004-08-31 18:14:41.359000453 -0600
+@@ -41,6 +41,13 @@
+ #include <stdint.h>
+ #endif
+
++/* Enable this for hashing and fast access to child node lists */
++#define FAST_NODELIST 1
++
++#if FAST_NODELIST
++#include <mba/hashmap.h>
++#endif
++
+ /* DOM_String
+ */
+
+@@ -185,6 +192,8 @@
DOM_String *data;
} ProcessingInstruction;
} u;
@@ -117,15 +131,18 @@ diff -r -U3 domc-0.7.1/src/domc.h domc/src/domc.h
};
DOM_Node *DOM_Node_insertBefore(DOM_Node *node, DOM_Node *newChild, DOM_Node *refChild);
-@@ -212,6 +214,7 @@
+@@ -212,6 +221,10 @@
NodeEntry *last;
unsigned short filter;
struct DOM_NodeList *list; /* Used for entities and notations */
++#if FAST_NODELIST
++ struct hashmap _map;
++#endif
+ unsigned int rtfxRefCount; /* Reference counting added for RTFX */
};
DOM_Node *DOM_NodeList_item(const DOM_NodeList *nl, int index);
-@@ -286,8 +289,10 @@
+@@ -286,8 +299,10 @@
* described in the latest W3C drafts at all.
*/
@@ -138,7 +155,37 @@ diff -r -U3 domc-0.7.1/src/domc.h domc/src/domc.h
diff -r -U3 domc-0.7.1/src/expatls.c domc/src/expatls.c
--- domc-0.7.1/src/expatls.c 2004-08-04 17:28:49.000000000 -0600
-+++ domc/src/expatls.c 2004-08-31 17:12:25.887854337 -0600
++++ domc/src/expatls.c 2004-08-31 18:26:14.254693516 -0600
+@@ -70,6 +70,14 @@
+
+ DOM_Node *Document_createNode(DOM_Document *doc, unsigned short nodeType);
+
++static int
++fputds(const DOM_String *s, FILE *stream)
++{
++ return fputs(s, stream);
++}
++
++#if HAVE_EXPAT > 0
++
+ struct user_data {
+ DOM_String *buf;
+ size_t siz;
+@@ -115,14 +123,6 @@
+ return n;
+ }
+
+-static int
+-fputds(const DOM_String *s, FILE *stream)
+-{
+- return fputs(s, stream);
+-}
+-
+-#if HAVE_EXPAT > 0
+-
+ static void
+ xmldecl_fn(void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
+ {
@@ -731,9 +731,6 @@
case '"':
fputs("&quot;", stream);
@@ -149,3 +196,229 @@ diff -r -U3 domc-0.7.1/src/expatls.c domc/src/expatls.c
default:
AMSG("");
break;
+diff -r -U3 domc-0.7.1/src/node.c domc/src/node.c
+--- domc-0.7.1/src/node.c 2004-08-04 17:29:12.000000000 -0600
++++ domc/src/node.c 2004-08-31 18:24:59.805396690 -0600
+@@ -337,7 +337,6 @@
+ DOM_Node *
+ DOM_Node_replaceChild(DOM_Node *node, DOM_Node *newChild, DOM_Node *oldChild)
+ {
+- DOM_Node *tmp;
+ DOM_MutationEvent evt;
+
+ if (node == NULL || newChild == NULL || oldChild == NULL) {
+@@ -352,12 +351,7 @@
+ return NULL;
+ }
+
+- for (tmp = node->firstChild;
+- tmp != NULL && tmp != oldChild;
+- tmp = tmp->nextSibling) {
+- ;
+- }
+- if (tmp != oldChild) {
++ if (!NodeList_exists(node->childNodes, oldChild)) {
+ DOM_Exception = DOM_NOT_FOUND_ERR;
+ PMNO(DOM_Exception);
+ return NULL;
+diff -r -U3 domc-0.7.1/src/nodelist.c domc/src/nodelist.c
+--- domc-0.7.1/src/nodelist.c 2004-08-04 17:19:25.000000000 -0600
++++ domc/src/nodelist.c 2004-08-31 18:22:47.053698572 -0600
+@@ -30,6 +30,14 @@
+ #include "domc.h"
+ #include "dom.h"
+
++#if FAST_NODELIST
++static void _removeFromMap(struct hashmap* hm, void* key)
++{
++ void* d = NULL;
++ hashmap_remove(hm, &key, &d);
++}
++#endif
++
+ /* NodeList
+ */
+
+@@ -42,8 +50,16 @@
+ DOM_Exception = errno;
+ PMNO(DOM_Exception);
+ }
++
+ r->_ownerDocument = doc;
+
++ if(hashmap_init(&(r->_map), 0, NULL, NULL, NULL, NULL) == -1) {
++ DOM_Exception = errno;
++ PMNO(DOM_Exception);
++ free(r);
++ r = NULL;
++ }
++
+ return r;
+ }
+ void
+@@ -63,6 +79,7 @@
+ free(tmp);
+ }
+ }
++ hashmap_deinit(&(nl->_map), NULL, NULL, NULL);
+ free(nl);
+ }
+ }
+@@ -110,7 +127,8 @@
+ NodeList_insert(DOM_NodeList *nl, DOM_Node *newChild, DOM_Node *refChild)
+ {
+ NodeEntry *e;
+-
++ NodeEntry *s = NULL;
++
+ if (nl == NULL) {
+ DOM_Exception = NULL_POINTER_ERR;
+ PMNO(DOM_Exception);
+@@ -122,12 +140,40 @@
+ return NULL;
+ }
+
++ if(refChild != NULL)
++ {
++#if FAST_NODELIST
++ s = (NodeEntry*)hashmap_get(&(nl->_map), refChild);
++#else
++ for (s = nl->first; s != NULL && s->node != refChild; s = s->next) {
++ ;
++ }
++#endif
++ if(s == NULL || s->node != refChild) {
++ DOM_Exception = DOM_NOT_FOUND_ERR;
++ PMNO(DOM_Exception);
++ return NULL;
++ }
++ }
++
+ if ((e = calloc(sizeof *e, 1)) == NULL) {
+ DOM_Exception = errno;
+ PMNO(DOM_Exception);
+ return NULL;
+ }
+
++#if FAST_NODELIST
++ if(hashmap_get(&(nl->_map), newChild) != NULL)
++ _removeFromMap(&(nl->_map), newChild);
++
++ if(hashmap_put(&(nl->_map), newChild, e) == -1) {
++ DOM_Exception = errno;
++ PMNO(DOM_Exception);
++ free(e);
++ return NULL;
++ }
++#endif
++
+ e->node = newChild;
+ if (nl->length == 0) {
+ nl->first = nl->last = e;
+@@ -136,18 +182,6 @@
+ nl->last->next = e;
+ nl->last = e;
+ } else {
+- NodeEntry *s;
+-
+- for (s = nl->first; s != NULL && s->node != refChild; s = s->next) {
+- ;
+- }
+- if (s == NULL || s->node != refChild) {
+- DOM_Exception = DOM_NOT_FOUND_ERR;
+- PMNO(DOM_Exception);
+- free(e);
+- return NULL;
+- }
+-
+ e->prev = s->prev;
+ e->next = s;
+ if (s == nl->first) {
+@@ -184,14 +218,32 @@
+ return NULL;
+ }
+
++#if FAST_NODELIST
++ e = (NodeEntry*)hashmap_get(&(nl->_map), oldChild);
++#else
+ for (e = nl->first; e != NULL && e->node != oldChild; e = e->next) {
+ ;
+ }
++#endif
+ if (e == NULL) {
+ DOM_Exception = DOM_NOT_FOUND_ERR;
+ PMNO(DOM_Exception);
+ return NULL;
+ }
++
++#if FAST_NODELIST
++ _removeFromMap(&(nl->_map), oldChild);
++
++ if(hashmap_get(&(nl->_map), newChild) != NULL)
++ _removeFromMap(&(nl->_map), newChild);
++
++ if(hashmap_put(&(nl->_map), newChild, e) == -1) {
++ DOM_Exception = errno;
++ PMNO(DOM_Exception);
++ return NULL;
++ }
++#endif
++
+ e->node = newChild;
+
+ if (oldChild->nodeType == DOM_ATTRIBUTE_NODE) {
+@@ -216,12 +268,20 @@
+ return NULL;
+ }
+
++#if FAST_NODELIST
++ e = (NodeEntry*)hashmap_get(&(nl->_map), oldChild);
++#else
+ for (e = nl->first; e != NULL && e->node != oldChild; e = e->next) {
+ ;
+ }
++#endif
+ if (e == NULL) {
+ return NULL;
+ }
++
++#if FAST_NODELIST
++ _removeFromMap(&(nl->_map), oldChild);
++#endif
+
+ if (nl->first == nl->last) {
+ nl->first = nl->last = NULL;
+@@ -269,6 +329,18 @@
+ return NULL;
+ }
+
++#if FAST_NODELIST
++ if(hashmap_get(&(nl->_map), newChild) != NULL)
++ _removeFromMap(&(nl->_map), newChild);
++
++ if(hashmap_put(&(nl->_map), newChild, e) == -1) {
++ DOM_Exception = errno;
++ PMNO(DOM_Exception);
++ free(e);
++ return NULL;
++ }
++#endif
++
+ e->node = newChild;
+ if (nl->first == NULL) {
+ nl->first = nl->last = e;
+@@ -311,9 +383,14 @@
+ return 0;
+ }
+
++#if FAST_NODELIST
++ e = (NodeEntry*)hashmap_get(&(nl->_map), child);
++#else
+ for (e = nl->first; e != NULL && e->node != child; e = e->next) {
+ ;
+ }
++#endif
++
+ return e != NULL;
+ }
+