Bug 777292 - Annotate some incorrect conversions to nsresult; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-07-27 17:03:25 +03:00
parent b6511c4a18
commit 96fc9d649c
6 changed files with 21 additions and 8 deletions

View File

@ -1051,7 +1051,8 @@ _elementName::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const \
NS_IMETHODIMP \
_class::Get##_method(nsAString& aValue) \
{ \
return GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
/* XXX Invalid cast of bool to nsresult (bug 778104) */ \
return (nsresult)GetAttr(kNameSpaceID_None, nsGkAtoms::_atom, aValue); \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAString& aValue) \

View File

@ -1623,7 +1623,10 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
else {
// Page is for a stream we don't know about (possibly a chained
// ogg), return an error.
return PAGE_SYNC_ERROR;
//
// XXX Invalid cast of PageSyncResult to nsresult -- this has numeric
// value 1 and will pass an NS_SUCCEEDED() check (bug 778105)
return (nsresult)PAGE_SYNC_ERROR;
}
}

View File

@ -86,7 +86,9 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose)
{
m_closeProgress = true;
return OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, forceClose);
// XXX Invalid cast of bool to nsresult (bug 778106)
return OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP,
(nsresult)forceClose);
}
/* nsIPrompt GetPrompter (); */

View File

@ -267,7 +267,8 @@ inDOMUtils::SetContentState(nsIDOMElement *aElement, nsEventStates::InternalType
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);
return esm->SetContentState(content, nsEventStates(aState));
// XXX Invalid cast of bool to nsresult (bug 778108)
return (nsresult)esm->SetContentState(content, nsEventStates(aState));
}
return NS_ERROR_FAILURE;

View File

@ -1097,7 +1097,9 @@ nsresult
nsFtpState::S_list() {
nsresult rv = SetContentType();
if (NS_FAILED(rv))
return FTP_ERROR;
// XXX Invalid cast of FTP_STATE to nsresult -- FTP_ERROR has
// value < 0x80000000 and will pass NS_SUCCEEDED() (bug 778109)
return (nsresult)FTP_ERROR;
rv = mChannel->PushStreamConverter("text/ftp-dir",
APPLICATION_HTTP_INDEX_FORMAT);
@ -1287,7 +1289,9 @@ nsFtpState::S_pasv() {
nsITransport *controlSocket = mControlConnection->Transport();
if (!controlSocket)
return FTP_ERROR;
// XXX Invalid cast of FTP_STATE to nsresult -- FTP_ERROR has
// value < 0x80000000 and will pass NS_SUCCEEDED() (bug 778109)
return (nsresult)FTP_ERROR;
nsCOMPtr<nsISocketTransport> sTrans = do_QueryInterface(controlSocket);
if (sTrans) {

View File

@ -43,11 +43,13 @@ public:
return ReplaceElementAt(value, aIndex) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHOD AppendElement(nsISupports *aElement) {
return InsertElementAt(aElement, mCount)/* ? NS_OK : NS_ERROR_FAILURE*/;
// XXX Invalid cast of bool to nsresult (bug 778110)
return (nsresult)InsertElementAt(aElement, mCount)/* ? NS_OK : NS_ERROR_FAILURE*/;
}
// XXX this is badly named - should be RemoveFirstElement
NS_IMETHOD RemoveElement(nsISupports *aElement) {
return RemoveElement(aElement, 0)/* ? NS_OK : NS_ERROR_FAILURE*/;
// XXX Invalid cast of bool to nsresult (bug 778110)
return (nsresult)RemoveElement(aElement, 0)/* ? NS_OK : NS_ERROR_FAILURE*/;
}
NS_IMETHOD_(bool) MoveElement(PRInt32 aFrom, PRInt32 aTo);
NS_IMETHOD Enumerate(nsIEnumerator* *result);