Menu

#8 lookup_tables error

open
nobody
None
5
2009-10-01
2009-10-01
kill rain
No

When parse utf-16 xml text, it sometimes fail.

In attribute_value_pure_pred::test() function, rapidxml lookup the table.

if 'Ch' is wchar_t and 'ch' is 51200(0xC800), then it should return 1,

but it return 0! Because static_cast<unsigned char>(51200) is '0'

------------
template<Ch Quote>
struct attribute_value_pure_pred
{
static unsigned char test(Ch ch)
{
if (Quote == Ch('\''))
return internal::lookup_tables<0>::lookup_attribute_data_1_pure[static_cast<unsigned char>(ch)];
if (Quote == Ch('\"'))
return internal::lookup_tables<0>::lookup_attribute_data_2_pure[static_cast<unsigned char>(ch)];
return 0; // Should never be executed, to avoid warnings on Comeau
}
};
------------

I think it need 'if-statement' before looking up the table,

Discussion


Log in to post a comment.