Hi Wez,

Thanks for your comments. After having some problems with the new functions i switched to use
php_stream_open_wrapper( STREAM_MUST_SEEK
now.

If have the following annotations to streams:

1) i do not like the style of how to determine the kine of a stream
instead of
#define php_stream_is(stream, anops)            ((stream)->ops == anops)
#define PHP_STREAM_IS_STDIO &php_stream_stdio_ops
i would like a 'call form' like
#define php_stream_is(stream, anops)            ((stream)->ops == anops)
#define PHP_STREAM_IS_STDIO(stream)  php_stream_is(stream,&php_stream_stdio_ops)

2) for seekable streams the copy function should seek to 0 if copying all, shouldn't it?

3) the patch below shows that as expected only one line has to be modified in order
to use temp-streams instead of temp-files directly. But you would have to reenable
memory_streams.c. I tried it and it worked fine for me.

marcus

diff -u -w -r1.27 streams.c
--- main/streams.c      17 Mar 2002 22:50:59 -0000      1.27
+++ main/streams.c      18 Mar 2002 05:36:45 -0000
@@ -1020,7 +1020,7 @@
        
        /* Use a tmpfile and copy the old streams contents into it */
 
-       *newstream = php_stream_fopen_tmpfile();
+       *newstream = php_stream_temp_create(TEMP_STREAM_DEFAULT,128*1024);
 
        if (*newstream == NULL)
                return PHP_STREAM_FAILED;


At 01:27 18.03.2002, you wrote:
Hi Marcus,

we can lose the "#ifdef HAVE_PHP_STREAM", because there is no longer
a choice not to have it :-)

> +             php_stream_make_seekable( ImageInfo->infile, &mem_stream);
> +             if ( !ImageInfo->FileSize) {
> +                     php_stream_seek(mem_stream,0,SEEK_END);
> +                     ImageInfo->FileSize = php_stream_tell(mem_stream);
> +                     php_stream_seek(mem_stream,0,SEEK_SET);
             }
> -             #else
> -             ImageInfo->FileSize = 0;
> -             #endif
> +             ImageInfo->infile = mem_stream;
     }
> +     #endif

It's also *extremely important* to check the return code from
php_stream_make_seekable, because you might find that you are
left with no valid streams!
Also, mem_stream may be set to NULL on error.

--Wez.

Reply via email to