[fpc-devel] [PATCH] patch for zipper.pp

Michael Van Canneyt michael at freepascal.org
Wed Jul 29 10:51:40 CEST 2009



On Wed, 29 Jul 2009, Micha Nelissen wrote:

> Michael Van Canneyt wrote:
>> The handler is called 2 times:
>> - Once to create the stream (aclosing=false)
>> - Once when the data has been written to the steam. (AClosing=true)
>> 
>> Maybe it had been better to create 2 events:
>> - OnCreateStream
>> - OnDestroyStream (optional, if not set the component frees the stream)
>> 
>> What do you think ?
>
> Yes, that's more intuitive to me. (Also removes the need for that boolean 
> parameter?)
>
> Would it be allowed to do processing on OnDestroyStream? Maybe OnDoneStream 
> or so would be even better (since that is what it means I guess, the file in 
> the zip stream has been extracted to the specified stream in 
> OnCreateStream?). In Delphi, in an "OnDestroy" you normally don't need to 
> destroy the object the event is about?
>
> Would it be allowed to re-use the same stream?
> 1) OnCreateStream <- MyStream
> 2) OnDoneStream <- write MyStream to .... but do not free it
> 3) OnCreateStream <- same MyStream
> etc...?

I don't see why it would not be allowed, so, yes.

I'll re-implement it as proposed.

Michael.



More information about the fpc-devel mailing list