Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Tomas Hajny
On 18 May 09, at 22:10, Jonas Maebe wrote: > On 18 May 2009, at 21:03, Michael Van Canneyt wrote: > > > I checked the windows code, and FindClose explicitly checks that > > the searchrec record contains a valid handle (i.e. NOT > > INVALID_HANDLE_VALUE), so all platforms would behave the same. > >

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 21:03, Michael Van Canneyt wrote: I checked the windows code, and FindClose explicitly checks that the searchrec record contains a valid handle (i.e. NOT INVALID_HANDLE_VALUE), so all platforms would behave the same. Opinions ? If no-one objects, I'll implement the 'fix', it

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Marco van de Voort wrote: > In our previous episode, Michael Van Canneyt said: > > Opinions ? If no-one objects, I'll implement the 'fix', it's only > > 2 lines of code. > > No fundamental objections, but maybe wait till just before a release to > avoid packages that work w

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > Opinions ? If no-one objects, I'll implement the 'fix', it's only > 2 lines of code. No fundamental objections, but maybe wait till just before a release to avoid packages that work with both 2.2.4 and 2.3.1 having to ifdef till the next release

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Leonardo M. Ramé wrote: > > This sounds good, just also check what happens if FindClose receives an > invalid handle. That was the second line in my line count estimate ;-) Michael.___ fpc-pascal maillist - fpc-pascal@lists.f

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé
This sounds good, just also check what happens if FindClose receives an invalid handle. Leonardo M. Ramé http://leonardorame.blogspot.com --- On Mon, 5/18/09, Michael Van Canneyt wrote: > From: Michael Van Canneyt > Subject: Re: [fpc-pascal] FindFirst...FindClose > To: "FP

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 18:15, Michael Van Canneyt wrote: As far as I know, the FindClose is only needed when FindFirst returned zero. That has never been true on FPC/unix, as far as I can see. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepa

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Marco van de Voort wrote: In our previous episode, Jonas Maebe said: Yes. Huh ? Since when is this requirement ? Since as long as I can remember. It at least predates the switch to svn (revision 1 of both rtl/unix/dos.pp and of rtl/unix/sysutils.pp requires it). Th

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: > >> > >> Yes. > > > > Huh ? Since when is this requirement ? > > Since as long as I can remember. It at least predates the switch to > svn (revision 1 of both rtl/unix/dos.pp and of rtl/unix/sysutils.pp > requires it). The current situation is proba

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jürgen Hestermann
Is that correct: http://www.delphifaq.com/faq/delphi/windows_file_system/f419.shtml ? If yes, then you need IFDEFs to distinguish between Linux and Windows. ;-( Jürgen Hestermann ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread fpclist
I must agree with Michael. In my experience, it doesn't matter where the findclose() is placed, as long as it's called within the scope of the findfirst(), findnext(). If findclose() is not called, all that happens is that the OS will use up file handles, which are finite in quantity on any giv

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 17:25, Michael Van Canneyt wrote: On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as fo

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 17:25, Michael Van Canneyt wrote: On Mon, 18 May 2009, Jonas Maebe wrote: On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as follows: if FindFirst(Edit1.Text, FileAttrs,

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé
09, Michael Van Canneyt wrote: > From: Michael Van Canneyt > Subject: Re: [fpc-pascal] FindFirst...FindClose > To: "FPC-Pascal users discussions" > Date: Monday, May 18, 2009, 12:25 PM > > > On Mon, 18 May 2009, Jonas Maebe wrote: > > >

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Michael Van Canneyt
On Mon, 18 May 2009, Jonas Maebe wrote: > > On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: > > >Apparently my program gets stuck after a couple (several, in fact) of calls > >to the function that includes this code. > > > >By reading the FPC.RTL documentation, I found it says that FindClose

Re: [fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Jonas Maebe
On 18 May 2009, at 16:39, Leonardo M. Ramé wrote: Apparently my program gets stuck after a couple (several, in fact) of calls to the function that includes this code. By reading the FPC.RTL documentation, I found it says that FindClose must be used outside the if, as follows: if FindFirs

[fpc-pascal] FindFirst...FindClose

2009-05-18 Thread Leonardo M . Ramé
Hi, I ported a Delphi service to linux using FPC. The app uses FindFirst, FindNext and FindClose the same way Delphi Help shows: if FindFirst(Edit1.Text, FileAttrs, sr) = 0 then begin repeat ... ... until FindNext(sr) <> 0; FindClose(sr); end; Apparently my program gets stuck afte