]> granicus.if.org Git - libexpat/commitdiff
* Added support for XML_LARGE_SIZE.
authorKarl Waclawek <kwaclaw@users.sourceforge.net>
Wed, 28 Dec 2005 18:43:36 +0000 (18:43 +0000)
committerKarl Waclawek <kwaclaw@users.sourceforge.net>
Wed, 28 Dec 2005 18:43:36 +0000 (18:43 +0000)
* Added comment about using with UTF-8 version of Expat only.

expat/examples/elements.c
expat/examples/outline.c

index e81d465862df38dfc1e4d2cf0deda4bfaba84866..421a1ce7793939208139822a3fd3bc12ea62338a 100644 (file)
@@ -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 @@ 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;
index e77081951ddf97420ba03051c69904ebb5f70989..807ddb89e0353b6e730426e6147b1ae8e03df1cd 100644 (file)
  *
  * 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 @@ 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);