[Expat-checkins] expat/examples elements.c, 1.6, 1.7 outline.c, 1.6, 1.7

Karl Waclawek kwaclaw at users.sourceforge.net
Wed Dec 28 19:43:40 CET 2005


Update of /cvsroot/expat/expat/examples
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2963

Modified Files:
	elements.c outline.c 
Log Message:
* Added support for XML_LARGE_SIZE.
* Added comment about using with UTF-8 version of Expat only.

Index: elements.c
===================================================================
RCS file: /cvsroot/expat/expat/examples/elements.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- elements.c	24 Dec 2005 06:52:33 -0000	1.6
+++ elements.c	28 Dec 2005 18:43:36 -0000	1.7
@@ -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 <stdio.h>
 #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 @@
     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;

Index: outline.c
===================================================================
RCS file: /cvsroot/expat/expat/examples/outline.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- outline.c	24 Dec 2005 06:52:33 -0000	1.6
+++ outline.c	28 Dec 2005 18:43:36 -0000	1.7
@@ -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 <stdio.h>
 #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
+
 #define BUFFSIZE        8192
 
 char Buff[BUFFSIZE];
@@ -83,7 +94,7 @@
     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);



More information about the Expat-checkins mailing list