Issue 4028 in pharo: Possible infinite loop in ImageSegment >> #uniqueFileNameFor:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 4028 in pharo: Possible infinite loop in ImageSegment >> #uniqueFileNameFor:

pharo
Status: Accepted
Owner: [hidden email]
Labels: Milestone-1.3

New issue 4028 by [hidden email]: 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



Reply | Threaded
Open this post in threaded view
|

Re: Issue 4028 in pharo: Possible infinite loop in ImageSegment >> #uniqueFileNameFor:

pharo
Updates:
        Cc: [hidden email]

Comment #1 on issue 4028 by marianopeck: Possible infinite loop in  
ImageSegment >> #uniqueFileNameFor:
http://code.google.com/p/pharo/issues/detail?id=4028

(No comment was entered for this change.)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 4028 in pharo: Possible infinite loop in ImageSegment >> #uniqueFileNameFor:

pharo

Comment #2 on issue 4028 by marianopeck: Possible infinite loop in  
ImageSegment >> #uniqueFileNameFor:
http://code.google.com/p/pharo/issues/detail?id=4028

hehehehehehheheh

At least that only happens when yo DO NOT specify a fileName....
And I don't see any reason about that limit. Cannot we just remove this  
line?

BiggestFileNumber > 99 ifTrue: [BiggestFileNumber := 1]. "wrap"

And then an explicit message to reset it ? So that the developer that  
really understand the problem, can explicirtly and savely reset it?




Reply | Threaded
Open this post in threaded view
|

Re: Issue 4028 in pharo: Possible infinite loop in ImageSegment >> #uniqueFileNameFor:

pharo
Updates:
        Labels: -Milestone-1.3

Comment #3 on issue 4028 by [hidden email]: Possible infinite loop  
in ImageSegment >> #uniqueFileNameFor:
http://code.google.com/p/pharo/issues/detail?id=4028

Not a showstopper for 1.3