Bug 777292 - Convert incorrect conversions to nsresult and fix named constants; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-07-27 16:59:29 +03:00
parent ddb0196aad
commit c81630fddb
99 changed files with 183 additions and 183 deletions

View file

@ -513,7 +513,7 @@ nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr, PRInt32 *aUInt)
nsAutoString value; nsAutoString value;
aContent->GetAttr(kNameSpaceID_None, aAttr, value); aContent->GetAttr(kNameSpaceID_None, aAttr, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
PRInt32 error = NS_OK; nsresult error = NS_OK;
PRInt32 integer = value.ToInteger(&error); PRInt32 integer = value.ToInteger(&error);
if (NS_SUCCEEDED(error) && integer > 0) { if (NS_SUCCEEDED(error) && integer > 0) {
*aUInt = integer; *aUInt = integer;

View file

@ -3056,7 +3056,7 @@ Accessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
if (attrValue.IsEmpty()) if (attrValue.IsEmpty())
return NS_OK; return NS_OK;
PRInt32 error = NS_OK; nsresult error = NS_OK;
double value = attrValue.ToDouble(&error); double value = attrValue.ToDouble(&error);
if (NS_SUCCEEDED(error)) if (NS_SUCCEEDED(error))
*aValue = value; *aValue = value;

View file

@ -111,7 +111,7 @@ ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
nsAutoString value; nsAutoString value;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) { if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
PRInt32 result = NS_OK; nsresult result = NS_OK;
*aMaximumValue = value.ToDouble(&result); *aMaximumValue = value.ToDouble(&result);
return result; return result;
} }
@ -159,7 +159,7 @@ ProgressMeterAccessible<Max>::GetCurrentValue(double* aCurrentValue)
if (attrValue.IsEmpty()) if (attrValue.IsEmpty())
return NS_OK; return NS_OK;
PRInt32 error = NS_OK; nsresult error = NS_OK;
double value = attrValue.ToDouble(&error); double value = attrValue.ToDouble(&error);
if (NS_FAILED(error)) if (NS_FAILED(error))
return NS_OK; // Zero value because of wrong markup. return NS_OK; // Zero value because of wrong markup.

View file

@ -313,7 +313,7 @@ nsXFormsRangeAccessible::GetMaximumValue(double *aMaximumValue)
nsresult rv = sXFormsService->GetRangeEnd(DOMNode, value); nsresult rv = sXFormsService->GetRangeEnd(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK; nsresult error = NS_OK;
*aMaximumValue = value.ToDouble(&error); *aMaximumValue = value.ToDouble(&error);
return error; return error;
} }
@ -328,7 +328,7 @@ nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue)
nsresult rv = sXFormsService->GetRangeStart(DOMNode, value); nsresult rv = sXFormsService->GetRangeStart(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK; nsresult error = NS_OK;
*aMinimumValue = value.ToDouble(&error); *aMinimumValue = value.ToDouble(&error);
return error; return error;
} }
@ -343,7 +343,7 @@ nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement)
nsresult rv = sXFormsService->GetRangeStep(DOMNode, value); nsresult rv = sXFormsService->GetRangeStep(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK; nsresult error = NS_OK;
*aMinimumIncrement = value.ToDouble(&error); *aMinimumIncrement = value.ToDouble(&error);
return error; return error;
} }
@ -358,7 +358,7 @@ nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue)
nsresult rv = sXFormsService->GetValue(DOMNode, value); nsresult rv = sXFormsService->GetValue(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK; nsresult error = NS_OK;
*aCurrentValue = value.ToDouble(&error); *aCurrentValue = value.ToDouble(&error);
return error; return error;
} }

View file

@ -213,7 +213,7 @@ XULMenuitemAccessible::KeyboardShortcut() const
if (keyStr.IsEmpty()) { if (keyStr.IsEmpty()) {
nsAutoString keyCodeStr; nsAutoString keyCodeStr;
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr); keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
PRUint32 errorCode; nsresult errorCode;
key = keyStr.ToInteger(&errorCode, kAutoDetect); key = keyStr.ToInteger(&errorCode, kAutoDetect);
} else { } else {
key = keyStr[0]; key = keyStr[0];

View file

@ -223,7 +223,7 @@ XULSliderAccessible::GetSliderAttr(nsIAtom* aName, double* aValue)
if (attrValue.IsEmpty()) if (attrValue.IsEmpty())
return NS_OK; return NS_OK;
PRInt32 error = NS_OK; nsresult error = NS_OK;
double value = attrValue.ToDouble(&error); double value = attrValue.ToDouble(&error);
if (NS_SUCCEEDED(error)) if (NS_SUCCEEDED(error))
*aValue = value; *aValue = value;

View file

@ -188,7 +188,7 @@ Link::SetHost(const nsAString &aHost)
if (iter != end) { if (iter != end) {
nsAutoString portStr(Substring(iter, end)); nsAutoString portStr(Substring(iter, end));
nsresult rv; nsresult rv;
PRInt32 port = portStr.ToInteger((PRInt32 *)&rv); PRInt32 port = portStr.ToInteger(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
(void)uri->SetPort(port); (void)uri->SetPort(port);
} }
@ -254,7 +254,7 @@ Link::SetPort(const nsAString &aPort)
nsresult rv; nsresult rv;
nsAutoString portStr(aPort); nsAutoString portStr(aPort);
PRInt32 port = portStr.ToInteger((PRInt32 *)&rv); PRInt32 port = portStr.ToInteger(&rv);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return NS_OK; return NS_OK;
} }

View file

@ -1462,7 +1462,7 @@ bool nsAttrValue::ParseDoubleValue(const nsAString& aString)
{ {
ResetIfSet(); ResetIfSet();
PRInt32 ec; nsresult ec;
double val = PromiseFlatString(aString).ToDouble(&ec); double val = PromiseFlatString(aString).ToDouble(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
return false; return false;

View file

@ -1261,8 +1261,8 @@ nsContentUtils::ParseIntMarginValue(const nsAString& aString, nsIntMargin& resul
if (end <= 0) if (end <= 0)
return false; return false;
PRInt32 ec, val = nsresult ec;
nsString(Substring(marginStr, start, end)).ToInteger(&ec); PRInt32 val = nsString(Substring(marginStr, start, end)).ToInteger(&ec);
if (NS_FAILED(ec)) if (NS_FAILED(ec))
return false; return false;
@ -5020,11 +5020,10 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
return ret; return ret;
} }
PRInt32 errorCode;
nsAutoString minScaleStr; nsAutoString minScaleStr;
aDocument->GetHeaderData(nsGkAtoms::minimum_scale, minScaleStr); aDocument->GetHeaderData(nsGkAtoms::minimum_scale, minScaleStr);
nsresult errorCode;
float scaleMinFloat = minScaleStr.ToFloat(&errorCode); float scaleMinFloat = minScaleStr.ToFloat(&errorCode);
if (errorCode) { if (errorCode) {
@ -5039,7 +5038,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
// We define a special error code variable for the scale and max scale, // We define a special error code variable for the scale and max scale,
// because they are used later (see the width calculations). // because they are used later (see the width calculations).
PRInt32 scaleMaxErrorCode; nsresult scaleMaxErrorCode;
float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode); float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode);
if (scaleMaxErrorCode) { if (scaleMaxErrorCode) {
@ -5052,7 +5051,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
nsAutoString scaleStr; nsAutoString scaleStr;
aDocument->GetHeaderData(nsGkAtoms::viewport_initial_scale, scaleStr); aDocument->GetHeaderData(nsGkAtoms::viewport_initial_scale, scaleStr);
PRInt32 scaleErrorCode; nsresult scaleErrorCode;
float scaleFloat = scaleStr.ToFloat(&scaleErrorCode); float scaleFloat = scaleStr.ToFloat(&scaleErrorCode);
scaleFloat = NS_MIN(scaleFloat, scaleMaxFloat); scaleFloat = NS_MIN(scaleFloat, scaleMaxFloat);
scaleFloat = NS_MAX(scaleFloat, scaleMinFloat); scaleFloat = NS_MAX(scaleFloat, scaleMinFloat);

View file

@ -241,7 +241,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start); aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
if (!start.IsEmpty()){ if (!start.IsEmpty()){
PRInt32 rv = 0; nsresult rv = NS_OK;
startAttrVal = start.ToInteger(&rv); startAttrVal = start.ToInteger(&rv);
//If OL has "start" attribute, first LI element has to start with that value //If OL has "start" attribute, first LI element has to start with that value
//Therefore subtracting 1 as all the LI elements are incrementing it before using it; //Therefore subtracting 1 as all the LI elements are incrementing it before using it;

View file

@ -480,7 +480,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
: style.Length() - widthOffset); : style.Length() - widthOffset);
nsAutoString widthstr; nsAutoString widthstr;
style.Mid(widthstr, widthOffset+6, length); style.Mid(widthstr, widthOffset+6, length);
PRInt32 err; nsresult err;
PRInt32 col = widthstr.ToInteger(&err); PRInt32 col = widthstr.ToInteger(&err);
if (NS_SUCCEEDED(err)) { if (NS_SUCCEEDED(err)) {
@ -563,7 +563,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
nsAutoString startAttr; nsAutoString startAttr;
PRInt32 startVal = 1; PRInt32 startVal = 1;
if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::start, startAttr))) { if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::start, startAttr))) {
PRInt32 rv = 0; nsresult rv = NS_OK;
startVal = startAttr.ToInteger(&rv); startVal = startAttr.ToInteger(&rv);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
startVal = 1; startVal = 1;
@ -581,7 +581,7 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
if (mOLStackIndex > 0) { if (mOLStackIndex > 0) {
nsAutoString valueAttr; nsAutoString valueAttr;
if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::value, valueAttr))) { if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::value, valueAttr))) {
PRInt32 rv = 0; nsresult rv = NS_OK;
PRInt32 valueAttrVal = valueAttr.ToInteger(&rv); PRInt32 valueAttrVal = valueAttr.ToInteger(&rv);
if (NS_SUCCEEDED(rv)) if (NS_SUCCEEDED(rv))
mOLStack[mOLStackIndex-1] = valueAttrVal; mOLStack[mOLStackIndex-1] = valueAttrVal;

View file

@ -254,7 +254,7 @@ nsXHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
PRInt32 startAttrVal = 0; PRInt32 startAttrVal = 0;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start); aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
if (!start.IsEmpty()) { if (!start.IsEmpty()) {
PRInt32 rv = 0; nsresult rv = NS_OK;
startAttrVal = start.ToInteger(&rv); startAttrVal = start.ToInteger(&rv);
//If OL has "start" attribute, first LI element has to start with that value //If OL has "start" attribute, first LI element has to start with that value
//Therefore subtracting 1 as all the LI elements are incrementing it before using it; //Therefore subtracting 1 as all the LI elements are incrementing it before using it;
@ -920,7 +920,7 @@ nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement,
offset++; offset++;
else { else {
found = true; found = true;
PRInt32 rv = 0; nsresult rv = NS_OK;
startVal = valueStr.ToInteger(&rv); startVal = valueStr.ToInteger(&rv);
} }
} }

