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;
aContent->GetAttr(kNameSpaceID_None, aAttr, value);
if (!value.IsEmpty()) {
PRInt32 error = NS_OK;
nsresult error = NS_OK;
PRInt32 integer = value.ToInteger(&error);
if (NS_SUCCEEDED(error) && integer > 0) {
*aUInt = integer;

View File

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

View File

@ -111,7 +111,7 @@ ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
nsAutoString value;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
PRInt32 result = NS_OK;
nsresult result = NS_OK;
*aMaximumValue = value.ToDouble(&result);
return result;
}
@ -159,7 +159,7 @@ ProgressMeterAccessible<Max>::GetCurrentValue(double* aCurrentValue)
if (attrValue.IsEmpty())
return NS_OK;
PRInt32 error = NS_OK;
nsresult error = NS_OK;
double value = attrValue.ToDouble(&error);
if (NS_FAILED(error))
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);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK;
nsresult error = NS_OK;
*aMaximumValue = value.ToDouble(&error);
return error;
}
@ -328,7 +328,7 @@ nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue)
nsresult rv = sXFormsService->GetRangeStart(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK;
nsresult error = NS_OK;
*aMinimumValue = value.ToDouble(&error);
return error;
}
@ -343,7 +343,7 @@ nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement)
nsresult rv = sXFormsService->GetRangeStep(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK;
nsresult error = NS_OK;
*aMinimumIncrement = value.ToDouble(&error);
return error;
}
@ -358,7 +358,7 @@ nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue)
nsresult rv = sXFormsService->GetValue(DOMNode, value);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 error = NS_OK;
nsresult error = NS_OK;
*aCurrentValue = value.ToDouble(&error);
return error;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -241,7 +241,7 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
if (!start.IsEmpty()){
PRInt32 rv = 0;
nsresult rv = NS_OK;
startAttrVal = start.ToInteger(&rv);
//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;

View File

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

View File

@ -254,7 +254,7 @@ nsXHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
PRInt32 startAttrVal = 0;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
if (!start.IsEmpty()) {
PRInt32 rv = 0;
nsresult rv = NS_OK;
startAttrVal = start.ToInteger(&rv);
//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;
@ -920,7 +920,7 @@ nsXHTMLContentSerializer::SerializeLIValueAttribute(nsIContent* aElement,
offset++;
else {
found = true;
PRInt32 rv = 0;
nsresult rv = NS_OK;
startVal = valueStr.ToInteger(&rv);
}
}

View File

@ -1794,7 +1794,7 @@ NS_IMETHODIMP
nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
PRUint32 aStateFlags,
PRUint32 aStatus)
nsresult aStatus)
{
// 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

View File

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

View File

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

View File

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

View File

@ -334,7 +334,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
}
// Convert number to floating point
PRInt32 errorCode;
nsresult errorCode;
float floatValue = number.ToFloat(&errorCode);
if (NS_FAILED(errorCode))
return false;
@ -397,7 +397,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
str.CompressWhitespace();
// MathML numbers can't have leading '+'
if (str.Length() > 0 && str.CharAt(0) != '+') {
PRInt32 errorCode;
nsresult errorCode;
float floatValue = str.ToFloat(&errorCode);
// Negative scriptsizemultipliers are not parsed
if (NS_SUCCEEDED(errorCode) && floatValue >= 0.0f) {
@ -443,7 +443,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
nsAutoString str(value->GetStringValue());
str.CompressWhitespace();
if (str.Length() > 0) {
PRInt32 errorCode;
nsresult errorCode;
PRInt32 intValue = str.ToInteger(&errorCode);
if (NS_SUCCEEDED(errorCode)) {
// 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.
// 5) Perform a seek in the decoder to find the value.
nsCAutoString durationText;
PRInt32 ec = 0;
nsresult ec = NS_OK;
rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("Content-Duration"), durationText);
if (NS_FAILED(rv)) {
rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("X-AMZ-Meta-Content-Duration"), durationText);

View File

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

View File

@ -4422,7 +4422,7 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild,
if (!posStr.IsEmpty()) {
nsresult rv;
// 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
// than 0 or greater than the number of children aParent has, then
// 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:
{
// non-numbers always compare false
PRInt32 err;
nsresult err;
PRInt32 leftint = PromiseFlatString(aLeftString).ToInteger(&err);
if (NS_SUCCEEDED(err)) {
PRInt32 rightint = PromiseFlatString(aRightString).ToInteger(&err);

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ interface nsIContentViewer : nsISupports
attribute nsISupports container;
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

View File

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

View File

@ -70,7 +70,7 @@ static struct ResultStruct
const char* mMessage;
} gDOMErrorMsgMap[] = {
#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
@ -205,7 +205,7 @@ nsDOMException::GetMessageMoz(char **aMessage)
}
NS_IMETHODIMP
nsDOMException::GetResult(PRUint32* aResult)
nsDOMException::GetResult(nsresult* aResult)
{
NS_ENSURE_ARG_POINTER(aResult);

View File

@ -2926,7 +2926,8 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
nsAutoString 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) {
tabIndex = (tabIndex == 0 || val < tabIndex) ? val : tabIndex;
}
@ -2945,7 +2946,8 @@ nsFocusManager::GetNextTabIndex(nsIContent* aParent,
nsAutoString 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 ((aCurrentTabIndex == 0 && val > tabIndex) ||
(val < aCurrentTabIndex && val > tabIndex) ) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,7 @@ using mozilla::dom::DestroyProtoOrIfaceCache;
/***************************************************************************/
// 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);
*retval = false;

View File

@ -27,7 +27,7 @@ static struct ResultMap
{(val), #val, format},
#include "xpc.msg"
#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)
@ -100,7 +100,7 @@ NS_IMPL_CI_INTERFACE_GETTER1(nsXPCException, nsIXPCException)
nsXPCException::nsXPCException()
: mMessage(nullptr),
mResult(0),
mResult(NS_OK),
mName(nullptr),
mLocation(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);
return false;
@ -2676,7 +2676,7 @@ CallMethodHelper::QueryInterfaceFastPath() const
}
jsval v = JSVAL_NULL;
unsigned err;
nsresult err;
JSBool success =
XPCConvert::NativeData2JS(mCallContext, &v, &qiresult,
nsXPTType::T_INTERFACE_IS,
@ -2842,7 +2842,7 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i)
return false;
}
unsigned err;
nsresult err;
if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type,
true, &param_iid, &err)) {
ThrowBadParam(err, i, mCallContext);
@ -2940,7 +2940,7 @@ CallMethodHelper::ConvertDependentParam(uint8_t i)
!GetInterfaceTypeFromParam(i, datum_type, &param_iid))
return false;
unsigned err;
nsresult err;
if (isArray || isSizedString) {
if (!GetArraySizeFromParam(i, &array_count))

View File

@ -17,7 +17,7 @@
// All of the exceptions thrown into JS from this file go through here.
// 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);
return false;

View File

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

View File

@ -1557,7 +1557,7 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
if (-1 != barIndex) {
nsAutoString nameSpaceVal;
contentString.Left(nameSpaceVal, barIndex);
PRInt32 error;
nsresult error;
attrNameSpace = nameSpaceVal.ToInteger(&error, 10);
contentString.Cut(0, barIndex + 1);
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)
if (nsGkAtoms::selected == aName) {
nsAutoString val(aValue);
PRInt32 error = 0;
nsresult error = NS_OK;
bool selected = false;
PRInt32 indx = val.ToInteger(&error, 10); // Get index from aValue
if (error == 0)

View File

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

View File

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

View File

@ -114,7 +114,7 @@ SetProperty(OperatorData* aOperatorData,
else return; // input is not applicable
// 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;
if (error) return;

View File

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

View File

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

View File

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

View File

@ -123,7 +123,7 @@ nsPrintData::DoOnProgressChange(PRInt32 aProgress,
nsIWebProgressListener* wpl = mPrintProgressListeners.ObjectAt(i);
wpl->OnProgressChange(nullptr, nullptr, aProgress, aMaxProgress, aProgress, aMaxProgress);
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,
const char *aMessage,
PRUint32 aFlags = nsIScriptError::errorFlag,
nsresult aStatus = 0);
nsresult aStatus = NS_OK);
nsresult CheckFontLoad(gfxProxyFontEntry *aFontToLoad,
const gfxFontFaceSrc *aFontFaceSrc,

View File

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

View File

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

View File

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

View File

@ -601,7 +601,7 @@ nsListBoxBodyFrame::GetRowCount()
PRInt32
nsListBoxBodyFrame::GetFixedRowSize()
{
PRInt32 dummy;
nsresult dummy;
nsAutoString 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::top, top);
PRInt32 err;
nsresult err;
if (!left.IsEmpty()) {
PRInt32 x = left.ToInteger(&err);
if (NS_SUCCEEDED(err))
@ -1791,7 +1791,7 @@ nsMenuPopupFrame::MoveToAttributePosition()
nsAutoString left, top;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left);
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top);
PRInt32 err1, err2;
nsresult err1, err2;
PRInt32 xpos = left.ToInteger(&err1);
PRInt32 ypos = top.ToInteger(&err2);

View File

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

View File

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

View File

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

View File

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

View File

@ -173,7 +173,7 @@ public:
* will be set to NULL.
* @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.

View File

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

View File

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

View File

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

View File

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

View File

@ -530,8 +530,7 @@ nsWyciwygChannel::GetCharsetAndSource(PRInt32* aSource, nsACString& aCharset)
mCacheEntry->GetMetaDataElement("charset-source", getter_Copies(sourceStr));
PRInt32 source;
// XXXbz ToInteger takes an PRInt32* but outputs an nsresult in it... :(
PRInt32 err;
nsresult err;
source = sourceStr.ToInteger(&err);
if (NS_FAILED(err) || source == 0) {
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;
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());
return rv;
}
@ -248,7 +248,7 @@ nsresult makeAbsTest(const char* i_BaseURI, const char* relativePortion,
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)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1014,7 +1014,7 @@ FileSystemDataSource::GetFolderList(nsIRDFResource *source, bool allowHidden,
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aIURI);
if (!fileURL)
return(false);
return NS_OK;
nsCOMPtr<nsIFile> 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);
if (!fileURL)
return(false);
return NS_OK;
nsCOMPtr<nsIFile> 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);
if (!fileURL)
return(false);
return NS_OK;
nsCOMPtr<nsIFile> 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);
if (!fileURL)
return(false);
return NS_OK;
nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -128,7 +128,8 @@ nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, PRInt32 defaultVal
nsAutoString 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))
return defaultValue;

