зеркало из https://github.com/mozilla/pjs.git
fixed numeric entities
This commit is contained in:
Родитель
23d466f216
Коммит
22e7a752e7
|
@ -237,7 +237,7 @@ PRInt32 CNavDelegate::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*&
|
|||
}
|
||||
else if(kHashsign==ch) {
|
||||
aToken = new CEntityToken(nsAutoString(""));
|
||||
result=aToken->Consume(ch,aScanner);
|
||||
result=aToken->Consume(0,aScanner);
|
||||
}
|
||||
else {
|
||||
//oops, we're actually looking at plain text...
|
||||
|
|
|
@ -939,8 +939,8 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
|
|||
* @return error result
|
||||
*/
|
||||
PRInt32 CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
|
||||
|
||||
mTextValue=aChar;
|
||||
if(aChar)
|
||||
mTextValue=aChar;
|
||||
PRInt32 result=ConsumeEntity(aChar,mTextValue,aScanner);
|
||||
return result;
|
||||
};
|
||||
|
@ -1013,17 +1013,27 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner&
|
|||
* @return
|
||||
*/
|
||||
PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
|
||||
char* cp = mTextValue.ToNewCString();
|
||||
PRInt32 index=FindEntityIndex(cp);
|
||||
if(kNotFound!=index) {
|
||||
PRUnichar ch=gStrToUnicodeTable[index].fValue;
|
||||
aString=ch;
|
||||
} else {
|
||||
#ifdef GESS_MACHINE
|
||||
index=TranslateExtendedEntity(cp,aString);
|
||||
#endif
|
||||
PRInt32 index=0;
|
||||
if(aString.IsDigit(mTextValue[0])) {
|
||||
PRInt32 err=0;
|
||||
index=mTextValue.ToInteger(&err);
|
||||
if(0==err)
|
||||
aString.Append(PRUnichar(index));
|
||||
}
|
||||
else {
|
||||
char* cp = mTextValue.ToNewCString();
|
||||
index=FindEntityIndex(cp);
|
||||
if(kNotFound!=index) {
|
||||
PRUnichar ch=gStrToUnicodeTable[index].fValue;
|
||||
aString=ch;
|
||||
}
|
||||
else {
|
||||
#ifdef GESS_MACHINE
|
||||
index=TranslateExtendedEntity(cp,aString);
|
||||
#endif
|
||||
}
|
||||
delete cp;
|
||||
}
|
||||
delete cp;
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ PRInt32 CNavDelegate::ConsumeEntity(PRUnichar aChar,CScanner& aScanner,CToken*&
|
|||
}
|
||||
else if(kHashsign==ch) {
|
||||
aToken = new CEntityToken(nsAutoString(""));
|
||||
result=aToken->Consume(ch,aScanner);
|
||||
result=aToken->Consume(0,aScanner);
|
||||
}
|
||||
else {
|
||||
//oops, we're actually looking at plain text...
|
||||
|
|
|
@ -939,8 +939,8 @@ CEntityToken::CEntityToken(const nsString& aName) : CHTMLToken(aName) {
|
|||
* @return error result
|
||||
*/
|
||||
PRInt32 CEntityToken::Consume(PRUnichar aChar, CScanner& aScanner) {
|
||||
|
||||
mTextValue=aChar;
|
||||
if(aChar)
|
||||
mTextValue=aChar;
|
||||
PRInt32 result=ConsumeEntity(aChar,mTextValue,aScanner);
|
||||
return result;
|
||||
};
|
||||
|
@ -1013,17 +1013,27 @@ PRInt32 CEntityToken::ConsumeEntity(PRUnichar aChar,nsString& aString,CScanner&
|
|||
* @return
|
||||
*/
|
||||
PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) {
|
||||
char* cp = mTextValue.ToNewCString();
|
||||
PRInt32 index=FindEntityIndex(cp);
|
||||
if(kNotFound!=index) {
|
||||
PRUnichar ch=gStrToUnicodeTable[index].fValue;
|
||||
aString=ch;
|
||||
} else {
|
||||
#ifdef GESS_MACHINE
|
||||
index=TranslateExtendedEntity(cp,aString);
|
||||
#endif
|
||||
PRInt32 index=0;
|
||||
if(aString.IsDigit(mTextValue[0])) {
|
||||
PRInt32 err=0;
|
||||
index=mTextValue.ToInteger(&err);
|
||||
if(0==err)
|
||||
aString.Append(PRUnichar(index));
|
||||
}
|
||||
else {
|
||||
char* cp = mTextValue.ToNewCString();
|
||||
index=FindEntityIndex(cp);
|
||||
if(kNotFound!=index) {
|
||||
PRUnichar ch=gStrToUnicodeTable[index].fValue;
|
||||
aString=ch;
|
||||
}
|
||||
else {
|
||||
#ifdef GESS_MACHINE
|
||||
index=TranslateExtendedEntity(cp,aString);
|
||||
#endif
|
||||
}
|
||||
delete cp;
|
||||
}
|
||||
delete cp;
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче