[Pharo-project] Issue 4028 in pharo: Possible infinite loop in ImageSegment >> #uniqueFileNameFor:

pharo at googlecode.com pharo at googlecode.com
Fri Apr 15 14:41:37 CEST 2011


Status: Accepted
Owner: ryd... at gmail.com
Labels: Milestone-1.3

New issue 4028 by ryd... at gmail.com: Possible infinite loop in ImageSegment  
>> #uniqueFileNameFor:
http://code.google.com/p/pharo/issues/detail?id=4028

I guess noone's ever needed more than 99 versions of a segment...

ImageSegment >> uniqueFileNameFor: segName
	"Choose a unique file name for the segment with this name."
	| segDir fileName listOfFiles |
	segDir := self segmentDirectory.
	listOfFiles := segDir fileNames.
	BiggestFileNumber ifNil: [BiggestFileNumber := 1].
	BiggestFileNumber > 99 ifTrue: [BiggestFileNumber := 1].	"wrap"
	[fileName := segName, BiggestFileNumber printString, '.seg'.
	 (listOfFiles includes: fileName)] whileTrue: [
		BiggestFileNumber := BiggestFileNumber + 1].	"force a unique file name"
	^ fileName





More information about the Pharo-project mailing list