diff --git a/xpcom/glue/nsDeque.cpp b/xpcom/glue/nsDeque.cpp index 7c1fd7a24f8..1086bcf2314 100644 --- a/xpcom/glue/nsDeque.cpp +++ b/xpcom/glue/nsDeque.cpp @@ -174,36 +174,32 @@ nsDeque& nsDeque::Erase() { * and you knew its capacity beforehand, * then this would be a way to indicate the failure. */ -PRInt32 nsDeque::GrowCapacity() { +PRBool nsDeque::GrowCapacity() { PRInt32 theNewSize=mCapacity<<2; NS_ASSERTION(theNewSize>mCapacity, "Overflow"); if (theNewSize<=mCapacity) - return mCapacity; + return PR_FALSE; void** temp=new void*[theNewSize]; + if (!temp) + return PR_FALSE; //Here's the interesting part: You can't just move the elements //directly (in situ) from the old buffer to the new one. //Since capacity has changed, the old origin doesn't make //sense anymore. It's better to resequence the elements now. - if (temp) { - PRInt32 tempi=0; - PRInt32 i=0; - PRInt32 j=0; - for (i=mOrigin; i