diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 19bb1267..dca20318 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -91,11 +91,16 @@ typedef enum { typedef struct _xmlBuffer xmlBuffer; typedef xmlBuffer *xmlBufferPtr; struct _xmlBuffer { - xmlChar *content; /* The buffer content UTF8 */ - unsigned int use; /* The buffer size used */ - unsigned int size; /* The buffer size */ - xmlBufferAllocationScheme alloc; /* The realloc method */ - xmlChar *contentIO; /* in IO mode we may have a different base */ + /* The buffer content UTF8 */ + xmlChar *content XML_DEPRECATED_MEMBER; + /* The buffer size used */ + unsigned int use XML_DEPRECATED_MEMBER; + /* The buffer size */ + unsigned int size XML_DEPRECATED_MEMBER; + /* The realloc method */ + xmlBufferAllocationScheme alloc XML_DEPRECATED_MEMBER; + /* in IO mode we may have a different base */ + xmlChar *contentIO XML_DEPRECATED_MEMBER; }; /** diff --git a/python/libxml.c b/python/libxml.c index 7c0f27fc..6897aa52 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -2773,8 +2773,7 @@ libxml_serializeNode(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) xmlSaveTree(ctxt, node); xmlSaveClose(ctxt); - c_retval = buf->content; - buf->content = NULL; + c_retval = xmlBufferDetach(buf); xmlBufferFree(buf); py_retval = libxml_charPtrWrap((char *) c_retval); diff --git a/runsuite.c b/runsuite.c index 0b592b0c..257b9210 100644 --- a/runsuite.c +++ b/runsuite.c @@ -302,7 +302,8 @@ xsdIncorrectTestCase(xmlNodePtr cur) { } xmlBufferSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT); xmlNodeDump(buf, test->doc, test, 0, 0); - pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use); + pctxt = xmlRelaxNGNewMemParserCtxt( + (const char *) xmlBufferContent(buf), xmlBufferLength(buf)); xmlRelaxNGSetParserErrors(pctxt, testErrorHandler, testErrorHandler, pctxt); xmlRelaxNGSetResourceLoader(pctxt, testResourceLoader, NULL); @@ -349,7 +350,7 @@ installResources(xmlNodePtr tst, const xmlChar *base) { xmlBufferEmpty(buf); xmlNodeDump(buf, test->doc, test, 0, 0); name = getString(tst, "string(@name)"); - content = xmlStrdup(buf->content); + content = xmlStrdup(xmlBufferContent(buf)); if ((name != NULL) && (content != NULL)) { res = composeDir(base, name); xmlFree(name); @@ -437,7 +438,8 @@ xsdTestCase(xmlNodePtr tst) { } xmlBufferSetAllocationScheme(buf, XML_BUFFER_ALLOC_DOUBLEIT); xmlNodeDump(buf, test->doc, test, 0, 0); - pctxt = xmlRelaxNGNewMemParserCtxt((const char *)buf->content, buf->use); + pctxt = xmlRelaxNGNewMemParserCtxt( + (const char *) xmlBufferContent(buf), xmlBufferLength(buf)); xmlRelaxNGSetParserErrors(pctxt, testErrorHandler, testErrorHandler, pctxt); xmlRelaxNGSetResourceLoader(pctxt, testResourceLoader, NULL); @@ -472,8 +474,8 @@ xsdTestCase(xmlNodePtr tst) { * We are ready to run the test */ mem = xmlMemUsed(); - doc = xmlReadMemory((const char *)buf->content, buf->use, - "test", NULL, 0); + doc = xmlReadMemory((const char *) xmlBufferContent(buf), + xmlBufferLength(buf), "test", NULL, 0); if (doc == NULL) { test_log("Failed to parse valid instance line %ld\n", xmlGetLineNo(tmp)); @@ -525,8 +527,8 @@ xsdTestCase(xmlNodePtr tst) { * We are ready to run the test */ mem = xmlMemUsed(); - doc = xmlReadMemory((const char *)buf->content, buf->use, - "test", NULL, 0); + doc = xmlReadMemory((const char *) xmlBufferContent(buf), + xmlBufferLength(buf), "test", NULL, 0); if (doc == NULL) { test_log("Failed to parse valid instance line %ld\n", xmlGetLineNo(tmp));