revamped the encoding support, added iconv support, so now libxml if
* encoding.[ch], xmlIO.[ch], parser.c, configure.in : revamped
the encoding support, added iconv support, so now libxml if
compiled with iconv automatically support japanese encodings
among others. Work based on initial patch from Yuan-Chen Cheng
I may have broken binary compat in the encoding handler
registration scheme, but that was so utterly broken I don't
expect anybody to have used this feature until now.
* parserInternals.h: fixup on the CHAR range macro
* xml-error.h, parser.c: catch URL/URI errors using the uri.c
code.
* tree.[ch]: added xmlBufferGrow(), was needed for iconv
* uri.c: added xmlParseURI() I can't believe I forgot to
implement this one in 2.0 !!!
* SAX.c: moved doc->encoding update in the endDocument() call.
* TODO: updated.
Iconv rules :-)
Daniel
diff --git a/tree.c b/tree.c
index 2cc4b51..74b5321 100644
--- a/tree.c
+++ b/tree.c
@@ -3772,6 +3772,31 @@
}
/**
+ * xmlBufferGrow:
+ * @buf: the buffer
+ * @len: the minimum free sie to allocate
+ *
+ * Grow the available space of an XML buffer.
+ *
+ * Returns the new available space or -1 in case of error
+ */
+int
+xmlBufferGrow(xmlBufferPtr buf, int len) {
+ int size;
+ xmlChar *newbuf;
+
+ if (len <= buf->use) return(0);
+
+ size = buf->size + buf->use + len + 100;
+
+ newbuf = xmlRealloc(buf->content, size);
+ if (newbuf == NULL) return(-1);
+ buf->content = newbuf;
+ buf->size = size;
+ return(buf->size - buf->use);
+}
+
+/**
* xmlBufferDump:
* @file: the file output
* @buf: the buffer to dump