修正htmlcxx中的几处bug

1.Node::parseAttributes 在解析这种 标签时会有问题!
原因:
stat.js?后面两个字节是a1 a7,(还有中文问题)显然不是ASCII表中的。
而Node.cc(Line89) 有while (*end && !isspace(*end) && *end != ‘>’) end++;
其中isspace(*end)中会有如下断言:_ASSERTE((unsigned)(c + 1) <= 256); //要求调用者保证传入的参数必须属于ASCII码
修改如下:
//while (*end && !isspace(*end) && *end != ‘>’) end++;
while (*end &&((unsigned)*end > 255 || !isspace(*end) ) && *end != ‘>’) end++;

3.ParserSax.tcc也存在如上相同问题:
修改如下
template
_Iterator
htmlcxx::HTML::ParserSax::skipHtmlComment(_Iterator c, _Iterator end)
{
while ( c != end ) {
if (*c++ == ‘-‘ && c != end && *c == ‘-‘)
{
_Iterator d(c);
while (++c != end &&((unsigned)*c > 255 || !isspace(*c) ) && *c != ‘>’);
if (c == end || *c++ == ‘>’) break;
c = d;
}
}

return c;
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *