To have image.c work i had to correct the php_stream_seek and php_stream_getc
calls. Seek caals had wrong parameter arragement - but nowhere else in code...
getc see below...
I changed both functions later.
in php_stream_getc i return buf & 0xFF because otherwise i get 0xFFFFFFxx
in return.
in php_stream_seek i added code to make it much faster....
and i couldn't compile php_stdiop_read see diff
marcus
diff -u -w -r1.11 streams.c
--- main/streams.c 16 Mar 2002 00:05:47 -0000 1.11
+++ main/streams.c 16 Mar 2002 02:28:55 -0000
@@ -132,7 +132,7 @@
char buf;
if (php_stream_read(stream, &buf, 1) > 0) {
- return buf;
+ return buf & 0xFF;
}
return EOF;
}
@@ -204,17 +204,19 @@
PHPAPI int php_stream_seek(php_stream *stream, off_t offset, int whence)
{
+ static char tmp[1024];
+
if (stream->ops->seek) {
return stream->ops->seek(stream, offset, whence);
}
/* emulate forward moving seeks with reads */
if (whence == SEEK_CUR && offset > 0) {
- while(offset-- > 0) {
- if (php_stream_getc(stream) == EOF) {
- return -1;
- }
+ while (offset>=sizeof(tmp)) {
+ php_stream_read(stream,tmp,sizeof(tmp));
+ offset -= sizeof(tmp);
}
+ if (offset) php_stream_read(stream,tmp,offset);
return 0;
}
@@ -447,7 +449,7 @@
static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
{
- php_stdio_stream_data * ata = (php_stdio_stream_data*)stream->abstract;
+ php_stdio_stream_data * data =
(php_stdio_stream_data*)stream->abstract;
if (buf == NULL && count == 0) {
/* check for EOF condition */
At 22:12 15.03.2002, Wez Furlong wrote:
>Well, PHP finally supports fopen("https://...") :-)
>
>Please please please test the following things in particular
>as I can't compile them or verify them here:
>
>hyperwave:
>hw_new_document_from_file
>
>gd:
>functions that create images from files.
>In particular, try creating from "wrapped" files over
>http, ftp etc.
>
>pfsockopen()
>copy() - particularly with "wrapped" source/dest
>gzopen (and friends)
>gzfile
>
>If you have a system where HAVE_FLUSHIO is important,
>please let me know if plain files work correctly when
>switching between read and write.
>
>If you have things in Pear/PECL or a third party
>extension that used the old FP_XXX or php_file_le_fopen(),
>please contact me and I can help you update your code for
>streams (it's easy).
>
>I'll check back in a couple of hours to see if anyone
>has found show stoppers; otherwise I'll be signing off
>till the morning (it is Friday after all!)
>
>--Wez.
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php