From 06fb5cebe8fe5c2115d8baf6b18e3d757be13a54 Mon Sep 17 00:00:00 2001 From: James Clark Date: Sat, 16 May 1998 09:18:16 +0000 Subject: [PATCH] Split externalEntityInitProcessor into 2. --- expat/xmlparse/xmlparse.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/expat/xmlparse/xmlparse.c b/expat/xmlparse/xmlparse.c index 0c4c6009..b26a73dc 100755 --- a/expat/xmlparse/xmlparse.c +++ b/expat/xmlparse/xmlparse.c @@ -109,6 +109,7 @@ static Processor cdataSectionProcessor; static Processor epilogProcessor; static Processor errorProcessor; static Processor externalEntityInitProcessor; +static Processor externalEntityInitProcessor2; static Processor externalEntityContentProcessor; static enum XML_Error @@ -576,10 +577,35 @@ enum XML_Error externalEntityInitProcessor(XML_Parser parser, switch (tok) { case XML_TOK_BOM: start = next; - tok = XmlContentTok(encoding, start, end, &next); - if (tok != XML_TOK_XML_DECL) - break; - /* fall through */ + break; + case XML_TOK_PARTIAL: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + errorPtr = start; + return XML_ERROR_UNCLOSED_TOKEN; + case XML_TOK_PARTIAL_CHAR: + if (endPtr) { + *endPtr = start; + return XML_ERROR_NONE; + } + errorPtr = start; + return XML_ERROR_PARTIAL_CHAR; + } + processor = externalEntityInitProcessor2; + return externalEntityInitProcessor2(parser, start, end, endPtr); +} + +static +enum XML_Error externalEntityInitProcessor2(XML_Parser parser, + const char *start, + const char *end, + const char **endPtr) +{ + const char *next; + int tok = XmlContentTok(encoding, start, end, &next); + switch (tok) { case XML_TOK_XML_DECL: { const char *encodingName = 0; -- 2.40.0