From: Adam Dickmeiss Date: Mon, 19 Aug 2013 12:09:55 +0000 (+0200) Subject: HTML: clean up char checks. Add ptr to HTML parse spec X-Git-Tag: v1.3.60~3 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=4f5fe9b621891d0d4eabbd7dbcba65f96f11f528;p=metaproxy-moved-to-github.git HTML: clean up char checks. Add ptr to HTML parse spec --- diff --git a/src/html_parser.cpp b/src/html_parser.cpp index fba5595..4d4e3a7 100644 --- a/src/html_parser.cpp +++ b/src/html_parser.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define SPACECHR " \t\r\n\f" +// http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html namespace metaproxy_1 { class HTMLParser::Rep { @@ -95,7 +96,7 @@ static int skipSpace(const char *cp) static int skipName(const char *cp) { int i; - for (i = 0; cp[i] && !strchr(SPACECHR "/>=<", cp[i]); i++) + for (i = 0; cp[i] && !strchr(SPACECHR "/><=", cp[i]); i++) ; return i; } @@ -146,7 +147,7 @@ int mp::HTMLParser::Rep::tagAttrs(HTMLParserEvent &event, const char *cp) { int i = skipSpace(cp); - while (cp[i] && cp[i] != '>' && cp[i] != '/' && cp[i] != '<') + while (cp[i] && !strchr("/><", cp[i])) { const char *attr_name = cp + i; int attr_len; @@ -174,7 +175,7 @@ int mp::HTMLParser::Rep::tagEnd(HTMLParserEvent &event, { int i = 0; int close_it = 0; - for (; cp[i] && cp[i] != '/' && cp[i] != '>' && cp[i] != '<'; i++) + for (; cp[i] && !strchr("/><", cp[i]); i++) ; if (i > 0) {