]> git.saurik.com Git - wxWidgets.git/blobdiff - src/expat/examples/outline.c
Fix Doxygen warnings due to documenting overloaded functions together.
[wxWidgets.git] / src / expat / examples / outline.c
index 10f6d1db5b8dcdb1bf0f87fc5ac2d5d44e3811ec..3a3c8385512a22bdfb18bfc3ef48b1252a22244c 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>
 
+#if defined(__amigaos__) && defined(__USE_INLINE__)
+#include <proto/expat.h>
+#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;
 }