summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib_fopen_wrapper.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-10-05 10:35:13 +0000
committerWez Furlong <wez@php.net>2002-10-05 10:35:13 +0000
commit077fe52d8b650b5d1739aa55ab90f6ab6ad8461b (patch)
tree90af179612cfc891683ba1fbf5ba8d66874b93bf /ext/zlib/zlib_fopen_wrapper.c
parent945ccfa76a8453ffc8fe4e514ef593c95fe377eb (diff)
downloadphp-git-077fe52d8b650b5d1739aa55ab90f6ab6ad8461b.tar.gz
This seems to resolve the issues with fgets.
I've moved EOF detection into the streams layer; a stream reader implementation should set stream->eof when it detects EOF. Fixed test for user streams - it still fails but that is due to an output buffering bug.
Diffstat (limited to 'ext/zlib/zlib_fopen_wrapper.c')
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index 1ccccc615a..b97f6a691b 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -32,14 +32,14 @@ struct php_gz_stream_data_t {
static size_t php_gziop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
{
struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *)stream->abstract;
+ size_t ret;
+
+ ret = gzread(self->gz_file, buf, count);
- if (buf == NULL && count == 0) {
- if (gzeof(self->gz_file))
- return EOF;
- return 0;
- }
+ if (ret == 0 && gzeof(self->gz_file))
+ stream->eof = 1;
- return gzread(self->gz_file, buf, count);
+ return ret;
}
static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)