projects
/
platform
/
upstream
/
wayland.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f3e7eed
)
scanner: Improve XML parse error reporting
author
Jonas Ådahl
<jadahl@gmail.com>
Mon, 22 Sep 2014 20:11:18 +0000
(22:11 +0200)
committer
Pekka Paalanen
<pekka.paalanen@collabora.co.uk>
Tue, 23 Sep 2014 08:40:46 +0000
(11:40 +0300)
Print the parse error and exit with a failure if expat can't parse the
XML.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
src/scanner.c
patch
|
blob
|
history
diff --git
a/src/scanner.c
b/src/scanner.c
index
72fd3e8
..
6be1d7a
100644
(file)
--- a/
src/scanner.c
+++ b/
src/scanner.c
@@
-1296,8
+1296,14
@@
int main(int argc, char *argv[])
fprintf(stderr, "fread: %m\n");
exit(EXIT_FAILURE);
}
- XML_ParseBuffer(ctx.parser, len, len == 0);
-
+ if (XML_ParseBuffer(ctx.parser, len, len == 0) == 0) {
+ fprintf(stderr,
+ "Error parsing XML at line %ld col %ld: %s\n",
+ XML_GetCurrentLineNumber(ctx.parser),
+ XML_GetCurrentColumnNumber(ctx.parser),
+ XML_ErrorString(XML_GetErrorCode(ctx.parser)));
+ exit(EXIT_FAILURE);
+ }
} while (len > 0);
XML_ParserFree(ctx.parser);