cvs: php4 /main streams.c
| From: | Wez Furlong | Date: | Sat, 16 Mar 2002 02:39:39 +0000 |
| Subject: | cvs: php4 /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10203@lists.php.net to get a copy of this message | ||
wez Fri Mar 15 21:39:39 2002 EDT
Modified files:
/php4/main streams.c
Log:
some tweaks for seek/read used in image.c (thanks Marcus)
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.12 php4/main/streams.c:1.13
--- php4/main/streams.c:1.12 Fri Mar 15 20:58:13 2002
+++ php4/main/streams.c Fri Mar 15 21:39:39 2002
@@ -132,7 +132,7 @@
char buf;
if (php_stream_read(stream, &buf, 1) > 0) {
- return buf;
+ return buf & 0xff;
}
return EOF;
}
@@ -210,10 +210,15 @@
/* emulate forward moving seeks with reads */
if (whence == SEEK_CUR && offset > 0) {
- while(offset-- > 0) {
- if (php_stream_getc(stream) == EOF) {
+ char tmp[1024];
+ while(offset >= sizeof(tmp)) {
+ if (php_stream_read(stream, tmp, sizeof(tmp)) == 0)
+ return -1;
+ offset -= sizeof(tmp);
+ }
+ if (offset) {
+ if (php_stream_read(stream, tmp, offset) == 0)
return -1;
- }
}
return 0;
}