From cdd92be805acacb4f6e376ee9bbb26bdf5404834 Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Thu, 23 Mar 2000 04:13:49 +0000 Subject: [PATCH] Don't try to Truncate when we fail to find the character. Actually, just do an assignment with the character location as the count size. This is actually a checkin for scc. r=travis --- htmlparser/src/nsHTMLTokens.cpp | 6 ++---- parser/htmlparser/src/nsHTMLTokens.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/htmlparser/src/nsHTMLTokens.cpp b/htmlparser/src/nsHTMLTokens.cpp index 5af921f049c8..46ef0111d83f 100644 --- a/htmlparser/src/nsHTMLTokens.cpp +++ b/htmlparser/src/nsHTMLTokens.cpp @@ -351,10 +351,8 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE); if(NS_OK==result){ - - PRInt32 theIndex=mTextValue.FindCharInSet(" \r\n\t\b",0); - nsAutoString buffer(mTextValue); - buffer.Truncate(theIndex); + nsAutoString buffer; + buffer.Assign(mTextValue, mTextValue.FindCharInSet(" \r\n\t\b",0)); mTypeID= nsHTMLTags::LookupTag(buffer); result=aScanner.GetChar(aChar); //eat the closing '>; } diff --git a/parser/htmlparser/src/nsHTMLTokens.cpp b/parser/htmlparser/src/nsHTMLTokens.cpp index 5af921f049c8..46ef0111d83f 100644 --- a/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/parser/htmlparser/src/nsHTMLTokens.cpp @@ -351,10 +351,8 @@ nsresult CEndToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) nsresult result=aScanner.ReadUntil(mTextValue,kGreaterThan,PR_FALSE); if(NS_OK==result){ - - PRInt32 theIndex=mTextValue.FindCharInSet(" \r\n\t\b",0); - nsAutoString buffer(mTextValue); - buffer.Truncate(theIndex); + nsAutoString buffer; + buffer.Assign(mTextValue, mTextValue.FindCharInSet(" \r\n\t\b",0)); mTypeID= nsHTMLTags::LookupTag(buffer); result=aScanner.GetChar(aChar); //eat the closing '>; }