From 0609f873d92f17126798005a15f5e2708585dafa Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Tue, 15 Dec 2009 15:19:09 +0200 Subject: [PATCH] Bug 525094 - Avoid shadowing member fields with local variables in the HTML5 parser. rs=sicking. --HG-- extra : rebase_source : bb52f6d5f9e335a7473524c6acc410b62b3c0863 --- parser/html/nsHtml5Tokenizer.cpp | 16 ++-------------- parser/html/nsHtml5Tokenizer.h | 1 - parser/html/nsHtml5TreeBuilder.cpp | 2 +- parser/html/nsHtml5TreeBuilder.h | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp index e0fa149718f5..f0a95f6d69aa 100644 --- a/parser/html/nsHtml5Tokenizer.cpp +++ b/parser/html/nsHtml5Tokenizer.cpp @@ -222,18 +222,6 @@ nsHtml5Tokenizer::appendStrBuf(PRUnichar c) strBuf[strBufLen++] = c; } -void -nsHtml5Tokenizer::appendStrBufForceWrite(PRUnichar c) -{ - if (strBufLen == strBuf.length) { - jArray newBuf = jArray(strBuf.length + NS_HTML5TOKENIZER_BUFFER_GROW_BY); - nsHtml5ArrayCopy::arraycopy(strBuf, newBuf, strBuf.length); - strBuf.release(); - strBuf = newBuf; - } - strBuf[strBufLen++] = c; -} - nsString* nsHtml5Tokenizer::strBufToString() { @@ -413,8 +401,8 @@ void nsHtml5Tokenizer::addAttributeWithValue() { if (!!attributeName) { - nsString* value = longStrBufToString(); - attributes->addAttribute(attributeName, value); + nsString* val = longStrBufToString(); + attributes->addAttribute(attributeName, val); attributeName = nsnull; } } diff --git a/parser/html/nsHtml5Tokenizer.h b/parser/html/nsHtml5Tokenizer.h index 85995a6498d0..fff5ecf2fcab 100644 --- a/parser/html/nsHtml5Tokenizer.h +++ b/parser/html/nsHtml5Tokenizer.h @@ -160,7 +160,6 @@ class nsHtml5Tokenizer void clearStrBufAndAppendForceWrite(PRUnichar c); void clearStrBufForNextState(); void appendStrBuf(PRUnichar c); - void appendStrBufForceWrite(PRUnichar c); protected: nsString* strBufToString(); private: diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index c10e91770540..3d39d1ab337f 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -2990,7 +2990,7 @@ nsHtml5TreeBuilder::resetTheInsertionMode() } else if (nsHtml5Atoms::table == name) { mode = NS_HTML5TREE_BUILDER_IN_TABLE; return; - } else if (kNameSpaceID_XHTML != node->ns) { + } else if (kNameSpaceID_XHTML != ns) { foreignFlag = NS_HTML5TREE_BUILDER_IN_FOREIGN; mode = NS_HTML5TREE_BUILDER_IN_BODY; return; diff --git a/parser/html/nsHtml5TreeBuilder.h b/parser/html/nsHtml5TreeBuilder.h index fc8089ba4bed..c5dcd61c001f 100644 --- a/parser/html/nsHtml5TreeBuilder.h +++ b/parser/html/nsHtml5TreeBuilder.h @@ -198,7 +198,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState void appendCommentToDocument(PRUnichar* buf, PRInt32 start, PRInt32 length); void addAttributesToElement(nsIContent** element, nsHtml5HtmlAttributes* attributes); void markMalformedIfScript(nsIContent** elt); - void start(PRBool fragment); + void start(PRBool fragmentMode); void end(); void appendDoctypeToDocument(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier); void elementPushed(PRInt32 ns, nsIAtom* name, nsIContent** node);