X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5e9f25245196606cd95bf05897c1d6720f6db081..8516f4fc7a3f0496418e5b77ef3a539aec253b6b:/src/expat/examples/outline.c diff --git a/src/expat/examples/outline.c b/src/expat/examples/outline.c index 10f6d1db5b..3a3c838551 100644 --- a/src/expat/examples/outline.c +++ b/src/expat/examples/outline.c @@ -18,19 +18,34 @@ * * Read an XML document from standard input and print an element * outline on standard output. + * Must be used with Expat compiled for UTF-8 output. */ #include #include +#if defined(__amigaos__) && defined(__USE_INLINE__) +#include +#endif + +#ifdef XML_LARGE_SIZE +#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 +#define XML_FMT_INT_MOD "I64" +#else +#define XML_FMT_INT_MOD "ll" +#endif +#else +#define XML_FMT_INT_MOD "l" +#endif + #define BUFFSIZE 8192 char Buff[BUFFSIZE]; int Depth; -static void +static void XMLCALL start(void *data, const char *el, const char **attr) { int i; @@ -48,7 +63,7 @@ start(void *data, const char *el, const char **attr) Depth++; } -static void +static void XMLCALL end(void *data, const char *el) { Depth--; @@ -69,7 +84,7 @@ main(int argc, char *argv[]) int done; int len; - len = fread(Buff, 1, BUFFSIZE, stdin); + len = (int)fread(Buff, 1, BUFFSIZE, stdin); if (ferror(stdin)) { fprintf(stderr, "Read error\n"); exit(-1); @@ -77,7 +92,7 @@ main(int argc, char *argv[]) done = feof(stdin); if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) { - fprintf(stderr, "Parse error at line %d:\n%s\n", + fprintf(stderr, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n", XML_GetCurrentLineNumber(p), XML_ErrorString(XML_GetErrorCode(p))); exit(-1); @@ -86,5 +101,6 @@ main(int argc, char *argv[]) if (done) break; } + XML_ParserFree(p); return 0; }