[libxml2] Fix and add const qualifiers
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix and add const qualifiers
- Date: Mon, 13 Oct 2014 08:07:44 +0000 (UTC)
commit 95ebe53b50dfcff1fc5378309bc4f3c58173298e
Author: Kurt Roeckx <kurt roeckx be>
Date: Mon Oct 13 16:06:21 2014 +0800
Fix and add const qualifiers
For https://bugzilla.gnome.org/show_bug.cgi?id=689483
It seems there are functions that do use the const qualifier for some of the
arguments, but it seems that there are a lot of functions that don't use it and
probably should.
So I created a patch against 2.9.0 that makes as much as possible const in
tree.h, and changed other files as needed.
There were a lot of cases like "const xmlNodePtr node". This doesn't actually
do anything, there the *pointer* is constant not the object it points to. So I
changed those to "const xmlNode *node".
I also removed some consts, mostly in the Copy functions, because those
functions can actually modify the doc or node they copy from
buf.c | 4 +-
buf.h | 4 +-
entities.c | 4 +-
include/libxml/entities.h | 4 +-
include/libxml/tree.h | 74 ++++++++++++++++++------------------
tree.c | 94 ++++++++++++++++++++++----------------------
6 files changed, 92 insertions(+), 92 deletions(-)
---
diff --git a/buf.c b/buf.c
index d1756c4..6efc7b6 100644
--- a/buf.c
+++ b/buf.c
@@ -565,7 +565,7 @@ xmlBufDump(FILE *file, xmlBufPtr buf) {
*/
xmlChar *
-xmlBufContent(const xmlBufPtr buf)
+xmlBufContent(const xmlBuf *buf)
{
if ((!buf) || (buf->error))
return NULL;
@@ -583,7 +583,7 @@ xmlBufContent(const xmlBufPtr buf)
*/
xmlChar *
-xmlBufEnd(const xmlBufPtr buf)
+xmlBufEnd(xmlBufPtr buf)
{
if ((!buf) || (buf->error))
return NULL;
diff --git a/buf.h b/buf.h
index e8c7715..ebdc978 100644
--- a/buf.h
+++ b/buf.h
@@ -50,8 +50,8 @@ int xmlBufIsEmpty(const xmlBufPtr buf);
int xmlBufAddLen(xmlBufPtr buf, size_t len);
int xmlBufErase(xmlBufPtr buf, size_t len);
-/* const xmlChar * xmlBufContent(const xmlBufPtr buf); */
-/* const xmlChar * xmlBufEnd(const xmlBufPtr buf); */
+/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
+/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
xmlChar * xmlBufDetach(xmlBufPtr buf);
diff --git a/entities.c b/entities.c
index 0c484a7..a72afb3 100644
--- a/entities.c
+++ b/entities.c
@@ -502,7 +502,7 @@ xmlGetDtdEntity(xmlDocPtr doc, const xmlChar *name) {
* Returns A pointer to the entity structure or NULL if not found.
*/
xmlEntityPtr
-xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) {
+xmlGetDocEntity(const xmlDoc *doc, const xmlChar *name) {
xmlEntityPtr cur;
xmlEntitiesTablePtr table;
@@ -783,7 +783,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) {
* Returns A newly allocated string with the substitution done.
*/
xmlChar *
-xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) {
+xmlEncodeSpecialChars(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlChar *input) {
const xmlChar *cur = input;
xmlChar *buffer = NULL;
xmlChar *out = NULL;
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
index 0ee56df..47b4573 100644
--- a/include/libxml/entities.h
+++ b/include/libxml/entities.h
@@ -103,7 +103,7 @@ XMLPUBFUN xmlEntityPtr XMLCALL
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetPredefinedEntity (const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
- xmlGetDocEntity (xmlDocPtr doc,
+ xmlGetDocEntity (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDtdEntity (xmlDocPtr doc,
@@ -120,7 +120,7 @@ XMLPUBFUN xmlChar * XMLCALL
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
const xmlChar *input);
XMLPUBFUN xmlChar * XMLCALL
- xmlEncodeSpecialChars (xmlDocPtr doc,
+ xmlEncodeSpecialChars (const xmlDoc *doc,
const xmlChar *input);
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCreateEntitiesTable (void);
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
index 7c865c7..d194596 100644
--- a/include/libxml/tree.h
+++ b/include/libxml/tree.h
@@ -116,8 +116,8 @@ typedef xmlBuf *xmlBufPtr;
* A few public routines for xmlBuf. As those are expected to be used
* mostly internally the bulk of the routines are internal in buf.h
*/
-XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBufPtr buf);
-XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (const xmlBufPtr buf);
+XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf);
+XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf);
XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len);
@@ -735,14 +735,14 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN void XMLCALL
xmlBufferEmpty (xmlBufferPtr buf);
XMLPUBFUN const xmlChar* XMLCALL
- xmlBufferContent (const xmlBufferPtr buf);
+ xmlBufferContent (const xmlBuffer *buf);
XMLPUBFUN xmlChar* XMLCALL
xmlBufferDetach (xmlBufferPtr buf);
XMLPUBFUN void XMLCALL
xmlBufferSetAllocationScheme(xmlBufferPtr buf,
xmlBufferAllocationScheme scheme);
XMLPUBFUN int XMLCALL
- xmlBufferLength (const xmlBufferPtr buf);
+ xmlBufferLength (const xmlBuffer *buf);
/*
* Creating/freeing new structures.
@@ -758,7 +758,7 @@ XMLPUBFUN xmlDtdPtr XMLCALL
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlDtdPtr XMLCALL
- xmlGetIntSubset (xmlDocPtr doc);
+ xmlGetIntSubset (const xmlDoc *doc);
XMLPUBFUN void XMLCALL
xmlFreeDtd (xmlDtdPtr cur);
#ifdef LIBXML_LEGACY_ENABLED
@@ -846,7 +846,7 @@ XMLPUBFUN xmlNodePtr XMLCALL
const xmlChar *content);
#endif
XMLPUBFUN xmlNodePtr XMLCALL
- xmlNewDocText (xmlDocPtr doc,
+ xmlNewDocText (const xmlDoc *doc,
const xmlChar *content);
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewText (const xmlChar *content);
@@ -877,20 +877,20 @@ XMLPUBFUN xmlNodePtr XMLCALL
xmlNewCharRef (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlNewReference (xmlDocPtr doc,
+ xmlNewReference (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlCopyNode (const xmlNodePtr node,
+ xmlCopyNode (xmlNodePtr node,
int recursive);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlDocCopyNode (const xmlNodePtr node,
+ xmlDocCopyNode (xmlNodePtr node,
xmlDocPtr doc,
int recursive);
XMLPUBFUN xmlNodePtr XMLCALL
xmlDocCopyNodeList (xmlDocPtr doc,
- const xmlNodePtr node);
+ xmlNodePtr node);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlCopyNodeList (const xmlNodePtr node);
+ xmlCopyNodeList (xmlNodePtr node);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNodePtr XMLCALL
xmlNewTextChild (xmlNodePtr parent,
@@ -910,19 +910,19 @@ XMLPUBFUN xmlNodePtr XMLCALL
* Navigating.
*/
XMLPUBFUN long XMLCALL
- xmlGetLineNo (xmlNodePtr node);
+ xmlGetLineNo (const xmlNode *node);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
XMLPUBFUN xmlChar * XMLCALL
- xmlGetNodePath (xmlNodePtr node);
+ xmlGetNodePath (const xmlNode *node);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
XMLPUBFUN xmlNodePtr XMLCALL
- xmlDocGetRootElement (xmlDocPtr doc);
+ xmlDocGetRootElement (const xmlDoc *doc);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlGetLastChild (xmlNodePtr parent);
+ xmlGetLastChild (const xmlNode *parent);
XMLPUBFUN int XMLCALL
- xmlNodeIsText (xmlNodePtr node);
+ xmlNodeIsText (const xmlNode *node);
XMLPUBFUN int XMLCALL
- xmlIsBlankNode (xmlNodePtr node);
+ xmlIsBlankNode (const xmlNode *node);
/*
* Changing the structure.
@@ -993,8 +993,8 @@ XMLPUBFUN xmlNsPtr XMLCALL
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN xmlNsPtr * XMLCALL
- xmlGetNsList (xmlDocPtr doc,
- xmlNodePtr node);
+ xmlGetNsList (const xmlDoc *doc,
+ const xmlNode *node);
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
XMLPUBFUN void XMLCALL
@@ -1022,37 +1022,37 @@ XMLPUBFUN xmlAttrPtr XMLCALL
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
XMLPUBFUN xmlChar * XMLCALL
- xmlGetNoNsProp (xmlNodePtr node,
+ xmlGetNoNsProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
- xmlGetProp (xmlNodePtr node,
+ xmlGetProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlAttrPtr XMLCALL
- xmlHasProp (xmlNodePtr node,
+ xmlHasProp (const xmlNode *node,
const xmlChar *name);
XMLPUBFUN xmlAttrPtr XMLCALL
- xmlHasNsProp (xmlNodePtr node,
+ xmlHasNsProp (const xmlNode *node,
const xmlChar *name,
const xmlChar *nameSpace);
XMLPUBFUN xmlChar * XMLCALL
- xmlGetNsProp (xmlNodePtr node,
+ xmlGetNsProp (const xmlNode *node,
const xmlChar *name,
const xmlChar *nameSpace);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlStringGetNodeList (xmlDocPtr doc,
+ xmlStringGetNodeList (const xmlDoc *doc,
const xmlChar *value);
XMLPUBFUN xmlNodePtr XMLCALL
- xmlStringLenGetNodeList (xmlDocPtr doc,
+ xmlStringLenGetNodeList (const xmlDoc *doc,
const xmlChar *value,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlNodeListGetString (xmlDocPtr doc,
- xmlNodePtr list,
+ const xmlNode *list,
int inLine);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlChar * XMLCALL
- xmlNodeListGetRawString (xmlDocPtr doc,
- xmlNodePtr list,
+ xmlNodeListGetRawString (const xmlDoc *doc,
+ const xmlNode *list,
int inLine);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
@@ -1072,19 +1072,19 @@ XMLPUBFUN void XMLCALL
const xmlChar *content,
int len);
XMLPUBFUN xmlChar * XMLCALL
- xmlNodeGetContent (xmlNodePtr cur);
+ xmlNodeGetContent (const xmlNode *cur);
XMLPUBFUN int XMLCALL
xmlNodeBufGetContent (xmlBufferPtr buffer,
- xmlNodePtr cur);
+ const xmlNode *cur);
XMLPUBFUN int XMLCALL
xmlBufGetNodeContent (xmlBufPtr buf,
- xmlNodePtr cur);
+ const xmlNode *cur);
XMLPUBFUN xmlChar * XMLCALL
- xmlNodeGetLang (xmlNodePtr cur);
+ xmlNodeGetLang (const xmlNode *cur);
XMLPUBFUN int XMLCALL
- xmlNodeGetSpacePreserve (xmlNodePtr cur);
+ xmlNodeGetSpacePreserve (const xmlNode *cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN void XMLCALL
xmlNodeSetLang (xmlNodePtr cur,
@@ -1094,8 +1094,8 @@ XMLPUBFUN void XMLCALL
int val);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
- xmlNodeGetBase (xmlDocPtr doc,
- xmlNodePtr cur);
+ xmlNodeGetBase (const xmlDoc *doc,
+ const xmlNode *cur);
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
XMLPUBFUN void XMLCALL
xmlNodeSetBase (xmlNodePtr cur,
@@ -1241,7 +1241,7 @@ XMLPUBFUN int XMLCALL
* Compression.
*/
XMLPUBFUN int XMLCALL
- xmlGetDocCompressMode (xmlDocPtr doc);
+ xmlGetDocCompressMode (const xmlDoc *doc);
XMLPUBFUN void XMLCALL
xmlSetDocCompressMode (xmlDocPtr doc,
int mode);
diff --git a/tree.c b/tree.c
index 572b663..307782c 100644
--- a/tree.c
+++ b/tree.c
@@ -55,7 +55,7 @@ int __xmlRegisterCallbacks = 0;
static xmlNsPtr
xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns);
-static xmlChar* xmlGetPropNodeValueInternal(xmlAttrPtr prop);
+static xmlChar* xmlGetPropNodeValueInternal(const xmlAttr *prop);
/************************************************************************
* *
@@ -160,7 +160,7 @@ static int xmlCheckDTD = 1;
* Returns A pointer to the entity structure or NULL if not found.
*/
static xmlEntityPtr
-xmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
+xmlGetEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) {
xmlEntitiesTablePtr table;
if((dtd != NULL) && (dtd->entities != NULL)) {
@@ -181,7 +181,7 @@ xmlGetEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
* Returns A pointer to the entity structure or NULL if not found.
*/
static xmlEntityPtr
-xmlGetParameterEntityFromDtd(xmlDtdPtr dtd, const xmlChar *name) {
+xmlGetParameterEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) {
xmlEntitiesTablePtr table;
if ((dtd != NULL) && (dtd->pentities != NULL)) {
@@ -916,7 +916,7 @@ xmlNewDtd(xmlDocPtr doc, const xmlChar *name,
*/
xmlDtdPtr
-xmlGetIntSubset(xmlDocPtr doc) {
+xmlGetIntSubset(const xmlDoc *doc) {
xmlNodePtr cur;
if (doc == NULL)
@@ -1266,7 +1266,7 @@ xmlFreeDoc(xmlDocPtr cur) {
* Returns a pointer to the first child
*/
xmlNodePtr
-xmlStringLenGetNodeList(xmlDocPtr doc, const xmlChar *value, int len) {
+xmlStringLenGetNodeList(const xmlDoc *doc, const xmlChar *value, int len) {
xmlNodePtr ret = NULL, last = NULL;
xmlNodePtr node;
xmlChar *val;
@@ -1474,7 +1474,7 @@ out:
* Returns a pointer to the first child
*/
xmlNodePtr
-xmlStringGetNodeList(xmlDocPtr doc, const xmlChar *value) {
+xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
xmlNodePtr ret = NULL, last = NULL;
xmlNodePtr node;
xmlChar *val;
@@ -1662,9 +1662,9 @@ out:
* Returns a pointer to the string copy, the caller must free it with xmlFree().
*/
xmlChar *
-xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine)
+xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine)
{
- xmlNodePtr node = list;
+ const xmlNode *node = list;
xmlChar *ret = NULL;
xmlEntityPtr ent;
int attr;
@@ -1752,9 +1752,9 @@ xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int inLine)
* Returns a pointer to the string copy, the caller must free it with xmlFree().
*/
xmlChar *
-xmlNodeListGetRawString(xmlDocPtr doc, xmlNodePtr list, int inLine)
+xmlNodeListGetRawString(const xmlDoc *doc, const xmlNode *list, int inLine)
{
- xmlNodePtr node = list;
+ const xmlNode *node = list;
xmlChar *ret = NULL;
xmlEntityPtr ent;
@@ -2583,7 +2583,7 @@ xmlNewCharRef(xmlDocPtr doc, const xmlChar *name) {
* Returns a pointer to the new node object.
*/
xmlNodePtr
-xmlNewReference(xmlDocPtr doc, const xmlChar *name) {
+xmlNewReference(const xmlDoc *doc, const xmlChar *name) {
xmlNodePtr cur;
xmlEntityPtr ent;
@@ -2601,7 +2601,7 @@ xmlNewReference(xmlDocPtr doc, const xmlChar *name) {
memset(cur, 0, sizeof(xmlNode));
cur->type = XML_ENTITY_REF_NODE;
- cur->doc = doc;
+ cur->doc = (xmlDoc *)doc;
if (name[0] == '&') {
int len;
name++;
@@ -2639,11 +2639,11 @@ xmlNewReference(xmlDocPtr doc, const xmlChar *name) {
* Returns a pointer to the new node object.
*/
xmlNodePtr
-xmlNewDocText(xmlDocPtr doc, const xmlChar *content) {
+xmlNewDocText(const xmlDoc *doc, const xmlChar *content) {
xmlNodePtr cur;
cur = xmlNewText(content);
- if (cur != NULL) cur->doc = doc;
+ if (cur != NULL) cur->doc = (xmlDoc *)doc;
return(cur);
}
@@ -3417,7 +3417,7 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
* Returns the last child or NULL if none.
*/
xmlNodePtr
-xmlGetLastChild(xmlNodePtr parent) {
+xmlGetLastChild(const xmlNode *parent) {
if ((parent == NULL) || (parent->type == XML_NAMESPACE_DECL)) {
#ifdef DEBUG_TREE
xmlGenericError(xmlGenericErrorContext,
@@ -4136,7 +4136,7 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
*/
static xmlNodePtr
-xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
+xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
int extended) {
xmlNodePtr ret;
@@ -4341,7 +4341,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
* Returns: a new #xmlNodePtr, or NULL in case of error.
*/
xmlNodePtr
-xmlCopyNode(const xmlNodePtr node, int extended) {
+xmlCopyNode(xmlNodePtr node, int extended) {
xmlNodePtr ret;
ret = xmlStaticCopyNode(node, NULL, NULL, extended);
@@ -4361,7 +4361,7 @@ xmlCopyNode(const xmlNodePtr node, int extended) {
* Returns: a new #xmlNodePtr, or NULL in case of error.
*/
xmlNodePtr
-xmlDocCopyNode(const xmlNodePtr node, xmlDocPtr doc, int extended) {
+xmlDocCopyNode(xmlNodePtr node, xmlDocPtr doc, int extended) {
xmlNodePtr ret;
ret = xmlStaticCopyNode(node, doc, NULL, extended);
@@ -4377,7 +4377,7 @@ xmlDocCopyNode(const xmlNodePtr node, xmlDocPtr doc, int extended) {
*
* Returns: a new #xmlNodePtr, or NULL in case of error.
*/
-xmlNodePtr xmlDocCopyNodeList(xmlDocPtr doc, const xmlNodePtr node) {
+xmlNodePtr xmlDocCopyNodeList(xmlDocPtr doc, xmlNodePtr node) {
xmlNodePtr ret = xmlStaticCopyNodeList(node, doc, NULL);
return(ret);
}
@@ -4391,7 +4391,7 @@ xmlNodePtr xmlDocCopyNodeList(xmlDocPtr doc, const xmlNodePtr node) {
*
* Returns: a new #xmlNodePtr, or NULL in case of error.
*/
-xmlNodePtr xmlCopyNodeList(const xmlNodePtr node) {
+xmlNodePtr xmlCopyNodeList(xmlNodePtr node) {
xmlNodePtr ret = xmlStaticCopyNodeList(node, NULL, NULL);
return(ret);
}
@@ -4561,7 +4561,7 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) {
* Returns the line number if successful, -1 otherwise
*/
static long
-xmlGetLineNoInternal(xmlNodePtr node, int depth)
+xmlGetLineNoInternal(const xmlNode *node, int depth)
{
long result = -1;
@@ -4611,7 +4611,7 @@ xmlGetLineNoInternal(xmlNodePtr node, int depth)
* Returns the line number if successful, -1 otherwise
*/
long
-xmlGetLineNo(xmlNodePtr node)
+xmlGetLineNo(const xmlNode *node)
{
return(xmlGetLineNoInternal(node, 0));
}
@@ -4627,9 +4627,9 @@ xmlGetLineNo(xmlNodePtr node)
* the returned string
*/
xmlChar *
-xmlGetNodePath(xmlNodePtr node)
+xmlGetNodePath(const xmlNode *node)
{
- xmlNodePtr cur, tmp, next;
+ const xmlNode *cur, *tmp, *next;
xmlChar *buffer = NULL, *temp;
size_t buf_len;
xmlChar *buf;
@@ -4873,7 +4873,7 @@ xmlGetNodePath(xmlNodePtr node)
* Returns the #xmlNodePtr for the root or NULL
*/
xmlNodePtr
-xmlDocGetRootElement(xmlDocPtr doc) {
+xmlDocGetRootElement(const xmlDoc *doc) {
xmlNodePtr ret;
if (doc == NULL) return(NULL);
@@ -4987,7 +4987,7 @@ xmlNodeSetLang(xmlNodePtr cur, const xmlChar *lang) {
* It's up to the caller to free the memory with xmlFree().
*/
xmlChar *
-xmlNodeGetLang(xmlNodePtr cur) {
+xmlNodeGetLang(const xmlNode *cur) {
xmlChar *lang;
if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
@@ -5068,7 +5068,7 @@ xmlNodeSetSpacePreserve(xmlNodePtr cur, int val) {
* Returns -1 if xml:space is not inherited, 0 if "default", 1 if "preserve"
*/
int
-xmlNodeGetSpacePreserve(xmlNodePtr cur) {
+xmlNodeGetSpacePreserve(const xmlNode *cur) {
xmlChar *space;
if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE))
@@ -5238,7 +5238,7 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) {
* It's up to the caller to free the memory with xmlFree().
*/
xmlChar *
-xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) {
+xmlNodeGetBase(const xmlDoc *doc, const xmlNode *cur) {
xmlChar *oldbase = NULL;
xmlChar *base, *newbase;
@@ -5323,7 +5323,7 @@ xmlNodeGetBase(xmlDocPtr doc, xmlNodePtr cur) {
* Returns 0 in case of success and -1 in case of error.
*/
int
-xmlNodeBufGetContent(xmlBufferPtr buffer, xmlNodePtr cur)
+xmlNodeBufGetContent(xmlBufferPtr buffer, const xmlNode *cur)
{
xmlBufPtr buf;
int ret;
@@ -5346,12 +5346,12 @@ xmlNodeBufGetContent(xmlBufferPtr buffer, xmlNodePtr cur)
* directly by this node if it's a TEXT node or the aggregate string
* of the values carried by this node child's (TEXT and ENTITY_REF).
* Entity references are substituted.
- * Fills up the buffer @buffer with this value
+ * Fills up the buffer @buf with this value
*
* Returns 0 in case of success and -1 in case of error.
*/
int
-xmlBufGetNodeContent(xmlBufPtr buf, xmlNodePtr cur)
+xmlBufGetNodeContent(xmlBufPtr buf, const xmlNode *cur)
{
if ((cur == NULL) || (buf == NULL)) return(-1);
switch (cur->type) {
@@ -5361,7 +5361,7 @@ xmlBufGetNodeContent(xmlBufPtr buf, xmlNodePtr cur)
break;
case XML_DOCUMENT_FRAG_NODE:
case XML_ELEMENT_NODE:{
- xmlNodePtr tmp = cur;
+ const xmlNode *tmp = cur;
while (tmp != NULL) {
switch (tmp->type) {
@@ -5492,7 +5492,7 @@ xmlBufGetNodeContent(xmlBufPtr buf, xmlNodePtr cur)
* It's up to the caller to free the memory with xmlFree().
*/
xmlChar *
-xmlNodeGetContent(xmlNodePtr cur)
+xmlNodeGetContent(const xmlNode *cur)
{
if (cur == NULL)
return (NULL);
@@ -5872,7 +5872,7 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) {
* namespace if defined
*/
xmlNsPtr *
-xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node)
+xmlGetNsList(const xmlDoc *doc ATTRIBUTE_UNUSED, const xmlNode *node)
{
xmlNsPtr cur;
xmlNsPtr *ret = NULL;
@@ -5979,7 +5979,7 @@ xmlNsPtr
xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
xmlNsPtr cur;
- xmlNodePtr orig = node;
+ const xmlNode *orig = node;
if ((node == NULL) || (node->type == XML_NAMESPACE_DECL)) return(NULL);
if ((nameSpace != NULL) &&
@@ -6448,7 +6448,7 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) {
#endif /* LIBXML_TREE_ENABLED */
static xmlAttrPtr
-xmlGetPropNodeInternal(xmlNodePtr node, const xmlChar *name,
+xmlGetPropNodeInternal(const xmlNode *node, const xmlChar *name,
const xmlChar *nsName, int useDTD)
{
xmlAttrPtr prop;
@@ -6562,7 +6562,7 @@ xmlGetPropNodeInternal(xmlNodePtr node, const xmlChar *name,
}
static xmlChar*
-xmlGetPropNodeValueInternal(xmlAttrPtr prop)
+xmlGetPropNodeValueInternal(const xmlAttr *prop)
{
if (prop == NULL)
return(NULL);
@@ -6608,7 +6608,7 @@ xmlGetPropNodeValueInternal(xmlAttrPtr prop)
* neither was found.
*/
xmlAttrPtr
-xmlHasProp(xmlNodePtr node, const xmlChar *name) {
+xmlHasProp(const xmlNode *node, const xmlChar *name) {
xmlAttrPtr prop;
xmlDocPtr doc;
@@ -6663,7 +6663,7 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) {
* if neither was found.
*/
xmlAttrPtr
-xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+xmlHasNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace) {
return(xmlGetPropNodeInternal(node, name, nameSpace, xmlCheckDTD));
}
@@ -6685,7 +6685,7 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
* It's up to the caller to free the memory with xmlFree().
*/
xmlChar *
-xmlGetProp(xmlNodePtr node, const xmlChar *name) {
+xmlGetProp(const xmlNode *node, const xmlChar *name) {
xmlAttrPtr prop;
prop = xmlHasProp(node, name);
@@ -6710,7 +6710,7 @@ xmlGetProp(xmlNodePtr node, const xmlChar *name) {
* It's up to the caller to free the memory with xmlFree().
*/
xmlChar *
-xmlGetNoNsProp(xmlNodePtr node, const xmlChar *name) {
+xmlGetNoNsProp(const xmlNode *node, const xmlChar *name) {
xmlAttrPtr prop;
prop = xmlGetPropNodeInternal(node, name, NULL, xmlCheckDTD);
@@ -6735,7 +6735,7 @@ xmlGetNoNsProp(xmlNodePtr node, const xmlChar *name) {
* It's up to the caller to free the memory with xmlFree().
*/
xmlChar *
-xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
+xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace) {
xmlAttrPtr prop;
prop = xmlGetPropNodeInternal(node, name, nameSpace, xmlCheckDTD);
@@ -6900,7 +6900,7 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name,
* Returns 1 yes, 0 no
*/
int
-xmlNodeIsText(xmlNodePtr node) {
+xmlNodeIsText(const xmlNode *node) {
if (node == NULL) return(0);
if (node->type == XML_TEXT_NODE) return(1);
@@ -6917,7 +6917,7 @@ xmlNodeIsText(xmlNodePtr node) {
* Returns 1 yes, 0 no
*/
int
-xmlIsBlankNode(xmlNodePtr node) {
+xmlIsBlankNode(const xmlNode *node) {
const xmlChar *cur;
if (node == NULL) return(0);
@@ -7320,7 +7320,7 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) {
*/
const xmlChar *
-xmlBufferContent(const xmlBufferPtr buf)
+xmlBufferContent(const xmlBuffer *buf)
{
if(!buf)
return NULL;
@@ -7338,7 +7338,7 @@ xmlBufferContent(const xmlBufferPtr buf)
*/
int
-xmlBufferLength(const xmlBufferPtr buf)
+xmlBufferLength(const xmlBuffer *buf)
{
if(!buf)
return 0;
@@ -7722,7 +7722,7 @@ xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
* Returns 0 (uncompressed) to 9 (max compression)
*/
int
-xmlGetDocCompressMode (xmlDocPtr doc) {
+xmlGetDocCompressMode (const xmlDoc *doc) {
if (doc == NULL) return(-1);
return(doc->compression);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]