Bug 782252 - Use NS_FAILED instead of boolean test for ToInteger()/ToFloat(); r=ehsan

This commit is contained in:
Aryeh Gregor 2012-08-13 16:49:48 +03:00
parent f85278393e
commit 963057b5ac
7 changed files with 9 additions and 9 deletions

View File

@ -1175,7 +1175,7 @@ nsPermissionManager::Import()
nsresult error;
PRUint32 permission = lineArray[2].ToInteger(&error);
if (error)
if (NS_FAILED(error))
continue;
// hosts might be encoded in UTF8; switch them to ACE to be consistent

View File

@ -116,7 +116,7 @@ SetProperty(OperatorData* aOperatorData,
// aValue is assumed to be a digit from 0 to 7
nsresult error = NS_OK;
float space = aValue.ToFloat(&error) / 18.0;
if (error) return;
if (NS_FAILED(error)) return;
if (isLeadingSpace)
aOperatorData->mLeadingSpace = space;

View File

@ -184,7 +184,7 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString,
nsresult errorCode;
float floatValue = number.ToFloat(&errorCode);
if (errorCode) {
if (NS_FAILED(errorCode)) {
aSign = NS_MATHML_SIGN_INVALID;
return false;
}

View File

@ -323,7 +323,7 @@ ParseAlignAttribute(nsString& aValue, eAlign& aAlign, PRInt32& aRowIndex)
nsresult error;
aValue.Cut(0, len); // aValue is not a const here
aRowIndex = aValue.ToInteger(&error);
if (error)
if (NS_FAILED(error))
aRowIndex = 0;
}
}
@ -777,7 +777,7 @@ nsMathMLmtdFrame::GetRowSpan()
if (!value.IsEmpty()) {
nsresult error;
rowspan = value.ToInteger(&error);
if (error || rowspan < 0)
if (NS_FAILED(error) || rowspan < 0)
rowspan = 1;
rowspan = NS_MIN(rowspan, MAX_ROWSPAN);
}
@ -797,7 +797,7 @@ nsMathMLmtdFrame::GetColSpan()
if (!value.IsEmpty()) {
nsresult error;
colspan = value.ToInteger(&error);
if (error || colspan < 0 || colspan > MAX_COLSPAN)
if (NS_FAILED(error) || colspan < 0 || colspan > MAX_COLSPAN)
colspan = 1;
}
}

View File

@ -2169,7 +2169,7 @@ CEntityToken::TranslateToUnicodeStr(nsString& aString)
value = mTextValue.ToInteger(&err, kAutoDetect);
if (0 == err) {
if (NS_SUCCEEDED(err)) {
AppendNCR(aString, value);
}
} else {

View File

@ -275,7 +275,7 @@ nsCertOverrideService::Read()
nsresult portParseError;
nsCAutoString portString(Substring(host, portIndex+1));
port = portString.ToInteger(&portParseError);
if (portParseError)
if (NS_FAILED(portParseError))
continue; // Ignore broken entries
host.Truncate(portIndex);

View File

@ -343,7 +343,7 @@ static bool HostIgnoredByProxy(const nsACString& aIgnore,
nsCAutoString maskStr2(maskStr);
nsresult err;
mask = maskStr2.ToInteger(&err);
if (err != 0) {
if (NS_FAILED(err)) {
mask = 128;
}
--slash;