[FIX] Array2D enumeration bug

Steve MacDonald stevem at cs.ualberta.ca
Fri Sep 7 16:39:53 UTC 2001


        The attached filein is a bug fix for the Array2D enumerators.
The width and height were reversed, which caused out of bounds errors
on arrays that were not square.

Steve
--
Steve MacDonald, Ph.D. Candidate  | Department of Computing Science
stevem at cs.ualberta.ca             | University of Alberta
http://www.cs.ualberta.ca/~stevem | Edmonton, Alberta, CANADA  T6G 2H1
I don't think I'm opinionated...  | 2048 - the real Y2K
-------------- next part --------------
'From Squeak3.0 of 4 February 2001 [latest update: #3552] on 6 September 2001 at 3:05:56 pm'!


!Array2D methodsFor: 'enumeration' stamp: 'sma 4/22/2000 18:14'!
do: aBlock
	"Iterate with X varying most quickly.  6/20/96 tk"

	contents do: aBlock! !

!Array2D methodsFor: 'enumeration' stamp: 'SM 9/6/2001 15:04'!
rowAndColumnValuesDo: aBlock
	1 to: self height do: [:col |
		1 to: self width do: [:row |
			aBlock value: row value: col value: (self at: row at: col)]]! !

!Array2D methodsFor: 'enumeration' stamp: 'SM 9/6/2001 15:04'!
rowsAndColumnsDo: aBlock 
	1
		to: self height
		do: [:col | 1
				to: self width
				do: [:row | aBlock value: row value: col]]! !


More information about the Squeak-dev mailing list