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)
#define PHP_STREAM_IS_STDIO &php_stream_stdio_ops
i would like a 'call form' like
#define php_stream_is(stream, 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
+++ main/streams.c
@@ -1020,7 +1020,7 @@
-
+
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.