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;
float scaleMinFloat = minScaleStr.ToFloat(&errorCode);
if (errorCode) {
if (NS_FAILED(errorCode)) {
scaleMinFloat = kViewportMinScale;
}
@ -5151,7 +5151,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
nsresult scaleMaxErrorCode;
float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode);
if (scaleMaxErrorCode) {
if (NS_FAILED(scaleMaxErrorCode)) {
scaleMaxFloat = kViewportMaxScale;
}
@ -5210,7 +5210,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
uint32_t width = widthStr.ToInteger(&errorCode);
if (errorCode) {
if (NS_FAILED(errorCode)) {
if (autoSize) {
width = screenWidth;
} else {
@ -5229,7 +5229,7 @@ nsContentUtils::GetViewportInfo(nsIDocument *aDocument)
uint32_t height = heightStr.ToInteger(&errorCode);
if (errorCode) {
if (NS_FAILED(errorCode)) {
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
// 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));
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));
height = NS_MAX(height, (uint32_t)(screenHeight / scaleMaxFloat));
}

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

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

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

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

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

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

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

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

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

@ -935,7 +935,7 @@ nsFrameSelection::MoveCaret(uint32_t aKeycode,
aVisualMovement);
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
//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;
result = GetPresContext(getter_AddRefs(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);
int32_t focusOffset = GetFocusOffset();

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

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