From d3a330d9a0a54bf62f8342a316de24619de09922 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Wed, 25 Aug 1999 22:04:54 +0000 Subject: [PATCH] small fix in rangelist that will stop warnings or infinite loops --- layout/base/src/nsRangeList.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layout/base/src/nsRangeList.cpp b/layout/base/src/nsRangeList.cpp index ae90bce7b68..ff0efd9fd53 100644 --- a/layout/base/src/nsRangeList.cpp +++ b/layout/base/src/nsRangeList.cpp @@ -232,7 +232,7 @@ private: nsDOMSelection *mDomSelections[NUM_SELECTIONTYPES]; //batching - PRUint32 mBatching; + PRInt32 mBatching; PRBool mChangesDuringBatching; PRBool mNotifyFrames; @@ -1184,7 +1184,7 @@ nsDOMSelection::~nsDOMSelection() PRUint32 cnt = 0; nsresult rv = mRangeArray->Count(&cnt); NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); - PRInt32 j; + PRUint32 j; for (j=0; jRemoveElementAt(0); @@ -1217,12 +1217,16 @@ nsDOMSelection::QueryInterface(REFNSIID aIID, void** aInstancePtr) } if (aIID.Equals(nsIEnumerator::GetIID())) { nsRangeListIterator *iter = new nsRangeListIterator(this); + if (!iter) + return NS_ERROR_OUT_OF_MEMORY; *aInstancePtr = (void*) (nsIEnumerator *) iter; NS_ADDREF_THIS(); return NS_OK; } if (aIID.Equals(nsIBidirectionalEnumerator::GetIID())) { nsRangeListIterator *iter = new nsRangeListIterator(this); + if (!iter) + return NS_ERROR_OUT_OF_MEMORY; *aInstancePtr = (void*) (nsIBidirectionalEnumerator *) iter; NS_ADDREF_THIS(); return NS_OK; @@ -1648,6 +1652,7 @@ nsDOMSelection::LookUpSelection(nsIContent *aContent, PRInt32 aContentOffset, PR endOffset > aContentOffset){ if (!details){ details = new SelectionDetails; + newDetails = details; } else{