зеркало из https://github.com/mozilla/gecko-dev.git
Bug 782252 - Use NS_FAILED instead of boolean test for ToInteger()/ToFloat(); r=ehsan
This commit is contained in:
Родитель
febeb17b31
Коммит
061fd9f9ca
|
@ -1175,7 +1175,7 @@ nsPermissionManager::Import()
|
||||||
|
|
||||||
nsresult error;
|
nsresult error;
|
||||||
PRUint32 permission = lineArray[2].ToInteger(&error);
|
PRUint32 permission = lineArray[2].ToInteger(&error);
|
||||||
if (error)
|
if (NS_FAILED(error))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// hosts might be encoded in UTF8; switch them to ACE to be consistent
|
// hosts might be encoded in UTF8; switch them to ACE to be consistent
|
||||||
|
|
|
@ -116,7 +116,7 @@ SetProperty(OperatorData* aOperatorData,
|
||||||
// aValue is assumed to be a digit from 0 to 7
|
// aValue is assumed to be a digit from 0 to 7
|
||||||
nsresult error = NS_OK;
|
nsresult error = NS_OK;
|
||||||
float space = aValue.ToFloat(&error) / 18.0;
|
float space = aValue.ToFloat(&error) / 18.0;
|
||||||
if (error) return;
|
if (NS_FAILED(error)) return;
|
||||||
|
|
||||||
if (isLeadingSpace)
|
if (isLeadingSpace)
|
||||||
aOperatorData->mLeadingSpace = space;
|
aOperatorData->mLeadingSpace = space;
|
||||||
|
|
|
@ -184,7 +184,7 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString,
|
||||||
|
|
||||||
nsresult errorCode;
|
nsresult errorCode;
|
||||||
float floatValue = number.ToFloat(&errorCode);
|
float floatValue = number.ToFloat(&errorCode);
|
||||||
if (errorCode) {
|
if (NS_FAILED(errorCode)) {
|
||||||
aSign = NS_MATHML_SIGN_INVALID;
|
aSign = NS_MATHML_SIGN_INVALID;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ ParseAlignAttribute(nsString& aValue, eAlign& aAlign, PRInt32& aRowIndex)
|
||||||
nsresult error;
|
nsresult error;
|
||||||
aValue.Cut(0, len); // aValue is not a const here
|
aValue.Cut(0, len); // aValue is not a const here
|
||||||
aRowIndex = aValue.ToInteger(&error);
|
aRowIndex = aValue.ToInteger(&error);
|
||||||
if (error)
|
if (NS_FAILED(error))
|
||||||
aRowIndex = 0;
|
aRowIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ nsMathMLmtdFrame::GetRowSpan()
|
||||||
if (!value.IsEmpty()) {
|
if (!value.IsEmpty()) {
|
||||||
nsresult error;
|
nsresult error;
|
||||||
rowspan = value.ToInteger(&error);
|
rowspan = value.ToInteger(&error);
|
||||||
if (error || rowspan < 0)
|
if (NS_FAILED(error) || rowspan < 0)
|
||||||
rowspan = 1;
|
rowspan = 1;
|
||||||
rowspan = NS_MIN(rowspan, MAX_ROWSPAN);
|
rowspan = NS_MIN(rowspan, MAX_ROWSPAN);
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ nsMathMLmtdFrame::GetColSpan()
|
||||||
if (!value.IsEmpty()) {
|
if (!value.IsEmpty()) {
|
||||||
nsresult error;
|
nsresult error;
|
||||||
colspan = value.ToInteger(&error);
|
colspan = value.ToInteger(&error);
|
||||||
if (error || colspan < 0 || colspan > MAX_COLSPAN)
|
if (NS_FAILED(error) || colspan < 0 || colspan > MAX_COLSPAN)
|
||||||
colspan = 1;
|
colspan = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2169,7 +2169,7 @@ CEntityToken::TranslateToUnicodeStr(nsString& aString)
|
||||||
|
|
||||||
value = mTextValue.ToInteger(&err, kAutoDetect);
|
value = mTextValue.ToInteger(&err, kAutoDetect);
|
||||||
|
|
||||||
if (0 == err) {
|
if (NS_SUCCEEDED(err)) {
|
||||||
AppendNCR(aString, value);
|
AppendNCR(aString, value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -275,7 +275,7 @@ nsCertOverrideService::Read()
|
||||||
nsresult portParseError;
|
nsresult portParseError;
|
||||||
nsCAutoString portString(Substring(host, portIndex+1));
|
nsCAutoString portString(Substring(host, portIndex+1));
|
||||||
port = portString.ToInteger(&portParseError);
|
port = portString.ToInteger(&portParseError);
|
||||||
if (portParseError)
|
if (NS_FAILED(portParseError))
|
||||||
continue; // Ignore broken entries
|
continue; // Ignore broken entries
|
||||||
|
|
||||||
host.Truncate(portIndex);
|
host.Truncate(portIndex);
|
||||||
|
|
|
@ -343,7 +343,7 @@ static bool HostIgnoredByProxy(const nsACString& aIgnore,
|
||||||
nsCAutoString maskStr2(maskStr);
|
nsCAutoString maskStr2(maskStr);
|
||||||
nsresult err;
|
nsresult err;
|
||||||
mask = maskStr2.ToInteger(&err);
|
mask = maskStr2.ToInteger(&err);
|
||||||
if (err != 0) {
|
if (NS_FAILED(err)) {
|
||||||
mask = 128;
|
mask = 128;
|
||||||
}
|
}
|
||||||
--slash;
|
--slash;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче