From: Karl Waclawek Date: Wed, 28 Dec 2005 18:43:36 +0000 (+0000) Subject: * Added support for XML_LARGE_SIZE. X-Git-Tag: R_2_0_0~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=925a683135386e0c9eaaa321346a2a19065ecaa0;p=libexpat * Added support for XML_LARGE_SIZE. * Added comment about using with UTF-8 version of Expat only. --- diff --git a/expat/examples/elements.c b/expat/examples/elements.c index e81d4658..421a1ce7 100644 --- a/expat/examples/elements.c +++ b/expat/examples/elements.c @@ -2,11 +2,22 @@ reads an XML document from standard input and writes a line with the name of each element to standard output indenting child elements by one tab stop more than their parent element. + It must be used with Expat compiled for UTF-8 output. */ #include #include "expat.h" +#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 + static void XMLCALL startElement(void *userData, const char *name, const char **atts) { @@ -45,7 +56,7 @@ main(int argc, char *argv[]) done = len < sizeof(buf); if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { fprintf(stderr, - "%s at line %d\n", + "%s at line %" XML_FMT_INT_MOD "u\n", XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser)); return 1; diff --git a/expat/examples/outline.c b/expat/examples/outline.c index e7708195..807ddb89 100644 --- a/expat/examples/outline.c +++ b/expat/examples/outline.c @@ -18,12 +18,23 @@ * * 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 +#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]; @@ -83,7 +94,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);