View file

@ -1794,7 +1794,7 @@ NS_IMETHODIMP
nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress, nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
PRUint32 aStateFlags, PRUint32 aStateFlags,
PRUint32 aStatus) nsresult aStatus)
{ {
// If STATE_STOP is never fired for any reason (redirect? Failed state // If STATE_STOP is never fired for any reason (redirect? Failed state
// change?) the form element will leak. It will be kept around by the // change?) the form element will leak. It will be kept around by the

View file

@ -275,7 +275,7 @@ nsHTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
} }
else { else {
// Otherwise just convert to integer. // Otherwise just convert to integer.
PRInt32 err; nsresult err;
specs[i].mValue = token.ToInteger(&err); specs[i].mValue = token.ToInteger(&err);
if (err) { if (err) {
specs[i].mValue = 0; specs[i].mValue = 0;

View file

@ -1005,7 +1005,7 @@ nsHTMLInputElement::GetValueAsDouble() const
{ {
double doubleValue; double doubleValue;
nsAutoString stringValue; nsAutoString stringValue;
PRInt32 ec; nsresult ec;
GetValueInternal(stringValue); GetValueInternal(stringValue);
doubleValue = stringValue.ToDouble(&ec); doubleValue = stringValue.ToDouble(&ec);
@ -1107,7 +1107,7 @@ nsHTMLInputElement::GetMinAsDouble() const
nsAutoString minStr; nsAutoString minStr;
GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr); GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
PRInt32 ec; nsresult ec;
double min = minStr.ToDouble(&ec); double min = minStr.ToDouble(&ec);
return NS_SUCCEEDED(ec) ? min : MOZ_DOUBLE_NaN(); return NS_SUCCEEDED(ec) ? min : MOZ_DOUBLE_NaN();
} }
@ -1125,7 +1125,7 @@ nsHTMLInputElement::GetMaxAsDouble() const
nsAutoString maxStr; nsAutoString maxStr;
GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr); GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
PRInt32 ec; nsresult ec;
double max = maxStr.ToDouble(&ec); double max = maxStr.ToDouble(&ec);
return NS_SUCCEEDED(ec) ? max : MOZ_DOUBLE_NaN(); return NS_SUCCEEDED(ec) ? max : MOZ_DOUBLE_NaN();
} }
@ -2661,7 +2661,7 @@ nsHTMLInputElement::SanitizeValue(nsAString& aValue)
break; break;
case NS_FORM_INPUT_NUMBER: case NS_FORM_INPUT_NUMBER:
{ {
PRInt32 ec; nsresult ec;
PromiseFlatString(aValue).ToDouble(&ec); PromiseFlatString(aValue).ToDouble(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
aValue.Truncate(); aValue.Truncate();
@ -3863,7 +3863,7 @@ nsHTMLInputElement::GetStep() const
return kStepAny; return kStepAny;
} }
PRInt32 ec; nsresult ec;
// NOTE: should be multiplied by defaultStepScaleFactor, // NOTE: should be multiplied by defaultStepScaleFactor,
// which is 1 for type=number. // which is 1 for type=number.
step = stepStr.ToDouble(&ec); step = stepStr.ToDouble(&ec);

View file

@ -106,7 +106,7 @@ bool nsMediaFragmentURIParser::ParseNPTSec(nsDependentSubstring& aString, double
} }
nsDependentSubstring n(aString, 0, index); nsDependentSubstring n(aString, 0, index);
PRInt32 ec; nsresult ec;
PRInt32 s = PromiseFlatString(n).ToInteger(&ec); PRInt32 s = PromiseFlatString(n).ToInteger(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
return false; return false;
@ -162,7 +162,7 @@ bool nsMediaFragmentURIParser::ParseNPTFraction(nsDependentSubstring& aString, d
if (index > 1) { if (index > 1) {
nsDependentSubstring number(aString, 0, index); nsDependentSubstring number(aString, 0, index);
PRInt32 ec; nsresult ec;
fraction = PromiseFlatString(number).ToDouble(&ec); fraction = PromiseFlatString(number).ToDouble(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
return false; return false;
@ -211,7 +211,7 @@ bool nsMediaFragmentURIParser::ParseNPTHH(nsDependentSubstring& aString, PRUint3
} }
nsDependentSubstring n(aString, 0, index); nsDependentSubstring n(aString, 0, index);
PRInt32 ec; nsresult ec;
PRInt32 u = PromiseFlatString(n).ToInteger(&ec); PRInt32 u = PromiseFlatString(n).ToInteger(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
return false; return false;
@ -235,8 +235,7 @@ bool nsMediaFragmentURIParser::ParseNPTSS(nsDependentSubstring& aString, PRUint3
if (IsDigit(aString[0]) && IsDigit(aString[1])) { if (IsDigit(aString[0]) && IsDigit(aString[1])) {
nsDependentSubstring n(aString, 0, 2); nsDependentSubstring n(aString, 0, 2);
PRInt32 ec; nsresult ec;
PRInt32 u = PromiseFlatString(n).ToInteger(&ec); PRInt32 u = PromiseFlatString(n).ToInteger(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
return false; return false;

View file

@ -334,7 +334,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
} }
// Convert number to floating point // Convert number to floating point
PRInt32 errorCode; nsresult errorCode;
float floatValue = number.ToFloat(&errorCode); float floatValue = number.ToFloat(&errorCode);
if (NS_FAILED(errorCode)) if (NS_FAILED(errorCode))
return false; return false;
@ -397,7 +397,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
str.CompressWhitespace(); str.CompressWhitespace();
// MathML numbers can't have leading '+' // MathML numbers can't have leading '+'
if (str.Length() > 0 && str.CharAt(0) != '+') { if (str.Length() > 0 && str.CharAt(0) != '+') {
PRInt32 errorCode; nsresult errorCode;
float floatValue = str.ToFloat(&errorCode); float floatValue = str.ToFloat(&errorCode);
// Negative scriptsizemultipliers are not parsed // Negative scriptsizemultipliers are not parsed
if (NS_SUCCEEDED(errorCode) && floatValue >= 0.0f) { if (NS_SUCCEEDED(errorCode) && floatValue >= 0.0f) {
@ -443,7 +443,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
nsAutoString str(value->GetStringValue()); nsAutoString str(value->GetStringValue());
str.CompressWhitespace(); str.CompressWhitespace();
if (str.Length() > 0) { if (str.Length() > 0) {
PRInt32 errorCode; nsresult errorCode;
PRInt32 intValue = str.ToInteger(&errorCode); PRInt32 intValue = str.ToInteger(&errorCode);
if (NS_SUCCEEDED(errorCode)) { if (NS_SUCCEEDED(errorCode)) {
// This is kind of cheesy ... if the scriptlevel has a sign, // This is kind of cheesy ... if the scriptlevel has a sign,

View file

@ -180,7 +180,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
// 4) X-Content-Duration. // 4) X-Content-Duration.
// 5) Perform a seek in the decoder to find the value. // 5) Perform a seek in the decoder to find the value.
nsCAutoString durationText; nsCAutoString durationText;
PRInt32 ec = 0; nsresult ec = NS_OK;
rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("Content-Duration"), durationText); rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("Content-Duration"), durationText);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("X-AMZ-Meta-Content-Duration"), durationText); rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("X-AMZ-Meta-Content-Duration"), durationText);

View file

@ -196,7 +196,7 @@ nsXULContextMenuBuilder::Init(nsIDOMDocumentFragment* aDocumentFragment,
NS_IMETHODIMP NS_IMETHODIMP
nsXULContextMenuBuilder::Click(const nsAString& aGeneratedItemId) nsXULContextMenuBuilder::Click(const nsAString& aGeneratedItemId)
{ {
PRInt32 rv; nsresult rv;
PRInt32 idx = nsString(aGeneratedItemId).ToInteger(&rv); PRInt32 idx = nsString(aGeneratedItemId).ToInteger(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIDOMHTMLElement> element = mElements.SafeObjectAt(idx); nsCOMPtr<nsIDOMHTMLElement> element = mElements.SafeObjectAt(idx);

View file

@ -4422,7 +4422,7 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild,
if (!posStr.IsEmpty()) { if (!posStr.IsEmpty()) {
nsresult rv; nsresult rv;
// Positions are one-indexed. // Positions are one-indexed.
PRInt32 pos = posStr.ToInteger(reinterpret_cast<PRInt32*>(&rv)); PRInt32 pos = posStr.ToInteger(&rv);
// Note: if the insertion index (which is |pos - 1|) would be less // Note: if the insertion index (which is |pos - 1|) would be less
// than 0 or greater than the number of children aParent has, then // than 0 or greater than the number of children aParent has, then
// don't insert, since the position is bogus. Just skip on to // don't insert, since the position is bogus. Just skip on to

View file

@ -155,7 +155,7 @@ nsTemplateCondition::CheckMatchStrings(const nsAString& aLeftString,
case eGreater: case eGreater:
{ {
// non-numbers always compare false // non-numbers always compare false
PRInt32 err; nsresult err;
PRInt32 leftint = PromiseFlatString(aLeftString).ToInteger(&err); PRInt32 leftint = PromiseFlatString(aLeftString).ToInteger(&err);
if (NS_SUCCEEDED(err)) { if (NS_SUCCEEDED(err)) {
PRInt32 rightint = PromiseFlatString(aRightString).ToInteger(&err); PRInt32 rightint = PromiseFlatString(aRightString).ToInteger(&err);

View file

@ -1889,7 +1889,7 @@ nsXULContentBuilder::InsertSortedNode(nsIContent* aContainer,
if (!staticValue.IsEmpty()) if (!staticValue.IsEmpty())
{ {
// found "static" XUL element count hint // found "static" XUL element count hint
PRInt32 strErr = 0; nsresult strErr = NS_OK;
staticCount = staticValue.ToInteger(&strErr); staticCount = staticValue.ToInteger(&strErr);
if (strErr) if (strErr)
staticCount = 0; staticCount = 0;

View file

@ -453,7 +453,7 @@ XULSortServiceImpl::CompareValues(const nsAString& aLeft,
PRUint32 aSortHints) PRUint32 aSortHints)
{ {
if (aSortHints & SORT_INTEGER) { if (aSortHints & SORT_INTEGER) {
PRInt32 err; nsresult err;
PRInt32 leftint = PromiseFlatString(aLeft).ToInteger(&err); PRInt32 leftint = PromiseFlatString(aLeft).ToInteger(&err);
if (NS_SUCCEEDED(err)) { if (NS_SUCCEEDED(err)) {
PRInt32 rightint = PromiseFlatString(aRight).ToInteger(&err); PRInt32 rightint = PromiseFlatString(aRight).ToInteger(&err);

View file

@ -1321,7 +1321,7 @@ nsXULTemplateQueryProcessorRDF::ParseLiteral(const nsString& aParseType,
if (aParseType.EqualsLiteral(PARSE_TYPE_INTEGER)) { if (aParseType.EqualsLiteral(PARSE_TYPE_INTEGER)) {
nsCOMPtr<nsIRDFInt> intLiteral; nsCOMPtr<nsIRDFInt> intLiteral;
PRInt32 errorCode; nsresult errorCode;
PRInt32 intValue = aValue.ToInteger(&errorCode); PRInt32 intValue = aValue.ToInteger(&errorCode);
if (NS_FAILED(errorCode)) if (NS_FAILED(errorCode))
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;

View file

@ -37,7 +37,7 @@ interface nsIContentViewer : nsISupports
attribute nsISupports container; attribute nsISupports container;
void loadStart(in nsISupports aDoc); void loadStart(in nsISupports aDoc);
void loadComplete(in unsigned long aStatus); void loadComplete(in nsresult aStatus);
/** /**
* Checks if the document wants to prevent unloading by firing beforeunload on * Checks if the document wants to prevent unloading by firing beforeunload on

View file

@ -10292,7 +10292,7 @@ nsStorage2SH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSString *jsstr = IdToString(cx, id); JSString *jsstr = IdToString(cx, id);
if (!jsstr) { if (!jsstr) {
return JS_FALSE; return NS_OK;
} }
JSObject *proto = ::JS_GetPrototype(realObj); JSObject *proto = ::JS_GetPrototype(realObj);

View file

@ -70,7 +70,7 @@ static struct ResultStruct
const char* mMessage; const char* mMessage;
} gDOMErrorMsgMap[] = { } gDOMErrorMsgMap[] = {
#include "domerr.msg" #include "domerr.msg"
{0, 0, nullptr, nullptr} // sentinel to mark end of array {NS_OK, 0, nullptr, nullptr} // sentinel to mark end of array
}; };
#undef DOM4_MSG_DEF #undef DOM4_MSG_DEF
@ -205,7 +205,7 @@ nsDOMException::GetMessageMoz(char **aMessage)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMException::GetResult(PRUint32* aResult) nsDOMException::GetResult(nsresult* aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult); NS_ENSURE_ARG_POINTER(aResult);

View file

@ -2926,7 +2926,8 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
nsAutoString tabIndexStr; nsAutoString tabIndexStr;
child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr); child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
PRInt32 ec, val = tabIndexStr.ToInteger(&ec); nsresult ec;
PRInt32 val = tabIndexStr.ToInteger(&ec);
if (NS_SUCCEEDED (ec) && val > aCurrentTabIndex && val != tabIndex) { if (NS_SUCCEEDED (ec) && val > aCurrentTabIndex && val != tabIndex) {
tabIndex = (tabIndex == 0 || val < tabIndex) ? val : tabIndex; tabIndex = (tabIndex == 0 || val < tabIndex) ? val : tabIndex;
} }
@ -2945,7 +2946,8 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
nsAutoString tabIndexStr; nsAutoString tabIndexStr;
child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr); child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
PRInt32 ec, val = tabIndexStr.ToInteger(&ec); nsresult ec;
PRInt32 val = tabIndexStr.ToInteger(&ec);
if (NS_SUCCEEDED (ec)) { if (NS_SUCCEEDED (ec)) {
if ((aCurrentTabIndex == 0 && val > tabIndex) || if ((aCurrentTabIndex == 0 && val > tabIndex) ||
(val < aCurrentTabIndex && val > tabIndex) ) { (val < aCurrentTabIndex && val > tabIndex) ) {

View file

@ -961,7 +961,7 @@ public:
// the one and only TabChild. // the one and only TabChild.
TabChild* child = GetTabChildFrom(mWindow->GetDocShell()); TabChild* child = GetTabChildFrom(mWindow->GetDocShell());
if (!child) if (!child)
return false; return NS_OK;
// Retain a reference so the object isn't deleted without IPDL's knowledge. // Retain a reference so the object isn't deleted without IPDL's knowledge.
// Corresponding release occurs in DeallocPContentPermissionRequest. // Corresponding release occurs in DeallocPContentPermissionRequest.
@ -1457,7 +1457,7 @@ nsDOMDeviceStorage::EnumerateInternal(const JS::Value & aName,
// the one and only TabChild. // the one and only TabChild.
TabChild* child = GetTabChildFrom(win->GetDocShell()); TabChild* child = GetTabChildFrom(win->GetDocShell());
if (!child) if (!child)
return false; return NS_OK;
// Retain a reference so the object isn't deleted without IPDL's knowledge. // Retain a reference so the object isn't deleted without IPDL's knowledge.
// Corresponding release occurs in DeallocPContentPermissionRequest. // Corresponding release occurs in DeallocPContentPermissionRequest.

View file

@ -305,12 +305,12 @@ IDBTransaction::ReleaseSavepoint()
nsCOMPtr<mozIStorageStatement> stmt = GetCachedStatement(NS_LITERAL_CSTRING( nsCOMPtr<mozIStorageStatement> stmt = GetCachedStatement(NS_LITERAL_CSTRING(
"RELEASE SAVEPOINT " SAVEPOINT_NAME "RELEASE SAVEPOINT " SAVEPOINT_NAME
)); ));
NS_ENSURE_TRUE(stmt, false); NS_ENSURE_TRUE(stmt, NS_OK);
mozStorageStatementScoper scoper(stmt); mozStorageStatementScoper scoper(stmt);
nsresult rv = stmt->Execute(); nsresult rv = stmt->Execute();
NS_ENSURE_SUCCESS(rv, false); NS_ENSURE_SUCCESS(rv, NS_OK);
--mSavepointCount; --mSavepointCount;

View file

@ -155,7 +155,7 @@ Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer &aTokenizer
// //
nsDependentCSubstring mntPoint(aTokenizer.nextToken()); nsDependentCSubstring mntPoint(aTokenizer.nextToken());
SetMountPoint(mntPoint); SetMountPoint(mntPoint);
PRInt32 errCode; nsresult errCode;
nsCString state(aTokenizer.nextToken()); nsCString state(aTokenizer.nextToken());
SetState((STATE)state.ToInteger(&errCode)); SetState((STATE)state.ToInteger(&errCode));
break; break;
@ -170,7 +170,7 @@ Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer &aTokenizer
while (aTokenizer.hasMoreTokens()) { while (aTokenizer.hasMoreTokens()) {
nsCAutoString token(aTokenizer.nextToken()); nsCAutoString token(aTokenizer.nextToken());
if (token.Equals("to")) { if (token.Equals("to")) {
PRInt32 errCode; nsresult errCode;
token = aTokenizer.nextToken(); token = aTokenizer.nextToken();
SetState((STATE)token.ToInteger(&errCode)); SetState((STATE)token.ToInteger(&errCode));
break; break;

View file

@ -1794,7 +1794,7 @@ WorkerRunnable::Run()
JSAutoEnterCompartment ac; JSAutoEnterCompartment ac;
if (targetCompartmentObject && !ac.enter(cx, targetCompartmentObject)) { if (targetCompartmentObject && !ac.enter(cx, targetCompartmentObject)) {
return false; return NS_OK;
} }
bool result = WorkerRun(cx, mWorkerPrivate); bool result = WorkerRun(cx, mWorkerPrivate);

View file

@ -3285,7 +3285,7 @@ nsEditor::GetNextNode(nsINode* aParentNode,
// and want the next one. // and want the next one.
if (aNoBlockCrossing && IsBlockNode(aParentNode)) { if (aNoBlockCrossing && IsBlockNode(aParentNode)) {
// don't cross out of parent block // don't cross out of parent block
return NS_OK; return nullptr;
} }
return GetNextNode(aParentNode, aEditableNode, aNoBlockCrossing); return GetNextNode(aParentNode, aEditableNode, aNoBlockCrossing);

View file

@ -233,7 +233,7 @@ nsHTMLEditor::GetElementZIndex(nsIDOMElement * aElement,
} }
if (!zIndexStr.EqualsLiteral("auto")) { if (!zIndexStr.EqualsLiteral("auto")) {
PRInt32 errorCode; nsresult errorCode;
*aZindex = zIndexStr.ToInteger(&errorCode); *aZindex = zIndexStr.ToInteger(&errorCode);
} }

View file

@ -1155,7 +1155,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode *aNode,
valueString.AssignLiteral("bold"); valueString.AssignLiteral("bold");
} else { } else {
PRInt32 weight = 0; PRInt32 weight = 0;
PRInt32 errorCode; nsresult errorCode;
nsAutoString value(valueString); nsAutoString value(valueString);
weight = value.ToInteger(&errorCode, 10); weight = value.ToInteger(&errorCode, 10);
if (400 < weight) { if (400 < weight) {

View file

@ -1043,7 +1043,7 @@ FindIntegerAfterString(const char *aLeadingString,
return false; return false;
nsCAutoString numStr(Substring(aCStr, numFront, numBack-numFront)); nsCAutoString numStr(Substring(aCStr, numFront, numBack-numFront));
PRInt32 errorCode; nsresult errorCode;
foundNumber = numStr.ToInteger(&errorCode); foundNumber = numStr.ToInteger(&errorCode);
return true; return true;
} }
@ -2289,12 +2289,13 @@ nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString,
nsAutoString numstr1, numstr2; nsAutoString numstr1, numstr2;
if (!aInfoStr.IsEmpty()) if (!aInfoStr.IsEmpty())
{ {
PRInt32 err, sep, num; PRInt32 sep, num;
sep = aInfoStr.FindChar((PRUnichar)','); sep = aInfoStr.FindChar((PRUnichar)',');
numstr1 = Substring(aInfoStr, 0, sep); numstr1 = Substring(aInfoStr, 0, sep);
numstr2 = Substring(aInfoStr, sep+1, aInfoStr.Length() - (sep+1)); numstr2 = Substring(aInfoStr, sep+1, aInfoStr.Length() - (sep+1));
// Move the start and end children. // Move the start and end children.
nsresult err;
num = numstr1.ToInteger(&err); num = numstr1.ToInteger(&err);
while (num--) while (num--)
{ {

View file

@ -1867,13 +1867,13 @@ nsTextServicesDocument::DidJoinNodes(nsIDOMNode *aLeftNode,
// Make sure that both nodes are text nodes -- otherwise we don't care. // Make sure that both nodes are text nodes -- otherwise we don't care.
result = aLeftNode->GetNodeType(&type); result = aLeftNode->GetNodeType(&type);
NS_ENSURE_SUCCESS(result, false); NS_ENSURE_SUCCESS(result, NS_OK);
if (nsIDOMNode::TEXT_NODE != type) { if (nsIDOMNode::TEXT_NODE != type) {
return NS_OK; return NS_OK;
} }
result = aRightNode->GetNodeType(&type); result = aRightNode->GetNodeType(&type);
NS_ENSURE_SUCCESS(result, false); NS_ENSURE_SUCCESS(result, NS_OK);
if (nsIDOMNode::TEXT_NODE != type) { if (nsIDOMNode::TEXT_NODE != type) {
return NS_OK; return NS_OK;
} }

View file

@ -27,7 +27,7 @@ nsPrintProgress::nsPrintProgress(nsIPrintSettings* aPrintSettings)
m_closeProgress = false; m_closeProgress = false;
m_processCanceled = false; m_processCanceled = false;
m_pendingStateFlags = -1; m_pendingStateFlags = -1;
m_pendingStateValue = 0; m_pendingStateValue = NS_OK;
m_PrintSetting = aPrintSettings; m_PrintSetting = aPrintSettings;
} }
@ -115,7 +115,7 @@ NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(bool aProcessCanceledByU
if(m_PrintSetting) if(m_PrintSetting)
m_PrintSetting->SetIsCancelled(true); m_PrintSetting->SetIsCancelled(true);
m_processCanceled = aProcessCanceledByUser; m_processCanceled = aProcessCanceledByUser;
OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, false); OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, NS_OK);
return NS_OK; return NS_OK;
} }
@ -134,7 +134,7 @@ NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listene
{ {
m_listenerList->AppendElement(listener); m_listenerList->AppendElement(listener);
if (m_closeProgress || m_processCanceled) if (m_closeProgress || m_processCanceled)
listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, 0); listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, NS_OK);
else else
{ {
listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get()); listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get());

View file

@ -34,7 +34,7 @@ private:
bool m_processCanceled; bool m_processCanceled;
nsString m_pendingStatus; nsString m_pendingStatus;
PRInt32 m_pendingStateFlags; PRInt32 m_pendingStateFlags;
PRInt32 m_pendingStateValue; nsresult m_pendingStateValue;
nsCOMPtr<nsIDOMWindow> m_dialog; nsCOMPtr<nsIDOMWindow> m_dialog;
nsCOMPtr<nsISupportsArray> m_listenerList; nsCOMPtr<nsISupportsArray> m_listenerList;
nsCOMPtr<nsIObserver> m_observer; nsCOMPtr<nsIObserver> m_observer;

View file

@ -1173,7 +1173,7 @@ nsPermissionManager::Import()
if (lineArray[0].EqualsLiteral(kMatchTypeHost) && if (lineArray[0].EqualsLiteral(kMatchTypeHost) &&
lineArray.Length() == 4) { lineArray.Length() == 4) {
PRInt32 error; nsresult error;
PRUint32 permission = lineArray[2].ToInteger(&error); PRUint32 permission = lineArray[2].ToInteger(&error);
if (error) if (error)
continue; continue;

View file

@ -259,7 +259,7 @@ protected:
virtual nsresult LogMessage(gfxProxyFontEntry *aProxy, virtual nsresult LogMessage(gfxProxyFontEntry *aProxy,
const char *aMessage, const char *aMessage,
PRUint32 aFlags = nsIScriptError::errorFlag, PRUint32 aFlags = nsIScriptError::errorFlag,
nsresult aStatus = 0) = 0; nsresult aStatus = NS_OK) = 0;
const PRUint8* SanitizeOpenTypeData(gfxProxyFontEntry *aProxy, const PRUint8* SanitizeOpenTypeData(gfxProxyFontEntry *aProxy,
const PRUint8* aData, const PRUint8* aData,

View file

@ -43,7 +43,7 @@ nsEntityConverter::LoadVersionPropertyFile()
nsresult rv = bundleService->CreateBundle(url.get(), getter_AddRefs(entities)); nsresult rv = bundleService->CreateBundle(url.get(), getter_AddRefs(entities));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
PRInt32 result; nsresult result;
nsAutoString key; nsAutoString key;
nsXPIDLString value; nsXPIDLString value;

View file

@ -42,7 +42,7 @@ using mozilla::dom::DestroyProtoOrIfaceCache;
/***************************************************************************/ /***************************************************************************/
// stuff used by all // stuff used by all
static nsresult ThrowAndFail(unsigned errNum, JSContext* cx, bool* retval) static nsresult ThrowAndFail(nsresult errNum, JSContext* cx, bool* retval)
{ {
XPCThrower::Throw(errNum, cx); XPCThrower::Throw(errNum, cx);
*retval = false; *retval = false;

View file

@ -27,7 +27,7 @@ static struct ResultMap
{(val), #val, format}, {(val), #val, format},
#include "xpc.msg" #include "xpc.msg"
#undef XPC_MSG_DEF #undef XPC_MSG_DEF
{0,0,0} // sentinel to mark end of array {NS_OK,0,0} // sentinel to mark end of array
}; };
#define RESULT_COUNT ((sizeof(map) / sizeof(map[0]))-1) #define RESULT_COUNT ((sizeof(map) / sizeof(map[0]))-1)
@ -100,7 +100,7 @@ NS_IMPL_CI_INTERFACE_GETTER1(nsXPCException, nsIXPCException)
nsXPCException::nsXPCException() nsXPCException::nsXPCException()
: mMessage(nullptr), : mMessage(nullptr),
mResult(0), mResult(NS_OK),
mName(nullptr), mName(nullptr),
mLocation(nullptr), mLocation(nullptr),
mData(nullptr), mData(nullptr),

View file

@ -2228,7 +2228,7 @@ XPCWrappedNative::GetSameCompartmentSecurityWrapper(JSContext *cx)
/***************************************************************************/ /***************************************************************************/
static JSBool Throw(unsigned errNum, XPCCallContext& ccx) static JSBool Throw(nsresult errNum, XPCCallContext& ccx)
{ {
XPCThrower::Throw(errNum, ccx); XPCThrower::Throw(errNum, ccx);
return false; return false;
@ -2676,7 +2676,7 @@ CallMethodHelper::QueryInterfaceFastPath() const
} }
jsval v = JSVAL_NULL; jsval v = JSVAL_NULL;
unsigned err; nsresult err;
JSBool success = JSBool success =
XPCConvert::NativeData2JS(mCallContext, &v, &qiresult, XPCConvert::NativeData2JS(mCallContext, &v, &qiresult,
nsXPTType::T_INTERFACE_IS, nsXPTType::T_INTERFACE_IS,
@ -2842,7 +2842,7 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i)
return false; return false;
} }
unsigned err; nsresult err;
if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type, if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type,
true, &param_iid, &err)) { true, &param_iid, &err)) {
ThrowBadParam(err, i, mCallContext); ThrowBadParam(err, i, mCallContext);
@ -2940,7 +2940,7 @@ CallMethodHelper::ConvertDependentParam(uint8_t i)
!GetInterfaceTypeFromParam(i, datum_type, &param_iid)) !GetInterfaceTypeFromParam(i, datum_type, &param_iid))
return false; return false;
unsigned err; nsresult err;
if (isArray || isSizedString) { if (isArray || isSizedString) {
if (!GetArraySizeFromParam(i, &array_count)) if (!GetArraySizeFromParam(i, &array_count))

View file

@ -17,7 +17,7 @@
// All of the exceptions thrown into JS from this file go through here. // All of the exceptions thrown into JS from this file go through here.
// That makes this a nice place to set a breakpoint. // That makes this a nice place to set a breakpoint.
static JSBool Throw(unsigned errNum, JSContext* cx) static JSBool Throw(nsresult errNum, JSContext* cx)
{ {
XPCThrower::Throw(errNum, cx); XPCThrower::Throw(errNum, cx);
return false; return false;

View file

@ -3394,7 +3394,7 @@ public:
static JSBool JSStringWithSize2Native(XPCCallContext& ccx, void* d, jsval s, static JSBool JSStringWithSize2Native(XPCCallContext& ccx, void* d, jsval s,
uint32_t count, const nsXPTType& type, uint32_t count, const nsXPTType& type,
unsigned* pErr); nsresult* pErr);
static nsresult JSValToXPCException(XPCCallContext& ccx, static nsresult JSValToXPCException(XPCCallContext& ccx,
jsval s, jsval s,

View file

@ -1557,7 +1557,7 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
if (-1 != barIndex) { if (-1 != barIndex) {
nsAutoString nameSpaceVal; nsAutoString nameSpaceVal;
contentString.Left(nameSpaceVal, barIndex); contentString.Left(nameSpaceVal, barIndex);
PRInt32 error; nsresult error;
attrNameSpace = nameSpaceVal.ToInteger(&error, 10); attrNameSpace = nameSpaceVal.ToInteger(&error, 10);
contentString.Cut(0, barIndex + 1); contentString.Cut(0, barIndex + 1);
if (contentString.Length()) { if (contentString.Length()) {

View file

@ -1572,7 +1572,7 @@ nsListControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const
// Get the selected value of option from local cache (optimization vs. widget) // Get the selected value of option from local cache (optimization vs. widget)
if (nsGkAtoms::selected == aName) { if (nsGkAtoms::selected == aName) {
nsAutoString val(aValue); nsAutoString val(aValue);
PRInt32 error = 0; nsresult error = NS_OK;
bool selected = false; bool selected = false;
PRInt32 indx = val.ToInteger(&error, 10); // Get index from aValue PRInt32 indx = val.ToInteger(&error, 10); // Get index from aValue
if (error == 0) if (error == 0)

View file

@ -3955,7 +3955,7 @@ nsGfxScrollFrameInner::GetCoordAttribute(nsIBox* aBox, nsIAtom* aAtom,
content->GetAttr(kNameSpaceID_None, aAtom, value); content->GetAttr(kNameSpaceID_None, aAtom, value);
if (!value.IsEmpty()) if (!value.IsEmpty())
{ {
PRInt32 error; nsresult error;
// convert it to appunits // convert it to appunits
nscoord result = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error)); nscoord result = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
nscoord halfPixel = nsPresContext::CSSPixelsToAppUnits(0.5f); nscoord halfPixel = nsPresContext::CSSPixelsToAppUnits(0.5f);

View file

@ -4140,7 +4140,8 @@ nsTextFrame::GetCursor(const nsPoint& aPoint,
nsAutoString tabIndexStr; nsAutoString tabIndexStr;
ancestorContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr); ancestorContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
if (!tabIndexStr.IsEmpty()) { if (!tabIndexStr.IsEmpty()) {
PRInt32 rv, tabIndexVal = tabIndexStr.ToInteger(&rv); nsresult rv;
PRInt32 tabIndexVal = tabIndexStr.ToInteger(&rv);
if (NS_SUCCEEDED(rv) && tabIndexVal >= 0) { if (NS_SUCCEEDED(rv) && tabIndexVal >= 0) {
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT; aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
break; break;

View file

@ -114,7 +114,7 @@ SetProperty(OperatorData* aOperatorData,
else return; // input is not applicable else return; // input is not applicable
// aValue is assumed to be a digit from 0 to 7 // aValue is assumed to be a digit from 0 to 7
PRInt32 error = 0; nsresult error = NS_OK;
float space = aValue.ToFloat(&error) / 18.0; float space = aValue.ToFloat(&error) / 18.0;
if (error) return; if (error) return;

View file

@ -170,7 +170,7 @@ nsMathMLmactionFrame::GetSelectedFrame()
GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::selection_, GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::selection_,
value); value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
PRInt32 errorCode; nsresult errorCode;
selection = value.ToInteger(&errorCode); selection = value.ToInteger(&errorCode);
if (NS_FAILED(errorCode)) if (NS_FAILED(errorCode))
selection = 1; selection = 1;

View file

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

View file

@ -320,7 +320,7 @@ ParseAlignAttribute(nsString& aValue, eAlign& aAlign, PRInt32& aRowIndex)
aAlign = eAlign_axis; aAlign = eAlign_axis;
} }
if (len) { if (len) {
PRInt32 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 (error)
@ -775,7 +775,7 @@ nsMathMLmtdFrame::GetRowSpan()
nsAutoString value; nsAutoString value;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rowspan, value); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rowspan, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
PRInt32 error; nsresult error;
rowspan = value.ToInteger(&error); rowspan = value.ToInteger(&error);
if (error || rowspan < 0) if (error || rowspan < 0)
rowspan = 1; rowspan = 1;
@ -795,7 +795,7 @@ nsMathMLmtdFrame::GetColSpan()
nsAutoString value; nsAutoString value;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::columnspan_, value); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::columnspan_, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
PRInt32 error; nsresult error;
colspan = value.ToInteger(&error); colspan = value.ToInteger(&error);
if (error || colspan < 0 || colspan > MAX_COLSPAN) if (error || colspan < 0 || colspan > MAX_COLSPAN)
colspan = 1; colspan = 1;

View file

@ -123,7 +123,7 @@ nsPrintData::DoOnProgressChange(PRInt32 aProgress,
nsIWebProgressListener* wpl = mPrintProgressListeners.ObjectAt(i); nsIWebProgressListener* wpl = mPrintProgressListeners.ObjectAt(i);
wpl->OnProgressChange(nullptr, nullptr, aProgress, aMaxProgress, aProgress, aMaxProgress); wpl->OnProgressChange(nullptr, nullptr, aProgress, aMaxProgress, aProgress, aMaxProgress);
if (aDoStartStop) { if (aDoStartStop) {
wpl->OnStateChange(nullptr, nullptr, aFlag, 0); wpl->OnStateChange(nullptr, nullptr, aFlag, NS_OK);
} }
} }
} }

View file

@ -72,7 +72,7 @@ protected:
virtual nsresult LogMessage(gfxProxyFontEntry *aProxy, virtual nsresult LogMessage(gfxProxyFontEntry *aProxy,
const char *aMessage, const char *aMessage,
PRUint32 aFlags = nsIScriptError::errorFlag, PRUint32 aFlags = nsIScriptError::errorFlag,
nsresult aStatus = 0); nsresult aStatus = NS_OK);
nsresult CheckFontLoad(gfxProxyFontEntry *aFontToLoad, nsresult CheckFontLoad(gfxProxyFontEntry *aFontToLoad,
const gfxFontFaceSrc *aFontFaceSrc, const gfxFontFaceSrc *aFontFaceSrc,

View file

@ -370,7 +370,7 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
static_cast<nsSVGSVGElement*>(imgRootFrame->GetContent()); static_cast<nsSVGSVGElement*>(imgRootFrame->GetContent());
if (!rootSVGElem || !rootSVGElem->IsSVG(nsGkAtoms::svg)) { if (!rootSVGElem || !rootSVGElem->IsSVG(nsGkAtoms::svg)) {
NS_ABORT_IF_FALSE(false, "missing or non-<svg> root node!!"); NS_ABORT_IF_FALSE(false, "missing or non-<svg> root node!!");
return false; return NS_OK;
} }
// Override preserveAspectRatio in our helper document // Override preserveAspectRatio in our helper document

View file

@ -470,7 +470,7 @@ nsIFrame::GetOrdinal(nsBoxLayoutState& aState)
// When present, attribute value overrides CSS. // When present, attribute value overrides CSS.
nsIContent* content = GetContent(); nsIContent* content = GetContent();
if (content && content->IsXUL()) { if (content && content->IsXUL()) {
PRInt32 error; nsresult error;
nsAutoString value; nsAutoString value;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::ordinal, value); content->GetAttr(kNameSpaceID_None, nsGkAtoms::ordinal, value);
@ -651,7 +651,7 @@ nsIBox::AddCSSPrefSize(nsIBox* aBox, nsSize& aSize, bool &aWidthSet, bool &aHeig
// <select> // <select>
if (content && content->IsXUL()) { if (content && content->IsXUL()) {
nsAutoString value; nsAutoString value;
PRInt32 error; nsresult error;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value); content->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
@ -755,7 +755,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize,
nsIContent* content = aBox->GetContent(); nsIContent* content = aBox->GetContent();
if (content && content->IsXUL()) { if (content && content->IsXUL()) {
nsAutoString value; nsAutoString value;
PRInt32 error; nsresult error;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::minwidth, value); content->GetAttr(kNameSpaceID_None, nsGkAtoms::minwidth, value);
if (!value.IsEmpty()) if (!value.IsEmpty())
@ -818,7 +818,7 @@ nsIBox::AddCSSMaxSize(nsIBox* aBox, nsSize& aSize, bool &aWidthSet, bool &aHeigh
nsIContent* content = aBox->GetContent(); nsIContent* content = aBox->GetContent();
if (content && content->IsXUL()) { if (content && content->IsXUL()) {
nsAutoString value; nsAutoString value;
PRInt32 error; nsresult error;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::maxwidth, value); content->GetAttr(kNameSpaceID_None, nsGkAtoms::maxwidth, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
@ -856,7 +856,7 @@ nsIBox::AddCSSFlex(nsBoxLayoutState& aState, nsIBox* aBox, nscoord& aFlex)
// attribute value overrides CSS // attribute value overrides CSS
nsIContent* content = aBox->GetContent(); nsIContent* content = aBox->GetContent();
if (content && content->IsXUL()) { if (content && content->IsXUL()) {
PRInt32 error; nsresult error;
nsAutoString value; nsAutoString value;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::flex, value); content->GetAttr(kNameSpaceID_None, nsGkAtoms::flex, value);

View file

@ -117,7 +117,7 @@ nsDeckFrame::GetSelectedIndex()
nsAutoString value; nsAutoString value;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::selectedIndex, value)) if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::selectedIndex, value))
{ {
PRInt32 error; nsresult error;
// convert it to an integer // convert it to an integer
index = value.ToInteger(&error); index = value.ToInteger(&error);

View file

@ -601,7 +601,7 @@ nsListBoxBodyFrame::GetRowCount()
PRInt32 PRInt32
nsListBoxBodyFrame::GetFixedRowSize() nsListBoxBodyFrame::GetFixedRowSize()
{ {
PRInt32 dummy; nsresult dummy;
nsAutoString rows; nsAutoString rows;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);

View file

@ -629,7 +629,7 @@ nsMenuPopupFrame::InitializePopup(nsIContent* aAnchorContent,
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left);
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top);
PRInt32 err; nsresult err;
if (!left.IsEmpty()) { if (!left.IsEmpty()) {
PRInt32 x = left.ToInteger(&err); PRInt32 x = left.ToInteger(&err);
if (NS_SUCCEEDED(err)) if (NS_SUCCEEDED(err))
@ -1791,7 +1791,7 @@ nsMenuPopupFrame::MoveToAttributePosition()
nsAutoString left, top; nsAutoString left, top;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left);
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top); mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top);
PRInt32 err1, err2; nsresult err1, err2;
PRInt32 xpos = left.ToInteger(&err1); PRInt32 xpos = left.ToInteger(&err1);
PRInt32 ypos = top.ToInteger(&err2); PRInt32 ypos = top.ToInteger(&err2);

View file

@ -171,7 +171,7 @@ nsSliderFrame::GetIntegerAttribute(nsIContent* content, nsIAtom* atom, PRInt32 d
nsAutoString value; nsAutoString value;
content->GetAttr(kNameSpaceID_None, atom, value); content->GetAttr(kNameSpaceID_None, atom, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {
PRInt32 error; nsresult error;
// convert it to an integer // convert it to an integer
defaultValue = value.ToInteger(&error); defaultValue = value.ToInteger(&error);

View file

@ -178,7 +178,7 @@ nsStackLayout::GetOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsMargin& aOf
if (content) { if (content) {
bool ltr = aChild->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR; bool ltr = aChild->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
nsAutoString value; nsAutoString value;
PRInt32 error; nsresult error;
content->GetAttr(kNameSpaceID_None, nsGkAtoms::start, value); content->GetAttr(kNameSpaceID_None, nsGkAtoms::start, value);
if (!value.IsEmpty()) { if (!value.IsEmpty()) {

View file

@ -190,7 +190,7 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
nsAutoString size; nsAutoString size;
baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size); baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size);
if (!size.IsEmpty()) { if (!size.IsEmpty()) {
PRInt32 err; nsresult err;
desiredRows = size.ToInteger(&err); desiredRows = size.ToInteger(&err);
mHasFixedRowCount = true; mHasFixedRowCount = true;
mPageLength = desiredRows; mPageLength = desiredRows;
@ -204,7 +204,7 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
nsAutoString rows; nsAutoString rows;
baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows); baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
if (!rows.IsEmpty()) { if (!rows.IsEmpty()) {
PRInt32 err; nsresult err;
desiredRows = rows.ToInteger(&err); desiredRows = rows.ToInteger(&err);
mPageLength = desiredRows; mPageLength = desiredRows;
} }
@ -355,7 +355,7 @@ nsTreeBodyFrame::EnsureView()
box->GetProperty(NS_LITERAL_STRING("topRow").get(), box->GetProperty(NS_LITERAL_STRING("topRow").get(),
getter_Copies(rowStr)); getter_Copies(rowStr));
nsAutoString rowStr2(rowStr); nsAutoString rowStr2(rowStr);
PRInt32 error; nsresult error;
PRInt32 rowIndex = rowStr2.ToInteger(&error); PRInt32 rowIndex = rowStr2.ToInteger(&error);
// Set our view. // Set our view.
@ -3719,7 +3719,7 @@ nsTreeBodyFrame::PaintProgressMeter(PRInt32 aRowIndex,
nsAutoString value; nsAutoString value;
mView->GetCellValue(aRowIndex, aColumn, value); mView->GetCellValue(aRowIndex, aColumn, value);
PRInt32 rv; nsresult rv;
PRInt32 intValue = value.ToInteger(&rv); PRInt32 intValue = value.ToInteger(&rv);
if (intValue < 0) if (intValue < 0)
intValue = 0; intValue = 0;

View file

@ -375,7 +375,7 @@ nsresult nsZipArchive::ExtractFile(nsZipItem *item, const char *outname,
//--------------------------------------------- //---------------------------------------------
// nsZipArchive::FindInit // nsZipArchive::FindInit
//--------------------------------------------- //---------------------------------------------
PRInt32 nsresult
nsZipArchive::FindInit(const char * aPattern, nsZipFind **aFind) nsZipArchive::FindInit(const char * aPattern, nsZipFind **aFind)
{ {
if (!aFind) if (!aFind)

View file

@ -173,7 +173,7 @@ public:
* will be set to NULL. * will be set to NULL.
* @return status code * @return status code
*/ */
PRInt32 FindInit(const char * aPattern, nsZipFind** aFind); nsresult FindInit(const char * aPattern, nsZipFind** aFind);
/* /*
* Gets an undependent handle to the mapped file. * Gets an undependent handle to the mapped file.

View file

@ -36,7 +36,7 @@ nsChannelClassifier::Start(nsIChannel *aChannel)
{ {
// Don't bother to run the classifier on a load that has already failed. // Don't bother to run the classifier on a load that has already failed.
// (this might happen after a redirect) // (this might happen after a redirect)
PRUint32 status; nsresult status;
aChannel->GetStatus(&status); aChannel->GetStatus(&status);
if (NS_FAILED(status)) if (NS_FAILED(status))
return NS_OK; return NS_OK;

View file

@ -906,7 +906,7 @@ nsIOService::ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool rem
PRUint32 index; PRUint32 index;
for (index=0; index < portListArray.Length(); index++) { for (index=0; index < portListArray.Length(); index++) {
portListArray[index].StripWhitespace(); portListArray[index].StripWhitespace();
PRInt32 aErrorCode, portBegin, portEnd; PRInt32 portBegin, portEnd;
if (PR_sscanf(portListArray[index].get(), "%d-%d", &portBegin, &portEnd) == 2) { if (PR_sscanf(portListArray[index].get(), "%d-%d", &portBegin, &portEnd) == 2) {
if ((portBegin < 65536) && (portEnd < 65536)) { if ((portBegin < 65536) && (portEnd < 65536)) {
@ -920,6 +920,7 @@ nsIOService::ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool rem
} }
} }
} else { } else {
nsresult aErrorCode;
PRInt32 port = portListArray[index].ToInteger(&aErrorCode); PRInt32 port = portListArray[index].ToInteger(&aErrorCode);
if (NS_SUCCEEDED(aErrorCode) && port < 65536) { if (NS_SUCCEEDED(aErrorCode) && port < 65536) {
if (remove) if (remove)

View file

@ -581,7 +581,7 @@ nsAuthURLParser::ParseServerInfo(const char *serverinfo, PRInt32 serverinfoLen,
if (nondigit && *nondigit) if (nondigit && *nondigit)
return NS_ERROR_MALFORMED_URI; return NS_ERROR_MALFORMED_URI;
PRInt32 err; nsresult err;
*port = buf.ToInteger(&err); *port = buf.ToInteger(&err);
if (NS_FAILED(err) || *port <= 0) if (NS_FAILED(err) || *port <= 0)
return NS_ERROR_MALFORMED_URI; return NS_ERROR_MALFORMED_URI;

View file

@ -1024,7 +1024,7 @@ nsFtpState::R_mdtm() {
// Save lastModified time for downloaded files. // Save lastModified time for downloaded files.
nsCAutoString timeString; nsCAutoString timeString;
PRInt32 error; nsresult error;
PRExplodedTime exTime; PRExplodedTime exTime;
mResponseMsg.Mid(timeString, 0, 4); mResponseMsg.Mid(timeString, 0, 4);
@ -2188,7 +2188,7 @@ nsFtpState::ReadCacheEntry()
nsXPIDLCString serverType; nsXPIDLCString serverType;
mCacheEntry->GetMetaDataElement("servertype", getter_Copies(serverType)); mCacheEntry->GetMetaDataElement("servertype", getter_Copies(serverType));
nsCAutoString serverNum(serverType.get()); nsCAutoString serverNum(serverType.get());
PRInt32 err; nsresult err;
mServerType = serverNum.ToInteger(&err); mServerType = serverNum.ToInteger(&err);
mChannel->PushStreamConverter("text/ftp-dir", mChannel->PushStreamConverter("text/ftp-dir",

View file

@ -530,8 +530,7 @@ nsWyciwygChannel::GetCharsetAndSource(PRInt32* aSource, nsACString& aCharset)
mCacheEntry->GetMetaDataElement("charset-source", getter_Copies(sourceStr)); mCacheEntry->GetMetaDataElement("charset-source", getter_Copies(sourceStr));
PRInt32 source; PRInt32 source;
// XXXbz ToInteger takes an PRInt32* but outputs an nsresult in it... :( nsresult err;
PRInt32 err;
source = sourceStr.ToInteger(&err); source = sourceStr.ToInteger(&err);
if (NS_FAILED(err) || source == 0) { if (NS_FAILED(err) || source == 0) {
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;

View file

@ -128,7 +128,7 @@ nsresult writeout(const char* i_pURL, PRInt32 urlFactory = URL_FACTORY_DEFAULT)
{ {
if (!i_pURL) return NS_ERROR_FAILURE; if (!i_pURL) return NS_ERROR_FAILURE;
nsCString temp; nsCString temp;
int rv = writeoutto(i_pURL, getter_Copies(temp), urlFactory); nsresult rv = writeoutto(i_pURL, getter_Copies(temp), urlFactory);
printf("%s\n%s\n", i_pURL, temp.get()); printf("%s\n%s\n", i_pURL, temp.get());
return rv; return rv;
} }
@ -248,7 +248,7 @@ nsresult makeAbsTest(const char* i_BaseURI, const char* relativePortion,
return NS_OK; return NS_OK;
} }
int doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0) nsresult doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0)
{ {
if (i_URL && i_relativePortion) if (i_URL && i_relativePortion)
{ {

View file

@ -87,7 +87,7 @@ ConsumeEntity(nsScannerSharedSubstring& aString,
writable.Append(amp); writable.Append(amp);
result = NS_OK; result = NS_OK;
} else { } else {
PRInt32 err; nsresult err;
theNCRValue = entity.ToInteger(&err, kAutoDetect); theNCRValue = entity.ToInteger(&err, kAutoDetect);
AppendNCR(writable, theNCRValue); AppendNCR(writable, theNCRValue);
} }
@ -1453,7 +1453,7 @@ CCommentToken::ConsumeQuirksComment(nsScanner& aScanner)
nsresult nsresult
CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner, PRInt32 aFlag) CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner, PRInt32 aFlag)
{ {
nsresult result = true; nsresult result = NS_OK;
if (aFlag & NS_IPARSER_FLAG_STRICT_MODE) { if (aFlag & NS_IPARSER_FLAG_STRICT_MODE) {
// Enabling strict comment parsing for Bug 53011 and 2749 contradicts! // Enabling strict comment parsing for Bug 53011 and 2749 contradicts!
@ -2165,7 +2165,7 @@ CEntityToken::TranslateToUnicodeStr(nsString& aString)
PRUnichar theChar0 = mTextValue.CharAt(0); PRUnichar theChar0 = mTextValue.CharAt(0);
if (kHashsign == theChar0) { if (kHashsign == theChar0) {
PRInt32 err = 0; nsresult err = NS_OK;
value = mTextValue.ToInteger(&err, kAutoDetect); value = mTextValue.ToInteger(&err, kAutoDetect);

View file

@ -198,7 +198,7 @@ nsParser::Initialize(bool aConstructor)
mCharsetSource = kCharsetUninitialized; mCharsetSource = kCharsetUninitialized;
mCharset.AssignLiteral("ISO-8859-1"); mCharset.AssignLiteral("ISO-8859-1");
mInternalState = NS_OK; mInternalState = NS_OK;
mStreamStatus = 0; mStreamStatus = NS_OK;
mCommand = eViewNormal; mCommand = eViewNormal;
mFlags = NS_PARSER_FLAG_OBSERVERS_ENABLED | mFlags = NS_PARSER_FLAG_OBSERVERS_ENABLED |
NS_PARSER_FLAG_PARSER_ENABLED | NS_PARSER_FLAG_PARSER_ENABLED |

View file

@ -412,7 +412,7 @@ protected:
eParserCommands mCommand; eParserCommands mCommand;
nsresult mInternalState; nsresult mInternalState;
PRInt32 mStreamStatus; nsresult mStreamStatus;
PRInt32 mCharsetSource; PRInt32 mCharsetSource;
PRUint16 mFlags; PRUint16 mFlags;

View file

@ -159,7 +159,7 @@ ContainerEnumeratorImpl::HasMoreElements(bool* aResult)
const PRUnichar *nextValStr; const PRUnichar *nextValStr;
nextValLiteral->GetValueConst(&nextValStr); nextValLiteral->GetValueConst(&nextValStr);
PRInt32 err; nsresult err;
PRInt32 nextVal = nsAutoString(nextValStr).ToInteger(&err); PRInt32 nextVal = nsAutoString(nextValStr).ToInteger(&err);
if (nextVal > max) if (nextVal > max)

View file

@ -184,7 +184,7 @@ RDFContainerImpl::GetCount(PRInt32 *aCount)
nsAutoString nextValStr(s); nsAutoString nextValStr(s);
PRInt32 nextVal; PRInt32 nextVal;
PRInt32 err; nsresult err;
nextVal = nextValStr.ToInteger(&err); nextVal = nextValStr.ToInteger(&err);
if (NS_FAILED(err)) if (NS_FAILED(err))
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;

View file

@ -696,8 +696,8 @@ RDFContentSinkImpl::ParseText(nsIRDFNode **aResult)
case eRDFContentSinkParseMode_Int: case eRDFContentSinkParseMode_Int:
{ {
PRInt32 i, err; nsresult err;
i = value.ToInteger(&err); PRInt32 i = value.ToInteger(&err);
nsIRDFInt *result; nsIRDFInt *result;
gRDFService->GetIntLiteral(i, &result); gRDFService->GetIntLiteral(i, &result);
*aResult = result; *aResult = result;

View file

@ -1014,7 +1014,7 @@ FileSystemDataSource::GetFolderList(nsIRDFResource *source, bool allowHidden,
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI); nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI);
if (!fileURL) if (!fileURL)
return(false); return NS_OK;
nsCOMPtr<nsIFile> aDir; nsCOMPtr<nsIFile> aDir;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aDir)))) if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aDir))))
@ -1122,7 +1122,7 @@ FileSystemDataSource::GetLastMod(nsIRDFResource *source, nsIRDFDate **aResult)
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI); nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI);
if (!fileURL) if (!fileURL)
return(false); return NS_OK;
nsCOMPtr<nsIFile> aFile; nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile)))) if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
@ -1169,7 +1169,7 @@ FileSystemDataSource::GetFileSize(nsIRDFResource *source, nsIRDFInt **aResult)
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI); nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI);
if (!fileURL) if (!fileURL)
return(false); return NS_OK;
nsCOMPtr<nsIFile> aFile; nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile)))) if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
@ -1220,7 +1220,7 @@ FileSystemDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral **aResult)
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI); nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI);
if (!fileURL) if (!fileURL)
return(false); return NS_OK;
nsCOMPtr<nsIFile> aFile; nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile)))) if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))

View file

@ -272,7 +272,7 @@ nsCertOverrideService::Read()
if (portIndex == kNotFound) if (portIndex == kNotFound)
continue; // Ignore broken entries continue; // Ignore broken entries
PRInt32 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 (portParseError)

View file

@ -159,7 +159,7 @@ void nsCertVerificationThread::Run(void)
} }
nsCertVerificationResult::nsCertVerificationResult() nsCertVerificationResult::nsCertVerificationResult()
: mRV(0), : mRV(NS_OK),
mVerified(0), mVerified(0),
mCount(0), mCount(0),
mUsages(0) mUsages(0)

View file

@ -299,7 +299,7 @@ Sanity_Child()
TestMutex m1("dd.sanity.m1"); TestMutex m1("dd.sanity.m1");
m1.Lock(); m1.Lock();
m1.Lock(); m1.Lock();
return 0; // not reached return NS_OK; // not reached
} }
nsresult nsresult
@ -329,7 +329,7 @@ Sanity2_Child()
m1.Lock(); m1.Lock();
m2.Lock(); m2.Lock();
m1.Lock(); m1.Lock();
return 0; // not reached return NS_OK; // not reached
} }
nsresult nsresult
@ -371,7 +371,7 @@ Sanity3_Child()
m4.Lock(); m4.Lock();
m1.Lock(); m1.Lock();
return 0; return NS_OK;
} }
nsresult nsresult
@ -403,7 +403,7 @@ Sanity4_Child()
m1.Enter(); m1.Enter();
m2.Lock(); m2.Lock();
m1.Enter(); m1.Enter();
return 0; return NS_OK;
} }
nsresult nsresult
@ -463,7 +463,7 @@ TwoThreads_Child()
PRThread* t2 = spawn(TwoThreads_thread, (void*) 1); PRThread* t2 = spawn(TwoThreads_thread, (void*) 1);
PR_JoinThread(t2); PR_JoinThread(t2);
return 0; return NS_OK;
} }
nsresult nsresult
@ -522,7 +522,7 @@ ContentionNoDeadlock_Child()
for (PRUint32 i = 0; i < ArrayLength(cndMs); ++i) for (PRUint32 i = 0; i < ArrayLength(cndMs); ++i)
delete cndMs[i]; delete cndMs[i];
return 0; return NS_OK;
} }
nsresult nsresult

View file

@ -75,7 +75,7 @@ public:
NS_IMETHODIMP OnStateChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, PRUint32 aStateFlags, nsIRequest* aRequest, PRUint32 aStateFlags,
PRUint32 aStatus) nsresult aStatus)
{ {
NS_ENSURE_TRUE(mInner, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mInner, NS_ERROR_NOT_INITIALIZED);
return mInner->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus); return mInner->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);

View file

@ -1658,7 +1658,7 @@ SetQueryKeyUint32(const nsCString& aValue, nsINavHistoryQuery* aQuery,
Uint32QuerySetter setter) Uint32QuerySetter setter)
{ {
nsresult rv; nsresult rv;
PRUint32 value = aValue.ToInteger(reinterpret_cast<PRInt32*>(&rv)); PRUint32 value = aValue.ToInteger(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = (aQuery->*setter)(value); rv = (aQuery->*setter)(value);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -1673,7 +1673,7 @@ SetOptionsKeyUint32(const nsCString& aValue, nsINavHistoryQueryOptions* aOptions
Uint32OptionsSetter setter) Uint32OptionsSetter setter)
{ {
nsresult rv; nsresult rv;
PRUint32 value = aValue.ToInteger(reinterpret_cast<PRInt32*>(&rv)); PRUint32 value = aValue.ToInteger(&rv);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = (aOptions->*setter)(value); rv = (aOptions->*setter)(value);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -1689,8 +1689,7 @@ SetOptionsKeyUint16(const nsCString& aValue, nsINavHistoryQueryOptions* aOptions
Uint16OptionsSetter setter) Uint16OptionsSetter setter)
{ {
nsresult rv; nsresult rv;
PRUint16 value = static_cast<PRUint16> PRUint16 value = static_cast<PRUint16>(aValue.ToInteger(&rv));
(aValue.ToInteger(reinterpret_cast<PRInt32*>(&rv)));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = (aOptions->*setter)(value); rv = (aOptions->*setter)(value);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {

View file

@ -4750,7 +4750,7 @@ nsNavHistoryResult::OnVisit(nsIURI* aURI, PRInt64 aVisitId, PRTime aTime,
rv = firstChild->GetTitle(title); rv = firstChild->GetTitle(title);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsNavHistory* history = nsNavHistory::GetHistoryService(); nsNavHistory* history = nsNavHistory::GetHistoryService();
NS_ENSURE_TRUE(history, 0); NS_ENSURE_TRUE(history, NS_OK);
nsCAutoString todayLabel; nsCAutoString todayLabel;
history->GetStringFromName( history->GetStringFromName(
NS_LITERAL_STRING("finduri-AgeInDays-is-0").get(), todayLabel); NS_LITERAL_STRING("finduri-AgeInDays-is-0").get(), todayLabel);

View file

@ -327,7 +327,7 @@ nsUrlClassifierStreamUpdater::UpdateSuccess(PRUint32 requestedTimeout)
} }
NS_IMETHODIMP NS_IMETHODIMP
nsUrlClassifierStreamUpdater::UpdateError(PRUint32 result) nsUrlClassifierStreamUpdater::UpdateError(nsresult result)
{ {
LOG(("nsUrlClassifierStreamUpdater::UpdateError [this=%p]", this)); LOG(("nsUrlClassifierStreamUpdater::UpdateError [this=%p]", this));
@ -408,10 +408,11 @@ nsUrlClassifierStreamUpdater::OnStartRequest(nsIRequest *request,
// 404 or other error, pass error status back // 404 or other error, pass error status back
LOG(("HTTP request returned failure code.")); LOG(("HTTP request returned failure code."));
rv = httpChannel->GetResponseStatus(&status); PRUint32 requestStatus;
rv = httpChannel->GetResponseStatus(&requestStatus);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
strStatus.AppendInt(status); strStatus.AppendInt(requestStatus);
downloadError = true; downloadError = true;
} }
} }

View file

@ -122,7 +122,7 @@ IsInNoProxyList(const nsACString& aHost, PRInt32 aPort, const char* noProxyVal)
++colon; ++colon;
nsDependentCSubstring portStr(colon, last); nsDependentCSubstring portStr(colon, last);
nsCAutoString portStr2(portStr); // We need this for ToInteger. String API's suck. nsCAutoString portStr2(portStr); // We need this for ToInteger. String API's suck.
PRInt32 err; nsresult err;
port = portStr2.ToInteger(&err); port = portStr2.ToInteger(&err);
if (NS_FAILED(err)) { if (NS_FAILED(err)) {
port = -2; // don't match any port, so we ignore this pattern port = -2; // don't match any port, so we ignore this pattern
@ -341,7 +341,7 @@ static bool HostIgnoredByProxy(const nsACString& aIgnore,
++slash; ++slash;
nsDependentCSubstring maskStr(slash, end); nsDependentCSubstring maskStr(slash, end);
nsCAutoString maskStr2(maskStr); nsCAutoString maskStr2(maskStr);
PRInt32 err; nsresult err;
mask = maskStr2.ToInteger(&err); mask = maskStr2.ToInteger(&err);
if (err != 0) { if (err != 0) {
mask = 128; mask = 128;

View file

@ -1412,7 +1412,7 @@ CreateUriList(nsISupportsArray *items, gchar **text, gint *length)
if (item) { if (item) {
PRUint32 tmpDataLen = 0; PRUint32 tmpDataLen = 0;
void *tmpData = NULL; void *tmpData = NULL;
nsresult rv = 0; nsresult rv = NS_OK;
nsCOMPtr<nsISupports> data; nsCOMPtr<nsISupports> data;
rv = item->GetTransferData(kURLMime, rv = item->GetTransferData(kURLMime,
getter_AddRefs(data), getter_AddRefs(data),

View file

@ -128,7 +128,8 @@ nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, PRInt32 defaultVal
nsAutoString attr; nsAutoString attr;
aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr); aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr);
PRInt32 err, value = attr.ToInteger(&err); nsresult err;
PRInt32 value = attr.ToInteger(&err);
if (attr.IsEmpty() || NS_FAILED(err)) if (attr.IsEmpty() || NS_FAILED(err))
return defaultValue; return defaultValue;

View file

@ -1088,7 +1088,7 @@ nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, PRInt32& aTwips,
rv = Preferences::GetString(aMarginPref, &str); rv = Preferences::GetString(aMarginPref, &str);
} }
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) { if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
PRInt32 errCode; nsresult errCode;
float inches = str.ToFloat(&errCode); float inches = str.ToFloat(&errCode);
if (NS_SUCCEEDED(errCode)) { if (NS_SUCCEEDED(errCode)) {
aTwips = NS_INCHES_TO_INT_TWIPS(inches); aTwips = NS_INCHES_TO_INT_TWIPS(inches);

View file

@ -230,7 +230,7 @@ class nsTString_CharT : public nsTSubstring_CharT
* @param aErrorCode will contain error if one occurs * @param aErrorCode will contain error if one occurs
* @return double-precision float rep of string value * @return double-precision float rep of string value
*/ */
double ToDouble( PRInt32* aErrorCode ) const; double ToDouble( nsresult* aErrorCode ) const;
/** /**
* Perform string to single-precision float conversion. * Perform string to single-precision float conversion.
@ -238,7 +238,7 @@ class nsTString_CharT : public nsTSubstring_CharT
* @param aErrorCode will contain error if one occurs * @param aErrorCode will contain error if one occurs
* @return single-precision float rep of string value * @return single-precision float rep of string value
*/ */
float ToFloat( PRInt32* aErrorCode ) const { float ToFloat( nsresult* aErrorCode ) const {
return (float)ToDouble(aErrorCode); return (float)ToDouble(aErrorCode);
} }
@ -249,10 +249,7 @@ class nsTString_CharT : public nsTSubstring_CharT
* @param aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you. * @param aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
* @return int rep of string value, and possible (out) error code * @return int rep of string value, and possible (out) error code
*/ */
PRInt32 ToInteger( PRInt32* aErrorCode, PRUint32 aRadix=kRadix10 ) const; PRInt32 ToInteger( nsresult* aErrorCode, PRUint32 aRadix=kRadix10 ) const;
PRInt32 ToInteger( nsresult* aErrorCode, PRUint32 aRadix=kRadix10 ) const {
return ToInteger(reinterpret_cast<PRInt32*>(aErrorCode), aRadix);
}
/** /**
* |Left|, |Mid|, and |Right| are annoying signatures that seem better almost * |Left|, |Mid|, and |Right| are annoying signatures that seem better almost

View file

@ -984,7 +984,7 @@ nsString::EqualsIgnoreCase( const char* aString, PRInt32 aCount ) const
*/ */
double double
nsCString::ToDouble(PRInt32* aErrorCode) const nsCString::ToDouble(nsresult* aErrorCode) const
{ {
double res = 0.0; double res = 0.0;
if (mLength > 0) if (mLength > 0)
@ -994,20 +994,20 @@ nsCString::ToDouble(PRInt32* aErrorCode) const
// Use PR_strtod, not strtod, since we don't want locale involved. // Use PR_strtod, not strtod, since we don't want locale involved.
res = PR_strtod(str, &conv_stopped); res = PR_strtod(str, &conv_stopped);
if (conv_stopped == str+mLength) if (conv_stopped == str+mLength)
*aErrorCode = (PRInt32) NS_OK; *aErrorCode = NS_OK;
else // Not all the string was scanned else // Not all the string was scanned
*aErrorCode = (PRInt32) NS_ERROR_ILLEGAL_VALUE; *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
} }
else else
{ {
// The string was too short (0 characters) // The string was too short (0 characters)
*aErrorCode = (PRInt32) NS_ERROR_ILLEGAL_VALUE; *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
} }
return res; return res;
} }
double double
nsString::ToDouble(PRInt32* aErrorCode) const nsString::ToDouble(nsresult* aErrorCode) const
{ {
return NS_LossyConvertUTF16toASCII(*this).ToDouble(aErrorCode); return NS_LossyConvertUTF16toASCII(*this).ToDouble(aErrorCode);
} }

View file

@ -109,7 +109,7 @@ nsTString_CharT::RFindCharInSet( const CharT* aSet, PRInt32 aOffset ) const
// to help performance. this function also gets to keep the rickg style // to help performance. this function also gets to keep the rickg style
// indentation :-/ // indentation :-/
PRInt32 PRInt32
nsTString_CharT::ToInteger( PRInt32* aErrorCode, PRUint32 aRadix ) const nsTString_CharT::ToInteger( nsresult* aErrorCode, PRUint32 aRadix ) const
{ {
CharT* cp=mData; CharT* cp=mData;
PRInt32 theRadix=10; // base 10 unless base 16 detected, or overriden (aRadix != kAutoDetect) PRInt32 theRadix=10; // base 10 unless base 16 detected, or overriden (aRadix != kAutoDetect)

View file

@ -166,7 +166,7 @@ CreateIFoo( void** result )
*result = foop; *result = foop;
printf("<<CreateIFoo()\n"); printf("<<CreateIFoo()\n");
return 0; return NS_OK;
} }
void void
@ -260,7 +260,7 @@ CreateIBar( void** result )
*result = barp; *result = barp;
printf("<<CreateIBar()\n"); printf("<<CreateIBar()\n");
return 0; return NS_OK;
} }
void void

View file

@ -263,7 +263,7 @@ Sanity_Child()
mozilla::Mutex m1("dd.sanity.m1"); mozilla::Mutex m1("dd.sanity.m1");
m1.Lock(); m1.Lock();
m1.Lock(); m1.Lock();
return 0; // not reached return NS_OK; // not reached
} }
nsresult nsresult
@ -293,7 +293,7 @@ Sanity2_Child()
m1.Lock(); m1.Lock();
m2.Lock(); m2.Lock();
m1.Lock(); m1.Lock();
return 0; // not reached return NS_OK; // not reached
} }
nsresult nsresult
@ -335,7 +335,7 @@ Sanity3_Child()
m4.Lock(); m4.Lock();
m1.Lock(); m1.Lock();
return 0; return NS_OK;
} }
nsresult nsresult
@ -367,7 +367,7 @@ Sanity4_Child()
m1.Enter(); m1.Enter();
m2.Lock(); m2.Lock();
m1.Enter(); m1.Enter();
return 0; return NS_OK;
} }
nsresult nsresult
@ -427,7 +427,7 @@ TwoThreads_Child()
PRThread* t2 = spawn(TwoThreads_thread, (void*) 1); PRThread* t2 = spawn(TwoThreads_thread, (void*) 1);
PR_JoinThread(t2); PR_JoinThread(t2);
return 0; return NS_OK;
} }
nsresult nsresult
@ -486,7 +486,7 @@ ContentionNoDeadlock_Child()
for (PRUint32 i = 0; i < ArrayLength(cndMs); ++i) for (PRUint32 i = 0; i < ArrayLength(cndMs); ++i)
delete cndMs[i]; delete cndMs[i];
return 0; return NS_OK;
} }
nsresult nsresult

View file

@ -324,7 +324,7 @@ CreateIFoo( IFoo** result )
*result = foop; *result = foop;
printf("<<CreateIFoo()\n"); printf("<<CreateIFoo()\n");
return 0; return NS_OK;
} }
PLDHashOperator PLDHashOperator

View file

@ -167,7 +167,7 @@ CreateFoo( void** result )
*result = foop; *result = foop;
printf("<<CreateFoo()\n"); printf("<<CreateFoo()\n");
return 0; return NS_OK;
} }
void void
@ -261,7 +261,7 @@ CreateBar( void** result )
*result = barp; *result = barp;
printf("<<CreateBar()\n"); printf("<<CreateBar()\n");
return 0; return NS_OK;
} }
void void

View file

@ -1013,7 +1013,7 @@ bool nsXULWindow::LoadPositionFromXUL()
PRInt32 currY = 0; PRInt32 currY = 0;
PRInt32 currWidth = 0; PRInt32 currWidth = 0;
PRInt32 currHeight = 0; PRInt32 currHeight = 0;
PRInt32 errorCode; nsresult errorCode;
PRInt32 temp; PRInt32 temp;
GetPositionAndSize(&currX, &currY, &currWidth, &currHeight); GetPositionAndSize(&currX, &currY, &currWidth, &currHeight);
@ -1080,7 +1080,7 @@ bool nsXULWindow::LoadSizeFromXUL()
PRInt32 currWidth = 0; PRInt32 currWidth = 0;
PRInt32 currHeight = 0; PRInt32 currHeight = 0;
PRInt32 errorCode; nsresult errorCode;
PRInt32 temp; PRInt32 temp;
GetSize(&currWidth, &currHeight); GetSize(&currWidth, &currHeight);
@ -1212,7 +1212,7 @@ bool nsXULWindow::LoadMiscPersistentAttributesFromXUL()
// zlevel // zlevel
rv = windowElement->GetAttribute(NS_LITERAL_STRING("zlevel"), stateString); rv = windowElement->GetAttribute(NS_LITERAL_STRING("zlevel"), stateString);
if (NS_SUCCEEDED(rv) && stateString.Length() > 0) { if (NS_SUCCEEDED(rv) && stateString.Length() > 0) {
PRInt32 errorCode; nsresult errorCode;
PRUint32 zLevel = stateString.ToInteger(&errorCode); PRUint32 zLevel = stateString.ToInteger(&errorCode);
if (NS_SUCCEEDED(errorCode) && zLevel >= lowestZ && zLevel <= highestZ) if (NS_SUCCEEDED(errorCode) && zLevel >= lowestZ && zLevel <= highestZ)
SetZLevel(zLevel); SetZLevel(zLevel);