summaryrefslogtreecommitdiff
path: root/lib/libexpat/examples/elements.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2017-11-02 13:40:58 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2017-11-02 13:40:58 +0000
commitf55cc4db493fb641c33114fd3055cc8262457531 (patch)
treec3230348efa82e63bbb33762c12f6b393b6b3277 /lib/libexpat/examples/elements.c
parent2ed5e72ec41f976789c136d4cb542ee9d2d23f57 (diff)
Update libexpat to 2.2.5. Changes for OpenBSD include a few bug
fixes, no library bump needed. OK deraadt@
Diffstat (limited to 'lib/libexpat/examples/elements.c')
-rw-r--r--lib/libexpat/examples/elements.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/libexpat/examples/elements.c b/lib/libexpat/examples/elements.c
index e3605f3a5dc..2f253f7cb97 100644
--- a/lib/libexpat/examples/elements.c
+++ b/lib/libexpat/examples/elements.c
@@ -38,17 +38,24 @@
#include <expat.h>
#ifdef XML_LARGE_SIZE
-#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
-#define XML_FMT_INT_MOD "I64"
+# 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 "ll"
+# define XML_FMT_INT_MOD "l"
#endif
+
+#ifdef XML_UNICODE_WCHAR_T
+# include <wchar.h>
+# define XML_FMT_STR "ls"
#else
-#define XML_FMT_INT_MOD "l"
+# define XML_FMT_STR "s"
#endif
static void XMLCALL
-startElement(void *userData, const char *name, const char **atts)
+startElement(void *userData, const XML_Char *name, const XML_Char **atts)
{
int i;
int *depthPtr = (int *)userData;
@@ -56,12 +63,12 @@ startElement(void *userData, const char *name, const char **atts)
for (i = 0; i < *depthPtr; i++)
putchar('\t');
- puts(name);
+ printf("%" XML_FMT_STR "\n", name);
*depthPtr += 1;
}
static void XMLCALL
-endElement(void *userData, const char *name)
+endElement(void *userData, const XML_Char *name)
{
int *depthPtr = (int *)userData;
(void)name;
@@ -86,7 +93,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 %" XML_FMT_INT_MOD "u\n",
+ "%" XML_FMT_STR " at line %" XML_FMT_INT_MOD "u\n",
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser));
return 1;