From 86615e43bbac2315aa069ca3ef4712477d61605c Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Thu, 9 Nov 2017 17:47:47 +0100 Subject: Fix IO callback signatures --- xmllint.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'xmllint.c') diff --git a/xmllint.c b/xmllint.c index a691aa68..75d2f9b4 100644 --- a/xmllint.c +++ b/xmllint.c @@ -814,13 +814,14 @@ xmlShellReadline(char *prompt) { * * ************************************************************************/ -static int myRead(FILE *f, char * buf, int len) { - return(fread(buf, 1, len, f)); +static int myRead(void *f, char *buf, int len) { + return(fread(buf, 1, len, (FILE *) f)); } -static void myClose(FILE *f) { - if (f != stdin) { - fclose(f); - } +static int myClose(void *context) { + FILE *f = (FILE *) context; + if (f == stdin) + return(0); + return(fclose(f)); } /************************************************************************ @@ -2303,14 +2304,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { #endif if (f != NULL) { if (rectxt == NULL) - doc = xmlReadIO((xmlInputReadCallback) myRead, - (xmlInputCloseCallback) myClose, f, - filename, NULL, options); + doc = xmlReadIO(myRead, myClose, f, filename, NULL, + options); else - doc = xmlCtxtReadIO(rectxt, - (xmlInputReadCallback) myRead, - (xmlInputCloseCallback) myClose, f, - filename, NULL, options); + doc = xmlCtxtReadIO(rectxt, myRead, myClose, f, + filename, NULL, options); } else doc = NULL; } -- cgit v1.2.1