Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 671417 - Incorrect use of PRBool when other types are more approp…
Browse files Browse the repository at this point in the history
…riate or vice versa, r=bz,ehsan,dwitte,joe,vlad,luke,mak,roc
  • Loading branch information
michaelwu committed Jul 27, 2011
1 parent 5700288 commit aedbeb9
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion content/base/public/nsLineBreaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class nsLineBreaker {
void FindHyphenationPoints(nsHyphenator *aHyphenator,
const PRUnichar *aTextStart,
const PRUnichar *aTextLimit,
PRPackedBool *aBreakState);
PRUint8 *aBreakState);

nsAutoTArray<PRUnichar,100> mCurrentWord;
// All the items that contribute to mCurrentWord
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/nsGenericElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4005,7 +4005,7 @@ nsINode::ReplaceOrInsertBefore(PRBool aReplace, nsINode* aNewChild,

PRBool appending =
!IsNodeOfType(eDOCUMENT) && PRUint32(insPos) == GetChildCount();
PRBool firstInsPos = insPos;
PRInt32 firstInsPos = insPos;
nsIContent* firstInsertedContent = fragChildren[0];

// Iterate through the fragment's children, and insert them in the new
Expand Down
4 changes: 2 additions & 2 deletions content/base/src/nsLineBreaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void
nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator,
const PRUnichar *aTextStart,
const PRUnichar *aTextLimit,
PRPackedBool *aBreakState)
PRUint8 *aBreakState)
{
nsDependentSubstring string(aTextStart, aTextLimit);
nsAutoTArray<PRPackedBool,200> hyphens;
Expand Down Expand Up @@ -414,7 +414,7 @@ nsLineBreaker::AppendText(nsIAtom* aLangGroup, const PRUint8* aText, PRUint32 aL
if (aSink && !(aFlags & BREAK_SUPPRESS_INSIDE)) {
// Save current start-of-word state because GetJISx4051Breaks will
// set it to false
PRPackedBool currentStart = breakState[wordStart];
PRUint8 currentStart = breakState[wordStart];
nsContentUtils::LineBreaker()->
GetJISx4051Breaks(aText + wordStart, offset - wordStart,
breakState.Elements() + wordStart);
Expand Down
4 changes: 2 additions & 2 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ nsIURIFixup *nsDocShell::sURIFixup = 0;
// True means we validate window targets to prevent frameset
// spoofing. Initialize this to a non-bolean value so we know to check
// the pref on the creation of the first docshell.
static PRBool gValidateOrigin = (PRBool)0xffffffff;
static PRUint32 gValidateOrigin = 0xffffffff;

// Hint for native dispatch of events on how long to delay after
// all documents have loaded in milliseconds before favoring normal
Expand Down Expand Up @@ -4504,7 +4504,7 @@ nsDocShell::Create()
mAllowSubframes =
Preferences::GetBool("browser.frames.enabled", mAllowSubframes);

if (gValidateOrigin == (PRBool)0xffffffff) {
if (gValidateOrigin == 0xffffffff) {
// Check pref to see if we should prevent frameset spoofing
gValidateOrigin =
Preferences::GetBool("browser.frame.validate_origin", PR_TRUE);
Expand Down
2 changes: 1 addition & 1 deletion editor/libeditor/html/nsHTMLEditRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5084,7 +5084,7 @@ nsHTMLEditRules::GetInnerContent(nsIDOMNode *aNode, nsCOMArray<nsIDOMNode> &outA
// ExpandSelectionForDeletion: this promotes our selection to include blocks
// that have all their children selected.
//
PRBool
nsresult
nsHTMLEditRules::ExpandSelectionForDeletion(nsISelection *aSelection)
{
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
Expand Down
2 changes: 1 addition & 1 deletion editor/libeditor/html/nsHTMLEditRules.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class nsHTMLEditRules : public nsTextEditRules, public nsIEditActionListener
PRBool *aHandled);
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
nsCOMPtr<nsIDOMNode> *outBRNode, PRInt32 aOffset=0);
PRBool ExpandSelectionForDeletion(nsISelection *aSelection);
nsresult ExpandSelectionForDeletion(nsISelection *aSelection);
PRBool IsFirstNode(nsIDOMNode *aNode);
PRBool IsLastNode(nsIDOMNode *aNode);
#ifdef XXX_DEAD_CODE
Expand Down
4 changes: 2 additions & 2 deletions editor/libeditor/html/nsTableEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,7 @@ nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **table
}

//Return actual number of cells (a cell with colspan > 1 counts as just 1)
PRBool nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex)
PRInt32 nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex)
{
PRInt32 cellCount = 0;
nsCOMPtr<nsIDOMElement> cell;
Expand All @@ -2689,7 +2689,7 @@ PRBool nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowInd
res = GetCellDataAt(aTable, rowIndex, colIndex, getter_AddRefs(cell),
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
&actualRowSpan, &actualColSpan, &isSelected);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_SUCCESS(res, 0);
if (cell)
{
// Only count cells that start in row we are working with
Expand Down
5 changes: 3 additions & 2 deletions extensions/cookie/nsCookiePermission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch,
// save cookie lifetime in seconds instead of days
mCookiesLifetimeSec = val * 24 * 60 * 60;

PRBool bval;
if (PREF_CHANGED(kCookiesAlwaysAcceptSession) &&
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &val)))
mCookiesAlwaysAcceptSession = val;
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &bval)))
mCookiesAlwaysAcceptSession = bval;
}

NS_IMETHODIMP
Expand Down
2 changes: 1 addition & 1 deletion gfx/thebes/gfxPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ unacceptable performance overhead, so we go with perceptual. */
#define INTENT_MIN 0
#define INTENT_MAX 3

