diff options
| author | Wez Furlong <wez@php.net> | 2002-10-05 10:35:13 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2002-10-05 10:35:13 +0000 |
| commit | 077fe52d8b650b5d1739aa55ab90f6ab6ad8461b (patch) | |
| tree | 90af179612cfc891683ba1fbf5ba8d66874b93bf /main/memory_streams.c | |
| parent | 945ccfa76a8453ffc8fe4e514ef593c95fe377eb (diff) | |
| download | php-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 'main/memory_streams.c')
| -rw-r--r-- | main/memory_streams.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/main/memory_streams.c b/main/memory_streams.c index 520225c87c..ca5055da8b 100644 --- a/main/memory_streams.c +++ b/main/memory_streams.c @@ -89,14 +89,6 @@ static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count ms = stream->abstract; assert(ms != NULL); - if (buf == NULL && count == 0) { - /* check for EOF condition */ - if (ms->fpos >= ms->fsize) { - return EOF; - } - return 0; - } - if (ms->fpos + count > ms->fsize) { count = ms->fsize - ms->fpos; } @@ -105,6 +97,8 @@ static size_t php_stream_memory_read(php_stream *stream, char *buf, size_t count assert(buf!= NULL); memcpy(buf, ms->data+ms->fpos, count); ms->fpos += count; + } else { + stream->eof = 1; } return count; } |
