diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 3584d5f94ec5..ac8a43331349 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -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)); } diff --git a/content/html/content/src/nsHTMLFrameSetElement.cpp b/content/html/content/src/nsHTMLFrameSetElement.cpp index 12a04ee8bd35..8435502e6730 100644 --- a/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -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; } } diff --git a/content/xul/templates/src/nsXULContentBuilder.cpp b/content/xul/templates/src/nsXULContentBuilder.cpp index 3597d8ccb0de..59154ecf8fe6 100644 --- a/content/xul/templates/src/nsXULContentBuilder.cpp +++ b/content/xul/templates/src/nsXULContentBuilder.cpp @@ -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 diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 27ef5d96c7f7..7d226726ede5 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -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(xpc_GetJSPrivate(cached)); diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 197a9bfc36c7..2749435206fc 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -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")); diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index b92350931e44..3e3c2c7cfc24 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -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(); diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp index 2c399b432e56..beddffbd8fd4 100644 --- a/layout/style/nsFontFaceLoader.cpp +++ b/layout/style/nsFontFaceLoader.cpp @@ -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: