Bug 724453. Don't assume that sizeof(bool) == 1 when memsetting arrays of bools in nsTextFrame. r=bzbarsky

This commit is contained in:
Cameron Kaiser 2012-02-06 13:00:54 -05:00
parent 61545034ce
commit ae23981e97

View File

@ -3027,7 +3027,7 @@ PropertyProvider::GetHyphenationBreaks(PRUint32 aStart, PRUint32 aLength,
if (!mTextStyle->WhiteSpaceCanWrap() ||
mTextStyle->mHyphens == NS_STYLE_HYPHENS_NONE)
{
memset(aBreakBefore, false, aLength);
memset(aBreakBefore, false, aLength*sizeof(bool));
return;
}
@ -3054,7 +3054,7 @@ PropertyProvider::GetHyphenationBreaks(PRUint32 aStart, PRUint32 aLength,
mFrag->CharAt(run.GetOriginalOffset() + run.GetRunLength() - 1) == CH_SHY;
} else {
PRInt32 runOffsetInSubstring = run.GetSkippedOffset() - aStart;
memset(aBreakBefore + runOffsetInSubstring, false, run.GetRunLength());
memset(aBreakBefore + runOffsetInSubstring, false, run.GetRunLength()*sizeof(bool));
// Don't allow hyphen breaks at the start of the line
aBreakBefore[runOffsetInSubstring] = allowHyphenBreakBeforeNextChar &&
(!(mFrame->GetStateBits() & TEXT_START_OF_LINE) ||
@ -6314,7 +6314,7 @@ ClusterIterator::ClusterIterator(nsTextFrame* aTextFrame, PRInt32 aPosition,
mDirection = 0; // signal failure
return;
}
memset(mWordBreaks.Elements(), false, textLen + 1);
memset(mWordBreaks.Elements(), false, (textLen + 1)*sizeof(bool));
PRInt32 textStart;
if (aDirection > 0) {
if (aContext.IsEmpty()) {