part of mailnews audit --> use nsCOMPtr.

part of mailnews audit --> Conversion to NS_WITH_SERVICE
This commit is contained in:
mscott%netscape.com 1999-05-04 22:51:14 +00:00
Родитель eb0f186f49
Коммит 56ff61c011
2 изменённых файлов: 13 добавлений и 29 удалений

Просмотреть файл

@ -113,8 +113,6 @@ nsMailboxUrl::nsMailboxUrl(nsISupports* aContainer, nsIURLGroup* aGroup)
NS_INIT_REFCNT();
// nsIMailboxUrl specific code...
m_mailboxParser = nsnull;
m_mailboxCopyHandler = nsnull;
m_errorMessage = nsnull;
// nsINetLibUrl specific state
@ -136,22 +134,18 @@ nsMailboxUrl::nsMailboxUrl(nsISupports* aContainer, nsIURLGroup* aGroup)
m_runningUrl = PR_FALSE;
m_urlListeners = nsnull;
nsComponentManager::CreateInstance(kUrlListenerManagerCID, nsnull, nsIUrlListenerManager::GetIID(), (void **) &m_urlListeners);
nsComponentManager::CreateInstance(kUrlListenerManagerCID, nsnull, nsIUrlListenerManager::GetIID(), (void **) getter_AddRefs(m_urlListeners));
m_container = aContainer;
NS_IF_ADDREF(m_container);
}
nsMailboxUrl::~nsMailboxUrl()
{
NS_IF_RELEASE(m_mailboxParser);
NS_IF_RELEASE(m_mailboxCopyHandler);
NS_IF_RELEASE(m_urlListeners);
NS_IF_RELEASE(m_container);
PR_FREEIF(m_errorMessage);
if (m_filePath) {
if (m_filePath)
{
delete m_filePath;
m_filePath = nsnull;
}
@ -163,10 +157,6 @@ nsMailboxUrl::~nsMailboxUrl()
PR_FREEIF(m_file);
PR_FREEIF(m_ref);
PR_FREEIF(m_search);
if (nsnull != m_URL_s)
{
// NET_DropURLStruct(m_URL_s);
}
}
NS_IMPL_THREADSAFE_ADDREF(nsMailboxUrl);
@ -230,11 +220,7 @@ nsresult nsMailboxUrl::SetMailboxParser(nsIStreamListener * aMailboxParser)
{
NS_LOCK_INSTANCE();
if (aMailboxParser)
{
NS_IF_RELEASE(m_mailboxParser);
NS_ADDREF(aMailboxParser);
m_mailboxParser = aMailboxParser;
}
m_mailboxParser = dont_QueryInterface(aMailboxParser);
NS_UNLOCK_INSTANCE();
return NS_OK;
}
@ -244,8 +230,8 @@ nsresult nsMailboxUrl::GetMailboxParser(nsIStreamListener ** aConsumer)
NS_LOCK_INSTANCE();
if (aConsumer)
{
NS_IF_ADDREF(m_mailboxParser);
*aConsumer = m_mailboxParser;
NS_IF_ADDREF(*aConsumer);
}
NS_UNLOCK_INSTANCE();
return NS_OK;
@ -255,11 +241,7 @@ nsresult nsMailboxUrl::SetMailboxCopyHandler(nsIStreamListener * aMailboxCopyHan
{
NS_LOCK_INSTANCE();
if (aMailboxCopyHandler)
{
NS_IF_RELEASE(m_mailboxCopyHandler);
NS_ADDREF(aMailboxCopyHandler);
m_mailboxCopyHandler = aMailboxCopyHandler;
}
m_mailboxCopyHandler = dont_QueryInterface(aMailboxCopyHandler);
NS_UNLOCK_INSTANCE();
return NS_OK;
}
@ -269,8 +251,8 @@ nsresult nsMailboxUrl::GetMailboxCopyHandler(nsIStreamListener ** aMailboxCopyHa
NS_LOCK_INSTANCE();
if (aMailboxCopyHandler)
{
NS_IF_ADDREF(m_mailboxCopyHandler);
*aMailboxCopyHandler = m_mailboxCopyHandler;
NS_IF_ADDREF(*aMailboxCopyHandler);
}
NS_UNLOCK_INSTANCE();
return NS_OK;
@ -485,7 +467,8 @@ nsresult nsMailboxUrl::ParseURL(const nsString& aSpec, const nsIURL* aURL)
const char* uHost = nsnull;
const char* uFile = nsnull;
PRUint32 uPort;
if (nsnull != aURL) {
if (nsnull != aURL)
{
nsresult rslt = aURL->GetProtocol(&uProtocol);
if (rslt != NS_OK) return rslt;
rslt = aURL->GetHost(&uHost);

Просмотреть файл

@ -23,6 +23,7 @@
#include "nsIUrlListenerManager.h"
#include "nsINetlibURL.h" /* this should be temporary until Network N2 project lands */
#include "nsFileSpec.h"
#include "nsCOMPtr.h"
class nsMailboxUrl : public nsIMailboxUrl, public nsINetlibURL, public nsIMsgUriUrl
{
@ -99,11 +100,11 @@ public:
protected:
// mailboxurl specific state
nsIStreamListener *m_mailboxParser;
nsIStreamListener *m_mailboxCopyHandler;
nsCOMPtr<nsIStreamListener> m_mailboxParser;
nsCOMPtr<nsIStreamListener> m_mailboxCopyHandler;
// manager of all of current url listeners....
nsIUrlListenerManager * m_urlListeners;
nsCOMPtr<nsIUrlListenerManager> m_urlListeners;
/* Here's our link to the old netlib world.... */
URL_Struct *m_URL_s;