mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
scanner: Improve XML parse error reporting
Print the parse error and exit with a failure if expat can't parse the XML. Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
parent
f3e7eedf1c
commit
2028227acc
1 changed files with 8 additions and 2 deletions
|
|
@ -1296,8 +1296,14 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, "fread: %m\n");
|
fprintf(stderr, "fread: %m\n");
|
||||||
exit(EXIT_FAILURE);
|
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);
|
} while (len > 0);
|
||||||
|
|
||||||
XML_ParserFree(ctx.parser);
|
XML_ParserFree(ctx.parser);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue