diff --git a/editor/base/InsertElementTxn.cpp b/editor/base/InsertElementTxn.cpp index fb6797fbac6..dab2e8fe6e6 100644 --- a/editor/base/InsertElementTxn.cpp +++ b/editor/base/InsertElementTxn.cpp @@ -87,7 +87,7 @@ NS_IMETHODIMP InsertElementTxn::Do(void) { PRUint32 count; childNodes->GetLength(&count); - if (mOffset>count) mOffset = count; + if (mOffset>(PRInt32)count) mOffset = count; result = childNodes->Item(mOffset, getter_AddRefs(refNode)); if (NS_FAILED(result)) return result; // note, it's ok for mRefNode to be null. that means append diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index 8d8aacdfe8b..8c04c90df51 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -899,6 +899,8 @@ nsEditor::nsEditor() , mRangeUpdater() , mShouldTxnSetSelection(PR_TRUE) , mBodyElement(nsnull) +, mAction(nsnull) +, mDirection(eNone) , mInIMEMode(PR_FALSE) , mIMETextRangeList(nsnull) , mIMETextNode(nsnull) @@ -908,8 +910,6 @@ nsEditor::nsEditor() , mEditorObservers(nsnull) , mDocDirtyState(-1) , mDocWeak(nsnull) -, mAction(nsnull) -, mDirection(eNone) { //initialize member variables here NS_INIT_REFCNT(); diff --git a/editor/base/nsEditorShell.cpp b/editor/base/nsEditorShell.cpp index 05668e862ad..d646ed6f089 100644 --- a/editor/base/nsEditorShell.cpp +++ b/editor/base/nsEditorShell.cpp @@ -5175,6 +5175,9 @@ nsEditorShell::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* aChanne case eCantEditOther: stringID.AssignWithConversion("CantEditDocumentMsg"); break; + default: + // Do nothing. + break; } GetBundleString(stringID, alertMessage); diff --git a/editor/base/nsHTMLEditRules.cpp b/editor/base/nsHTMLEditRules.cpp index 25df258e820..c05da48e797 100644 --- a/editor/base/nsHTMLEditRules.cpp +++ b/editor/base/nsHTMLEditRules.cpp @@ -621,7 +621,7 @@ nsHTMLEditRules::GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign) { nsAutoString typeAttrName; typeAttrName.AssignWithConversion("align"); nsAutoString typeAttrVal; - nsresult res = elem->GetAttribute(typeAttrName, typeAttrVal); + res = elem->GetAttribute(typeAttrName, typeAttrVal); typeAttrVal.ToLowerCase(); if (NS_SUCCEEDED(res) && typeAttrVal.Length()) { @@ -705,7 +705,7 @@ nsHTMLEditRules::GetParagraphState(PRBool &aMixed, nsString &outFormat) nsCOMPtr selNode; PRInt32 selOffset; nsCOMPtrselection; - nsresult res = mEditor->GetSelection(getter_AddRefs(selection)); + res = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_FAILED(res)) return res; res = mEditor->GetStartNodeAndOffset(selection, &selNode, &selOffset); if (NS_FAILED(res)) return res; @@ -1108,8 +1108,6 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo // its something else (body, div, td, ...): insert a normal br else { - nsCOMPtr selection(aSelection); - nsCOMPtr selPriv(do_QueryInterface(selection)); nsCOMPtr brNode; res = mEditor->CreateBR(node, offset, &brNode); if (NS_FAILED(res)) return res; @@ -3445,7 +3443,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, res = item->GetRange(&opRange); if (NS_FAILED(res)) return res; delete item; - nsCOMPtr isupports = do_QueryInterface(opRange); + isupports = do_QueryInterface(opRange); inArrayOfRanges->AppendElement(isupports); } } @@ -3472,7 +3470,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, (*outArrayOfNodes)->Count(&listCount); for (i=(PRInt32)listCount-1; i>=0; i--) { - nsCOMPtr isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); + isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); nsCOMPtr node( do_QueryInterface(isupports) ); if ( (nsHTMLEditUtils::IsTableElement(node) && !nsHTMLEditUtils::IsTable(node)) || (nsHTMLEditUtils::IsListItem(node))) @@ -3492,7 +3490,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, (*outArrayOfNodes)->Count(&listCount); for (i=(PRInt32)listCount-1; i>=0; i--) { - nsCOMPtr isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); + isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); nsCOMPtr node( do_QueryInterface(isupports) ); if ( (nsHTMLEditUtils::IsTableElement(node) && !nsHTMLEditUtils::IsTable(node)) ) { @@ -3516,7 +3514,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, (*outArrayOfNodes)->Count(&listCount); for (i=(PRInt32)listCount-1; i>=0; i--) { - nsCOMPtr isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); + isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); nsCOMPtr node( do_QueryInterface(isupports) ); if (!aDontTouchContent && mEditor->IsInlineNode(node) && mEditor->IsContainer(node) && !mEditor->IsTextNode(node)) @@ -4324,12 +4322,12 @@ nsHTMLEditRules::MakeBlockquote(nsISupportsArray *arrayOfNodes) // further nodes in a new parent if (prevParent) { - nsCOMPtr curParent; - curNode->GetParentNode(getter_AddRefs(curParent)); - if (curParent != prevParent) + nsCOMPtr temp; + curNode->GetParentNode(getter_AddRefs(temp)); + if (temp != prevParent) { curBlock = 0; // forget any previous blockquote node we were using - prevParent = curParent; + prevParent = temp; } } else diff --git a/editor/base/nsHTMLEditor.cpp b/editor/base/nsHTMLEditor.cpp index da87fa5ad20..93424724448 100644 --- a/editor/base/nsHTMLEditor.cpp +++ b/editor/base/nsHTMLEditor.cpp @@ -6190,7 +6190,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToString(nsAWritableString& aOutputString, nsCOMPtr encoder; nsCAutoString formatType(NS_DOC_ENCODER_CONTRACTID_BASE); formatType.AppendWithConversion(aFormatType); - rv = nsComponentManager::CreateInstance(formatType, + rv = nsComponentManager::CreateInstance((char*)formatType, nsnull, NS_GET_IID(nsIDocumentEncoder), getter_AddRefs(encoder)); diff --git a/editor/composer/src/nsEditorShell.cpp b/editor/composer/src/nsEditorShell.cpp index 05668e862ad..d646ed6f089 100644 --- a/editor/composer/src/nsEditorShell.cpp +++ b/editor/composer/src/nsEditorShell.cpp @@ -5175,6 +5175,9 @@ nsEditorShell::OnEndDocumentLoad(nsIDocumentLoader* aLoader, nsIChannel* aChanne case eCantEditOther: stringID.AssignWithConversion("CantEditDocumentMsg"); break; + default: + // Do nothing. + break; } GetBundleString(stringID, alertMessage); diff --git a/editor/libeditor/base/InsertElementTxn.cpp b/editor/libeditor/base/InsertElementTxn.cpp index fb6797fbac6..dab2e8fe6e6 100644 --- a/editor/libeditor/base/InsertElementTxn.cpp +++ b/editor/libeditor/base/InsertElementTxn.cpp @@ -87,7 +87,7 @@ NS_IMETHODIMP InsertElementTxn::Do(void) { PRUint32 count; childNodes->GetLength(&count); - if (mOffset>count) mOffset = count; + if (mOffset>(PRInt32)count) mOffset = count; result = childNodes->Item(mOffset, getter_AddRefs(refNode)); if (NS_FAILED(result)) return result; // note, it's ok for mRefNode to be null. that means append diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 8d8aacdfe8b..8c04c90df51 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -899,6 +899,8 @@ nsEditor::nsEditor() , mRangeUpdater() , mShouldTxnSetSelection(PR_TRUE) , mBodyElement(nsnull) +, mAction(nsnull) +, mDirection(eNone) , mInIMEMode(PR_FALSE) , mIMETextRangeList(nsnull) , mIMETextNode(nsnull) @@ -908,8 +910,6 @@ nsEditor::nsEditor() , mEditorObservers(nsnull) , mDocDirtyState(-1) , mDocWeak(nsnull) -, mAction(nsnull) -, mDirection(eNone) { //initialize member variables here NS_INIT_REFCNT(); diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 25df258e820..c05da48e797 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -621,7 +621,7 @@ nsHTMLEditRules::GetAlignment(PRBool &aMixed, nsIHTMLEditor::EAlignment &aAlign) { nsAutoString typeAttrName; typeAttrName.AssignWithConversion("align"); nsAutoString typeAttrVal; - nsresult res = elem->GetAttribute(typeAttrName, typeAttrVal); + res = elem->GetAttribute(typeAttrName, typeAttrVal); typeAttrVal.ToLowerCase(); if (NS_SUCCEEDED(res) && typeAttrVal.Length()) { @@ -705,7 +705,7 @@ nsHTMLEditRules::GetParagraphState(PRBool &aMixed, nsString &outFormat) nsCOMPtr selNode; PRInt32 selOffset; nsCOMPtrselection; - nsresult res = mEditor->GetSelection(getter_AddRefs(selection)); + res = mEditor->GetSelection(getter_AddRefs(selection)); if (NS_FAILED(res)) return res; res = mEditor->GetStartNodeAndOffset(selection, &selNode, &selOffset); if (NS_FAILED(res)) return res; @@ -1108,8 +1108,6 @@ nsHTMLEditRules::WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBo // its something else (body, div, td, ...): insert a normal br else { - nsCOMPtr selection(aSelection); - nsCOMPtr selPriv(do_QueryInterface(selection)); nsCOMPtr brNode; res = mEditor->CreateBR(node, offset, &brNode); if (NS_FAILED(res)) return res; @@ -3445,7 +3443,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, res = item->GetRange(&opRange); if (NS_FAILED(res)) return res; delete item; - nsCOMPtr isupports = do_QueryInterface(opRange); + isupports = do_QueryInterface(opRange); inArrayOfRanges->AppendElement(isupports); } } @@ -3472,7 +3470,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, (*outArrayOfNodes)->Count(&listCount); for (i=(PRInt32)listCount-1; i>=0; i--) { - nsCOMPtr isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); + isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); nsCOMPtr node( do_QueryInterface(isupports) ); if ( (nsHTMLEditUtils::IsTableElement(node) && !nsHTMLEditUtils::IsTable(node)) || (nsHTMLEditUtils::IsListItem(node))) @@ -3492,7 +3490,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, (*outArrayOfNodes)->Count(&listCount); for (i=(PRInt32)listCount-1; i>=0; i--) { - nsCOMPtr isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); + isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); nsCOMPtr node( do_QueryInterface(isupports) ); if ( (nsHTMLEditUtils::IsTableElement(node) && !nsHTMLEditUtils::IsTable(node)) ) { @@ -3516,7 +3514,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges, (*outArrayOfNodes)->Count(&listCount); for (i=(PRInt32)listCount-1; i>=0; i--) { - nsCOMPtr isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); + isupports = (dont_AddRef)((*outArrayOfNodes)->ElementAt(i)); nsCOMPtr node( do_QueryInterface(isupports) ); if (!aDontTouchContent && mEditor->IsInlineNode(node) && mEditor->IsContainer(node) && !mEditor->IsTextNode(node)) @@ -4324,12 +4322,12 @@ nsHTMLEditRules::MakeBlockquote(nsISupportsArray *arrayOfNodes) // further nodes in a new parent if (prevParent) { - nsCOMPtr curParent; - curNode->GetParentNode(getter_AddRefs(curParent)); - if (curParent != prevParent) + nsCOMPtr temp; + curNode->GetParentNode(getter_AddRefs(temp)); + if (temp != prevParent) { curBlock = 0; // forget any previous blockquote node we were using - prevParent = curParent; + prevParent = temp; } } else diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index da87fa5ad20..93424724448 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -6190,7 +6190,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToString(nsAWritableString& aOutputString, nsCOMPtr encoder; nsCAutoString formatType(NS_DOC_ENCODER_CONTRACTID_BASE); formatType.AppendWithConversion(aFormatType); - rv = nsComponentManager::CreateInstance(formatType, + rv = nsComponentManager::CreateInstance((char*)formatType, nsnull, NS_GET_IID(nsIDocumentEncoder), getter_AddRefs(encoder));