From b81fb21272fd2ad0a8c6c5664b1e4786494ce51d Mon Sep 17 00:00:00 2001 From: "scc%netscape.com" Date: Tue, 2 Mar 1999 22:27:46 +0000 Subject: [PATCH] fixed for nsCOMPtr: no construction or assignment from raw COM interface pointers --- editor/base/DeleteRangeTxn.cpp | 4 ++-- editor/base/InsertTextTxn.cpp | 4 ++-- editor/base/nsEditor.cpp | 14 +++++++------- editor/base/nsTextEditor.cpp | 12 ++++++------ editor/libeditor/base/DeleteRangeTxn.cpp | 4 ++-- editor/libeditor/base/InsertTextTxn.cpp | 4 ++-- editor/libeditor/base/nsEditor.cpp | 14 +++++++------- rdf/content/src/nsRDFTreeBuilder.cpp | 2 +- rdf/content/src/nsRDFXULBuilder.cpp | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/editor/base/DeleteRangeTxn.cpp b/editor/base/DeleteRangeTxn.cpp index a8b19baa5904..159ac039a541 100644 --- a/editor/base/DeleteRangeTxn.cpp +++ b/editor/base/DeleteRangeTxn.cpp @@ -224,7 +224,7 @@ NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent nsresult result; // see what kind of node we have nsCOMPtr textNode; - textNode = aStartParent; // this uses implicit nsCOMPtr QI + textNode = do_QueryInterface(aStartParent); if (textNode) { // if the node is a text node, then delete text content DeleteTextTxn *txn; @@ -279,7 +279,7 @@ NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent, nsresult result; // see what kind of node we have nsCOMPtr textNode; - textNode = aParent; // this uses implicit nsCOMPtr QI + textNode = do_QueryInterface(aParent); if (textNode) { // if the node is a text node, then delete text content PRUint32 start, numToDelete; diff --git a/editor/base/InsertTextTxn.cpp b/editor/base/InsertTextTxn.cpp index ab7f3d3bb0da..b500c783c099 100644 --- a/editor/base/InsertTextTxn.cpp +++ b/editor/base/InsertTextTxn.cpp @@ -99,7 +99,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti { // if aTransaction isa InsertTextTxn, and if the selection hasn't changed, // then absorb it - nsCOMPtr otherTxn(aTransaction); + nsCOMPtr otherTxn( do_QueryInterface(aTransaction) ); if (otherTxn) { if (PR_TRUE==IsSequentialInsert(otherTxn)) @@ -112,7 +112,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti } else { // the next InsertTextTxn might be inside an aggregate that we have special knowledge of - nsCOMPtr otherTxn(aTransaction); + nsCOMPtr otherTxn( do_QueryInterface(aTransaction) ); if (otherTxn) { nsCOMPtr txnName; diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index 800225ddae3d..3e1ea30170b8 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -880,7 +880,7 @@ NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert, result = NS_ERROR_UNEXPECTED; // XXX: we'll want to deleteRange if the selection isn't just an insertion point // for now, just insert text after the start of the first node - nsCOMPtr range(currentItem); + nsCOMPtr range( do_QueryInterface(currentItem) ); if (range) { nsCOMPtr node; @@ -1116,7 +1116,7 @@ NS_IMETHODIMP nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir, result = enumerator->CurrentItem(¤tItem); if ((NS_SUCCEEDED(result)) && (currentItem)) { - nsCOMPtr range(currentItem); + nsCOMPtr range( do_QueryInterface(currentItem) ); PRBool isCollapsed; range->GetIsCollapsed(&isCollapsed); if (PR_FALSE==isCollapsed) @@ -1482,8 +1482,8 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, if (0<=aOffset) // don't bother unless we're going to move at least one child { // if it's a text node, just shuffle around some text - nsCOMPtr rightNodeAsText(aExistingRightNode); - nsCOMPtr leftNodeAsText(aNewLeftNode); + nsCOMPtr rightNodeAsText( do_QueryInterface(aExistingRightNode) ); + nsCOMPtr leftNodeAsText( do_QueryInterface(aNewLeftNode) ); if (leftNodeAsText && rightNodeAsText) { // fix right node @@ -1540,8 +1540,8 @@ nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep, (nsnull!=aParent)) { // if it's a text node, just shuffle around some text - nsCOMPtr keepNodeAsText(aNodeToKeep); - nsCOMPtr joinNodeAsText(aNodeToJoin); + nsCOMPtr keepNodeAsText( do_QueryInterface(aNodeToKeep) ); + nsCOMPtr joinNodeAsText( do_QueryInterface(aNodeToJoin) ); if (keepNodeAsText && joinNodeAsText) { nsString rightText; @@ -1651,7 +1651,7 @@ NS_IMETHODIMP nsEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayout { if ((nsnull!=aNode)) { // get the content interface - nsCOMPtr nodeAsContent(aNode); + nsCOMPtr nodeAsContent( do_QueryInterface(aNode) ); if (nodeAsContent) { // get the frame from the content interface nsISupports *layoutObject=nsnull; // frames are not ref counted, so don't use an nsCOMPtr diff --git a/editor/base/nsTextEditor.cpp b/editor/base/nsTextEditor.cpp index bc03eebeb45c..e45d8b636ce9 100644 --- a/editor/base/nsTextEditor.cpp +++ b/editor/base/nsTextEditor.cpp @@ -159,7 +159,7 @@ NS_IMETHODIMP nsTextEditor::SetTextProperty(nsIAtom *aProperty) result = enumerator->CurrentItem(¤tItem); if ((NS_SUCCEEDED(result)) && (nsnull!=currentItem)) { - nsCOMPtr range(currentItem); + nsCOMPtr range( do_QueryInterface(currentItem) ); nsCOMPtrcommonParent; result = range->GetCommonParent(getter_AddRefs(commonParent)); if ((NS_SUCCEEDED(result)) && commonParent) @@ -245,7 +245,7 @@ NS_IMETHODIMP nsTextEditor::GetTextProperty(nsIAtom *aProperty, PRBool &aAny, PR result = enumerator->CurrentItem(¤tItem); if ((NS_SUCCEEDED(result)) && currentItem) { - nsCOMPtr range(currentItem); + nsCOMPtr range( do_QueryInterface(currentItem) ); nsCOMPtr iter; result = nsRepository::CreateInstance(kCContentIteratorCID, nsnull, kIContentIteratorIID, @@ -604,7 +604,7 @@ NS_IMETHODIMP nsTextEditor::SetTextPropertiesForNode(nsIDOMNode *aNode, { nsresult result=NS_OK; nsCOMPtrnodeAsChar; - nodeAsChar = aNode; + nodeAsChar = do_QueryInterface(aNode); if (!nodeAsChar) return NS_ERROR_FAILURE; PRUint32 count; @@ -667,7 +667,7 @@ nsTextEditor::SetTextPropertiesForNodesWithSameParent(nsIDOMNode *aStartNode, if (NS_SUCCEEDED(result)) { nsCOMPtrendNodeAsChar; - endNodeAsChar = aEndNode; + endNodeAsChar = do_QueryInterface(aEndNode); if (!endNodeAsChar) return NS_ERROR_FAILURE; PRUint32 count; @@ -765,7 +765,7 @@ nsTextEditor::SetTextPropertiesForNodeWithDifferentParents(nsIDOMRange *aRange, return result; } nsCOMPtrnodeAsChar; - nodeAsChar = aStartNode; + nodeAsChar = do_QueryInterface(aStartNode); if (!nodeAsChar) return NS_ERROR_FAILURE; PRUint32 count; @@ -777,7 +777,7 @@ nsTextEditor::SetTextPropertiesForNodeWithDifferentParents(nsIDOMRange *aRange, if (NS_FAILED(result)) { return result; } - nodeAsChar = aEndNode; + nodeAsChar = do_QueryInterface(aEndNode); if (!nodeAsChar) return NS_ERROR_FAILURE; nodeAsChar->GetLength(&count); diff --git a/editor/libeditor/base/DeleteRangeTxn.cpp b/editor/libeditor/base/DeleteRangeTxn.cpp index a8b19baa5904..159ac039a541 100644 --- a/editor/libeditor/base/DeleteRangeTxn.cpp +++ b/editor/libeditor/base/DeleteRangeTxn.cpp @@ -224,7 +224,7 @@ NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent nsresult result; // see what kind of node we have nsCOMPtr textNode; - textNode = aStartParent; // this uses implicit nsCOMPtr QI + textNode = do_QueryInterface(aStartParent); if (textNode) { // if the node is a text node, then delete text content DeleteTextTxn *txn; @@ -279,7 +279,7 @@ NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent, nsresult result; // see what kind of node we have nsCOMPtr textNode; - textNode = aParent; // this uses implicit nsCOMPtr QI + textNode = do_QueryInterface(aParent); if (textNode) { // if the node is a text node, then delete text content PRUint32 start, numToDelete; diff --git a/editor/libeditor/base/InsertTextTxn.cpp b/editor/libeditor/base/InsertTextTxn.cpp index ab7f3d3bb0da..b500c783c099 100644 --- a/editor/libeditor/base/InsertTextTxn.cpp +++ b/editor/libeditor/base/InsertTextTxn.cpp @@ -99,7 +99,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti { // if aTransaction isa InsertTextTxn, and if the selection hasn't changed, // then absorb it - nsCOMPtr otherTxn(aTransaction); + nsCOMPtr otherTxn( do_QueryInterface(aTransaction) ); if (otherTxn) { if (PR_TRUE==IsSequentialInsert(otherTxn)) @@ -112,7 +112,7 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti } else { // the next InsertTextTxn might be inside an aggregate that we have special knowledge of - nsCOMPtr otherTxn(aTransaction); + nsCOMPtr otherTxn( do_QueryInterface(aTransaction) ); if (otherTxn) { nsCOMPtr txnName; diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 800225ddae3d..3e1ea30170b8 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -880,7 +880,7 @@ NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert, result = NS_ERROR_UNEXPECTED; // XXX: we'll want to deleteRange if the selection isn't just an insertion point // for now, just insert text after the start of the first node - nsCOMPtr range(currentItem); + nsCOMPtr range( do_QueryInterface(currentItem) ); if (range) { nsCOMPtr node; @@ -1116,7 +1116,7 @@ NS_IMETHODIMP nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir, result = enumerator->CurrentItem(¤tItem); if ((NS_SUCCEEDED(result)) && (currentItem)) { - nsCOMPtr range(currentItem); + nsCOMPtr range( do_QueryInterface(currentItem) ); PRBool isCollapsed; range->GetIsCollapsed(&isCollapsed); if (PR_FALSE==isCollapsed) @@ -1482,8 +1482,8 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode, if (0<=aOffset) // don't bother unless we're going to move at least one child { // if it's a text node, just shuffle around some text - nsCOMPtr rightNodeAsText(aExistingRightNode); - nsCOMPtr leftNodeAsText(aNewLeftNode); + nsCOMPtr rightNodeAsText( do_QueryInterface(aExistingRightNode) ); + nsCOMPtr leftNodeAsText( do_QueryInterface(aNewLeftNode) ); if (leftNodeAsText && rightNodeAsText) { // fix right node @@ -1540,8 +1540,8 @@ nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep, (nsnull!=aParent)) { // if it's a text node, just shuffle around some text - nsCOMPtr keepNodeAsText(aNodeToKeep); - nsCOMPtr joinNodeAsText(aNodeToJoin); + nsCOMPtr keepNodeAsText( do_QueryInterface(aNodeToKeep) ); + nsCOMPtr joinNodeAsText( do_QueryInterface(aNodeToJoin) ); if (keepNodeAsText && joinNodeAsText) { nsString rightText; @@ -1651,7 +1651,7 @@ NS_IMETHODIMP nsEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayout { if ((nsnull!=aNode)) { // get the content interface - nsCOMPtr nodeAsContent(aNode); + nsCOMPtr nodeAsContent( do_QueryInterface(aNode) ); if (nodeAsContent) { // get the frame from the content interface nsISupports *layoutObject=nsnull; // frames are not ref counted, so don't use an nsCOMPtr diff --git a/rdf/content/src/nsRDFTreeBuilder.cpp b/rdf/content/src/nsRDFTreeBuilder.cpp index 06e79ee9bd0b..9ab19e0e5db7 100644 --- a/rdf/content/src/nsRDFTreeBuilder.cpp +++ b/rdf/content/src/nsRDFTreeBuilder.cpp @@ -830,7 +830,7 @@ RDFTreeBuilderImpl::OnAssert(nsIRDFResource* aSubject, } for (PRInt32 i = elements->Count() - 1; i >= 0; --i) { - nsCOMPtr element(elements->ElementAt(i)); + nsCOMPtr element( do_QueryInterface(elements->ElementAt(i)) ); // XXX somehow figure out if building XUL kids on this // particular element makes any sense whatsoever. diff --git a/rdf/content/src/nsRDFXULBuilder.cpp b/rdf/content/src/nsRDFXULBuilder.cpp index 3b3cabf86575..c7b59a2bc2a1 100644 --- a/rdf/content/src/nsRDFXULBuilder.cpp +++ b/rdf/content/src/nsRDFXULBuilder.cpp @@ -1412,7 +1412,7 @@ RDFXULBuilderImpl::CreateXULElement(nsIRDFResource* aResource, // Set the document for this XUL element. It must be set now // in order for event handlers to be detected in the subsequent // SetAttribute calls. - nsCOMPtr document(mDocument); + nsCOMPtr document( do_QueryInterface(mDocument) ); element->SetDocument(document, PR_FALSE); // Now iterate through all the properties and add them as