small fix in rangelist that will stop warnings or infinite loops

This commit is contained in:
mjudge%netscape.com 1999-08-25 22:04:54 +00:00
Родитель 43b4c5e6b6
Коммит d3a330d9a0
1 изменённых файлов: 7 добавлений и 2 удалений

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

@ -232,7 +232,7 @@ private:
nsDOMSelection *mDomSelections[NUM_SELECTIONTYPES]; nsDOMSelection *mDomSelections[NUM_SELECTIONTYPES];
//batching //batching
PRUint32 mBatching; PRInt32 mBatching;
PRBool mChangesDuringBatching; PRBool mChangesDuringBatching;
PRBool mNotifyFrames; PRBool mNotifyFrames;
@ -1184,7 +1184,7 @@ nsDOMSelection::~nsDOMSelection()
PRUint32 cnt = 0; PRUint32 cnt = 0;
nsresult rv = mRangeArray->Count(&cnt); nsresult rv = mRangeArray->Count(&cnt);
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
PRInt32 j; PRUint32 j;
for (j=0; j<cnt; j++) for (j=0; j<cnt; j++)
{ {
mRangeArray->RemoveElementAt(0); mRangeArray->RemoveElementAt(0);
@ -1217,12 +1217,16 @@ nsDOMSelection::QueryInterface(REFNSIID aIID, void** aInstancePtr)
} }
if (aIID.Equals(nsIEnumerator::GetIID())) { if (aIID.Equals(nsIEnumerator::GetIID())) {
nsRangeListIterator *iter = new nsRangeListIterator(this); nsRangeListIterator *iter = new nsRangeListIterator(this);
if (!iter)
return NS_ERROR_OUT_OF_MEMORY;
*aInstancePtr = (void*) (nsIEnumerator *) iter; *aInstancePtr = (void*) (nsIEnumerator *) iter;
NS_ADDREF_THIS(); NS_ADDREF_THIS();
return NS_OK; return NS_OK;
} }
if (aIID.Equals(nsIBidirectionalEnumerator::GetIID())) { if (aIID.Equals(nsIBidirectionalEnumerator::GetIID())) {
nsRangeListIterator *iter = new nsRangeListIterator(this); nsRangeListIterator *iter = new nsRangeListIterator(this);
if (!iter)
return NS_ERROR_OUT_OF_MEMORY;
*aInstancePtr = (void*) (nsIBidirectionalEnumerator *) iter; *aInstancePtr = (void*) (nsIBidirectionalEnumerator *) iter;
NS_ADDREF_THIS(); NS_ADDREF_THIS();
return NS_OK; return NS_OK;
@ -1648,6 +1652,7 @@ nsDOMSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PR
endOffset > aContentOffset){ endOffset > aContentOffset){
if (!details){ if (!details){
details = new SelectionDetails; details = new SelectionDetails;
newDetails = details; newDetails = details;
} }
else{ else{