From af464de1f3ff543d9ed33a3ade9d16d5cd7271b5 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 23 Jul 2025 02:20:13 +0200 Subject: [PATCH] io: Deprecate xmlOutputBuffer members --- include/libxml/xmlIO.h | 20 ++++++++++++-------- python/libxml.c | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index 6ebd6381..3090215b 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -148,16 +148,20 @@ struct _xmlParserInputBuffer { * Output buffer */ struct _xmlOutputBuffer { - void* context; - xmlOutputWriteCallback writecallback; - xmlOutputCloseCallback closecallback; + void* context XML_DEPRECATED_MEMBER; + xmlOutputWriteCallback writecallback XML_DEPRECATED_MEMBER; + xmlOutputCloseCallback closecallback XML_DEPRECATED_MEMBER; - xmlCharEncodingHandler *encoder; /* I18N conversions to UTF-8 */ + /* I18N conversions to UTF-8 */ + xmlCharEncodingHandler *encoder XML_DEPRECATED_MEMBER; - xmlBuf *buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ - xmlBuf *conv; /* if encoder != NULL buffer for output */ - int written; /* total number of byte written */ - int error; + /* Local buffer encoded in UTF-8 or ISOLatin */ + xmlBuf *buffer XML_DEPRECATED_MEMBER; + /* if encoder != NULL buffer for output */ + xmlBuf *conv XML_DEPRECATED_MEMBER; + /* total number of byte written */ + int written XML_DEPRECATED_MEMBER; + int error XML_DEPRECATED_MEMBER; }; #endif /* LIBXML_OUTPUT_ENABLED */ diff --git a/python/libxml.c b/python/libxml.c index ba2c8d44..c35ebff4 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -516,6 +516,7 @@ libxml_outputBufferGetPythonFile(ATTRIBUTE_UNUSED PyObject *self, Py_INCREF(Py_None); return(Py_None); } +XML_IGNORE_DEPRECATION_WARNINGS if (obj->closecallback != xmlPythonFileClose) { fprintf(stderr, "outputBufferGetPythonFile: not a python file wrapper\n"); @@ -527,6 +528,7 @@ libxml_outputBufferGetPythonFile(ATTRIBUTE_UNUSED PyObject *self, Py_INCREF(Py_None); return(Py_None); } +XML_POP_WARNINGS Py_INCREF(file); return(file); }