mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
render.cpp: print a warning and continue on encountering malformed XML in a layout file (nw)
This commit is contained in:
parent
68d38ecac6
commit
fde41f3fad
@ -2057,7 +2057,27 @@ bool render_target::load_layout_file(const char *dirname, const char *filename)
|
||||
return false;
|
||||
|
||||
// read the file
|
||||
util::xml::file::ptr rootnode(util::xml::file::read(layoutfile, nullptr));
|
||||
util::xml::parse_options parseopt;
|
||||
util::xml::parse_error parseerr;
|
||||
parseopt.error = &parseerr;
|
||||
util::xml::file::ptr rootnode(util::xml::file::read(layoutfile, &parseopt));
|
||||
if (!rootnode)
|
||||
{
|
||||
if (parseerr.error_message)
|
||||
{
|
||||
osd_printf_warning(
|
||||
"Error parsing XML file '%s' at line %d column %d: %s, ignoring\n",
|
||||
filename,
|
||||
parseerr.error_line,
|
||||
parseerr.error_column,
|
||||
parseerr.error_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
osd_printf_warning("Error parsing XML file '%s', ignorning\n", filename);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// if we didn't get a properly-formatted XML file, record a warning and exit
|
||||
if (!load_layout_file(m_manager.machine().root_device(), dirname, *rootnode))
|
||||
|
@ -45,18 +45,22 @@ enum
|
||||
/* extended error information from parsing */
|
||||
struct parse_error
|
||||
{
|
||||
const char * error_message;
|
||||
int error_line;
|
||||
int error_column;
|
||||
parse_error() = default;
|
||||
|
||||
const char * error_message = nullptr;
|
||||
int error_line = 0;
|
||||
int error_column = 0;
|
||||
};
|
||||
|
||||
|
||||
// parsing options
|
||||
struct parse_options
|
||||
{
|
||||
parse_error * error;
|
||||
void (*init_parser)(XML_ParserStruct *parser);
|
||||
uint32_t flags;
|
||||
parse_options() = default;
|
||||
|
||||
parse_error * error = nullptr;
|
||||
void (*init_parser)(XML_ParserStruct *parser) = nullptr;
|
||||
uint32_t flags = 0;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user