From 6860a0a739ad6cfc15838dcbf126b0d9cc0bbce1 Mon Sep 17 00:00:00 2001 From: "scc%mozilla.org" Date: Thu, 3 May 2001 10:09:59 +0000 Subject: [PATCH] bug #75504; sr=jband. simple fixes correcting where people inappropriately applied |getter_AddRefs| --- accessible/src/base/nsGenericAccessible.cpp | 2 +- accessible/src/base/nsGenericAccessible.h | 2 +- accessible/src/nsGenericAccessible.cpp | 2 +- accessible/src/nsGenericAccessible.h | 2 +- content/xul/document/src/nsXULControllers.cpp | 2 +- docshell/base/nsDocShell.cpp | 2 +- docshell/base/nsWebShell.cpp | 2 +- dom/src/base/nsGlobalWindow.cpp | 2 +- mailnews/absync/src/nsAbSync.cpp | 2 +- mailnews/addrbook/src/nsAbMDBDirectory.cpp | 9 +++------ mailnews/addrbook/src/nsAddbookProtocolHandler.cpp | 2 +- netwerk/base/public/nsNetUtil.h | 4 ++-- xpfe/components/shistory/src/nsSHistory.cpp | 2 +- xpinstall/src/nsInstall.cpp | 2 +- xpinstall/src/nsInstallPatch.cpp | 4 ++-- 15 files changed, 19 insertions(+), 22 deletions(-) diff --git a/accessible/src/base/nsGenericAccessible.cpp b/accessible/src/base/nsGenericAccessible.cpp index a1d778870d53..c7ec8763d939 100644 --- a/accessible/src/base/nsGenericAccessible.cpp +++ b/accessible/src/base/nsGenericAccessible.cpp @@ -221,7 +221,7 @@ NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval) nsDOMAccessible::nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode) { - mPresShell = getter_AddRefs(NS_GetWeakReference(aShell)); + mPresShell = do_GetWeakReference(aShell); mNode = aNode; } diff --git a/accessible/src/base/nsGenericAccessible.h b/accessible/src/base/nsGenericAccessible.h index ac247f4860a9..acd9f60971ed 100644 --- a/accessible/src/base/nsGenericAccessible.h +++ b/accessible/src/base/nsGenericAccessible.h @@ -64,7 +64,7 @@ class nsDOMAccessible : public nsGenericAccessible NS_IMETHOD AccRemoveSelection(void); protected: - nsIWeakReference* mPresShell; + nsCOMPtr mPresShell; nsCOMPtr mNode; }; diff --git a/accessible/src/nsGenericAccessible.cpp b/accessible/src/nsGenericAccessible.cpp index a1d778870d53..c7ec8763d939 100644 --- a/accessible/src/nsGenericAccessible.cpp +++ b/accessible/src/nsGenericAccessible.cpp @@ -221,7 +221,7 @@ NS_IMETHODIMP nsGenericAccessible::GetAccExtState(PRUint32 *_retval) nsDOMAccessible::nsDOMAccessible(nsIPresShell* aShell, nsIDOMNode* aNode) { - mPresShell = getter_AddRefs(NS_GetWeakReference(aShell)); + mPresShell = do_GetWeakReference(aShell); mNode = aNode; } diff --git a/accessible/src/nsGenericAccessible.h b/accessible/src/nsGenericAccessible.h index ac247f4860a9..acd9f60971ed 100644 --- a/accessible/src/nsGenericAccessible.h +++ b/accessible/src/nsGenericAccessible.h @@ -64,7 +64,7 @@ class nsDOMAccessible : public nsGenericAccessible NS_IMETHOD AccRemoveSelection(void); protected: - nsIWeakReference* mPresShell; + nsCOMPtr mPresShell; nsCOMPtr mNode; }; diff --git a/content/xul/document/src/nsXULControllers.cpp b/content/xul/document/src/nsXULControllers.cpp index 6aa075868d5a..5b8aaa7381c4 100644 --- a/content/xul/document/src/nsXULControllers.cpp +++ b/content/xul/document/src/nsXULControllers.cpp @@ -155,7 +155,7 @@ nsXULControllers::RemoveControllerAt(PRUint32 index, nsIController **_retval) PRBool removed = mControllers.RemoveElementAt(index); NS_ASSERTION(removed, "Removal of controller failed"); - controllerData->GetController(getter_AddRefs(_retval)); + controllerData->GetController(_retval); delete controllerData; return NS_OK; diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 65a252f37c5c..d053deb32f71 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -4740,7 +4740,7 @@ nsDocShell::GetPromptAndStringBundle(nsIPrompt ** aPrompt, NS_ENSURE_SUCCESS(stringBundleService-> CreateBundle(DIALOG_STRING_URI, - getter_AddRefs(aStringBundle)), + aStringBundle), NS_ERROR_FAILURE); return NS_OK; diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 51a3424f3cbe..fad7b6b1492f 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -1244,7 +1244,7 @@ nsWebShell::GetControllerForCommand ( const nsAReadableString & inCommand, nsICo nsCOMPtr focusController; rv = window->GetRootFocusController ( getter_AddRefs(focusController) ); if ( focusController ) - rv = focusController->GetControllerForCommand ( inCommand, getter_AddRefs(outController) ); + rv = focusController->GetControllerForCommand ( inCommand, outController ); } // if window return rv; diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 33c2b561d3dc..d64a47388fa8 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -2881,7 +2881,7 @@ GlobalWindowImpl::GetRootFocusController(nsIFocusController** aController) if (chromeHandler) { nsCOMPtr windowRoot(do_QueryInterface(chromeHandler)); if (windowRoot) { - windowRoot->GetFocusController(getter_AddRefs(aController)); + windowRoot->GetFocusController(aController); } } } diff --git a/mailnews/absync/src/nsAbSync.cpp b/mailnews/absync/src/nsAbSync.cpp index 2b1b6c09b146..9ede6c9c5a3b 100644 --- a/mailnews/absync/src/nsAbSync.cpp +++ b/mailnews/absync/src/nsAbSync.cpp @@ -726,7 +726,7 @@ nsAbSync::OpenAB(char *aAbName, nsIAddrDatabase **aDatabase) NS_WITH_SERVICE(nsIAddrDatabase, addrDBFactory, kAddressBookDBCID, &rv); if (NS_SUCCEEDED(rv) && addrDBFactory) - rv = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(aDatabase), PR_TRUE); + rv = addrDBFactory->Open(dbPath, PR_TRUE, aDatabase, PR_TRUE); } else rv = NS_ERROR_FAILURE; diff --git a/mailnews/addrbook/src/nsAbMDBDirectory.cpp b/mailnews/addrbook/src/nsAbMDBDirectory.cpp index bf8e8c704b48..07d83c4cc1a2 100644 --- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp +++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp @@ -629,8 +629,7 @@ NS_IMETHODIMP nsAbMDBDirectory::AddMailList(nsIAbDirectory *list) { nsAbMDBDirProperty* dblistproperty = new nsAbMDBDirProperty (); NS_ADDREF(dblistproperty); - nsCOMPtr newlist; - newlist = getter_AddRefs(dblistproperty); + nsCOMPtr newlist = getter_AddRefs(NS_STATIC_CAST(nsIAbDirectory*, dblistproperty)); newlist->CopyMailList(list); list = newlist; dblist = do_QueryInterface(list); @@ -675,8 +674,7 @@ NS_IMETHODIMP nsAbMDBDirectory::AddCard(nsIAbCard* card, nsIAbCard **_retval) { nsAbMDBCardProperty* dbcardproperty = new nsAbMDBCardProperty (); NS_ADDREF(dbcardproperty); - nsCOMPtr newcard; - newcard = getter_AddRefs(dbcardproperty); + nsCOMPtr newcard = getter_AddRefs(NS_STATIC_CAST(nsIAbCard*, dbcardproperty)); newcard->Copy (card); card = newcard; dbcard = do_QueryInterface(card); @@ -735,8 +733,7 @@ NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* card, nsIAbCard **_retval) { nsAbMDBCardProperty* dbcardproperty = new nsAbMDBCardProperty (); NS_ADDREF(dbcardproperty); - nsCOMPtr newcard; - newcard = getter_AddRefs (dbcardproperty); + nsCOMPtr newcard = getter_AddRefs (NS_STATIC_CAST(nsIAbCard*, dbcardproperty)); newcard->Copy (card); card = newcard; dbcard = do_QueryInterface (card); diff --git a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp index a30845f03bbc..925101aaf51e 100644 --- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp +++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp @@ -261,7 +261,7 @@ nsAddbookProtocolHandler::OpenAB(char *aAbName, nsIAddrDatabase **aDatabase) NS_WITH_SERVICE(nsIAddrDatabase, addrDBFactory, kAddressBookDBCID, &rv); if (NS_SUCCEEDED(rv) && addrDBFactory) - rv = addrDBFactory->Open(dbPath, PR_TRUE, getter_AddRefs(aDatabase), PR_TRUE); + rv = addrDBFactory->Open(dbPath, PR_TRUE, aDatabase, PR_TRUE); delete dbPath; } diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h index 27d3c586a2ec..1e63a6f79e44 100644 --- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -589,7 +589,7 @@ NS_AsyncWriteFromStream(nsIRequest **aRequest, aOffset, aCount, aFlags, - getter_AddRefs(aRequest)); + aRequest); } // @@ -619,7 +619,7 @@ NS_AsyncReadToStream(nsIRequest **aRequest, aOffset, aCount, aFlags, - getter_AddRefs(aRequest)); + aRequest); } #endif // nsNetUtil_h__ diff --git a/xpfe/components/shistory/src/nsSHistory.cpp b/xpfe/components/shistory/src/nsSHistory.cpp index 1574c76193f3..bb3162836169 100644 --- a/xpfe/components/shistory/src/nsSHistory.cpp +++ b/xpfe/components/shistory/src/nsSHistory.cpp @@ -176,7 +176,7 @@ nsSHistory::GetEntryAtIndex(PRInt32 aIndex, PRBool aModifyIndex, nsISHEntry** aR rv = GetTransactionAtIndex(aIndex, getter_AddRefs(txn)); if (NS_SUCCEEDED(rv) && txn) { //Get the Entry from the transaction - rv = txn->GetSHEntry(getter_AddRefs(aResult)); + rv = txn->GetSHEntry(aResult); if (NS_SUCCEEDED(rv) && (*aResult)) { // Set mIndex to the requested index, if asked to do so.. if (aModifyIndex) { diff --git a/xpinstall/src/nsInstall.cpp b/xpinstall/src/nsInstall.cpp index 68c3923b4adb..e73df025e698 100644 --- a/xpinstall/src/nsInstall.cpp +++ b/xpinstall/src/nsInstall.cpp @@ -2660,7 +2660,7 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsIFile* aSuggestedName, } #endif - extractHereSpec->Clone(getter_AddRefs(aRealName)); + extractHereSpec->Clone(aRealName); return nsInstall::SUCCESS; } diff --git a/xpinstall/src/nsInstallPatch.cpp b/xpinstall/src/nsInstallPatch.cpp index b44d847f5397..c0a2fc56b48b 100644 --- a/xpinstall/src/nsInstallPatch.cpp +++ b/xpinstall/src/nsInstallPatch.cpp @@ -553,7 +553,7 @@ nsInstallPatch::NativePatch(nsIFile *sourceFile, nsIFile *patchFile, nsIFile **n if (status == GDIFF_ERR_CHECKSUM) status = GDIFF_ERR_CHECKSUM_RESULT; - rv = outFileSpec->Clone(getter_AddRefs(newFile)); + rv = outFileSpec->Clone(newFile); } else { @@ -616,7 +616,7 @@ nsInstallPatch::NativePatch(nsIFile *sourceFile, nsIFile *patchFile, nsIFile **n anotherName->GetLeafName(&leaf); anotherName->CopyTo(parent, leaf); - anotherName->Clone(getter_AddRefs(newFile)); + anotherName->Clone(newFile); }