diff --git a/mozilla/htmlparser/src/nsHTMLEntities.cpp b/mozilla/htmlparser/src/nsHTMLEntities.cpp
index 6c178ae6e12..e3774b3bf6d 100644
--- a/mozilla/htmlparser/src/nsHTMLEntities.cpp
+++ b/mozilla/htmlparser/src/nsHTMLEntities.cpp
@@ -147,7 +147,7 @@ nsHTMLEntities::ReleaseTable(void)
}
PRInt32
-nsHTMLEntities::EntityToUnicode(const nsString& aEntity)
+nsHTMLEntities::EntityToUnicode(const nsCString& aEntity)
{
NS_ASSERTION(gEntityToCodeTree, "no lookup table, needs addref");
if (gEntityToCodeTree) {
@@ -173,31 +173,12 @@ nsHTMLEntities::EntityToUnicode(const nsString& aEntity)
return -1;
}
+
PRInt32
-nsHTMLEntities::EntityToUnicode(const nsCString& aEntity)
-{
- NS_ASSERTION(gEntityToCodeTree, "no lookup table, needs addref");
- if (gEntityToCodeTree) {
-
- //this little piece of code exists because entities may or may not have the terminating ';'.
- //if we see it, strip if off for this test...
-
- PRUnichar theLastChar=GetCharAt(aEntity,aEntity.mLength-1);
- if(';'==theLastChar) {
- nsCAutoString temp(aEntity);
- temp.Truncate(aEntity.mLength-1);
- return EntityToUnicode(temp);
- }
-
-
- EntityNode node(aEntity);
- EntityNode* found = (EntityNode*)gEntityToCodeTree->FindItem(&node);
- if (found) {
- NS_ASSERTION(found->mStr.Equals(aEntity.mUStr,PR_FALSE,aEntity.mLength), "bad tree");
- return found->mUnicode;
- }
- }
- return -1;
+nsHTMLEntities::EntityToUnicode(const nsString& aEntity) {
+ nsCAutoString theEntity(aEntity);
+ PRInt32 result=EntityToUnicode(theEntity);
+ return result;
}
const nsCString&
diff --git a/mozilla/htmlparser/src/nsHTMLTags.cpp b/mozilla/htmlparser/src/nsHTMLTags.cpp
index 11e04dad1f3..52b768b9fba 100644
--- a/mozilla/htmlparser/src/nsHTMLTags.cpp
+++ b/mozilla/htmlparser/src/nsHTMLTags.cpp
@@ -39,13 +39,7 @@ struct TagNode {
mEnum(eHTMLTag_unknown)
{}
- TagNode(const nsStr& aStringValue)
- : mStr(),
- mEnum(eHTMLTag_unknown)
- { // point to the incomming buffer
- // note that the incomming buffer may really be 2 byte
- nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity,
- aStringValue.mLength, aStringValue.mCharSize, PR_FALSE);
+ TagNode(const nsCString& aString) : mStr(aString), mEnum(eHTMLTag_unknown) {
}
nsCAutoString mStr;
@@ -110,29 +104,6 @@ nsHTMLTags::ReleaseTable(void)
}
-nsHTMLTag
-nsHTMLTags::LookupTag(const nsString& aTag)
-{
- NS_ASSERTION(gTagTree, "no lookup table, needs addref");
- if (gTagTree) {
- TagNode node(aTag);
- TagNode* found = (TagNode*)gTagTree->FindItem(&node);
- if (found) {
- NS_ASSERTION(found->mStr.EqualsIgnoreCase(aTag), "bad tree");
- return found->mEnum;
- }
- else {
- // hack: this can come out when rickg provides a way for the editor to ask
- // CanContain() questions without having to first fetch the parsers
- // internal enum values for a tag name.
- nsAutoString textTag("__moz_text");
- if (textTag==aTag)
- return eHTMLTag_text;
- }
- }
- return eHTMLTag_userdefined;
-}
-
nsHTMLTag
nsHTMLTags::LookupTag(const nsCString& aTag)
{
@@ -148,14 +119,20 @@ nsHTMLTags::LookupTag(const nsCString& aTag)
// hack: this can come out when rickg provides a way for the editor to ask
// CanContain() questions without having to first fetch the parsers
// internal enum values for a tag name.
- nsAutoString textTag("__moz_text");
- if (textTag==aTag)
+ if (aTag.Equals("__moz_text"))
return eHTMLTag_text;
}
}
return eHTMLTag_userdefined;
}
+nsHTMLTag
+nsHTMLTags::LookupTag(const nsString& aTag) {
+ nsCAutoString theTag(aTag);
+ return LookupTag(theTag);
+}
+
+
const nsCString&
nsHTMLTags::GetStringValue(nsHTMLTag aTag)
diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp
index 15f02b8973f..c14a1e1aa15 100644
--- a/mozilla/htmlparser/src/nsParser.cpp
+++ b/mozilla/htmlparser/src/nsParser.cpp
@@ -602,8 +602,8 @@ eParseMode DetermineParseMode(nsParser& aParser) {
else if(kNotFound<(theSubIndex=theBuffer.Find("HTML",PR_TRUE,theStartPos,theCount))) {
- PRInt32 theStartPos=theSubIndex+5;
- PRInt32 theCount=theEnd-theStartPos;
+ theStartPos=theSubIndex+5;
+ theCount=theEnd-theStartPos;
nsAutoString theNum;
theBuffer.Mid(theNum,theStartPos-1,3);
diff --git a/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp b/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp
index 6c178ae6e12..e3774b3bf6d 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLEntities.cpp
@@ -147,7 +147,7 @@ nsHTMLEntities::ReleaseTable(void)
}
PRInt32
-nsHTMLEntities::EntityToUnicode(const nsString& aEntity)
+nsHTMLEntities::EntityToUnicode(const nsCString& aEntity)
{
NS_ASSERTION(gEntityToCodeTree, "no lookup table, needs addref");
if (gEntityToCodeTree) {
@@ -173,31 +173,12 @@ nsHTMLEntities::EntityToUnicode(const nsString& aEntity)
return -1;
}
+
PRInt32
-nsHTMLEntities::EntityToUnicode(const nsCString& aEntity)
-{
- NS_ASSERTION(gEntityToCodeTree, "no lookup table, needs addref");
- if (gEntityToCodeTree) {
-
- //this little piece of code exists because entities may or may not have the terminating ';'.
- //if we see it, strip if off for this test...
-
- PRUnichar theLastChar=GetCharAt(aEntity,aEntity.mLength-1);
- if(';'==theLastChar) {
- nsCAutoString temp(aEntity);
- temp.Truncate(aEntity.mLength-1);
- return EntityToUnicode(temp);
- }
-
-
- EntityNode node(aEntity);
- EntityNode* found = (EntityNode*)gEntityToCodeTree->FindItem(&node);
- if (found) {
- NS_ASSERTION(found->mStr.Equals(aEntity.mUStr,PR_FALSE,aEntity.mLength), "bad tree");
- return found->mUnicode;
- }
- }
- return -1;
+nsHTMLEntities::EntityToUnicode(const nsString& aEntity) {
+ nsCAutoString theEntity(aEntity);
+ PRInt32 result=EntityToUnicode(theEntity);
+ return result;
}
const nsCString&
diff --git a/mozilla/parser/htmlparser/src/nsHTMLTags.cpp b/mozilla/parser/htmlparser/src/nsHTMLTags.cpp
index 11e04dad1f3..52b768b9fba 100644
--- a/mozilla/parser/htmlparser/src/nsHTMLTags.cpp
+++ b/mozilla/parser/htmlparser/src/nsHTMLTags.cpp
@@ -39,13 +39,7 @@ struct TagNode {
mEnum(eHTMLTag_unknown)
{}
- TagNode(const nsStr& aStringValue)
- : mStr(),
- mEnum(eHTMLTag_unknown)
- { // point to the incomming buffer
- // note that the incomming buffer may really be 2 byte
- nsStr::Initialize(mStr, aStringValue.mStr, aStringValue.mCapacity,
- aStringValue.mLength, aStringValue.mCharSize, PR_FALSE);
+ TagNode(const nsCString& aString) : mStr(aString), mEnum(eHTMLTag_unknown) {
}
nsCAutoString mStr;
@@ -110,29 +104,6 @@ nsHTMLTags::ReleaseTable(void)
}
-nsHTMLTag
-nsHTMLTags::LookupTag(const nsString& aTag)
-{
- NS_ASSERTION(gTagTree, "no lookup table, needs addref");
- if (gTagTree) {
- TagNode node(aTag);
- TagNode* found = (TagNode*)gTagTree->FindItem(&node);
- if (found) {
- NS_ASSERTION(found->mStr.EqualsIgnoreCase(aTag), "bad tree");
- return found->mEnum;
- }
- else {
- // hack: this can come out when rickg provides a way for the editor to ask
- // CanContain() questions without having to first fetch the parsers
- // internal enum values for a tag name.
- nsAutoString textTag("__moz_text");
- if (textTag==aTag)
- return eHTMLTag_text;
- }
- }
- return eHTMLTag_userdefined;
-}
-
nsHTMLTag
nsHTMLTags::LookupTag(const nsCString& aTag)
{
@@ -148,14 +119,20 @@ nsHTMLTags::LookupTag(const nsCString& aTag)
// hack: this can come out when rickg provides a way for the editor to ask
// CanContain() questions without having to first fetch the parsers
// internal enum values for a tag name.
- nsAutoString textTag("__moz_text");
- if (textTag==aTag)
+ if (aTag.Equals("__moz_text"))
return eHTMLTag_text;
}
}
return eHTMLTag_userdefined;
}
+nsHTMLTag
+nsHTMLTags::LookupTag(const nsString& aTag) {
+ nsCAutoString theTag(aTag);
+ return LookupTag(theTag);
+}
+
+
const nsCString&
nsHTMLTags::GetStringValue(nsHTMLTag aTag)
diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp
index 15f02b8973f..c14a1e1aa15 100644
--- a/mozilla/parser/htmlparser/src/nsParser.cpp
+++ b/mozilla/parser/htmlparser/src/nsParser.cpp
@@ -602,8 +602,8 @@ eParseMode DetermineParseMode(nsParser& aParser) {
else if(kNotFound<(theSubIndex=theBuffer.Find("HTML",PR_TRUE,theStartPos,theCount))) {
- PRInt32 theStartPos=theSubIndex+5;
- PRInt32 theCount=theEnd-theStartPos;
+ theStartPos=theSubIndex+5;
+ theCount=theEnd-theStartPos;
nsAutoString theNum;
theBuffer.Mid(theNum,theStartPos-1,3);