mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +03:00
Fix IO callback signatures
This commit is contained in:
6
xmlIO.c
6
xmlIO.c
@@ -2843,10 +2843,8 @@ xmlOutputBufferCreateBuffer(xmlBufferPtr buffer,
|
|||||||
|
|
||||||
if (buffer == NULL) return(NULL);
|
if (buffer == NULL) return(NULL);
|
||||||
|
|
||||||
ret = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
|
ret = xmlOutputBufferCreateIO(xmlBufferWrite, NULL, (void *) buffer,
|
||||||
xmlBufferWrite,
|
encoder);
|
||||||
(xmlOutputCloseCallback)
|
|
||||||
NULL, (void *) buffer, encoder);
|
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|||||||
24
xmllint.c
24
xmllint.c
@@ -814,13 +814,14 @@ xmlShellReadline(char *prompt) {
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static int myRead(FILE *f, char * buf, int len) {
|
static int myRead(void *f, char *buf, int len) {
|
||||||
return(fread(buf, 1, len, f));
|
return(fread(buf, 1, len, (FILE *) f));
|
||||||
}
|
}
|
||||||
static void myClose(FILE *f) {
|
static int myClose(void *context) {
|
||||||
if (f != stdin) {
|
FILE *f = (FILE *) context;
|
||||||
fclose(f);
|
if (f == stdin)
|
||||||
}
|
return(0);
|
||||||
|
return(fclose(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@@ -2303,14 +2304,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
|||||||
#endif
|
#endif
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
if (rectxt == NULL)
|
if (rectxt == NULL)
|
||||||
doc = xmlReadIO((xmlInputReadCallback) myRead,
|
doc = xmlReadIO(myRead, myClose, f, filename, NULL,
|
||||||
(xmlInputCloseCallback) myClose, f,
|
options);
|
||||||
filename, NULL, options);
|
|
||||||
else
|
else
|
||||||
doc = xmlCtxtReadIO(rectxt,
|
doc = xmlCtxtReadIO(rectxt, myRead, myClose, f,
|
||||||
(xmlInputReadCallback) myRead,
|
filename, NULL, options);
|
||||||
(xmlInputCloseCallback) myClose, f,
|
|
||||||
filename, NULL, options);
|
|
||||||
} else
|
} else
|
||||||
doc = NULL;
|
doc = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
12
xmlwriter.c
12
xmlwriter.c
@@ -110,7 +110,7 @@ static void xmlFreeTextWriterNsStackEntry(xmlLinkPtr lk);
|
|||||||
static int xmlCmpTextWriterNsStackEntry(const void *data0,
|
static int xmlCmpTextWriterNsStackEntry(const void *data0,
|
||||||
const void *data1);
|
const void *data1);
|
||||||
static int xmlTextWriterWriteDocCallback(void *context,
|
static int xmlTextWriterWriteDocCallback(void *context,
|
||||||
const xmlChar * str, int len);
|
const char *str, int len);
|
||||||
static int xmlTextWriterCloseDocCallback(void *context);
|
static int xmlTextWriterCloseDocCallback(void *context);
|
||||||
|
|
||||||
static xmlChar *xmlTextWriterVSprintf(const char *format, va_list argptr) LIBXML_ATTR_FORMAT(1,0);
|
static xmlChar *xmlTextWriterVSprintf(const char *format, va_list argptr) LIBXML_ATTR_FORMAT(1,0);
|
||||||
@@ -325,9 +325,7 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = xmlOutputBufferCreateIO((xmlOutputWriteCallback)
|
out = xmlOutputBufferCreateIO(xmlTextWriterWriteDocCallback,
|
||||||
xmlTextWriterWriteDocCallback,
|
|
||||||
(xmlOutputCloseCallback)
|
|
||||||
xmlTextWriterCloseDocCallback,
|
xmlTextWriterCloseDocCallback,
|
||||||
(void *) ctxt, NULL);
|
(void *) ctxt, NULL);
|
||||||
if (out == NULL) {
|
if (out == NULL) {
|
||||||
@@ -4418,12 +4416,12 @@ xmlCmpTextWriterNsStackEntry(const void *data0, const void *data1)
|
|||||||
* Returns -1, 0, 1
|
* Returns -1, 0, 1
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xmlTextWriterWriteDocCallback(void *context, const xmlChar * str, int len)
|
xmlTextWriterWriteDocCallback(void *context, const char *str, int len)
|
||||||
{
|
{
|
||||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) context;
|
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) context;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = xmlParseChunk(ctxt, (const char *) str, len, 0)) != 0) {
|
if ((rc = xmlParseChunk(ctxt, str, len, 0)) != 0) {
|
||||||
xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR,
|
xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR,
|
||||||
"xmlTextWriterWriteDocCallback : XML error %d !\n",
|
"xmlTextWriterWriteDocCallback : XML error %d !\n",
|
||||||
rc);
|
rc);
|
||||||
@@ -4449,7 +4447,7 @@ xmlTextWriterCloseDocCallback(void *context)
|
|||||||
|
|
||||||
if ((rc = xmlParseChunk(ctxt, NULL, 0, 1)) != 0) {
|
if ((rc = xmlParseChunk(ctxt, NULL, 0, 1)) != 0) {
|
||||||
xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR,
|
xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR,
|
||||||
"xmlTextWriterWriteDocCallback : XML error %d !\n",
|
"xmlTextWriterCloseDocCallback : XML error %d !\n",
|
||||||
rc);
|
rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user