diff --git a/editor/composer/src/nsEditingSession.cpp b/editor/composer/src/nsEditingSession.cpp index c2ebb4d2d069..743a6b3548dc 100644 --- a/editor/composer/src/nsEditingSession.cpp +++ b/editor/composer/src/nsEditingSession.cpp @@ -1026,9 +1026,9 @@ nsEditingSession::EndDocumentLoad(nsIWebProgress *aWebProgress, { // To keep pre Gecko 1.9 behavior, setup editor always when // mMakeWholeDocumentEditable. - PRBool needsSetup; + bool needsSetup = false; if (mMakeWholeDocumentEditable) { - needsSetup = PR_TRUE; + needsSetup = true; } else { // do we already have an editor here? nsCOMPtr editor; diff --git a/editor/composer/src/nsEditorSpellCheck.cpp b/editor/composer/src/nsEditorSpellCheck.cpp index 70743ce08f9e..cbd15607a681 100644 --- a/editor/composer/src/nsEditorSpellCheck.cpp +++ b/editor/composer/src/nsEditorSpellCheck.cpp @@ -454,7 +454,10 @@ nsEditorSpellCheck::UninitSpellChecker() // we preserve the last selected language, but ignore errors so we continue // to uninitialize - nsresult rv = SaveDefaultDictionary(); +#ifdef DEBUG + nsresult rv = +#endif + SaveDefaultDictionary(); NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "failed to set default dictionary"); // Cleanup - kill the spell checker diff --git a/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp b/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp index 17ee11b0c45c..d51f2613c775 100644 --- a/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp +++ b/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp @@ -266,7 +266,7 @@ nsresult ChangeCSSInlineStyleTxn::SetStyle(PRBool aAttributeWasSet, NS_ASSERTION(mEditor && mElement, "bad state"); if (!mEditor || !mElement) { return NS_ERROR_NOT_INITIALIZED; } - nsresult result; + nsresult result = NS_OK; if (aAttributeWasSet) { // the style attribute was set and not empty, let's recreate the declaration nsAutoString propertyNameString; diff --git a/editor/libeditor/base/DeleteRangeTxn.cpp b/editor/libeditor/base/DeleteRangeTxn.cpp index 58a5e8eb57ab..4045c0901b62 100644 --- a/editor/libeditor/base/DeleteRangeTxn.cpp +++ b/editor/libeditor/base/DeleteRangeTxn.cpp @@ -253,7 +253,7 @@ DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent, PRUint32 aStartOffset, PRUint32 aEndOffset) { - nsresult result; + nsresult result = NS_OK; // see what kind of node we have nsCOMPtr textNode = do_QueryInterface(aStartParent); if (textNode) diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 6d321a132391..e157deaa6a17 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -224,15 +224,18 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsEditor, nsIEditor) NS_IMETHODIMP nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags) { - NS_PRECONDITION(nsnull!=aDoc && nsnull!=aPresShell, "bad arg"); - if ((nsnull==aDoc) || (nsnull==aPresShell)) + NS_PRECONDITION(aDoc && aPresShell, "bad arg"); + if (!aDoc || !aPresShell) return NS_ERROR_NULL_POINTER; // First only set flags, but other stuff shouldn't be initialized now. // Don't move this call after initializing mDocWeak and mPresShellWeak. // SetFlags() can check whether it's called during initialization or not by // them. Note that SetFlags() will be called by PostCreate(). - nsresult rv = SetFlags(aFlags); +#ifdef DEBUG + nsresult rv = +#endif + SetFlags(aFlags); NS_ASSERTION(NS_SUCCEEDED(rv), "SetFlags() failed"); mDocWeak = do_GetWeakReference(aDoc); // weak reference to doc @@ -2874,7 +2877,7 @@ nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep, PRBool aNodeToKeepIsFirst) { NS_ASSERTION(aNodeToKeep && aNodeToJoin && aParent, "null arg"); - nsresult result; + nsresult result = NS_OK; if (aNodeToKeep && aNodeToJoin && aParent) { // get selection diff --git a/editor/libeditor/base/nsEditorUtils.cpp b/editor/libeditor/base/nsEditorUtils.cpp index d75f19cd1c91..6e96335bdb3d 100644 --- a/editor/libeditor/base/nsEditorUtils.cpp +++ b/editor/libeditor/base/nsEditorUtils.cpp @@ -271,7 +271,10 @@ nsEditorHookUtils::DoInsertionHook(nsIDOMDocument *aDoc, nsIDOMEvent *aDropEvent if (override) { PRBool doInsert = PR_TRUE; - nsresult hookResult = override->OnPasteOrDrop(aDropEvent, aTrans, &doInsert); +#ifdef DEBUG + nsresult hookResult = +#endif + override->OnPasteOrDrop(aDropEvent, aTrans, &doInsert); NS_ASSERTION(NS_SUCCEEDED(hookResult), "hook failure in OnPasteOrDrop"); NS_ENSURE_TRUE(doInsert, PR_FALSE); } diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 6bf0799d52af..1b5057cb35b3 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -5822,7 +5822,7 @@ nsHTMLEditRules::GetNodesForOperation(nsCOMArray& inArrayOfRanges, NS_ASSERTION(rangeCount == rangeItemArray.Length(), "How did that happen?"); // first register ranges for special editor gravity - for (i = 0; i < (PRInt32)rangeCount; i++) + for (i = 0; i < rangeCount; i++) { opRange = inArrayOfRanges[0]; nsRangeStore *item = rangeItemArray.Elements() + i; diff --git a/editor/libeditor/html/nsWSRunObject.cpp b/editor/libeditor/html/nsWSRunObject.cpp index c65658baf0ea..21f67df2918b 100644 --- a/editor/libeditor/html/nsWSRunObject.cpp +++ b/editor/libeditor/html/nsWSRunObject.cpp @@ -1914,8 +1914,8 @@ nsWSRunObject::GetCharAt(nsIContent *aTextNode, PRInt32 aOffset) // return 0 if we can't get a char, for whatever reason NS_ENSURE_TRUE(aTextNode, 0); - PRUint32 len = aTextNode->TextLength(); - if (aOffset < 0 || aOffset >= PRUint32(len)) + PRInt32 len = PRInt32(aTextNode->TextLength()); + if (aOffset < 0 || aOffset >= len) return 0; return aTextNode->GetText()->CharAt(aOffset); diff --git a/editor/libeditor/text/nsInternetCiter.cpp b/editor/libeditor/text/nsInternetCiter.cpp index 9aaea959743c..50a5ca9b6803 100644 --- a/editor/libeditor/text/nsInternetCiter.cpp +++ b/editor/libeditor/text/nsInternetCiter.cpp @@ -354,7 +354,7 @@ nsInternetCiter::Rewrap(const nsAString& aInString, continue; // continue inner loop, with outStringCol now at bol } - PRInt32 breakPt; + PRInt32 breakPt = 0; rv = NS_ERROR_BASE; if (lineBreaker) { diff --git a/editor/txtsvc/src/nsTextServicesDocument.cpp b/editor/txtsvc/src/nsTextServicesDocument.cpp index d7b48621e7ad..e2587207f457 100644 --- a/editor/txtsvc/src/nsTextServicesDocument.cpp +++ b/editor/txtsvc/src/nsTextServicesDocument.cpp @@ -1809,8 +1809,8 @@ nsTextServicesDocument::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult) LOCK_DOC(this); - PRInt32 nodeIndex, tcount; - PRBool hasEntry; + PRInt32 nodeIndex = 0; + PRBool hasEntry = PR_FALSE; OffsetEntry *entry; nsresult result = NodeHasOffsetEntry(&mOffsetTable, aChild, &hasEntry, &nodeIndex); @@ -1844,7 +1844,7 @@ nsTextServicesDocument::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult) NS_ERROR("DeleteNode called for current iterator node."); } - tcount = mOffsetTable.Length(); + PRInt32 tcount = mOffsetTable.Length(); while (nodeIndex < tcount) { @@ -1924,8 +1924,10 @@ nsTextServicesDocument::DidJoinNodes(nsIDOMNode *aLeftNode, // Note: The editor merges the contents of the left node into the // contents of the right. - PRInt32 leftIndex, rightIndex; - PRBool leftHasEntry, rightHasEntry; + PRInt32 leftIndex = 0; + PRInt32 rightIndex = 0; + PRBool leftHasEntry = PR_FALSE; + PRBool rightHasEntry = PR_FALSE; result = NodeHasOffsetEntry(&mOffsetTable, aLeftNode, &leftHasEntry, &leftIndex); @@ -3846,8 +3848,8 @@ nsTextServicesDocument::FindWordBounds(nsTArray *aOffsetTable, if (aWordEndOffset) *aWordEndOffset = 0; - PRInt32 entryIndex; - PRBool hasEntry; + PRInt32 entryIndex = 0; + PRBool hasEntry = PR_FALSE; // It's assumed that aNode is a text node. The first thing // we do is get it's index in the offset table so we can