Bug 782594 - Use NS_FAILED instead of boolean test (content/, js/xpconnect/, layout/); r=bz

This commit is contained in:
Aryeh Gregor 2012-08-07 17:58:47 +03:00
Родитель fcf82e3f1d
Коммит 33fe5589ca
7 изменённых файлов: 14 добавлений и 14 удалений

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

@ -5136,7 +5136,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
nsresult errorCode; nsresult errorCode;
float scaleMinFloat = minScaleStr.ToFloat(&errorCode); float scaleMinFloat = minScaleStr.ToFloat(&errorCode);
if (errorCode) { if (NS_FAILED(errorCode)) {
scaleMinFloat = kViewportMinScale; scaleMinFloat = kViewportMinScale;
} }
@ -5151,7 +5151,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
nsresult scaleMaxErrorCode; nsresult scaleMaxErrorCode;
float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode); float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode);
if (scaleMaxErrorCode) { if (NS_FAILED(scaleMaxErrorCode)) {
scaleMaxFloat = kViewportMaxScale; scaleMaxFloat = kViewportMaxScale;
} }
@ -5210,7 +5210,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight); screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
uint32_t width = widthStr.ToInteger(&errorCode); uint32_t width = widthStr.ToInteger(&errorCode);
if (errorCode) { if (NS_FAILED(errorCode)) {
if (autoSize) { if (autoSize) {
width = screenWidth; width = screenWidth;
} else { } else {
@ -5229,7 +5229,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
uint32_t height = heightStr.ToInteger(&errorCode); uint32_t height = heightStr.ToInteger(&errorCode);
if (errorCode) { if (NS_FAILED(errorCode)) {
height = width * ((float)screenHeight / screenWidth); height = width * ((float)screenHeight / screenWidth);
} }
@ -5244,10 +5244,10 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
// We need to perform a conversion, but only if the initial or maximum // We need to perform a conversion, but only if the initial or maximum
// scale were set explicitly by the user. // scale were set explicitly by the user.
if (!scaleStr.IsEmpty() && !scaleErrorCode) { if (!scaleStr.IsEmpty() && NS_SUCCEEDED(scaleErrorCode)) {
width = NS_MAX(width, (uint32_t)(screenWidth / scaleFloat)); width = NS_MAX(width, (uint32_t)(screenWidth / scaleFloat));
height = NS_MAX(height, (uint32_t)(screenHeight / scaleFloat)); height = NS_MAX(height, (uint32_t)(screenHeight / scaleFloat));
} else if (!maxScaleStr.IsEmpty() && !scaleMaxErrorCode) { } else if (!maxScaleStr.IsEmpty() && NS_SUCCEEDED(scaleMaxErrorCode)) {
width = NS_MAX(width, (uint32_t)(screenWidth / scaleMaxFloat)); width = NS_MAX(width, (uint32_t)(screenWidth / scaleMaxFloat));
height = NS_MAX(height, (uint32_t)(screenHeight / scaleMaxFloat)); height = NS_MAX(height, (uint32_t)(screenHeight / scaleMaxFloat));
} }

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

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

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

@ -1891,7 +1891,7 @@ nsXULContentBuilder::InsertSortedNode(nsIContent* aContainer,
// found "static" XUL element count hint // found "static" XUL element count hint
nsresult strErr = NS_OK; nsresult strErr = NS_OK;
staticCount = staticValue.ToInteger(&strErr); staticCount = staticValue.ToInteger(&strErr);
if (strErr) if (NS_FAILED(strErr))
staticCount = 0; staticCount = 0;
} else { } else {
// compute the "static" XUL element count // compute the "static" XUL element count

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

@ -551,8 +551,8 @@ XPCWrappedNative::GetNewOrUsed(XPCCallContext& ccx,
JSObject *cached = cache->GetWrapper(); JSObject *cached = cache->GetWrapper();
if (cached) { if (cached) {
if (IS_SLIM_WRAPPER_OBJECT(cached)) { if (IS_SLIM_WRAPPER_OBJECT(cached)) {
if (!XPCWrappedNative::Morph(ccx, cached, Interface, cache, if (NS_FAILED(XPCWrappedNative::Morph(ccx, cached,
getter_AddRefs(wrapper))) Interface, cache, getter_AddRefs(wrapper))))
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} else { } else {
wrapper = static_cast<XPCWrappedNative*>(xpc_GetJSPrivate(cached)); wrapper = static_cast<XPCWrappedNative*>(xpc_GetJSPrivate(cached));

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

@ -1575,7 +1575,7 @@ nsListControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const
nsresult error = NS_OK; nsresult error = NS_OK;
bool selected = false; bool selected = false;
int32_t indx = val.ToInteger(&error, 10); // Get index from aValue int32_t indx = val.ToInteger(&error, 10); // Get index from aValue
if (error == 0) if (NS_SUCCEEDED(error))
selected = IsContentSelectedByIndex(indx); selected = IsContentSelectedByIndex(indx);
aValue.Assign(selected ? NS_LITERAL_STRING("1") : NS_LITERAL_STRING("0")); aValue.Assign(selected ? NS_LITERAL_STRING("1") : NS_LITERAL_STRING("0"));

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

@ -935,7 +935,7 @@ nsFrameSelection::MoveCaret(uint32_t aKeycode,
aVisualMovement); aVisualMovement);
if (NS_FAILED(result) || !frame) if (NS_FAILED(result) || !frame)
return result?result:NS_ERROR_FAILURE; return NS_FAILED(result) ? result : NS_ERROR_FAILURE;
//set data using mLimiter to stop on scroll views. If we have a limiter then we stop peeking //set data using mLimiter to stop on scroll views. If we have a limiter then we stop peeking
//when we hit scrollable views. If no limiter then just let it go ahead //when we hit scrollable views. If no limiter then just let it go ahead
@ -5567,7 +5567,7 @@ Selection::SelectionLanguageChange(bool aLangRTL)
uint8_t levelBefore, levelAfter; uint8_t levelBefore, levelAfter;
result = GetPresContext(getter_AddRefs(context)); result = GetPresContext(getter_AddRefs(context));
if (NS_FAILED(result) || !context) if (NS_FAILED(result) || !context)
return result?result:NS_ERROR_FAILURE; return NS_FAILED(result) ? result : NS_ERROR_FAILURE;
uint8_t level = NS_GET_EMBEDDING_LEVEL(focusFrame); uint8_t level = NS_GET_EMBEDDING_LEVEL(focusFrame);
int32_t focusOffset = GetFocusOffset(); int32_t focusOffset = GetFocusOffset();

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

@ -734,7 +734,7 @@ nsUserFontSet::LogMessage(gfxProxyFontEntry *aProxy,
nsCSSProps::kFontStretchKTable).get(), nsCSSProps::kFontStretchKTable).get(),
aProxy->mSrcIndex); aProxy->mSrcIndex);
if (aStatus != 0) { if (NS_FAILED(aStatus)) {
msg.Append(": "); msg.Append(": ");
switch (aStatus) { switch (aStatus) {
case NS_ERROR_DOM_BAD_URI: case NS_ERROR_DOM_BAD_URI: