Bug 398433 - "PRBool misuse bugs in content/" [p=tglek@mozilla.com (Taras Glek) r+sr=sicking a1.9=schrep a=blocking1.9+]

This commit is contained in:
reed%reedloden.com 2008-02-10 06:16:32 +00:00
Родитель e74a25928b
Коммит 203ab3e6e7
14 изменённых файлов: 23 добавлений и 23 удалений

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

@ -916,7 +916,7 @@ nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
PRBool subsumes; PRBool subsumes;
nsresult rv = subjectPrincipal->Subsumes(nodePrincipal, &subsumes); nsresult rv = subjectPrincipal->Subsumes(nodePrincipal, &subsumes);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, PR_FALSE);
if (subsumes) { if (subsumes) {
return PR_TRUE; return PR_TRUE;

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

@ -1374,11 +1374,11 @@ IsSameOrigin(nsIPrincipal* aPrincipal, nsIChannel* aChannel)
nsCOMPtr<nsIURI> codebase; nsCOMPtr<nsIURI> codebase;
nsresult rv = aPrincipal->GetURI(getter_AddRefs(codebase)); nsresult rv = aPrincipal->GetURI(getter_AddRefs(codebase));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, PR_FALSE);
nsCOMPtr<nsIURI> channelURI; nsCOMPtr<nsIURI> channelURI;
rv = aChannel->GetURI(getter_AddRefs(channelURI)); rv = aChannel->GetURI(getter_AddRefs(channelURI));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, PR_FALSE);
rv = nsContentUtils::GetSecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
CheckSameOriginURI(codebase, channelURI, PR_FALSE); CheckSameOriginURI(codebase, channelURI, PR_FALSE);
@ -2477,7 +2477,7 @@ nsXMLHttpRequest::OverrideMimeType(const nsACString& aMimeType)
NS_IMETHODIMP NS_IMETHODIMP
nsXMLHttpRequest::GetMultipart(PRBool *_retval) nsXMLHttpRequest::GetMultipart(PRBool *_retval)
{ {
*_retval = mState & XML_HTTP_REQUEST_MULTIPART; *_retval = !!(mState & XML_HTTP_REQUEST_MULTIPART);
return NS_OK; return NS_OK;
} }

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

@ -1835,7 +1835,7 @@ nsCanvasRenderingContext2D::IsPointInPath(float x, float y, PRBool *retVal)
if (!FloatValidate(x,y)) if (!FloatValidate(x,y))
return NS_ERROR_DOM_SYNTAX_ERR; return NS_ERROR_DOM_SYNTAX_ERR;
*retVal = (PRBool) cairo_in_fill(mCairo, x, y); *retVal = !!cairo_in_fill(mCairo, x, y);
return NS_OK; return NS_OK;
} }

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

@ -201,7 +201,7 @@ nsIMEStateManager::OnInstalledMenuKeyboardListener(PRBool aInstalling)
PRBool PRBool
nsIMEStateManager::IsActive(nsPresContext* aPresContext) nsIMEStateManager::IsActive(nsPresContext* aPresContext)
{ {
NS_ENSURE_ARG_POINTER(aPresContext); NS_ENSURE_TRUE(aPresContext, PR_FALSE);
nsPIDOMWindow* window = aPresContext->Document()->GetWindow(); nsPIDOMWindow* window = aPresContext->Document()->GetWindow();
NS_ENSURE_TRUE(window, PR_FALSE); NS_ENSURE_TRUE(window, PR_FALSE);
if (!sActiveWindow || sActiveWindow != window->GetPrivateRoot()) { if (!sActiveWindow || sActiveWindow != window->GetPrivateRoot()) {
@ -254,7 +254,7 @@ nsIMEStateManager::SetIMEState(nsPresContext* aPresContext,
aKB->SetIMEEnabled(state); aKB->SetIMEEnabled(state);
} }
if (aState & nsIContent::IME_STATUS_MASK_OPENED) { if (aState & nsIContent::IME_STATUS_MASK_OPENED) {
PRBool open = (aState & nsIContent::IME_STATUS_OPEN); PRBool open = !!(aState & nsIContent::IME_STATUS_OPEN);
aKB->SetIMEOpenState(open); aKB->SetIMEOpenState(open);
} }
} }

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

@ -1097,7 +1097,7 @@ nsGenericHTMLElement::UpdateEditableState()
// XXX Should we do this only when in a document? // XXX Should we do this only when in a document?
ContentEditableTristate value = GetContentEditableValue(); ContentEditableTristate value = GetContentEditableValue();
if (value != eInherit) { if (value != eInherit) {
SetEditableFlag(value); SetEditableFlag(!!value);
return; return;
} }
@ -1882,7 +1882,7 @@ nsGenericHTMLFormElement::UpdateEditableFormControlState()
{ {
ContentEditableTristate value = GetContentEditableValue(); ContentEditableTristate value = GetContentEditableValue();
if (value != eInherit) { if (value != eInherit) {
SetEditableFlag(value); SetEditableFlag(!!value);
return; return;
} }

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

@ -1596,10 +1596,10 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
return NS_OK; return NS_OK;
} }
nsresult rv = NS_OK; nsresult rv = NS_OK;
PRBool outerActivateEvent = aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT; PRBool outerActivateEvent = !!(aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT);
PRBool originalCheckedValue = PRBool originalCheckedValue =
aVisitor.mItemFlags & NS_ORIGINAL_CHECKED_VALUE; !!(aVisitor.mItemFlags & NS_ORIGINAL_CHECKED_VALUE);
PRBool noContentDispatch = aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH; PRBool noContentDispatch = !!(aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH);
PRInt8 oldType = NS_CONTROL_TYPE(aVisitor.mItemFlags); PRInt8 oldType = NS_CONTROL_TYPE(aVisitor.mItemFlags);
// Ideally we would make the default action for click and space just dispatch // Ideally we would make the default action for click and space just dispatch
// DOMActivate, and the default action for DOMActivate flip the checkbox/ // DOMActivate, and the default action for DOMActivate flip the checkbox/

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

@ -246,8 +246,8 @@ nsXBLPrototypeHandler::ExecuteHandler(nsPIDOMEventTarget* aTarget,
return rv; return rv;
// See if our event receiver is a content node (and not us). // See if our event receiver is a content node (and not us).
PRBool isXULKey = (mType & NS_HANDLER_TYPE_XUL); PRBool isXULKey = !!(mType & NS_HANDLER_TYPE_XUL);
PRBool isXBLCommand = (mType & NS_HANDLER_TYPE_XBL_COMMAND); PRBool isXBLCommand = !!(mType & NS_HANDLER_TYPE_XBL_COMMAND);
NS_ASSERTION(!(isXULKey && isXBLCommand), NS_ASSERTION(!(isXULKey && isXBLCommand),
"can't be both a key and xbl command handler"); "can't be both a key and xbl command handler");

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

@ -63,7 +63,7 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
txNodeSet* nodeSet = static_cast<txNodeSet*>(aLeft); txNodeSet* nodeSet = static_cast<txNodeSet*>(aLeft);
nsRefPtr<StringResult> strResult; nsRefPtr<StringResult> strResult;
rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult)); rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, PR_FALSE);
PRInt32 i; PRInt32 i;
for (i = 0; i < nodeSet->size(); ++i) { for (i = 0; i < nodeSet->size(); ++i) {
@ -88,7 +88,7 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
txNodeSet* nodeSet = static_cast<txNodeSet*>(aRight); txNodeSet* nodeSet = static_cast<txNodeSet*>(aRight);
nsRefPtr<StringResult> strResult; nsRefPtr<StringResult> strResult;
rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult)); rv = aContext->recycler()->getStringResult(getter_AddRefs(strResult));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, PR_FALSE);
PRInt32 i; PRInt32 i;
for (i = 0; i < nodeSet->size(); ++i) { for (i = 0; i < nodeSet->size(); ++i) {

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

@ -47,7 +47,7 @@ CurrentFunctionCall::getReturnType()
PRBool PRBool
CurrentFunctionCall::isSensitiveTo(ContextSensitivity aContext) CurrentFunctionCall::isSensitiveTo(ContextSensitivity aContext)
{ {
return (aContext & PRIVATE_CONTEXT); return !!(aContext & PRIVATE_CONTEXT);
} }
#ifdef TX_TO_STRING #ifdef TX_TO_STRING

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

@ -1111,7 +1111,7 @@ TX_XSLTFunctionAvailable(nsIAtom* aName, PRInt32 aNameSpaceID)
{ {
nsRefPtr<txStylesheetCompiler> compiler = nsRefPtr<txStylesheetCompiler> compiler =
new txStylesheetCompiler(EmptyString(), nsnull); new txStylesheetCompiler(EmptyString(), nsnull);
NS_ENSURE_TRUE(compiler, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(compiler, PR_FALSE);
nsAutoPtr<FunctionCall> fnCall; nsAutoPtr<FunctionCall> fnCall;

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

@ -456,7 +456,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
// Create the context node set for evaluating the predicates // Create the context node set for evaluating the predicates
nsRefPtr<txNodeSet> nodes; nsRefPtr<txNodeSet> nodes;
nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes)); nsresult rv = aContext->recycler()->getNodeSet(getter_AddRefs(nodes));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, MB_FALSE);
PRBool hasNext = mIsAttr ? walker.moveToFirstAttribute() : PRBool hasNext = mIsAttr ? walker.moveToFirstAttribute() :
walker.moveToFirstChild(); walker.moveToFirstChild();
@ -471,7 +471,7 @@ MBool txStepPattern::matches(const txXPathNode& aNode, txIMatchContext* aContext
Expr* predicate = mPredicates[0]; Expr* predicate = mPredicates[0];
nsRefPtr<txNodeSet> newNodes; nsRefPtr<txNodeSet> newNodes;
rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes)); rv = aContext->recycler()->getNodeSet(getter_AddRefs(newNodes));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, MB_FALSE);
PRUint32 i, predLen = mPredicates.Length(); PRUint32 i, predLen = mPredicates.Length();
for (i = 1; i < predLen; ++i) { for (i = 1; i < predLen; ++i) {

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

@ -604,7 +604,7 @@ public:
void ClearLazyState(LazyState aFlags) void ClearLazyState(LazyState aFlags)
{ UnsetFlags(aFlags << XUL_ELEMENT_LAZY_STATE_OFFSET); } { UnsetFlags(aFlags << XUL_ELEMENT_LAZY_STATE_OFFSET); }
PRBool GetLazyState(LazyState aFlag) PRBool GetLazyState(LazyState aFlag)
{ return GetFlags() & (aFlag << XUL_ELEMENT_LAZY_STATE_OFFSET); } { return !!(GetFlags() & (aFlag << XUL_ELEMENT_LAZY_STATE_OFFSET)); }
// nsIDOMNode // nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericElement::) NS_FORWARD_NSIDOMNODE(nsGenericElement::)

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

@ -274,7 +274,7 @@ nsRDFConInstanceTestNode::CanPropagate(nsIRDFResource* aSource,
= do_GetService("@mozilla.org/rdf/container-utils;1"); = do_GetService("@mozilla.org/rdf/container-utils;1");
if (! rdfc) if (! rdfc)
return NS_ERROR_FAILURE; return PR_FALSE;
// We can certainly propagate ordinal properties // We can certainly propagate ordinal properties
rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate); rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);

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

@ -502,7 +502,7 @@ nsRDFConMemberTestNode::CanPropagate(nsIRDFResource* aSource,
do_GetService("@mozilla.org/rdf/container-utils;1"); do_GetService("@mozilla.org/rdf/container-utils;1");
if (! rdfc) if (! rdfc)
return NS_ERROR_FAILURE; return PR_FALSE;
// We can certainly propagate ordinal properties // We can certainly propagate ordinal properties
rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate); rv = rdfc->IsOrdinalProperty(aProperty, &canpropagate);