Bug 605177 - Fix a number of build warnings in editor/; r=ehsan a=bsmedberg

This commit is contained in:
Ms2ger 2010-11-04 16:44:46 -04:00
parent bd375e6b4e
commit 83a3dc5087
10 changed files with 32 additions and 21 deletions

View File

@ -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<nsIEditor> editor;

View File

@ -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

View File

@ -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;

View File

@ -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<nsIDOMCharacterData> textNode = do_QueryInterface(aStartParent);
if (textNode)

View File

@ -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

View File

@ -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);
}

View File

@ -5822,7 +5822,7 @@ nsHTMLEditRules::GetNodesForOperation(nsCOMArray<nsIDOMRange>& 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;

View File

@ -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);

View File

@ -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)
{

View File

@ -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<OffsetEntry*> *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