зеркало из https://github.com/mozilla/pjs.git
small performance enhancement -- less searching
This commit is contained in:
Родитель
1a121d89d6
Коммит
ad482c8baf
|
@ -424,7 +424,7 @@ eParseMode DetermineParseMode(nsParser& aParser) {
|
|||
if(theScanner){
|
||||
nsString theBufCopy;
|
||||
nsString& theBuffer=theScanner->GetBuffer();
|
||||
theBuffer.Left(theBufCopy,300);
|
||||
theBuffer.Left(theBufCopy,125);
|
||||
theBufCopy.ToUpperCase();
|
||||
PRInt32 theIndex=theBufCopy.Find("<!DOCTYPE");
|
||||
if(kNotFound==theIndex){
|
||||
|
|
|
@ -184,7 +184,9 @@ eAutoDetectResult CWellFormedDTD::CanParse(nsString& aContentType, nsString& aCo
|
|||
result=eValidDetect;
|
||||
}
|
||||
else {
|
||||
if(-1<aBuffer.Find("<?xml ")) {
|
||||
nsAutoString temp;
|
||||
aBuffer.Left(temp,150); //let's only scan the first 150 or so bytes...
|
||||
if(-1<temp.Find("<?xml ")) {
|
||||
if(0==aContentType.Length()) {
|
||||
aContentType = kXMLTextContentType; //only reset it if it's empty
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ eParseMode DetermineParseMode(nsParser& aParser) {
|
|||
if(theScanner){
|
||||
nsString theBufCopy;
|
||||
nsString& theBuffer=theScanner->GetBuffer();
|
||||
theBuffer.Left(theBufCopy,300);
|
||||
theBuffer.Left(theBufCopy,125);
|
||||
theBufCopy.ToUpperCase();
|
||||
PRInt32 theIndex=theBufCopy.Find("<!DOCTYPE");
|
||||
if(kNotFound==theIndex){
|
||||
|
|
|
@ -184,7 +184,9 @@ eAutoDetectResult CWellFormedDTD::CanParse(nsString& aContentType, nsString& aCo
|
|||
result=eValidDetect;
|
||||
}
|
||||
else {
|
||||
if(-1<aBuffer.Find("<?xml ")) {
|
||||
nsAutoString temp;
|
||||
aBuffer.Left(temp,150); //let's only scan the first 150 or so bytes...
|
||||
if(-1<temp.Find("<?xml ")) {
|
||||
if(0==aContentType.Length()) {
|
||||
aContentType = kXMLTextContentType; //only reset it if it's empty
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче