Bugzilla Bug 110080 change !NS_SUCCEEDED(status) to NS_FAILED(status)

s/!NS_SUCCEEDED/NS_FAILED/g;s/!NS_FAILED/NS_SUCCEEDED/g;
r=dougt sr=hewitt
This commit is contained in:
timeless%mac.com 2001-11-19 06:45:00 +00:00
Родитель 93e80f739b
Коммит dfa8594725
84 изменённых файлов: 181 добавлений и 397 удалений

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

@ -4233,17 +4233,17 @@ nsSelection::DeleteFromDocument()
// Get an iterator // Get an iterator
nsSelectionIterator iter(mDomSelections[index]); nsSelectionIterator iter(mDomSelections[index]);
res = iter.First(); res = iter.First();
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
nsCOMPtr<nsIDOMRange> range; nsCOMPtr<nsIDOMRange> range;
while (iter.IsDone()) while (iter.IsDone())
{ {
res = iter.CurrentItem(NS_STATIC_CAST(nsIDOMRange**, getter_AddRefs(range))); res = iter.CurrentItem(NS_STATIC_CAST(nsIDOMRange**, getter_AddRefs(range)));
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
res = range->DeleteContents(); res = range->DeleteContents();
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
iter.Next(); iter.Next();
} }
@ -5670,7 +5670,7 @@ nsTypedSelection::GetEnumerator(nsIEnumerator **aIterator)
{ {
nsresult status = NS_ERROR_OUT_OF_MEMORY; nsresult status = NS_ERROR_OUT_OF_MEMORY;
nsSelectionIterator *iterator = new nsSelectionIterator(this); nsSelectionIterator *iterator = new nsSelectionIterator(this);
if ( iterator && !NS_SUCCEEDED(status = CallQueryInterface(iterator, aIterator)) ) if ( iterator && NS_FAILED(status = CallQueryInterface(iterator, aIterator)) )
delete iterator; delete iterator;
return status; return status;
} }

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

@ -260,7 +260,7 @@ nsFormSubmitter::OnSubmit(nsIForm* form,
if (href.IsEmpty()) { if (href.IsEmpty()) {
nsCOMPtr<nsIHTMLDocument> htmlDoc; nsCOMPtr<nsIHTMLDocument> htmlDoc;
if (!NS_SUCCEEDED(document->QueryInterface(NS_GET_IID(nsIHTMLDocument), if (NS_FAILED(document->QueryInterface(NS_GET_IID(nsIHTMLDocument),
getter_AddRefs(htmlDoc)))) { getter_AddRefs(htmlDoc)))) {
// Must be a XML, XUL or other non-HTML document type // Must be a XML, XUL or other non-HTML document type
// so do nothing. // so do nothing.

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

@ -1969,7 +1969,7 @@ nsHTMLSelectElement::InitializeOption(nsIDOMHTMLOptionElement * aOption,
{ {
PRBool selected; PRBool selected;
nsresult rv = aOption->GetDefaultSelected(&selected); nsresult rv = aOption->GetDefaultSelected(&selected);
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
selected = PR_FALSE; selected = PR_FALSE;
} }
SetOptionSelected(aOption, selected); SetOptionSelected(aOption, selected);

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

@ -531,7 +531,7 @@ nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
// callback which should happen on another thread) // callback which should happen on another thread)
// //
rv = operation->GetMessageListener(getter_AddRefs(listener)); rv = operation->GetMessageListener(getter_AddRefs(listener));
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
NS_ERROR("nsLDAPConnection::InvokeMessageCallback(): probable " NS_ERROR("nsLDAPConnection::InvokeMessageCallback(): probable "
"memory corruption: GetMessageListener() returned error"); "memory corruption: GetMessageListener() returned error");
delete key; delete key;
@ -547,7 +547,7 @@ nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
// //
if (aRemoveOpFromConnQ) { if (aRemoveOpFromConnQ) {
rv = mPendingOperations->Remove(key); rv = mPendingOperations->Remove(key);
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
NS_ERROR("nsLDAPConnection::InvokeMessageCallback: unable to " NS_ERROR("nsLDAPConnection::InvokeMessageCallback: unable to "
"remove operation from the connection queue\n"); "remove operation from the connection queue\n");
delete key; delete key;

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

@ -5345,7 +5345,7 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, PRUint32 aCloneID,
result = nsComponentManager::CreateInstance(NS_SHENTRY_CONTRACTID, NULL, result = nsComponentManager::CreateInstance(NS_SHENTRY_CONTRACTID, NULL,
NS_GET_IID(nsISHEntry), NS_GET_IID(nsISHEntry),
(void **) &dest); (void **) &dest);
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
srcHE->GetURI(getter_AddRefs(uri)); srcHE->GetURI(getter_AddRefs(uri));
@ -5389,15 +5389,15 @@ nsDocShell::CloneAndReplace(nsISHEntry * src, PRUint32 aCloneID,
if (!srcChild) if (!srcChild)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsCOMPtr<nsISHEntry> destChild; nsCOMPtr<nsISHEntry> destChild;
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
result = result =
CloneAndReplace(srcChild, aCloneID, replaceEntry, CloneAndReplace(srcChild, aCloneID, replaceEntry,
getter_AddRefs(destChild)); getter_AddRefs(destChild));
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
result = destContainer->AddChild(destChild, i); result = destContainer->AddChild(destChild, i);
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
} // for } // for
} }

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

@ -3853,7 +3853,7 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
nsCOMPtr<nsIDOMNode> node1; nsCOMPtr<nsIDOMNode> node1;
nsCOMPtr<nsIDOMNode> node2; nsCOMPtr<nsIDOMNode> node2;
if (!NS_SUCCEEDED(aNode->GetFirstChild(getter_AddRefs(node1)))) if (NS_FAILED(aNode->GetFirstChild(getter_AddRefs(node1))))
{ {
NS_NOTREACHED("GetFirstTextNode Failed"); NS_NOTREACHED("GetFirstTextNode Failed");
} }
@ -4498,7 +4498,7 @@ nsEditor::DeleteSelectionAndCreateNode(const nsAReadableString& aTag,
PRInt32 offsetOfNewNode; PRInt32 offsetOfNewNode;
nsresult result = DeleteSelectionAndPrepareToCreateNode(parentSelectedNode, nsresult result = DeleteSelectionAndPrepareToCreateNode(parentSelectedNode,
offsetOfNewNode); offsetOfNewNode);
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
nsCOMPtr<nsIDOMNode> newNode; nsCOMPtr<nsIDOMNode> newNode;

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

@ -1748,7 +1748,7 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe
nsCOMPtr<nsISelection>selection; nsCOMPtr<nsISelection>selection;
res = GetSelection(getter_AddRefs(selection)); res = GetSelection(getter_AddRefs(selection));
if (!NS_SUCCEEDED(res) || !selection) if (NS_FAILED(res) || !selection)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// hand off to the rules system, see if it has anything to say about this // hand off to the rules system, see if it has anything to say about this
@ -1765,7 +1765,7 @@ nsHTMLEditor::InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSe
nsCOMPtr<nsIDOMNode> tempNode; nsCOMPtr<nsIDOMNode> tempNode;
PRInt32 tempOffset; PRInt32 tempOffset;
nsresult result = DeleteSelectionAndPrepareToCreateNode(tempNode,tempOffset); nsresult result = DeleteSelectionAndPrepareToCreateNode(tempNode,tempOffset);
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
} }
@ -2608,7 +2608,7 @@ NODE_FOUND:
// Search up the parent chain // Search up the parent chain
// We should never fail because of root test below, but lets be safe // We should never fail because of root test below, but lets be safe
// XXX: ERROR_HANDLING error return code lost // XXX: ERROR_HANDLING error return code lost
if (!NS_SUCCEEDED(currentNode->GetParentNode(getter_AddRefs(parent))) || !parent) if (NS_FAILED(currentNode->GetParentNode(getter_AddRefs(parent))) || !parent)
break; break;
// Stop searching if parent is a body tag // Stop searching if parent is a body tag
@ -2617,7 +2617,7 @@ NODE_FOUND:
// Note: Originally used IsRoot to stop at table cells, // Note: Originally used IsRoot to stop at table cells,
// but that's too messy when you are trying to find the parent table // but that's too messy when you are trying to find the parent table
//PRBool isRoot; //PRBool isRoot;
//if (!NS_SUCCEEDED(IsRootTag(parentTagName, isRoot)) || isRoot) //if (NS_FAILED(IsRootTag(parentTagName, isRoot)) || isRoot)
if(parentTagName.EqualsIgnoreCase("body")) if(parentTagName.EqualsIgnoreCase("body"))
break; break;
@ -4075,7 +4075,7 @@ nsCOMPtr<nsIDOMElement> nsHTMLEditor::FindPreElement()
nsString prestr ("PRE"); // GetFirstNodeOfType requires capitals nsString prestr ("PRE"); // GetFirstNodeOfType requires capitals
nsCOMPtr<nsIDOMNode> preNode; nsCOMPtr<nsIDOMNode> preNode;
if (!NS_SUCCEEDED(nsEditor::GetFirstNodeOfType(rootNode, prestr, if (NS_FAILED(nsEditor::GetFirstNodeOfType(rootNode, prestr,
getter_AddRefs(preNode)))) getter_AddRefs(preNode))))
return 0; return 0;

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

@ -314,7 +314,7 @@ nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode)
nsHTMLURIRefObject* refObject = new nsHTMLURIRefObject(); nsHTMLURIRefObject* refObject = new nsHTMLURIRefObject();
if (!refObject) return NS_ERROR_OUT_OF_MEMORY; if (!refObject) return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = refObject->SetNode(aNode); nsresult rv = refObject->SetNode(aNode);
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
*aResult = 0; *aResult = 0;
delete refObject; delete refObject;
return rv; return rv;

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

@ -414,10 +414,10 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
if (!nsuiEvent) if (!nsuiEvent)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIDOMNode> parent; nsCOMPtr<nsIDOMNode> parent;
if (!NS_SUCCEEDED(nsuiEvent->GetRangeParent(getter_AddRefs(parent)))) if (NS_FAILED(nsuiEvent->GetRangeParent(getter_AddRefs(parent))))
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
PRInt32 offset = 0; PRInt32 offset = 0;
if (!NS_SUCCEEDED(nsuiEvent->GetRangeOffset(&offset))) if (NS_FAILED(nsuiEvent->GetRangeOffset(&offset)))
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsISelection> selection; nsCOMPtr<nsISelection> selection;

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

@ -1381,7 +1381,7 @@ NS_IMETHODIMP nsPlaintextEditor::Cut()
{ {
nsCOMPtr<nsISelection> selection; nsCOMPtr<nsISelection> selection;
nsresult res = GetSelection(getter_AddRefs(selection)); nsresult res = GetSelection(getter_AddRefs(selection));
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
PRBool isCollapsed; PRBool isCollapsed;
@ -1699,7 +1699,7 @@ nsPlaintextEditor::InsertAsQuotation(const nsAReadableString& aQuotedText,
// Let the citer quote it for us: // Let the citer quote it for us:
nsString quotedStuff; nsString quotedStuff;
nsresult rv = citer->GetCiteString(aQuotedText, quotedStuff); nsresult rv = citer->GetCiteString(aQuotedText, quotedStuff);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
// It's best to put a blank line after the quoted text so that mails // It's best to put a blank line after the quoted text so that mails

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

@ -1170,7 +1170,7 @@ static int InitProfiles( char *aProfileDir, char *aProfileName ) {
// Load preferences service // Load preferences service
nsIPref *mPrefs; nsIPref *mPrefs;
rv = nsServiceManager::GetService(kPrefCID, NS_GET_IID(nsIPref), (nsISupports **)&mPrefs); rv = nsServiceManager::GetService(kPrefCID, NS_GET_IID(nsIPref), (nsISupports **)&mPrefs);
if( !NS_FAILED( rv ) ) { if( NS_SUCCEEDED( rv ) ) {
mPrefs->ResetPrefs(); mPrefs->ResetPrefs();
mPrefs->ReadUserPrefs( nsnull ); //Reads from default_prefs.js mPrefs->ReadUserPrefs( nsnull ); //Reads from default_prefs.js
} }

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

@ -393,7 +393,7 @@ void CTests::OnToolsRemoveGHPage()
return; return;
} }
nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv); nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
if(!NS_SUCCEEDED(rv)) { if(NS_FAILED(rv)) {
QAOutput("Could not get the history object.", 2); QAOutput("Could not get the history object.", 2);
return; return;
} }
@ -433,7 +433,7 @@ void CTests::OnToolsRemoveAllGH()
return; return;
} }
nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv); nsCOMPtr<nsIBrowserHistory> myHistory = do_QueryInterface(myGHistory, &rv);
if(!NS_SUCCEEDED(rv)) { if(NS_FAILED(rv)) {
QAOutput("Could not get the history object.", 2); QAOutput("Could not get the history object.", 2);
return; return;
} }

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

@ -427,7 +427,7 @@ cookie_LifetimeLimitPrefChanged(const char * newpref, void * data) {
PRInt32 n; PRInt32 n;
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (!NS_FAILED(rv) && !NS_FAILED(prefs->GetIntPref(cookie_lifetimeValue, &n))) { if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(prefs->GetIntPref(cookie_lifetimeValue, &n))) {
cookie_SetLifetimeLimit(n); cookie_SetLifetimeLimit(n);
} }
return 0; return 0;
@ -463,7 +463,7 @@ cookie_LifetimeDaysPrefChanged(const char * newpref, void * data) {
PRInt32 n; PRInt32 n;
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (!prefs || !NS_FAILED(prefs->GetIntPref(cookie_lifetimeDaysPref, &n))) { if (!prefs || NS_SUCCEEDED(prefs->GetIntPref(cookie_lifetimeDaysPref, &n))) {
cookie_lifetimeDays = n; cookie_lifetimeDays = n;
if (!cookie_lifetimeCurrentSession) { if (!cookie_lifetimeCurrentSession) {
cookie_SetLifetimeLimit(n); cookie_SetLifetimeLimit(n);
@ -521,14 +521,14 @@ COOKIE_RegisterPrefCallbacks(void) {
cookie_lifetimeDays = 90; cookie_lifetimeDays = 90;
cookie_lifetimeCurrentSession = PR_FALSE; cookie_lifetimeCurrentSession = PR_FALSE;
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeDaysPref, &n))) { if (NS_SUCCEEDED(prefs->GetIntPref(cookie_lifetimeDaysPref, &n))) {
cookie_lifetimeDays = n; cookie_lifetimeDays = n;
} }
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeBehaviorPref, &n))) { if (NS_SUCCEEDED(prefs->GetIntPref(cookie_lifetimeBehaviorPref, &n))) {
cookie_lifetimeCurrentSession = (n==0); cookie_lifetimeCurrentSession = (n==0);
cookie_SetLifetimeLimit((n==0) ? 0 : cookie_lifetimeDays); cookie_SetLifetimeLimit((n==0) ? 0 : cookie_lifetimeDays);
} }
if (!NS_FAILED(prefs->GetBoolPref(cookie_lifetimeEnabledPref, &n))) { if (NS_SUCCEEDED(prefs->GetBoolPref(cookie_lifetimeEnabledPref, &n))) {
cookie_SetLifetimePref(n ? COOKIE_Trim : COOKIE_Normal); cookie_SetLifetimePref(n ? COOKIE_Trim : COOKIE_Normal);
} }
prefs->RegisterCallback(cookie_lifetimeEnabledPref, cookie_LifetimeEnabledPrefChanged, nsnull); prefs->RegisterCallback(cookie_lifetimeEnabledPref, cookie_LifetimeEnabledPrefChanged, nsnull);
@ -536,12 +536,12 @@ COOKIE_RegisterPrefCallbacks(void) {
prefs->RegisterCallback(cookie_lifetimeDaysPref, cookie_LifetimeDaysPrefChanged, nsnull); prefs->RegisterCallback(cookie_lifetimeDaysPref, cookie_LifetimeDaysPrefChanged, nsnull);
// Override cookie_lifetime initialization if the older prefs (with no UI) are used // Override cookie_lifetime initialization if the older prefs (with no UI) are used
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimePref, &n))) { if (NS_SUCCEEDED(prefs->GetIntPref(cookie_lifetimePref, &n))) {
cookie_SetLifetimePref((COOKIE_LifetimeEnum)n); cookie_SetLifetimePref((COOKIE_LifetimeEnum)n);
} }
prefs->RegisterCallback(cookie_lifetimePref, cookie_LifetimeOptPrefChanged, nsnull); prefs->RegisterCallback(cookie_lifetimePref, cookie_LifetimeOptPrefChanged, nsnull);
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeValue, &n))) { if (NS_SUCCEEDED(prefs->GetIntPref(cookie_lifetimeValue, &n))) {
cookie_SetLifetimeLimit(n); cookie_SetLifetimeLimit(n);
} }
prefs->RegisterCallback(cookie_lifetimeValue, cookie_LifetimeLimitPrefChanged, nsnull); prefs->RegisterCallback(cookie_lifetimeValue, cookie_LifetimeLimitPrefChanged, nsnull);

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

@ -157,7 +157,7 @@ PUBLIC void
SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data) { SI_RegisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data) {
nsresult ret; nsresult ret;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->RegisterCallback(domain, callback, instance_data); ret = pPrefService->RegisterCallback(domain, callback, instance_data);
} }
} }
@ -166,7 +166,7 @@ PUBLIC void
SI_UnregisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data) { SI_UnregisterCallback(const char* domain, PrefChangedFunc callback, void* instance_data) {
nsresult ret; nsresult ret;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->UnregisterCallback(domain, callback, instance_data); ret = pPrefService->UnregisterCallback(domain, callback, instance_data);
} }
} }
@ -175,9 +175,9 @@ PUBLIC void
SI_SetBoolPref(const char * prefname, PRBool prefvalue) { SI_SetBoolPref(const char * prefname, PRBool prefvalue) {
nsresult ret; nsresult ret;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->SetBoolPref(prefname, prefvalue); ret = pPrefService->SetBoolPref(prefname, prefvalue);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->SavePrefFile(nsnull); ret = pPrefService->SavePrefFile(nsnull);
} }
} }
@ -188,7 +188,7 @@ SI_GetBoolPref(const char * prefname, PRBool defaultvalue) {
nsresult ret; nsresult ret;
PRBool prefvalue = defaultvalue; PRBool prefvalue = defaultvalue;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->GetBoolPref(prefname, &prefvalue); ret = pPrefService->GetBoolPref(prefname, &prefvalue);
} }
return prefvalue; return prefvalue;
@ -201,9 +201,9 @@ SI_SetCharPref(const char * prefname, const char * prefvalue) {
} }
nsresult ret; nsresult ret;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->SetCharPref(prefname, prefvalue); ret = pPrefService->SetCharPref(prefname, prefvalue);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->SavePrefFile(nsnull); ret = pPrefService->SavePrefFile(nsnull);
} }
} }
@ -213,7 +213,7 @@ PUBLIC void
SI_GetCharPref(const char * prefname, char** aPrefvalue) { SI_GetCharPref(const char * prefname, char** aPrefvalue) {
nsresult ret; nsresult ret;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->CopyCharPref(prefname, aPrefvalue); ret = pPrefService->CopyCharPref(prefname, aPrefvalue);
if (NS_FAILED(ret)) { if (NS_FAILED(ret)) {
*aPrefvalue = nsnull; *aPrefvalue = nsnull;
@ -227,7 +227,7 @@ PUBLIC void
SI_GetLocalizedUnicharPref(const char * prefname, PRUnichar** aPrefvalue) { SI_GetLocalizedUnicharPref(const char * prefname, PRUnichar** aPrefvalue) {
nsresult ret; nsresult ret;
nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret); nsCOMPtr<nsIPref> pPrefService = do_GetService(NS_PREF_CONTRACTID, &ret);
if (!NS_FAILED(ret)) { if (NS_SUCCEEDED(ret)) {
ret = pPrefService->GetLocalizedUnicharPref(prefname, aPrefvalue); ret = pPrefService->GetLocalizedUnicharPref(prefname, aPrefvalue);
if (NS_FAILED(ret)) { if (NS_FAILED(ret)) {
*aPrefvalue = nsnull; *aPrefvalue = nsnull;

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

@ -199,7 +199,7 @@ void nsDeviceContextPh :: CommonInit( nsNativeDeviceContext aDC ) {
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res)); nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &res));
if( NS_SUCCEEDED( res ) && prefs ) { if( NS_SUCCEEDED( res ) && prefs ) {
res = prefs->GetIntPref("browser.display.screen_resolution", &prefVal); res = prefs->GetIntPref("browser.display.screen_resolution", &prefVal);
if( !NS_SUCCEEDED( res ) ) { if( NS_FAILED( res ) ) {
prefVal = 96; prefVal = 96;
} }

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

@ -1627,7 +1627,7 @@ nsPostScriptObj::GetUnixPrinterSetting(const nsCAutoString& aKey, char** aVal)
key.AssignWithConversion(aKey.get()); key.AssignWithConversion(aKey.get());
nsAutoString oValue; nsAutoString oValue;
nsresult res = mPrinterProps->GetStringProperty(key, oValue); nsresult res = mPrinterProps->GetStringProperty(key, oValue);
if (!NS_SUCCEEDED(res)) { if (NS_FAILED(res)) {
return PR_FALSE; return PR_FALSE;
} }
*aVal = ToNewCString(oValue); *aVal = ToNewCString(oValue);

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

@ -793,7 +793,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
//tag but ran out of data (not in the stream, but in this *part* of the stream. //tag but ran out of data (not in the stream, but in this *part* of the stream.
//For simplicity, we have to unwind our input. Therefore, we pop and discard //For simplicity, we have to unwind our input. Therefore, we pop and discard
//any new tokens we've cued this round. Later we can get smarter about this. //any new tokens we've cued this round. Later we can get smarter about this.
if(!NS_SUCCEEDED(result)) { if(NS_FAILED(result)) {
while(mTokenDeque.GetSize()>theDequeSize) { while(mTokenDeque.GetSize()>theDequeSize) {
CToken* theToken=(CToken*)mTokenDeque.Pop(); CToken* theToken=(CToken*)mTokenDeque.Pop();
IF_FREE(theToken, mTokenAllocator); IF_FREE(theToken, mTokenAllocator);
@ -942,7 +942,7 @@ nsresult nsHTMLTokenizer::ConsumeText(CToken*& aToken,nsScanner& aScanner){
if(theToken) { if(theToken) {
PRUnichar ch=0; PRUnichar ch=0;
result=theToken->Consume(ch,aScanner,mFlags); result=theToken->Consume(ch,aScanner,mFlags);
if(!NS_SUCCEEDED(result)) { if(NS_FAILED(result)) {
if(0==theToken->GetTextLength()){ if(0==theToken->GetTextLength()){
IF_FREE(aToken, mTokenAllocator); IF_FREE(aToken, mTokenAllocator);
aToken = nsnull; aToken = nsnull;

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

@ -228,7 +228,7 @@ nsresult nsCollation::UnicodeToChar(const nsAString& aSrc, char** dst, const nsA
} }
} }
} }
if (!NS_SUCCEEDED(res)) { if (NS_FAILED(res)) {
PR_Free(*dst); PR_Free(*dst);
*dst = nsnull; *dst = nsnull;
} }

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

@ -756,7 +756,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert(
nsString tmpCharset; nsString tmpCharset;
nsCOMPtr<nsICharsetConverterManager> ccm = nsCOMPtr<nsICharsetConverterManager> ccm =
do_GetService(kCharsetConverterManagerCID, &rv); do_GetService(kCharsetConverterManagerCID, &rv);
if (!NS_FAILED(rv)) { if (NS_SUCCEEDED(rv)) {
tmpCharset.AssignWithConversion("GB2312"); tmpCharset.AssignWithConversion("GB2312");
rv = ccm->GetUnicodeDecoder(&tmpCharset, &mGB2312Decoder); rv = ccm->GetUnicodeDecoder(&tmpCharset, &mGB2312Decoder);
} }
@ -810,7 +810,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert(
nsString tmpCharset; nsString tmpCharset;
nsCOMPtr<nsICharsetConverterManager> ccm = nsCOMPtr<nsICharsetConverterManager> ccm =
do_GetService(kCharsetConverterManagerCID, &rv); do_GetService(kCharsetConverterManagerCID, &rv);
if (!NS_FAILED(rv)) { if (NS_SUCCEEDED(rv)) {
tmpCharset.AssignWithConversion("EUC-KR"); tmpCharset.AssignWithConversion("EUC-KR");
rv = ccm->GetUnicodeDecoder(&tmpCharset, &mEUCKRDecoder); rv = ccm->GetUnicodeDecoder(&tmpCharset, &mEUCKRDecoder);
} }
@ -883,7 +883,7 @@ NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert(
nsString tmpCharset; nsString tmpCharset;
nsCOMPtr<nsICharsetConverterManager> ccm = nsCOMPtr<nsICharsetConverterManager> ccm =
do_GetService(kCharsetConverterManagerCID, &rv); do_GetService(kCharsetConverterManagerCID, &rv);
if (!NS_FAILED(rv)) { if (NS_SUCCEEDED(rv)) {
tmpCharset.AssignWithConversion("ISO-8859-7"); tmpCharset.AssignWithConversion("ISO-8859-7");
rv = ccm->GetUnicodeDecoder(&tmpCharset, &mISO88597Decoder); rv = ccm->GetUnicodeDecoder(&tmpCharset, &mISO88597Decoder);
} }

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

@ -145,7 +145,7 @@ NS_IMETHODIMP nsISO2022KRToUnicode::Convert(const char * aSrc, PRInt32 * aSrcLen
nsString tmpCharset; nsString tmpCharset;
nsCOMPtr<nsICharsetConverterManager> ccm = nsCOMPtr<nsICharsetConverterManager> ccm =
do_GetService(kCharsetConverterManagerCID, &rv); do_GetService(kCharsetConverterManagerCID, &rv);
if (!NS_FAILED(rv)) { if (NS_SUCCEEDED(rv)) {
tmpCharset.AssignWithConversion("EUC-KR"); tmpCharset.AssignWithConversion("EUC-KR");
rv = ccm->GetUnicodeDecoder(&tmpCharset, &mEUCKRDecoder); rv = ccm->GetUnicodeDecoder(&tmpCharset, &mEUCKRDecoder);
} }

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

@ -322,7 +322,7 @@ TestSecurityManager(JSContext* jscontext, JSObject* glob, nsIXPConnect* xpc)
rval = JSVAL_FALSE; rval = JSVAL_FALSE;
JS_SetProperty(jscontext, glob, "failed", &rval); JS_SetProperty(jscontext, glob, "failed", &rval);
printf("Individual SecurityManager tests...\n"); printf("Individual SecurityManager tests...\n");
if(!NS_SUCCEEDED(xpc->SetSecurityManagerForJSContext(jscontext, sm, if(NS_FAILED(xpc->SetSecurityManagerForJSContext(jscontext, sm,
nsIXPCSecurityManager::HOOK_ALL))) nsIXPCSecurityManager::HOOK_ALL)))
{ {
success = JS_FALSE; success = JS_FALSE;

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

@ -4299,7 +4299,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
{ {
nsIFrame * newFrame; nsIFrame * newFrame;
nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, NS_BLOCK_SPACE_MGR); nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, NS_BLOCK_SPACE_MGR);
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

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

@ -1570,7 +1570,7 @@ PresShell::Init(nsIDocument* aDocument,
nsresult result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull, nsresult result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
NS_GET_IID(nsIFrameSelection), NS_GET_IID(nsIFrameSelection),
getter_AddRefs(mSelection)); getter_AddRefs(mSelection));
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
// Create and initialize the frame manager // Create and initialize the frame manager
@ -1584,7 +1584,7 @@ PresShell::Init(nsIDocument* aDocument,
} }
result = mSelection->Init((nsIFocusTracker *) this, nsnull); result = mSelection->Init((nsIFocusTracker *) this, nsnull);
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
// Important: this has to happen after the selection has been set up // Important: this has to happen after the selection has been set up
#ifdef SHOW_CARET #ifdef SHOW_CARET

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

@ -4233,17 +4233,17 @@ nsSelection::DeleteFromDocument()
// Get an iterator // Get an iterator
nsSelectionIterator iter(mDomSelections[index]); nsSelectionIterator iter(mDomSelections[index]);
res = iter.First(); res = iter.First();
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
nsCOMPtr<nsIDOMRange> range; nsCOMPtr<nsIDOMRange> range;
while (iter.IsDone()) while (iter.IsDone())
{ {
res = iter.CurrentItem(NS_STATIC_CAST(nsIDOMRange**, getter_AddRefs(range))); res = iter.CurrentItem(NS_STATIC_CAST(nsIDOMRange**, getter_AddRefs(range)));
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
res = range->DeleteContents(); res = range->DeleteContents();
if (!NS_SUCCEEDED(res)) if (NS_FAILED(res))
return res; return res;
iter.Next(); iter.Next();
} }
@ -5670,7 +5670,7 @@ nsTypedSelection::GetEnumerator(nsIEnumerator **aIterator)
{ {
nsresult status = NS_ERROR_OUT_OF_MEMORY; nsresult status = NS_ERROR_OUT_OF_MEMORY;
nsSelectionIterator *iterator = new nsSelectionIterator(this); nsSelectionIterator *iterator = new nsSelectionIterator(this);
if ( iterator && !NS_SUCCEEDED(status = CallQueryInterface(iterator, aIterator)) ) if ( iterator && NS_FAILED(status = CallQueryInterface(iterator, aIterator)) )
delete iterator; delete iterator;
return status; return status;
} }

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

@ -1570,7 +1570,7 @@ PresShell::Init(nsIDocument* aDocument,
nsresult result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull, nsresult result = nsComponentManager::CreateInstance(kFrameSelectionCID, nsnull,
NS_GET_IID(nsIFrameSelection), NS_GET_IID(nsIFrameSelection),
getter_AddRefs(mSelection)); getter_AddRefs(mSelection));
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
// Create and initialize the frame manager // Create and initialize the frame manager
@ -1584,7 +1584,7 @@ PresShell::Init(nsIDocument* aDocument,
} }
result = mSelection->Init((nsIFocusTracker *) this, nsnull); result = mSelection->Init((nsIFocusTracker *) this, nsnull);
if (!NS_SUCCEEDED(result)) if (NS_FAILED(result))
return result; return result;
// Important: this has to happen after the selection has been set up // Important: this has to happen after the selection has been set up
#ifdef SHOW_CARET #ifdef SHOW_CARET

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

@ -4299,7 +4299,7 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
{ {
nsIFrame * newFrame; nsIFrame * newFrame;
nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, NS_BLOCK_SPACE_MGR); nsresult rv = NS_NewFieldSetFrame(aPresShell, &newFrame, NS_BLOCK_SPACE_MGR);
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

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

@ -136,7 +136,7 @@ nsStackFrame::GetFrameForPoint(nsIPresContext* aPresContext,
} else } else
rv = NS_ERROR_FAILURE; rv = NS_ERROR_FAILURE;
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
const nsStyleColor* color = const nsStyleColor* color =
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color); (const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);

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

@ -112,7 +112,7 @@ NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *address)
if(sizeLimitEnabled == -1){ if(sizeLimitEnabled == -1){
rv = pPref->GetBoolPref(PREF_COLLECT_EMAIL_ADDRESS_ENABLE_SIZE_LIMIT, &sizeLimitEnabled); rv = pPref->GetBoolPref(PREF_COLLECT_EMAIL_ADDRESS_ENABLE_SIZE_LIMIT, &sizeLimitEnabled);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
} }
@ -120,7 +120,7 @@ NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *address)
if(sizeLimitEnabled && maxCABsize == -1){ if(sizeLimitEnabled && maxCABsize == -1){
PRInt32 max = 0; PRInt32 max = 0;
rv = pPref->GetIntPref(PREF_COLLECT_EMAIL_ADDRESS_SIZE_LIMIT, &max); rv = pPref->GetIntPref(PREF_COLLECT_EMAIL_ADDRESS_SIZE_LIMIT, &max);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
maxCABsize = max; maxCABsize = max;
} }
@ -128,7 +128,7 @@ NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *address)
if (!m_historyAB) if (!m_historyAB)
{ {
rv = OpenHistoryAB(getter_AddRefs(m_historyAB)); rv = OpenHistoryAB(getter_AddRefs(m_historyAB));
if (!NS_SUCCEEDED(rv) || !m_historyAB) if (NS_FAILED(rv) || !m_historyAB)
return rv; return rv;
} }
// note that we're now setting the whole recipient list, // note that we're now setting the whole recipient list,
@ -248,7 +248,7 @@ nsresult nsAbAddressCollecter::OpenHistoryAB(nsIAddrDatabase **aDatabase)
if (NS_SUCCEEDED(rv) && addrDBFactory) if (NS_SUCCEEDED(rv) && addrDBFactory)
{ {
rv = addrDBFactory->Open(dbPath, PR_TRUE, aDatabase, PR_TRUE); rv = addrDBFactory->Open(dbPath, PR_TRUE, aDatabase, PR_TRUE);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
// blow away corrupt db's // blow away corrupt db's
dbPath->Delete(PR_FALSE); dbPath->Delete(PR_FALSE);

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

@ -594,7 +594,7 @@ nsresult nsMsgFilter::SaveRule(nsIOFileStream *aStream)
condition += "OR ("; condition += "OR (";
nsresult searchError = term->EnStreamNew(stream); nsresult searchError = term->EnStreamNew(stream);
if (!NS_SUCCEEDED(searchError)) if (NS_FAILED(searchError))
{ {
err = searchError; err = searchError;
break; break;

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

@ -169,7 +169,7 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsgFilterTypeType filterType,
PRBool applyMore; PRBool applyMore;
ret = listener->ApplyFilterHit(filter, msgWindow, &applyMore); ret = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
if (!NS_SUCCEEDED(ret) || !applyMore) if (NS_FAILED(ret) || !applyMore)
break; break;
} }
} }

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

@ -138,12 +138,12 @@ nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding,
nsCOMPtr <nsIMsgSearchValue> searchValue; nsCOMPtr <nsIMsgSearchValue> searchValue;
nsresult rv = pTerm->GetValue(getter_AddRefs(searchValue)); nsresult rv = pTerm->GetValue(getter_AddRefs(searchValue));
if (!NS_SUCCEEDED(rv) || !searchValue) if (NS_FAILED(rv) || !searchValue)
continue; continue;
rv = searchValue->GetStr(getter_Copies(pchar)); rv = searchValue->GetStr(getter_Copies(pchar));
if (!NS_SUCCEEDED(rv) || !pchar) if (NS_FAILED(rv) || !pchar)
continue; continue;
asciiOnly = nsCRT::IsAscii(NS_CONST_CAST(PRUnichar*, pchar.get())); asciiOnly = nsCRT::IsAscii(NS_CONST_CAST(PRUnichar*, pchar.get()));
} }

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

@ -697,7 +697,7 @@ nsresult nsMsgSearchOfflineMail::Search (PRBool *aDone)
{ {
msgDBHdr = do_QueryInterface(currentItem, &dbErr); msgDBHdr = do_QueryInterface(currentItem, &dbErr);
} }
if (!NS_SUCCEEDED(dbErr)) if (NS_FAILED(dbErr))
*aDone = PR_TRUE; //###phil dbErr is dropped on the floor. just note that we did have an error so we'll clean up later *aDone = PR_TRUE; //###phil dbErr is dropped on the floor. just note that we did have an error so we'll clean up later
else else
{ {

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

@ -392,7 +392,7 @@ nsresult nsMsgSearchAdapter::EncodeImapTerm (nsIMsgSearchTerm *term, PRBool real
nsCOMPtr <nsIMsgSearchValue> searchValue; nsCOMPtr <nsIMsgSearchValue> searchValue;
nsresult rv = term->GetValue(getter_AddRefs(searchValue)); nsresult rv = term->GetValue(getter_AddRefs(searchValue));
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
nsMsgSearchOpValue op; nsMsgSearchOpValue op;

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

@ -186,13 +186,13 @@ char *nsMsgSearchNews::EncodeTerm (nsIMsgSearchTerm *term)
nsCOMPtr <nsIMsgSearchValue> searchValue; nsCOMPtr <nsIMsgSearchValue> searchValue;
nsresult rv = term->GetValue(getter_AddRefs(searchValue)); nsresult rv = term->GetValue(getter_AddRefs(searchValue));
if (!NS_SUCCEEDED(rv) || !searchValue) if (NS_FAILED(rv) || !searchValue)
return nsnull; return nsnull;
nsXPIDLString intlNonRFC1522Value; nsXPIDLString intlNonRFC1522Value;
rv = searchValue->GetStr(getter_Copies(intlNonRFC1522Value)); rv = searchValue->GetStr(getter_Copies(intlNonRFC1522Value));
if (!NS_SUCCEEDED(rv) || !intlNonRFC1522Value) if (NS_FAILED(rv) || !intlNonRFC1522Value)
return nsnull; return nsnull;
PRUnichar *caseInsensitiveValue = EncodeToWildmat (intlNonRFC1522Value); PRUnichar *caseInsensitiveValue = EncodeToWildmat (intlNonRFC1522Value);

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

@ -949,7 +949,7 @@ nsresult nsMsgSearchTerm::MatchRfc822String (const char *string, const char *cha
*pResult = PR_FALSE; *pResult = PR_FALSE;
PRBool result; PRBool result;
nsresult err = InitHeaderAddressParser(); nsresult err = InitHeaderAddressParser();
if (!NS_SUCCEEDED(err)) if (NS_FAILED(err))
return err; return err;
// Isolate the RFC 822 parsing weirdnesses here. MSG_ParseRFC822Addresses // Isolate the RFC 822 parsing weirdnesses here. MSG_ParseRFC822Addresses
// returns a catenated string of null-terminated strings, which we walk // returns a catenated string of null-terminated strings, which we walk

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

@ -2978,7 +2978,7 @@ nsresult nsMsgDBView::CollapseByIndex(nsMsgViewIndex index, PRUint32 *pNumCollap
firstIdInThread = m_keys[index]; firstIdInThread = m_keys[index];
nsCOMPtr <nsIMsgDBHdr> msgHdr; nsCOMPtr <nsIMsgDBHdr> msgHdr;
rv = m_db->GetMsgHdrForKey(firstIdInThread, getter_AddRefs(msgHdr)); rv = m_db->GetMsgHdrForKey(firstIdInThread, getter_AddRefs(msgHdr));
if (!NS_SUCCEEDED(rv) || msgHdr == nsnull) if (NS_FAILED(rv) || msgHdr == nsnull)
{ {
NS_ASSERTION(PR_FALSE, "error collapsing thread"); NS_ASSERTION(PR_FALSE, "error collapsing thread");
return NS_MSG_MESSAGE_NOT_FOUND; return NS_MSG_MESSAGE_NOT_FOUND;

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

@ -339,7 +339,7 @@ NS_IMETHODIMP nsMsgFolderCache::Init(nsIFileSpec *dbFileSpec)
// ### evil cast until MDB supports file streams. // ### evil cast until MDB supports file streams.
rv = OpenMDB((const char *) m_dbFileSpec, exists); rv = OpenMDB((const char *) m_dbFileSpec, exists);
// if this fails and panacea.dat exists, try blowing away the db and recreating it // if this fails and panacea.dat exists, try blowing away the db and recreating it
if (!NS_SUCCEEDED(rv) && exists) if (NS_FAILED(rv) && exists)
{ {
if (m_mdbStore) if (m_mdbStore)
m_mdbStore->Release(); m_mdbStore->Release();

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

@ -145,7 +145,7 @@ nsFolderCompactState::InitDB(nsIMsgDatabase *db)
PR_FALSE, PR_FALSE,
getter_AddRefs(m_db)); getter_AddRefs(m_db));
if(!NS_SUCCEEDED(folderOpen) && if(NS_FAILED(folderOpen) &&
folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE || folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE ||
folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_MISSING ) folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_MISSING )
{ {
@ -606,7 +606,7 @@ nsOfflineStoreCompactState::OnStopRequest(nsIRequest *request, nsISupports *ctxt
if (NS_FAILED(rv)) goto done; if (NS_FAILED(rv)) goto done;
rv = m_messageService->CopyMessage(m_messageUri.get(), this, PR_FALSE, nsnull, rv = m_messageService->CopyMessage(m_messageUri.get(), this, PR_FALSE, nsnull,
/* ### should get msg window! */ nsnull, nsnull); /* ### should get msg window! */ nsnull, nsnull);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
PRUint32 resultFlags; PRUint32 resultFlags;
msgHdr->AndFlags(~MSG_FLAG_OFFLINE, &resultFlags); msgHdr->AndFlags(~MSG_FLAG_OFFLINE, &resultFlags);

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

@ -124,7 +124,7 @@ nsresult nsMsgOfflineManager::StopRunning(nsresult exitStatus)
nsresult nsMsgOfflineManager::AdvanceToNextState(nsresult exitStatus) nsresult nsMsgOfflineManager::AdvanceToNextState(nsresult exitStatus)
{ {
if (!NS_SUCCEEDED(exitStatus)) if (NS_FAILED(exitStatus))
{ {
return StopRunning(exitStatus); return StopRunning(exitStatus);
} }
@ -303,7 +303,7 @@ nsresult nsMsgOfflineManager::DownloadOfflineNewsgroups()
if (NS_SUCCEEDED(rv) && nntpService) if (NS_SUCCEEDED(rv) && nntpService)
rv = nntpService->DownloadNewsgroupsForOffline(m_window, this); rv = nntpService->DownloadNewsgroupsForOffline(m_window, this);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return AdvanceToNextState(rv); return AdvanceToNextState(rv);
return rv; return rv;
} }

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

@ -319,7 +319,7 @@ nsresult nsMsgThreadedDBView::ListThreadIds(nsMsgKey *startMsg, PRBool unreadOnl
{ {
nsCOMPtr <nsISupports> supports; nsCOMPtr <nsISupports> supports;
rv = m_threadEnumerator->GetNext(getter_AddRefs(supports)); rv = m_threadEnumerator->GetNext(getter_AddRefs(supports));
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
threadHdr = nsnull; threadHdr = nsnull;
break; break;

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

@ -1055,7 +1055,7 @@ NS_IMETHODIMP nsMsgDBFolder::WriteToFolderCache(nsIMsgFolderCache *folderCache,
nsCOMPtr<nsISupports> aItem; nsCOMPtr<nsISupports> aItem;
rv = aEnumerator->First(); rv = aEnumerator->First();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return NS_OK; // it's OK, there are no sub-folders. return NS_OK; // it's OK, there are no sub-folders.
while(NS_SUCCEEDED(rv)) while(NS_SUCCEEDED(rv))
@ -1068,12 +1068,12 @@ NS_IMETHODIMP nsMsgDBFolder::WriteToFolderCache(nsIMsgFolderCache *folderCache,
if (folderCache) if (folderCache)
{ {
rv = aMsgFolder->WriteToFolderCache(folderCache, PR_TRUE); rv = aMsgFolder->WriteToFolderCache(folderCache, PR_TRUE);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
break; break;
} }
} }
rv = aEnumerator->Next(); rv = aEnumerator->Next();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
rv = NS_OK; rv = NS_OK;
break; break;

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

@ -938,7 +938,7 @@ NS_IMETHODIMP nsMsgFolder::GetChildWithURI(const char *uri, PRBool deep, PRBool
nsCOMPtr<nsISupports> aItem; nsCOMPtr<nsISupports> aItem;
rv = aEnumerator->First(); rv = aEnumerator->First();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return NS_OK; // it's OK, there are no sub-folders. return NS_OK; // it's OK, there are no sub-folders.
while(NS_SUCCEEDED(rv)) while(NS_SUCCEEDED(rv))
@ -974,7 +974,7 @@ NS_IMETHODIMP nsMsgFolder::GetChildWithURI(const char *uri, PRBool deep, PRBool
} }
} }
rv = aEnumerator->Next(); rv = aEnumerator->Next();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
rv = NS_OK; rv = NS_OK;
break; break;
@ -1544,7 +1544,7 @@ NS_IMETHODIMP nsMsgFolder::SetFlag(PRUint32 flag)
PRBool flagSet; PRBool flagSet;
nsresult rv; nsresult rv;
if(!NS_SUCCEEDED(rv = GetFlag(flag, &flagSet))) if(NS_FAILED(rv = GetFlag(flag, &flagSet)))
return rv; return rv;
if (!flagSet) if (!flagSet)
@ -1562,7 +1562,7 @@ NS_IMETHODIMP nsMsgFolder::ClearFlag(PRUint32 flag)
PRBool flagSet; PRBool flagSet;
nsresult rv; nsresult rv;
if(!NS_SUCCEEDED(rv = GetFlag(flag, &flagSet))) if(NS_FAILED(rv = GetFlag(flag, &flagSet)))
return rv; return rv;
if (flagSet) if (flagSet)

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

@ -371,7 +371,7 @@ char * nsMsgLineStreamBuffer::ReadNextLine(nsIInputStream * aInputStream, PRUint
// try growing buffer by twice as much as we need. // try growing buffer by twice as much as we need.
nsresult rv = GrowBuffer(m_dataBufferSize + growBy); nsresult rv = GrowBuffer(m_dataBufferSize + growBy);
// if we can't grow the buffer, we have to bail. // if we can't grow the buffer, we have to bail.
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return nsnull; return nsnull;
startOfLine = m_dataBuffer; startOfLine = m_dataBuffer;
numFreeBytesInBuffer += growBy; numFreeBytesInBuffer += growBy;

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

@ -3139,7 +3139,7 @@ nsMsgComposeAndSend::DeliverFileAsMail()
nsCOMPtr<nsIAbAddressCollecter> addressCollecter = nsCOMPtr<nsIAbAddressCollecter> addressCollecter =
do_GetService(kCAddressCollecter, &rv); do_GetService(kCAddressCollecter, &rv);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
addressCollecter = nsnull; addressCollecter = nsnull;
PRBool collectAddresses = (collectOutgoingAddresses && addressCollecter); PRBool collectAddresses = (collectOutgoingAddresses && addressCollecter);

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

@ -843,7 +843,7 @@ nsresult nsMsgOfflineOpEnumerator::PrefetchNext()
if (!mRowCursor) if (!mRowCursor)
{ {
rv = GetRowCursor(); rv = GetRowCursor();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
} }

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

@ -2288,7 +2288,7 @@ nsresult nsMsgDBEnumerator::PrefetchNext()
if (!mRowCursor) if (!mRowCursor)
{ {
rv = GetRowCursor(); rv = GetRowCursor();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
} }
@ -2473,7 +2473,7 @@ nsresult nsMsgDBThreadEnumerator::PrefetchNext()
if (!mTableCursor) if (!mTableCursor)
{ {
rv = GetTableCursor(); rv = GetTableCursor();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
} }
while (PR_TRUE) while (PR_TRUE)
@ -2903,7 +2903,7 @@ nsIMsgHeaderParser *nsMsgDatabase::GetHeaderParser()
NULL, NULL,
NS_GET_IID(nsIMsgHeaderParser), NS_GET_IID(nsIMsgHeaderParser),
(void **) &m_HeaderParser); (void **) &m_HeaderParser);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
m_HeaderParser = nsnull; m_HeaderParser = nsnull;
} }
return m_HeaderParser; return m_HeaderParser;

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

@ -504,7 +504,7 @@ nsImapIncomingServer::LoadNextQueuedUrl(PRBool *aResult)
if (!request) if (!request)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
request->GetStatus(&rv); request->GetStatus(&rv);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
nsresult res; nsresult res;
removeUrlFromQueue = PR_TRUE; removeUrlFromQueue = PR_TRUE;
@ -2180,7 +2180,7 @@ nsresult nsImapIncomingServer::GetUnverifiedSubFolders(nsIFolder *parentFolder,
if (NS_SUCCEEDED(rv) && childFolder) if (NS_SUCCEEDED(rv) && childFolder)
{ {
rv = GetUnverifiedSubFolders(childFolder, aFoldersArray, aNumUnverifiedFolders); rv = GetUnverifiedSubFolders(childFolder, aFoldersArray, aNumUnverifiedFolders);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
break; break;
} }
} }

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

@ -542,7 +542,7 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsIEnumerator* *result)
nsCOMPtr <nsIMsgFolder> inboxFolder; nsCOMPtr <nsIMsgFolder> inboxFolder;
rv = GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1, &numFolders, getter_AddRefs(inboxFolder)); rv = GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1, &numFolders, getter_AddRefs(inboxFolder));
if (!NS_SUCCEEDED(rv) || numFolders == 0 || !inboxFolder) if (NS_FAILED(rv) || numFolders == 0 || !inboxFolder)
{ {
// create an inbox if we don't have one. // create an inbox if we don't have one.
CreateClientSubfolderInfo("INBOX", kOnlineHierarchySeparatorUnknown,0); CreateClientSubfolderInfo("INBOX", kOnlineHierarchySeparatorUnknown,0);
@ -3596,7 +3596,7 @@ nsImapMailFolder::NotifyMessageFlags(PRUint32 flags, nsMsgKey msgKey)
rv = mDatabase->ContainsKey(msgKey , &containsKey); rv = mDatabase->ContainsKey(msgKey , &containsKey);
// if we don't have the header, don't diddle the flags. // if we don't have the header, don't diddle the flags.
// GetMsgHdrForKey will create the header if it doesn't exist. // GetMsgHdrForKey will create the header if it doesn't exist.
if (!NS_SUCCEEDED(rv) || !containsKey) if (NS_FAILED(rv) || !containsKey)
return rv; return rv;
rv = mDatabase->GetMsgHdrForKey(msgKey, getter_AddRefs(dbHdr)); rv = mDatabase->GetMsgHdrForKey(msgKey, getter_AddRefs(dbHdr));
@ -4232,7 +4232,7 @@ nsImapMailFolder::NotifySearchHit(nsIMsgMailNewsUrl * aUrl,
const char* searchHitLine) const char* searchHitLine)
{ {
nsresult rv = GetDatabase(nsnull /* don't need msg window, that's more for local mbox parsing */); nsresult rv = GetDatabase(nsnull /* don't need msg window, that's more for local mbox parsing */);
if (!mDatabase || !NS_SUCCEEDED(rv)) if (!mDatabase || NS_FAILED(rv))
return rv; return rv;
// expect search results in the form of "* SEARCH <hit> <hit> ..." // expect search results in the form of "* SEARCH <hit> <hit> ..."
// expect search results in the form of "* SEARCH <hit> <hit> ..." // expect search results in the form of "* SEARCH <hit> <hit> ..."
@ -5076,7 +5076,7 @@ nsresult nsImapMailFolder::CopyMessagesOffline(nsIMsgFolder* srcFolder,
nsCOMPtr <nsIMsgDBHdr> newMailHdr; nsCOMPtr <nsIMsgDBHdr> newMailHdr;
rv = mDatabase->CopyHdrFromExistingHdr(fakeBase + sourceKeyIndex, mailHdr, rv = mDatabase->CopyHdrFromExistingHdr(fakeBase + sourceKeyIndex, mailHdr,
PR_TRUE, getter_AddRefs(newMailHdr)); PR_TRUE, getter_AddRefs(newMailHdr));
if (!newMailHdr || !NS_SUCCEEDED(rv)) if (!newMailHdr || NS_FAILED(rv))
{ {
NS_ASSERTION(PR_FALSE, "failed to copy hdr"); NS_ASSERTION(PR_FALSE, "failed to copy hdr");
stopit = rv; stopit = rv;

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

@ -178,7 +178,7 @@ nsresult nsImapOfflineSync::AdvanceToNextFolder()
rv = AdvanceToNextServer(); rv = AdvanceToNextServer();
else else
rv = m_serverEnumerator->Next(); rv = m_serverEnumerator->Next();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
rv = AdvanceToNextServer(); rv = AdvanceToNextServer();
if (NS_SUCCEEDED(rv) && m_serverEnumerator) if (NS_SUCCEEDED(rv) && m_serverEnumerator)

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

@ -1866,7 +1866,7 @@ void nsImapServerResponseParser::msg_fetch_content(PRBool chunk, PRInt32 origin,
if ((!chunk || (origin == 0)) && !GetDownloadingHeaders() && if ((!chunk || (origin == 0)) && !GetDownloadingHeaders() &&
(GetFillingInShell() ? m_shell->GetGeneratingWholeMessage() : PR_TRUE)) (GetFillingInShell() ? m_shell->GetGeneratingWholeMessage() : PR_TRUE))
{ {
if (!NS_SUCCEEDED(BeginMessageDownload(content_type))) if (NS_FAILED(BeginMessageDownload(content_type)))
return; return;
} }

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

@ -529,7 +529,7 @@ nsresult nsMsgLocalMailFolder::GetDatabase(nsIMsgWindow *aMsgWindow)
if (NS_SUCCEEDED(rv) && mailDBFactory) if (NS_SUCCEEDED(rv) && mailDBFactory)
{ {
folderOpen = mailDBFactory->OpenFolderDB(this, PR_TRUE, PR_FALSE, getter_AddRefs(mDatabase)); folderOpen = mailDBFactory->OpenFolderDB(this, PR_TRUE, PR_FALSE, getter_AddRefs(mDatabase));
if(!NS_SUCCEEDED(folderOpen) && if(NS_FAILED(folderOpen) &&
folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE || folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_MISSING ) folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE || folderOpen == NS_MSG_ERROR_FOLDER_SUMMARY_MISSING )
{ {
nsCOMPtr <nsIDBFolderInfo> dbFolderInfo; nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
@ -546,7 +546,7 @@ nsresult nsMsgLocalMailFolder::GetDatabase(nsIMsgWindow *aMsgWindow)
dbFolderInfo = nsnull; dbFolderInfo = nsnull;
} }
// if it's out of date then reopen with upgrade. // if it's out of date then reopen with upgrade.
if(!NS_SUCCEEDED(rv = mailDBFactory->OpenFolderDB(this, PR_TRUE, PR_TRUE, getter_AddRefs(mDatabase)))) if(NS_FAILED(rv = mailDBFactory->OpenFolderDB(this, PR_TRUE, PR_TRUE, getter_AddRefs(mDatabase))))
{ {
return rv; return rv;
} }
@ -1839,7 +1839,7 @@ nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder* srcFolder, nsISupportsArray*
if (msgSupport) if (msgSupport)
{ {
rv = CopyMessageTo(msgSupport, this, msgWindow, isMove); rv = CopyMessageTo(msgSupport, this, msgWindow, isMove);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
NS_ASSERTION(PR_FALSE, "copy message failed"); NS_ASSERTION(PR_FALSE, "copy message failed");
ClearCopyState(PR_FALSE); ClearCopyState(PR_FALSE);

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

@ -1838,7 +1838,7 @@ nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
destIFolder->GetPath(getter_AddRefs(destIFolderSpec)); destIFolder->GetPath(getter_AddRefs(destIFolderSpec));
err = destIFolderSpec->GetFileSpec(&destFolderSpec); err = destIFolderSpec->GetFileSpec(&destFolderSpec);
if (!NS_SUCCEEDED(err)) if (NS_FAILED(err))
return err; return err;
nsCOMPtr <nsISupports> myISupports = do_QueryInterface(NS_STATIC_CAST(nsIMsgParseMailMsgState*, this)); nsCOMPtr <nsISupports> myISupports = do_QueryInterface(NS_STATIC_CAST(nsIMsgParseMailMsgState*, this));

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

@ -3474,7 +3474,7 @@ PRInt32 nsNNTPProtocol::FigureNextChunk()
} }
/* convert nsresult->status */ /* convert nsresult->status */
status = !NS_SUCCEEDED(rv); status = NS_FAILED(rv);
if (status < 0) if (status < 0)
return status; return status;
@ -3664,7 +3664,7 @@ PRInt32 nsNNTPProtocol::ReadNewsgroupResponse()
/* Give the message number to the header parser. */ /* Give the message number to the header parser. */
rv = m_newsgroupList->ProcessNonXOVER(m_responseText); rv = m_newsgroupList->ProcessNonXOVER(m_responseText);
/* convert nsresult->status */ /* convert nsresult->status */
return !NS_SUCCEEDED(rv); return NS_FAILED(rv);
} }
else else
{ {
@ -3711,7 +3711,7 @@ PRInt32 nsNNTPProtocol::ReadNewsgroupBody(nsIInputStream * inputStream, PRUint32
rv = m_newsgroupList->ProcessNonXOVER(line); rv = m_newsgroupList->ProcessNonXOVER(line);
/* convert nsresult->status */ /* convert nsresult->status */
PR_FREEIF(line); PR_FREEIF(line);
return !NS_SUCCEEDED(rv); return NS_FAILED(rv);
} }

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

@ -303,7 +303,7 @@ NS_IMETHODIMP nsNewsDownloader::OnSearchDone(nsresult status)
return m_listener->OnStopRunningUrl(nsnull, NS_OK); return m_listener->OnStopRunningUrl(nsnull, NS_OK);
} }
nsresult rv = DownloadArticles(m_window, m_folder, &m_keysToDownload); nsresult rv = DownloadArticles(m_window, m_folder, &m_keysToDownload);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
if (m_listener) if (m_listener)
m_listener->OnStopRunningUrl(nsnull, rv); m_listener->OnStopRunningUrl(nsnull, rv);
@ -463,7 +463,7 @@ nsresult nsMsgDownloadAllNewsgroups::AdvanceToNextGroup(PRBool *done)
rv = AdvanceToNextServer(done); rv = AdvanceToNextServer(done);
else else
rv = m_serverEnumerator->Next(); rv = m_serverEnumerator->Next();
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
rv = AdvanceToNextServer(done); rv = AdvanceToNextServer(done);
if (NS_SUCCEEDED(rv) && !*done && m_serverEnumerator) if (NS_SUCCEEDED(rv) && !*done && m_serverEnumerator)
@ -508,7 +508,7 @@ nsresult nsMsgDownloadAllNewsgroups::ProcessNextGroup()
break; break;
} }
} }
if (!NS_SUCCEEDED(rv) || done) if (NS_FAILED(rv) || done)
{ {
if (m_listener) if (m_listener)
return m_listener->OnStopRunningUrl(nsnull, NS_OK); return m_listener->OnStopRunningUrl(nsnull, NS_OK);

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

@ -703,7 +703,7 @@ void imgContainer::BuildCompositeMask(gfxIImageFrame *aCompositingFrame, gfxIIma
PRUint32 compositingAlphaDataLength; PRUint32 compositingAlphaDataLength;
aCompositingFrame->LockAlphaData(); aCompositingFrame->LockAlphaData();
res = aCompositingFrame->GetAlphaData(&compositingAlphaData, &compositingAlphaDataLength); res = aCompositingFrame->GetAlphaData(&compositingAlphaData, &compositingAlphaDataLength);
if(!compositingAlphaData || !compositingAlphaDataLength || !NS_SUCCEEDED(res)) { if(!compositingAlphaData || !compositingAlphaDataLength || NS_FAILED(res)) {
aCompositingFrame->UnlockAlphaData(); aCompositingFrame->UnlockAlphaData();
return; return;
} }
@ -711,7 +711,7 @@ void imgContainer::BuildCompositeMask(gfxIImageFrame *aCompositingFrame, gfxIIma
// The current frame of the animation (overlay frame) is what // The current frame of the animation (overlay frame) is what
// determines the transparent color. // determines the transparent color.
gfx_color color; gfx_color color;
if(!NS_SUCCEEDED(aOverlayFrame->GetTransparentColor(&color))) { if(NS_FAILED(aOverlayFrame->GetTransparentColor(&color))) {
//XXX setting the entire mask on here is probably the wrong thing //XXX setting the entire mask on here is probably the wrong thing
//we should probably just set the region of the overlay frame //we should probably just set the region of the overlay frame
//to 255, but for the moment I can't find a case where this gives //to 255, but for the moment I can't find a case where this gives

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

@ -5491,7 +5491,7 @@ nsPluginHostImpl::StopPluginInstance(nsIPluginInstance* aInstance)
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID); nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);
if (prefs) rv = prefs->GetIntPref(NS_PREF_MAX_NUM_CACHED_PLUGINS,(int *)&max_num); if (prefs) rv = prefs->GetIntPref(NS_PREF_MAX_NUM_CACHED_PLUGINS,(int *)&max_num);
if (!NS_SUCCEEDED(rv)) max_num = DEFAULT_NUMBER_OF_STOPPED_PLUGINS; if (NS_FAILED(rv)) max_num = DEFAULT_NUMBER_OF_STOPPED_PLUGINS;
if(mActivePluginList.getStoppedCount() >= max_num) if(mActivePluginList.getStoppedCount() >= max_num)
{ {

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

@ -193,7 +193,7 @@ nsSanePluginInstance::Initialize( nsIPluginInstancePeer* peer )
result = peer->QueryInterface( nsIPluginTagInfo::GetIID(), result = peer->QueryInterface( nsIPluginTagInfo::GetIID(),
( void ** )&taginfo ); ( void ** )&taginfo );
if ( !NS_FAILED( result ) ) if ( NS_SUCCEEDED( result ) )
{ {
taginfo->GetAttributes( count, names, values ); taginfo->GetAttributes( count, names, values );
NS_IF_RELEASE( taginfo ); NS_IF_RELEASE( taginfo );

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

@ -554,7 +554,7 @@ SimplePluginInstance::Initialize(nsIPluginInstancePeer* peer)
result = peer->QueryInterface(NS_GET_IID(nsIPluginTagInfo), (void **)&taginfo); result = peer->QueryInterface(NS_GET_IID(nsIPluginTagInfo), (void **)&taginfo);
if (!NS_FAILED(result)) if (NS_SUCCEEDED(result))
{ {
taginfo->GetAttributes(count, names, values); taginfo->GetAttributes(count, names, values);
NS_IF_RELEASE(taginfo); NS_IF_RELEASE(taginfo);

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

@ -364,7 +364,7 @@ NS_METHOD EventsPluginInstance::Initialize(nsIPluginInstancePeer *peer) {
if (NS_FAILED(result)) return result; if (NS_FAILED(result)) return result;
taginfo = do_QueryInterface(peer, &result); taginfo = do_QueryInterface(peer, &result);
if (!NS_FAILED(result)) { if (NS_SUCCEEDED(result)) {
taginfo->GetAttributes(count, names, values); taginfo->GetAttributes(count, names, values);
} }

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

@ -141,7 +141,7 @@ nsProtocolProxyService::PrefsChanged(const char* pref) {
{ {
rv = mPrefs->CopyCharPref("network.proxy.http", rv = mPrefs->CopyCharPref("network.proxy.http",
getter_Copies(mHTTPProxyHost)); getter_Copies(mHTTPProxyHost));
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
mHTTPProxyHost.Adopt(nsCRT::strdup("")); mHTTPProxyHost.Adopt(nsCRT::strdup(""));
} }
@ -158,7 +158,7 @@ nsProtocolProxyService::PrefsChanged(const char* pref) {
{ {
rv = mPrefs->CopyCharPref("network.proxy.ssl", rv = mPrefs->CopyCharPref("network.proxy.ssl",
getter_Copies(mHTTPSProxyHost)); getter_Copies(mHTTPSProxyHost));
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
mHTTPSProxyHost.Adopt(nsCRT::strdup("")); mHTTPSProxyHost.Adopt(nsCRT::strdup(""));
} }
@ -175,7 +175,7 @@ nsProtocolProxyService::PrefsChanged(const char* pref) {
{ {
rv = mPrefs->CopyCharPref("network.proxy.ftp", rv = mPrefs->CopyCharPref("network.proxy.ftp",
getter_Copies(mFTPProxyHost)); getter_Copies(mFTPProxyHost));
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
mFTPProxyHost.Adopt(nsCRT::strdup("")); mFTPProxyHost.Adopt(nsCRT::strdup(""));
} }
@ -192,7 +192,7 @@ nsProtocolProxyService::PrefsChanged(const char* pref) {
{ {
rv = mPrefs->CopyCharPref("network.proxy.gopher", rv = mPrefs->CopyCharPref("network.proxy.gopher",
getter_Copies(mGopherProxyHost)); getter_Copies(mGopherProxyHost));
if (!NS_SUCCEEDED(rv) || !mGopherProxyHost) if (NS_FAILED(rv) || !mGopherProxyHost)
mGopherProxyHost.Adopt(nsCRT::strdup("")); mGopherProxyHost.Adopt(nsCRT::strdup(""));
} }
@ -209,7 +209,7 @@ nsProtocolProxyService::PrefsChanged(const char* pref) {
{ {
rv = mPrefs->CopyCharPref("network.proxy.socks", rv = mPrefs->CopyCharPref("network.proxy.socks",
getter_Copies(mSOCKSProxyHost)); getter_Copies(mSOCKSProxyHost));
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
mSOCKSProxyHost.Adopt(nsCRT::strdup("")); mSOCKSProxyHost.Adopt(nsCRT::strdup(""));
} }

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

@ -746,7 +746,7 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags)
rv = pProviderService->GetSocketProvider(mSocketTypes[type], rv = pProviderService->GetSocketProvider(mSocketTypes[type],
getter_AddRefs(pProvider)); getter_AddRefs(pProvider));
if (!NS_SUCCEEDED(rv)) break; if (NS_FAILED(rv)) break;
nsCOMPtr<nsISupports> socketInfo; nsCOMPtr<nsISupports> socketInfo;
@ -772,7 +772,7 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags)
getter_AddRefs(socketInfo)); getter_AddRefs(socketInfo));
} }
if (!NS_SUCCEEDED(rv) || !mSocketFD) break; if (NS_FAILED(rv) || !mSocketFD) break;
// if the service was ssl or tlsstepup, we want to hold onto the socket info // if the service was ssl or tlsstepup, we want to hold onto the socket info
if (nsCRT::strcmp(mSocketTypes[type], "ssl") == 0 || if (nsCRT::strcmp(mSocketTypes[type], "ssl") == 0 ||

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

@ -793,7 +793,7 @@ nsresult nsHTMLTokenizer::ConsumeStartTag(PRUnichar aChar,CToken*& aToken,nsScan
//tag but ran out of data (not in the stream, but in this *part* of the stream. //tag but ran out of data (not in the stream, but in this *part* of the stream.
//For simplicity, we have to unwind our input. Therefore, we pop and discard //For simplicity, we have to unwind our input. Therefore, we pop and discard
//any new tokens we've cued this round. Later we can get smarter about this. //any new tokens we've cued this round. Later we can get smarter about this.
if(!NS_SUCCEEDED(result)) { if(NS_FAILED(result)) {
while(mTokenDeque.GetSize()>theDequeSize) { while(mTokenDeque.GetSize()>theDequeSize) {
CToken* theToken=(CToken*)mTokenDeque.Pop(); CToken* theToken=(CToken*)mTokenDeque.Pop();
IF_FREE(theToken, mTokenAllocator); IF_FREE(theToken, mTokenAllocator);
@ -942,7 +942,7 @@ nsresult nsHTMLTokenizer::ConsumeText(CToken*& aToken,nsScanner& aScanner){
if(theToken) { if(theToken) {
PRUnichar ch=0; PRUnichar ch=0;
result=theToken->Consume(ch,aScanner,mFlags); result=theToken->Consume(ch,aScanner,mFlags);
if(!NS_SUCCEEDED(result)) { if(NS_FAILED(result)) {
if(0==theToken->GetTextLength()){ if(0==theToken->GetTextLength()){
IF_FREE(aToken, mTokenAllocator); IF_FREE(aToken, mTokenAllocator);
aToken = nsnull; aToken = nsnull;

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

@ -147,7 +147,7 @@ int main(int argc, char **argv)
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service."); NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
// Force the toolkit into "xlib" mode regardless of MOZ_TOOLKIT // Force the toolkit into "xlib" mode regardless of MOZ_TOOLKIT
@ -180,21 +180,21 @@ int main(int argc, char **argv)
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not obtain the event queue service."); NS_ASSERTION(NS_SUCCEEDED(rv),"Could not obtain the event queue service.");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
rv = eventQueueService->CreateThreadEventQueue(); rv = eventQueueService->CreateThreadEventQueue();
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not create the event queue for the the thread."); NS_ASSERTION(NS_SUCCEEDED(rv),"Could not create the event queue for the the thread.");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
rv = eventQueueService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQueue); rv = eventQueueService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQueue);
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get the newly created thread event queue.\n"); NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get the newly created thread event queue.\n");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
NS_RELEASE(eventQueueService); NS_RELEASE(eventQueueService);
@ -205,7 +205,7 @@ int main(int argc, char **argv)
NS_ASSERTION(NS_SUCCEEDED(rv),"Couldn't obtain window service\n"); NS_ASSERTION(NS_SUCCEEDED(rv),"Couldn't obtain window service\n");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
gsWindowService->SetWindowCreateCallback(WindowCreateCallback); gsWindowService->SetWindowCreateCallback(WindowCreateCallback);
@ -224,7 +224,7 @@ int main(int argc, char **argv)
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot create WebShell.\n"); NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot create WebShell.\n");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
// XXX - fix me! // XXX - fix me!

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

@ -255,7 +255,7 @@ int QMozillaContainer::init()
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service."); NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot obtain unix toolkit service.");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
// Force the toolkit into "xlib" mode regardless of MOZ_TOOLKIT // Force the toolkit into "xlib" mode regardless of MOZ_TOOLKIT
@ -288,21 +288,21 @@ int QMozillaContainer::init()
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not obtain the event queue service."); NS_ASSERTION(NS_SUCCEEDED(rv),"Could not obtain the event queue service.");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
rv = eventQueueService->CreateThreadEventQueue(); rv = eventQueueService->CreateThreadEventQueue();
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not create the event queue for the the thread."); NS_ASSERTION(NS_SUCCEEDED(rv),"Could not create the event queue for the the thread.");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
rv = eventQueueService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQueue); rv = eventQueueService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQueue);
NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get the newly created thread event queue.\n"); NS_ASSERTION(NS_SUCCEEDED(rv),"Could not get the newly created thread event queue.\n");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
NS_RELEASE(eventQueueService); NS_RELEASE(eventQueueService);
@ -313,7 +313,7 @@ int QMozillaContainer::init()
NS_ASSERTION(NS_SUCCEEDED(rv),"Couldn't obtain window service\n"); NS_ASSERTION(NS_SUCCEEDED(rv),"Couldn't obtain window service\n");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
m_WindowService->SetWindowCreateCallback(WindowCreateCallback); m_WindowService->SetWindowCreateCallback(WindowCreateCallback);
@ -331,7 +331,7 @@ int QMozillaContainer::init()
NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot create WebShell.\n"); NS_ASSERTION(NS_SUCCEEDED(rv),"Cannot create WebShell.\n");
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return 1; return 1;
printf("initializing webshell...\n"); printf("initializing webshell...\n");

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

@ -1020,7 +1020,7 @@ nsBrowserWindow::DispatchMenuItem(PRInt32 aID)
res = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url); res = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);
NS_RELEASE(uri); NS_RELEASE(uri);
if (!NS_FAILED(res)) { if (NS_SUCCEEDED(res)) {
// res = walletservice->WALLET_PreEdit(url); // res = walletservice->WALLET_PreEdit(url);
NS_RELEASE(walletservice); NS_RELEASE(walletservice);
} }

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

@ -1197,7 +1197,7 @@ nsIMEGtkIC::GetInputStyle() {
#endif #endif
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
if (!NS_FAILED(rv) && (prefs)) { if (NS_SUCCEEDED(rv) && (prefs)) {
char *input_style; char *input_style;
rv = prefs->CopyCharPref(PREF_XIM_INPUTSTYLE, &input_style); rv = prefs->CopyCharPref(PREF_XIM_INPUTSTYLE, &input_style);
if (NS_SUCCEEDED(rv) && input_style[0]) { if (NS_SUCCEEDED(rv) && input_style[0]) {

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

@ -2629,9 +2629,9 @@ static void debugSetupWindow (void)
debugCheckedDebugWindow = PR_TRUE; debugCheckedDebugWindow = PR_TRUE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
if (!NS_FAILED(rv) && (prefs)) { if (NS_SUCCEEDED(rv) && (prefs)) {
rv = prefs->GetBoolPref(debugPrefName, &enable_window); rv = prefs->GetBoolPref(debugPrefName, &enable_window);
if (!NS_FAILED(rv) && enable_window) { if (NS_SUCCEEDED(rv) && enable_window) {
debugTopLevel = gtk_window_new(GTK_WINDOW_TOPLEVEL); debugTopLevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(debugTopLevel), gtk_signal_connect(GTK_OBJECT(debugTopLevel),
"delete_event", "delete_event",
@ -2666,16 +2666,16 @@ static int debugWindowPrefChanged (const char *newpref, void *data)
PRBool enable_window; PRBool enable_window;
nsresult rv; nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
if (!NS_FAILED(rv) && (prefs)) { if (NS_SUCCEEDED(rv) && (prefs)) {
rv = prefs->GetBoolPref(debugPrefName, &enable_window); rv = prefs->GetBoolPref(debugPrefName, &enable_window);
if (!NS_FAILED(rv) && enable_window) { if (NS_SUCCEEDED(rv) && enable_window) {
if (!debugTopLevel) { if (!debugTopLevel) {
// this will trigger the creation of the window // this will trigger the creation of the window
debugCheckedDebugWindow = PR_FALSE; debugCheckedDebugWindow = PR_FALSE;
debugSetupWindow(); debugSetupWindow();
} }
} }
else if (!NS_FAILED(rv) && (!enable_window)) { else if (NS_SUCCEEDED(rv) && (!enable_window)) {
if (debugTopLevel) { if (debugTopLevel) {
debugDestroyWindow(); debugDestroyWindow();
} }
@ -2691,7 +2691,7 @@ static void debugRegisterCallback (void)
// make sure we don't call in here again // make sure we don't call in here again
debugCallbackRegistered = PR_TRUE; debugCallbackRegistered = PR_TRUE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv)); nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
if (!NS_FAILED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = prefs->RegisterCallback(debugPrefName, debugWindowPrefChanged, NULL); rv = prefs->RegisterCallback(debugPrefName, debugWindowPrefChanged, NULL);
} }
} }

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

@ -3089,7 +3089,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT
nsresult rv; nsresult rv;
nsCOMPtr<nsITimerQueue> queue = nsCOMPtr<nsITimerQueue> queue =
do_GetService(kTimerManagerCID, &rv); do_GetService(kTimerManagerCID, &rv);
if (!NS_FAILED(rv)) { if (NS_SUCCEEDED(rv)) {
if (queue->HasReadyTimers(NS_PRIORITY_LOWEST)) { if (queue->HasReadyTimers(NS_PRIORITY_LOWEST)) {

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

@ -68,7 +68,7 @@ nsBaseDragService::nsBaseDragService() :
{ {
NS_INIT_REFCNT(); NS_INIT_REFCNT();
nsresult result = NS_NewISupportsArray(getter_AddRefs(mTransArray)); nsresult result = NS_NewISupportsArray(getter_AddRefs(mTransArray));
if ( !NS_SUCCEEDED(result) ) { if ( NS_FAILED(result) ) {
//what do we do? we can't throw! //what do we do? we can't throw!
; ;
} }

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

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Scott Collins <scc@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
nsresult
nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const
{
nsresult status;
if ( mSource )
{
nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource, &status);
NS_ASSERTION(factoryPtr, "Did you know you were calling |do_GetInterface()| on an object that doesn't support the |nsIInterfaceRequestor| interface?");
if ( factoryPtr )
status = factoryPtr->GetInterface(aIID, aInstancePtr);
if ( !NS_SUCCEEDED(status) )
*aInstancePtr = 0;
}
else
status = NS_ERROR_NULL_POINTER;
if ( mErrorPtr )
*mErrorPtr = status;
return status;
}

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

@ -1,152 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Scott Collins <scc@netscape.com>
* Pierre Phaneuf <pp@ludusdesign.com>
*/
// nsWeakReference.cpp
#include "nsWeakReference.h"
#include "nsCOMPtr.h"
nsresult
nsQueryReferent::operator()( const nsIID& aIID, void** answer ) const
{
nsresult status;
if ( mWeakPtr )
{
if ( !NS_SUCCEEDED(status = mWeakPtr->QueryReferent(aIID, answer)) )
*answer = 0;
}
else
status = NS_ERROR_NULL_POINTER;
if ( mErrorPtr )
*mErrorPtr = status;
return status;
}
nsresult
nsGetWeakReference::operator()( const nsIID&, void** aResult ) const
{
nsresult status;
// nsIWeakReference** result = &NS_STATIC_CAST(nsIWeakReference*, *aResult);
*aResult = 0;
if ( mRawPtr )
{
nsCOMPtr<nsISupportsWeakReference> factoryPtr = do_QueryInterface(mRawPtr, &status);
NS_ASSERTION(factoryPtr, "Oops! You're asking for a weak reference to an object that doesn't support that.");
if ( factoryPtr )
{
nsIWeakReference* temp;
status = factoryPtr->GetWeakReference(&temp);
*aResult = temp;
}
// else, |status| has already been set by |do_QueryInterface|
}
else
status = NS_ERROR_NULL_POINTER;
if ( mErrorPtr )
*mErrorPtr = status;
return status;
}
NS_COM nsIWeakReference* // or else |already_AddRefed<nsIWeakReference>|
NS_GetWeakReference( nsISupports* aInstancePtr, nsresult* aErrorPtr )
{
void* result = 0;
nsGetWeakReference(aInstancePtr, aErrorPtr)(NS_GET_IID(nsIWeakReference), &result);
return NS_STATIC_CAST(nsIWeakReference*, result);
}
NS_IMETHODIMP
nsSupportsWeakReference::GetWeakReference( nsIWeakReference** aInstancePtr )
{
if ( !aInstancePtr )
return NS_ERROR_NULL_POINTER;
if ( !mProxy )
mProxy = new nsWeakReference(this);
*aInstancePtr = mProxy;
nsresult status;
if ( !*aInstancePtr )
status = NS_ERROR_OUT_OF_MEMORY;
else
{
NS_ADDREF(*aInstancePtr);
status = NS_OK;
}
return status;
}
NS_IMETHODIMP_(nsrefcnt)
nsWeakReference::AddRef()
{
return ++mRefCount;
}
NS_IMETHODIMP_(nsrefcnt)
nsWeakReference::Release()
{
nsrefcnt temp = --mRefCount;
if ( !mRefCount )
delete this;
return temp;
}
NS_IMETHODIMP
nsWeakReference::QueryInterface( const nsIID& aIID, void** aInstancePtr )
{
NS_ASSERTION(aInstancePtr, "QueryInterface requires a non-NULL destination!");
if ( !aInstancePtr )
return NS_ERROR_NULL_POINTER;
nsISupports* foundInterface;
if ( aIID.Equals(NS_GET_IID(nsIWeakReference)) )
foundInterface = NS_STATIC_CAST(nsIWeakReference*, this);
else if ( aIID.Equals(NS_GET_IID(nsISupports)) )
foundInterface = NS_STATIC_CAST(nsISupports*, this);
else
foundInterface = 0;
nsresult status;
if ( !foundInterface )
status = NS_NOINTERFACE;
else
{
NS_ADDREF(foundInterface);
status = NS_OK;
}
*aInstancePtr = foundInterface;
return status;
}
NS_IMETHODIMP
nsWeakReference::QueryReferent( const nsIID& aIID, void** aInstancePtr )
{
return mReferent ? mReferent->QueryInterface(aIID, aInstancePtr) : NS_ERROR_NULL_POINTER;
}

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

@ -468,7 +468,7 @@ nsCategoryManager::EnumerateCategory( const char *aCategoryName,
} }
// If you couldn't find the category, or had trouble creating an enumerator... // If you couldn't find the category, or had trouble creating an enumerator...
if ( !NS_SUCCEEDED(status) ) if ( NS_FAILED(status) )
{ {
NS_IF_RELEASE(*_retval); NS_IF_RELEASE(*_retval);
status = NS_NewEmptyEnumerator(_retval); status = NS_NewEmptyEnumerator(_retval);

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

@ -136,7 +136,7 @@ nsresult
nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const nsCreateInstanceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
{ {
nsresult status = nsComponentManager::CreateInstance(mCID, mOuter, aIID, aInstancePtr); nsresult status = nsComponentManager::CreateInstance(mCID, mOuter, aIID, aInstancePtr);
if ( !NS_SUCCEEDED(status) ) if ( NS_FAILED(status) )
*aInstancePtr = 0; *aInstancePtr = 0;
if ( mErrorPtr ) if ( mErrorPtr )
@ -150,7 +150,7 @@ nsCreateInstanceByContractID::operator()( const nsIID& aIID, void** aInstancePtr
nsresult status; nsresult status;
if ( mContractID ) if ( mContractID )
{ {
if ( !NS_SUCCEEDED(status = nsComponentManager::CreateInstance(mContractID, mOuter, aIID, aInstancePtr)) ) if ( NS_FAILED(status = nsComponentManager::CreateInstance(mContractID, mOuter, aIID, aInstancePtr)) )
*aInstancePtr = 0; *aInstancePtr = 0;
} }
else else
@ -215,7 +215,7 @@ nsGetServiceByCID::operator()( const nsIID& aIID, void** aInstancePtr ) const
if (mgr) if (mgr)
status = mgr->GetService(mCID, aIID, (void**)aInstancePtr); status = mgr->GetService(mCID, aIID, (void**)aInstancePtr);
} }
if ( !NS_SUCCEEDED(status) ) if ( NS_FAILED(status) )
*aInstancePtr = 0; *aInstancePtr = 0;
if ( mErrorPtr ) if ( mErrorPtr )
@ -236,7 +236,7 @@ nsGetServiceByContractID::operator()( const nsIID& aIID, void** aInstancePtr ) c
status = mgr->GetServiceByContractID(mContractID, aIID, (void**)aInstancePtr); status = mgr->GetServiceByContractID(mContractID, aIID, (void**)aInstancePtr);
} }
if ( !NS_SUCCEEDED(status) ) if ( NS_FAILED(status) )
*aInstancePtr = 0; *aInstancePtr = 0;
if ( mErrorPtr ) if ( mErrorPtr )

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

@ -117,7 +117,7 @@ hash_enumerator (nsHashKey *aKey, void *aObject, void *closure)
rv = c->Converter (aKey, (void *)aObject, (void *)c->Data, rv = c->Converter (aKey, (void *)aObject, (void *)c->Data,
&c->Elements[c->Current]); &c->Elements[c->Current]);
if (!NS_FAILED(rv)) if (NS_SUCCEEDED(rv))
c->Current++; c->Current++;
return PR_TRUE; return PR_TRUE;

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

@ -395,7 +395,7 @@ PR_IMPLEMENT(nsresult) NS_TimelineOutdent()
PR_IMPLEMENT(nsresult) NS_TimelineEnter(const char *text) PR_IMPLEMENT(nsresult) NS_TimelineEnter(const char *text)
{ {
nsresult rv = NS_TimelineMark("%s...", text); nsresult rv = NS_TimelineMark("%s...", text);
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
return NS_TimelineIndent(); return NS_TimelineIndent();
@ -404,7 +404,7 @@ PR_IMPLEMENT(nsresult) NS_TimelineEnter(const char *text)
PR_IMPLEMENT(nsresult) NS_TimelineLeave(const char *text) PR_IMPLEMENT(nsresult) NS_TimelineLeave(const char *text)
{ {
nsresult rv = NS_TimelineOutdent(); nsresult rv = NS_TimelineOutdent();
if (!NS_SUCCEEDED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
return NS_TimelineMark("...%s", text); return NS_TimelineMark("...%s", text);

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

@ -77,7 +77,7 @@ void
nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid ) nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid )
{ {
nsISupports* newRawPtr; nsISupports* newRawPtr;
if ( !NS_SUCCEEDED( helper(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) ) if ( NS_FAILED( helper(iid, NS_REINTERPRET_CAST(void**, &newRawPtr)) ) )
newRawPtr = 0; newRawPtr = 0;
assign_assuming_AddRef(newRawPtr); assign_assuming_AddRef(newRawPtr);
} }

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

@ -32,7 +32,7 @@ nsQueryReferent::operator()( const nsIID& aIID, void** answer ) const
nsresult status; nsresult status;
if ( mWeakPtr ) if ( mWeakPtr )
{ {
if ( !NS_SUCCEEDED(status = mWeakPtr->QueryReferent(aIID, answer)) ) if ( NS_FAILED(status = mWeakPtr->QueryReferent(aIID, answer)) )
*answer = 0; *answer = 0;
} }
else else

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

@ -231,7 +231,7 @@ nsSHistory::GetTransactionAtIndex(PRInt32 aIndex, nsISHTransaction ** aResult)
nsCOMPtr<nsISHTransaction> tempPtr; nsCOMPtr<nsISHTransaction> tempPtr;
rv = GetRootTransaction(getter_AddRefs(tempPtr)); rv = GetRootTransaction(getter_AddRefs(tempPtr));
if (!NS_SUCCEEDED(rv) || !tempPtr) if (NS_FAILED(rv) || !tempPtr)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
while(1) { while(1) {
@ -274,7 +274,7 @@ nsSHistory::PrintHistory()
break; break;
nsCOMPtr<nsISHEntry> entry; nsCOMPtr<nsISHEntry> entry;
rv = txn->GetSHEntry(getter_AddRefs(entry)); rv = txn->GetSHEntry(getter_AddRefs(entry));
if (!NS_SUCCEEDED(rv) && !entry) if (NS_FAILED(rv) && !entry)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsCOMPtr<nsILayoutHistoryState> layoutHistoryState; nsCOMPtr<nsILayoutHistoryState> layoutHistoryState;
@ -826,7 +826,7 @@ nsSHistory::GetSHistoryEnumerator(nsISimpleEnumerator** aEnumerator)
NS_ENSURE_ARG_POINTER(aEnumerator); NS_ENSURE_ARG_POINTER(aEnumerator);
nsSHEnumerator * iterator = new nsSHEnumerator(this); nsSHEnumerator * iterator = new nsSHEnumerator(this);
if (iterator && !NS_SUCCEEDED(status = CallQueryInterface(iterator, aEnumerator))) if (iterator && NS_FAILED(status = CallQueryInterface(iterator, aEnumerator)))
delete iterator; delete iterator;
return status; return status;
} }

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

@ -1372,11 +1372,11 @@ nsInstallFileOpItem::NativeFileOpMacAliasPrepare()
char *aliasLeaf; char *aliasLeaf;
rv = sourceFile->GetResolvedFSSpec(&fsSource); rv = sourceFile->GetResolvedFSSpec(&fsSource);
if (!NS_SUCCEEDED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = targetFile->GetFSSpec(&fsAliasParent); rv = targetFile->GetFSSpec(&fsAliasParent);
if (!NS_SUCCEEDED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = targetFile->GetAppendedPath(&aliasLeaf); rv = targetFile->GetAppendedPath(&aliasLeaf);
if (!NS_SUCCEEDED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// check if source file exists // check if source file exists
err = FSMakeFSSpec(fsSource.vRefNum, fsSource.parID, fsSource.name, &fsCheckSource); err = FSMakeFSSpec(fsSource.vRefNum, fsSource.parID, fsSource.name, &fsCheckSource);
@ -1433,11 +1433,11 @@ nsInstallFileOpItem::NativeFileOpMacAliasComplete()
// nsIFile sucks so we have to do special hackery here // nsIFile sucks so we have to do special hackery here
rv = localFileMacSrc->GetResolvedFSSpec(&fsSource); rv = localFileMacSrc->GetResolvedFSSpec(&fsSource);
if (!NS_SUCCEEDED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = localFileMacTarget->GetFSSpec(&fsAliasParent); rv = localFileMacTarget->GetFSSpec(&fsAliasParent);
if (!NS_SUCCEEDED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = localFileMacTarget->GetAppendedPath(&aliasLeaf); rv = localFileMacTarget->GetAppendedPath(&aliasLeaf);
if (!NS_SUCCEEDED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// check if source file exists // check if source file exists
err = FSMakeFSSpec(fsSource.vRefNum, fsSource.parID, fsSource.name, &fsCheckSource); err = FSMakeFSSpec(fsSource.vRefNum, fsSource.parID, fsSource.name, &fsCheckSource);

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

@ -1266,7 +1266,7 @@ InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
nsCOMPtr<nsIFile> iFileAlias; nsCOMPtr<nsIFile> iFileAlias;
rv1 = iFileSourceOrig->Clone(getter_AddRefs(iFileSource)); rv1 = iFileSourceOrig->Clone(getter_AddRefs(iFileSource));
rv2 = iFileAliasOrig->Clone(getter_AddRefs(iFileAlias)); rv2 = iFileAliasOrig->Clone(getter_AddRefs(iFileAlias));
if (!NS_SUCCEEDED(rv1) || !NS_SUCCEEDED(rv2)) if (NS_FAILED(rv1) || NS_FAILED(rv2))
{ {
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR); *rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
return JS_TRUE; return JS_TRUE;
@ -1299,7 +1299,7 @@ InstallFileOpFileMacAlias(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
} }
rv2 = iFileAlias->Append(NS_LossyConvertUCS2toASCII(aliasLeaf).get()); rv2 = iFileAlias->Append(NS_LossyConvertUCS2toASCII(aliasLeaf).get());
if (!NS_SUCCEEDED(rv1) || !NS_SUCCEEDED(rv2)) if (NS_FAILED(rv1) || NS_FAILED(rv2))
{ {
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR); *rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
return JS_TRUE; return JS_TRUE;

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

@ -126,7 +126,7 @@ XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report
nsCOMPtr<nsISoftwareUpdate> softwareUpdate = nsCOMPtr<nsISoftwareUpdate> softwareUpdate =
do_GetService(kSoftwareUpdateCID, &rv); do_GetService(kSoftwareUpdateCID, &rv);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
NS_WARNING("shouldn't have RunInstall() if we can't get SoftwareUpdate"); NS_WARNING("shouldn't have RunInstall() if we can't get SoftwareUpdate");
@ -382,7 +382,7 @@ extern "C" void RunInstallOnThread(void *data)
nsCOMPtr<nsISoftwareUpdate> softwareUpdate = nsCOMPtr<nsISoftwareUpdate> softwareUpdate =
do_GetService(kSoftwareUpdateCID, &rv); do_GetService(kSoftwareUpdateCID, &rv);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
NS_WARNING("shouldn't have RunInstall() if we can't get SoftwareUpdate"); NS_WARNING("shouldn't have RunInstall() if we can't get SoftwareUpdate");
return; return;

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

@ -233,7 +233,7 @@ nsXPInstallManager::InitManager(nsIScriptGlobalObject* aGlobalObject, nsXPITrigg
PRInt32 cbstatus = 0; // callback status PRInt32 cbstatus = 0; // callback status
if (NS_SUCCEEDED(rv) && !OKtoInstall ) if (NS_SUCCEEDED(rv) && !OKtoInstall )
cbstatus = nsInstall::USER_CANCELLED; cbstatus = nsInstall::USER_CANCELLED;
else if (!NS_SUCCEEDED(rv)) else if (NS_FAILED(rv))
cbstatus = nsInstall::UNEXPECTED_ERROR; cbstatus = nsInstall::UNEXPECTED_ERROR;
if ( cbstatus != 0 ) if ( cbstatus != 0 )
@ -748,7 +748,7 @@ nsXPInstallManager::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
mItem->mOutStream = nsnull; mItem->mOutStream = nsnull;
} }
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
if ( mItem->mFile ) if ( mItem->mFile )
{ {

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

@ -151,7 +151,7 @@ PR_PUBLIC_API(nsresult) XPI_Init(
#endif #endif
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
#if defined(XP_UNIX) || defined(XP_MAC) #if defined(XP_UNIX) || defined(XP_MAC)
@ -161,7 +161,7 @@ PR_PUBLIC_API(nsresult) XPI_Init(
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,
nsnull); nsnull);
#endif #endif
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;
@ -176,7 +176,7 @@ PR_PUBLIC_API(nsresult) XPI_Init(
nsnull, nsnull,
NS_GET_IID(nsISoftwareUpdate), NS_GET_IID(nsISoftwareUpdate),
(void**) &gXPI); (void**) &gXPI);
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
return rv; return rv;

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

@ -685,7 +685,7 @@ nsXIEngine::InstallXPI(nsComponent *aXPI, xpistub_t *aStub)
printf("DEBUG: XPI_Install %s returned %d\n", aXPI->GetArchive(), rv); printf("DEBUG: XPI_Install %s returned %d\n", aXPI->GetArchive(), rv);
#endif #endif
if (!NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
err = E_INSTALL; err = E_INSTALL;
return err; return err;