View File

@ -1088,7 +1088,7 @@ nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, PRInt32& aTwips,
rv = Preferences::GetString(aMarginPref, &str);
}
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
PRInt32 errCode;
nsresult errCode;
float inches = str.ToFloat(&errCode);
if (NS_SUCCEEDED(errCode)) {
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
* @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.
@ -238,7 +238,7 @@ class nsTString_CharT : public nsTSubstring_CharT
* @param aErrorCode will contain error if one occurs
* @return single-precision float rep of string value
*/
float ToFloat( PRInt32* aErrorCode ) const {
float ToFloat( nsresult* aErrorCode ) const {
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.
* @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 {
return ToInteger(reinterpret_cast<PRInt32*>(aErrorCode), aRadix);
}
PRInt32 ToInteger( nsresult* aErrorCode, PRUint32 aRadix=kRadix10 ) const;
/**
* |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
nsCString::ToDouble(PRInt32* aErrorCode) const
nsCString::ToDouble(nsresult* aErrorCode) const
{
double res = 0.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.
res = PR_strtod(str, &conv_stopped);
if (conv_stopped == str+mLength)
*aErrorCode = (PRInt32) NS_OK;
*aErrorCode = NS_OK;
else // Not all the string was scanned
*aErrorCode = (PRInt32) NS_ERROR_ILLEGAL_VALUE;
*aErrorCode = NS_ERROR_ILLEGAL_VALUE;
}
else
{
// The string was too short (0 characters)
*aErrorCode = (PRInt32) NS_ERROR_ILLEGAL_VALUE;
*aErrorCode = NS_ERROR_ILLEGAL_VALUE;
}
return res;
}
double
nsString::ToDouble(PRInt32* aErrorCode) const
nsString::ToDouble(nsresult* aErrorCode) const
{
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
// indentation :-/
PRInt32
nsTString_CharT::ToInteger( PRInt32* aErrorCode, PRUint32 aRadix ) const
nsTString_CharT::ToInteger( nsresult* aErrorCode, PRUint32 aRadix ) const
{
CharT* cp=mData;
PRInt32 theRadix=10; // base 10 unless base 16 detected, or overriden (aRadix != kAutoDetect)

View File

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

View File

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

View File

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

View File

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

View File

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