Issue #373 - Merge branch 'issue-373' of github.com:htacg/tidy-html5 into issue-373

Conflicts: version.txt - set version 5.1.41issue-373
This commit is contained in:
Geoff McLane 2016-02-18 15:18:39 +01:00
commit 23e689d145

View file

@ -352,6 +352,7 @@ uint EntityCode( ctmbstr name, uint versions )
Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions ) Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions )
{ {
const entity* np; const entity* np;
int res;
assert( name && name[0] == '&' ); assert( name && name[0] == '&' );
assert( code != NULL ); assert( code != NULL );
assert( versions != NULL ); assert( versions != NULL );
@ -363,14 +364,24 @@ Bool TY_(EntityInfo)( ctmbstr name, Bool isXml, uint* code, uint* versions )
/* 'x' prefix denotes hexadecimal number format */ /* 'x' prefix denotes hexadecimal number format */
if ( name[2] == 'x' || (!isXml && name[2] == 'X') ) if ( name[2] == 'x' || (!isXml && name[2] == 'X') )
sscanf( name+3, "%x", &c ); res = sscanf( name+3, "%x", &c );
else else
sscanf( name+2, "%u", &c ); res = sscanf( name+2, "%u", &c );
/* Issue #373 - Null Char in XML result doc - sf905 2009 */
if ( res == 1 )
{
*code = c; *code = c;
*versions = VERS_ALL; *versions = VERS_ALL;
return yes; return yes;
} }
else
{
*code = 0;
*versions = ( isXml ? VERS_XML : VERS_PROPRIETARY );
return no;
}
}
/* Named entity: name ="&" followed by a name */ /* Named entity: name ="&" followed by a name */
if ( NULL != (np = entitiesLookup(name+1)) ) if ( NULL != (np = entitiesLookup(name+1)) )