diff options
author | Brad King <brad.king@kitware.com> | 2017-08-07 14:10:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-08-07 14:19:30 (GMT) |
commit | 44e5fb9c7ea3e3b0288cc24ec85554112e966d73 (patch) | |
tree | 32f6032ff5567c0f1cda418817d3b113df265af5 /Utilities/cmexpat/lib/xmlrole.c | |
parent | 6276ec3726ce4bb92748b0a70b1102e38924b626 (diff) | |
parent | 7e08602c761cabe75c557eacf738b716a4a1e18a (diff) | |
download | CMake-44e5fb9c7ea3e3b0288cc24ec85554112e966d73.zip CMake-44e5fb9c7ea3e3b0288cc24ec85554112e966d73.tar.gz CMake-44e5fb9c7ea3e3b0288cc24ec85554112e966d73.tar.bz2 |
Merge branch 'upstream-expat' into update-expat
* upstream-expat:
expat 2017-08-02 (97c6bd01)
Diffstat (limited to 'Utilities/cmexpat/lib/xmlrole.c')
-rw-r--r-- | Utilities/cmexpat/lib/xmlrole.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Utilities/cmexpat/lib/xmlrole.c b/Utilities/cmexpat/lib/xmlrole.c index a7c5630..c809ee5 100644 --- a/Utilities/cmexpat/lib/xmlrole.c +++ b/Utilities/cmexpat/lib/xmlrole.c @@ -170,7 +170,14 @@ prolog1(PROLOG_STATE *state, case XML_TOK_COMMENT: return XML_ROLE_COMMENT; case XML_TOK_BOM: - return XML_ROLE_NONE; + /* This case can never arise. To reach this role function, the + * parse must have passed through prolog0 and therefore have had + * some form of input, even if only a space. At that point, a + * byte order mark is no longer a valid character (though + * technically it should be interpreted as a non-breaking space), + * so will be rejected by the tokenizing stages. + */ + return XML_ROLE_NONE; /* LCOV_EXCL_LINE */ case XML_TOK_DECL_OPEN: if (!XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), @@ -1285,6 +1292,26 @@ declClose(PROLOG_STATE *state, return common(state, tok); } +/* This function will only be invoked if the internal logic of the + * parser has broken down. It is used in two cases: + * + * 1: When the XML prolog has been finished. At this point the + * processor (the parser level above these role handlers) should + * switch from prologProcessor to contentProcessor and reinitialise + * the handler function. + * + * 2: When an error has been detected (via common() below). At this + * point again the processor should be switched to errorProcessor, + * which will never call a handler. + * + * The result of this is that error() can only be called if the + * processor switch failed to happen, which is an internal error and + * therefore we shouldn't be able to provoke it simply by using the + * library. It is a necessary backstop, however, so we merely exclude + * it from the coverage statistics. + * + * LCOV_EXCL_START + */ static int PTRCALL error(PROLOG_STATE *UNUSED_P(state), int UNUSED_P(tok), @@ -1294,6 +1321,7 @@ error(PROLOG_STATE *UNUSED_P(state), { return XML_ROLE_NONE; } +/* LCOV_EXCL_STOP */ static int FASTCALL common(PROLOG_STATE *state, int tok) |