зеркало из https://github.com/mozilla/pjs.git
Bug 566414 - Signed/unsigned comparison warnings in editor; r=ehsan
This commit is contained in:
Родитель
6a3aead4b2
Коммит
0a53d15c24
|
@ -733,7 +733,7 @@ nsWSRunObject::GetWSNodes()
|
|||
for (pos=mOffset-1; pos>=0; pos--)
|
||||
{
|
||||
// sanity bounds check the char position. bug 136165
|
||||
if (pos >= textFrag->GetLength())
|
||||
if (PRUint32(pos) >= textFrag->GetLength())
|
||||
{
|
||||
NS_NOTREACHED("looking beyond end of text fragment");
|
||||
continue;
|
||||
|
@ -801,7 +801,7 @@ nsWSRunObject::GetWSNodes()
|
|||
for (pos=len-1; pos>=0; pos--)
|
||||
{
|
||||
// sanity bounds check the char position. bug 136165
|
||||
if (pos >= textFrag->GetLength())
|
||||
if (PRUint32(pos) >= textFrag->GetLength())
|
||||
{
|
||||
NS_NOTREACHED("looking beyond end of text fragment");
|
||||
continue;
|
||||
|
@ -860,13 +860,13 @@ nsWSRunObject::GetWSNodes()
|
|||
const nsTextFragment *textFrag = textNode->GetText();
|
||||
|
||||
PRUint32 len = textNode->TextLength();
|
||||
if (mOffset<len)
|
||||
if (PRUint16(mOffset)<len)
|
||||
{
|
||||
PRInt32 pos;
|
||||
for (pos=mOffset; pos<len; pos++)
|
||||
for (pos=mOffset; PRUint32(pos)<len; pos++)
|
||||
{
|
||||
// sanity bounds check the char position. bug 136165
|
||||
if ((pos<0) || (pos>=textFrag->GetLength()))
|
||||
if ((pos<0) || (PRUint32(pos)>=textFrag->GetLength()))
|
||||
{
|
||||
NS_NOTREACHED("looking beyond end of text fragment");
|
||||
continue;
|
||||
|
@ -932,10 +932,10 @@ nsWSRunObject::GetWSNodes()
|
|||
else
|
||||
{
|
||||
PRInt32 pos;
|
||||
for (pos=0; pos<len; pos++)
|
||||
for (pos=0; PRUint32(pos)<len; pos++)
|
||||
{
|
||||
// sanity bounds check the char position. bug 136165
|
||||
if (pos >= textFrag->GetLength())
|
||||
if (PRUint32(pos) >= textFrag->GetLength())
|
||||
{
|
||||
NS_NOTREACHED("looking beyond end of text fragment");
|
||||
continue;
|
||||
|
@ -1587,7 +1587,7 @@ nsWSRunObject::DeleteChars(nsIDOMNode *aStartNode, PRInt32 aStartOffset,
|
|||
textnode = do_QueryInterface(node);
|
||||
PRUint32 len;
|
||||
textnode->GetLength(&len);
|
||||
if (aStartOffset<len)
|
||||
if (PRUint32(aStartOffset)<len)
|
||||
{
|
||||
res = mHTMLEditor->DeleteText(textnode, (PRUint32)aStartOffset, len-aStartOffset);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
@ -1695,7 +1695,7 @@ nsWSRunObject::GetCharAfter(WSPoint &aPoint, WSPoint *outPoint)
|
|||
if (idx == -1) return NS_OK; // can't find point, but it's not an error
|
||||
PRInt32 numNodes = mNodeArray.Count();
|
||||
|
||||
if (aPoint.mOffset < aPoint.mTextNode->TextLength())
|
||||
if (PRUint16(aPoint.mOffset) < aPoint.mTextNode->TextLength())
|
||||
{
|
||||
*outPoint = aPoint;
|
||||
outPoint->mChar = GetCharAt(aPoint.mTextNode, aPoint.mOffset);
|
||||
|
@ -1941,7 +1941,7 @@ nsWSRunObject::GetCharAt(nsIContent *aTextNode, PRInt32 aOffset)
|
|||
return 0;
|
||||
|
||||
PRUint32 len = aTextNode->TextLength();
|
||||
if (aOffset < 0 || aOffset >= len)
|
||||
if (aOffset < 0 || aOffset >= PRUint32(len))
|
||||
return 0;
|
||||
|
||||
return aTextNode->GetText()->CharAt(aOffset);
|
||||
|
|
|
@ -534,8 +534,8 @@ GetTextNode(nsISelection *selection, nsEditor *editor) {
|
|||
#define ASSERT_PASSWORD_LENGTHS_EQUAL() \
|
||||
if (IsPasswordEditor()) { \
|
||||
PRInt32 txtLen; \
|
||||
mEditor->GetTextLength(&txtLen); \
|
||||
NS_ASSERTION(mPasswordText.Length() == txtLen, \
|
||||
mEditor->GetTextLength(&txtLen); \
|
||||
NS_ASSERTION(mPasswordText.Length() == PRUint32(txtLen), \
|
||||
"password length not equal to number of asterisks"); \
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -4028,8 +4028,9 @@ nsTextServicesDocument::FindWordBounds(nsTArray<OffsetEntry*> *aOffsetTable,
|
|||
// character covered by this entry, we will use the next
|
||||
// entry if there is one.
|
||||
|
||||
if (entry->mStrOffset <= res.mBegin &&
|
||||
(res.mBegin < strEndOffset || (res.mBegin == strEndOffset && i == lastIndex)))
|
||||
if (PRUint32(entry->mStrOffset) <= res.mBegin &&
|
||||
(res.mBegin < PRUint32(strEndOffset) ||
|
||||
(res.mBegin == PRUint32(strEndOffset) && i == lastIndex)))
|
||||
{
|
||||
if (aWordStartNode)
|
||||
{
|
||||
|
@ -4052,9 +4053,9 @@ nsTextServicesDocument::FindWordBounds(nsTArray<OffsetEntry*> *aOffsetTable,
|
|||
// Check to see if res.mEnd is within the range covered
|
||||
// by this entry.
|
||||
|
||||
if (entry->mStrOffset <= res.mEnd && res.mEnd <= strEndOffset)
|
||||
if (PRUint32(entry->mStrOffset) <= res.mEnd && res.mEnd <= PRUint32(strEndOffset))
|
||||
{
|
||||
if (res.mBegin == res.mEnd && res.mEnd == strEndOffset && i != lastIndex)
|
||||
if (res.mBegin == res.mEnd && res.mEnd == PRUint32(strEndOffset) && i != lastIndex)
|
||||
{
|
||||
// Wait for the next round so that we use the same entry
|
||||
// we did for aWordStartNode.
|
||||
|
|
Загрузка…
Ссылка в новой задаче