PRBool
int
gfxPlatform::GetRenderingIntent()
{
if (gCMSIntent == -2) {
Expand Down
2 changes: 1 addition & 1 deletion intl/uconv/src/nsUTF8ToUnicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc,
PRInt32 mUcs4 = this->mUcs4;
PRUint8 mState = this->mState;
PRUint8 mBytes = this->mBytes;
PRUint8 mFirst = this->mFirst;
PRPackedBool mFirst = this->mFirst;

// Set mFirst to PR_FALSE now so we don't have to every time through the ASCII
// branch within the loop.
Expand Down
2 changes: 1 addition & 1 deletion js/src/jstracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8992,7 +8992,7 @@ EvalCmp(JSContext *cx, LOpcode op, JSString* l, JSString* r, JSBool *ret)
{
if (op == LIR_eqd)
return EqualStrings(cx, l, r, ret);
JSBool cmp;
int32 cmp;
if (!CompareStrings(cx, l, r, &cmp))
return false;
*ret = EvalCmp(op, cmp, 0);
Expand Down
2 changes: 1 addition & 1 deletion js/src/methodjit/StubCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ template void JS_FASTCALL stubs::DefFun<false>(VMFrame &f, JSFunction *fun);
THROWV(JS_FALSE); \
if (lval.isString() && rval.isString()) { \
JSString *l = lval.toString(), *r = rval.toString(); \
JSBool cmp; \
int32 cmp; \
if (!CompareStrings(cx, l, r, &cmp)) \
THROWV(JS_FALSE); \
cond = cmp OP 0; \
Expand Down
2 changes: 1 addition & 1 deletion layout/xul/base/src/nsListBoxBodyFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class nsListScrollSmoother : public nsITimerCallback
PRBool IsRunning();

nsCOMPtr<nsITimer> mRepeatTimer;
PRBool mDelta;
PRInt32 mDelta;
nsListBoxBodyFrame* mOuter;
};

Expand Down
2 changes: 1 addition & 1 deletion layout/xul/base/src/nsMenuPopupFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContex
mPopupState(ePopupClosed),
mPopupAlignment(POPUPALIGNMENT_NONE),
mPopupAnchor(POPUPALIGNMENT_NONE),
mConsumeRollupEvent(nsIPopupBoxObject::ROLLUP_DEFAULT),
mFlipBoth(PR_FALSE),
mIsOpenChanged(PR_FALSE),
mIsContextMenu(PR_FALSE),
mAdjustOffsetForContextMenu(PR_FALSE),
mGeneratedChildren(PR_FALSE),
mMenuCanOverlapOSBar(PR_FALSE),
mShouldAutoPosition(PR_TRUE),
mConsumeRollupEvent(nsIPopupBoxObject::ROLLUP_DEFAULT),
mInContentShell(PR_TRUE),
mIsMenuLocked(PR_FALSE),
mHFlip(PR_FALSE),
Expand Down
3 changes: 2 additions & 1 deletion layout/xul/base/src/nsMenuPopupFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ class nsMenuPopupFrame : public nsBoxFrame, public nsMenuParent
// popup alignment relative to the anchor node
PRInt8 mPopupAlignment;
PRInt8 mPopupAnchor;
// One of nsIPopupBoxObject::ROLLUP_DEFAULT/ROLLUP_CONSUME/ROLLUP_NO_CONSUME
PRInt8 mConsumeRollupEvent;
PRPackedBool mFlipBoth; // flip in both directions

PRPackedBool mIsOpenChanged; // true if the open state changed since the last layout
Expand All @@ -445,7 +447,6 @@ class nsMenuPopupFrame : public nsBoxFrame, public nsMenuParent

PRPackedBool mMenuCanOverlapOSBar; // can we appear over the taskbar/menubar?
PRPackedBool mShouldAutoPosition; // Should SetPopupPosition be allowed to auto position popup?
PRPackedBool mConsumeRollupEvent; // Should the rollup event be consumed?
PRPackedBool mInContentShell; // True if the popup is in a content shell
PRPackedBool mIsMenuLocked; // Should events inside this menu be ignored?

Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/places/nsNavHistoryResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ class nsNavHistoryContainerResultNode : public nsNavHistoryResultNode,
nsresult NotifyOnStateChange(PRUint16 aOldState);

nsCOMPtr<mozIStoragePendingStatement> mAsyncPendingStmt;
PRBool mAsyncCanceledState;
AsyncCanceledState mAsyncCanceledState;
};

NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryContainerResultNode,
Expand Down
2 changes: 1 addition & 1 deletion widget/src/xpwidgets/nsPrintSettingsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ NS_IMETHODIMP nsPrintSettings::SetPlexName(const PRUnichar * aPlexName)
NS_IMETHODIMP nsPrintSettings::GetHowToEnableFrameUI(PRInt16 *aHowToEnableFrameUI)
{
NS_ENSURE_ARG_POINTER(aHowToEnableFrameUI);
*aHowToEnableFrameUI = (PRInt32)mHowToEnableFrameUI;
*aHowToEnableFrameUI = mHowToEnableFrameUI;
return NS_OK;
}
NS_IMETHODIMP nsPrintSettings::SetHowToEnableFrameUI(PRInt16 aHowToEnableFrameUI)
Expand Down
2 changes: 1 addition & 1 deletion widget/src/xpwidgets/nsPrintSettingsImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class nsPrintSettings : public nsIPrintSettings

PRInt16 mPrintFrameTypeUsage;
PRInt16 mPrintFrameType;
PRBool mHowToEnableFrameUI;
PRInt16 mHowToEnableFrameUI;
PRBool mIsCancelled;
PRBool mPrintSilent;
PRBool mPrintPreview;
Expand Down

0 comments on commit aedbeb9

Please sign in to comment.