1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-27 14:03:36 +03:00

tree: Deprecate xmlBuffer members

This commit is contained in:
Nick Wellnhofer 2024-06-10 23:20:22 +02:00
parent 712a31abe4
commit b34dc1e4a3
3 changed files with 20 additions and 14 deletions

View File

@ -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;
};
/**

View File

@ -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);

View File

@ -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));