Backed out change to nsISupportsArray::AppendElement() and RemoveElement(); they now return PRBool's like they used to.

This commit is contained in:
waterson%netscape.com 1999-04-14 23:06:22 +00:00
Родитель 3e3ead911f
Коммит 295796c6fd
8 изменённых файлов: 20 добавлений и 16 удалений

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

@ -280,7 +280,7 @@ nsThreadPool::Init(PRUint32 stackSize,
NS_RELEASE(runnable); NS_RELEASE(runnable);
if (NS_FAILED(rv)) goto exit; if (NS_FAILED(rv)) goto exit;
rv = mThreads->AppendElement(thread); rv = mThreads->AppendElement(thread) ? NS_OK : NS_ERROR_FAILURE;
NS_RELEASE(thread); NS_RELEASE(thread);
if (NS_FAILED(rv)) goto exit; if (NS_FAILED(rv)) goto exit;
} }
@ -318,7 +318,8 @@ nsThreadPool::DispatchRequest(nsIRunnable* runnable)
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;
} }
else { else {
rv = mRequests->AppendElement(runnable); // XXX for now AppendElement returns a PRBool
rv = ((PRBool) mRequests->AppendElement(runnable)) ? NS_OK : NS_ERROR_FAILURE;
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
PR_Notify(mRequestMonitor); PR_Notify(mRequestMonitor);
} }

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

@ -2178,7 +2178,7 @@ XULDocumentImpl::AddContentModelBuilder(nsIRDFContentModelBuilder* aBuilder)
return rv; return rv;
} }
return mBuilders->AppendElement(aBuilder); return mBuilders->AppendElement(aBuilder) ? NS_OK : NS_ERROR_FAILURE;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -2178,7 +2178,7 @@ XULDocumentImpl::AddContentModelBuilder(nsIRDFContentModelBuilder* aBuilder)
return rv; return rv;
} }
return mBuilders->AppendElement(aBuilder); return mBuilders->AppendElement(aBuilder) ? NS_OK : NS_ERROR_FAILURE;
} }
NS_IMETHODIMP NS_IMETHODIMP

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

@ -1392,9 +1392,8 @@ void nsDocLoaderImpl::LoadURLComplete(nsIURL* aURL, nsISupports* aBindInfo, PRIn
* If the entry is not found in the list, then it must have been cancelled * If the entry is not found in the list, then it must have been cancelled
* via Stop(...). So ignore just it... * via Stop(...). So ignore just it...
*/ */
nsresult res; rv = m_LoadingDocsList->RemoveElement(aBindInfo);
res = m_LoadingDocsList->RemoveElement(aBindInfo); if (PR_FALSE != rv) {
if (NS_SUCCEEDED(res)) {
nsILoadAttribs* loadAttributes; nsILoadAttribs* loadAttributes;
nsURLLoadType loadType = nsURLLoadNormal; nsURLLoadType loadType = nsURLLoadNormal;

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

@ -1392,9 +1392,8 @@ void nsDocLoaderImpl::LoadURLComplete(nsIURL* aURL, nsISupports* aBindInfo, PRIn
* If the entry is not found in the list, then it must have been cancelled * If the entry is not found in the list, then it must have been cancelled
* via Stop(...). So ignore just it... * via Stop(...). So ignore just it...
*/ */
nsresult res; rv = m_LoadingDocsList->RemoveElement(aBindInfo);
res = m_LoadingDocsList->RemoveElement(aBindInfo); if (PR_FALSE != rv) {
if (NS_SUCCEEDED(res)) {
nsILoadAttribs* loadAttributes; nsILoadAttribs* loadAttributes;
nsURLLoadType loadType = nsURLLoadNormal; nsURLLoadType loadType = nsURLLoadNormal;

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

@ -33,10 +33,12 @@ public:
// nsICollection methods: // nsICollection methods:
NS_IMETHOD_(PRUint32) Count(void) const { return mCount; } NS_IMETHOD_(PRUint32) Count(void) const { return mCount; }
NS_IMETHOD AppendElement(nsISupports *aElement) { NS_IMETHOD AppendElement(nsISupports *aElement) {
return InsertElementAt(aElement, mCount) ? NS_OK : NS_ERROR_FAILURE; // XXX This incorrectly returns a PRBool instead of an nsresult.
return InsertElementAt(aElement, mCount);
} }
NS_IMETHOD RemoveElement(nsISupports *aElement) { NS_IMETHOD RemoveElement(nsISupports *aElement) {
return RemoveElement(aElement, 0) ? NS_OK : NS_ERROR_FAILURE; // XXX This incorrectly returns a PRBool instead of an nsresult.
return RemoveElement(aElement, 0);
} }
NS_IMETHOD Enumerate(nsIEnumerator* *result); NS_IMETHOD Enumerate(nsIEnumerator* *result);
NS_IMETHOD Clear(void); NS_IMETHOD Clear(void);

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

@ -33,10 +33,12 @@ public:
// nsICollection methods: // nsICollection methods:
NS_IMETHOD_(PRUint32) Count(void) const { return mCount; } NS_IMETHOD_(PRUint32) Count(void) const { return mCount; }
NS_IMETHOD AppendElement(nsISupports *aElement) { NS_IMETHOD AppendElement(nsISupports *aElement) {
return InsertElementAt(aElement, mCount) ? NS_OK : NS_ERROR_FAILURE; // XXX This incorrectly returns a PRBool instead of an nsresult.
return InsertElementAt(aElement, mCount);
} }
NS_IMETHOD RemoveElement(nsISupports *aElement) { NS_IMETHOD RemoveElement(nsISupports *aElement) {
return RemoveElement(aElement, 0) ? NS_OK : NS_ERROR_FAILURE; // XXX This incorrectly returns a PRBool instead of an nsresult.
return RemoveElement(aElement, 0);
} }
NS_IMETHOD Enumerate(nsIEnumerator* *result); NS_IMETHOD Enumerate(nsIEnumerator* *result);
NS_IMETHOD Clear(void); NS_IMETHOD Clear(void);

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

@ -280,7 +280,7 @@ nsThreadPool::Init(PRUint32 stackSize,
NS_RELEASE(runnable); NS_RELEASE(runnable);
if (NS_FAILED(rv)) goto exit; if (NS_FAILED(rv)) goto exit;
rv = mThreads->AppendElement(thread); rv = mThreads->AppendElement(thread) ? NS_OK : NS_ERROR_FAILURE;
NS_RELEASE(thread); NS_RELEASE(thread);
if (NS_FAILED(rv)) goto exit; if (NS_FAILED(rv)) goto exit;
} }
@ -318,7 +318,8 @@ nsThreadPool::DispatchRequest(nsIRunnable* runnable)
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;
} }
else { else {
rv = mRequests->AppendElement(runnable); // XXX for now AppendElement returns a PRBool
rv = ((PRBool) mRequests->AppendElement(runnable)) ? NS_OK : NS_ERROR_FAILURE;
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
PR_Notify(mRequestMonitor); PR_Notify(mRequestMonitor);
} }