helly           Thu Oct  6 17:35:30 2005 EDT

  Modified files:              (Branch: PHP_4_4)
    /php-src/main       memory_streams.c 
  Log:
  - MFH Fix issue (endless loop) with temp/memory streams
  
http://cvs.php.net/diff.php/php-src/main/memory_streams.c?r1=1.20.2.2&r2=1.20.2.2.8.1&ty=u
Index: php-src/main/memory_streams.c
diff -u php-src/main/memory_streams.c:1.20.2.2 
php-src/main/memory_streams.c:1.20.2.2.8.1
--- php-src/main/memory_streams.c:1.20.2.2      Tue Dec 31 11:26:11 2002
+++ php-src/main/memory_streams.c       Thu Oct  6 17:35:29 2005
@@ -12,11 +12,12 @@
    | obtain it through the world-wide-web, please send a note to          |
    | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
    +----------------------------------------------------------------------+
-   | Author:                                                              |
-   | Marcus Boerger <[EMAIL PROTECTED]>                                       |
+   | Author: Marcus Boerger <[EMAIL PROTECTED]>                               |
    +----------------------------------------------------------------------+
  */
 
+/* $Id: memory_streams.c,v 1.20.2.2.8.1 2005/10/06 21:35:29 helly Exp $ */
+
 #define _GNU_SOURCE
 #include "php.h"
 
@@ -214,7 +215,6 @@
        php_stream *stream;
 
        self = emalloc(sizeof(*self));
-       assert(self != NULL);
        self->data = NULL;
        self->fpos = 0;
        self->fsize = 0;
@@ -313,7 +313,13 @@
        ts = stream->abstract;
        assert(ts != NULL);
 
-       return php_stream_read(ts->innerstream, buf, count);
+       size_t got = php_stream_read(ts->innerstream, buf, count);
+       
+       if (!got) {
+               stream->eof |= ts->innerstream->eof;
+       }
+       
+       return got;
 }
 /* }}} */
 
@@ -423,15 +429,15 @@
        NULL /* set_option */
 };
 
+/* }}} */
 
-/* {{{ */
+/* {{{ _php_stream_temp_create */
 PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage 
STREAMS_DC TSRMLS_DC)
 {
        php_stream_temp_data *self;
        php_stream *stream;
 
        self = ecalloc(1, sizeof(*self));
-       assert(self != NULL);
        self->smax = max_memory_usage;
        self->mode = mode;
        stream = php_stream_alloc(&php_stream_temp_ops, self, 0, "r+b");
@@ -443,7 +449,7 @@
 /* }}} */
 
 
-/* {{{ */
+/* {{{ _php_stream_temp_open */
 PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, 
char *buf, size_t length STREAMS_DC TSRMLS_DC)
 {
        php_stream *stream;
@@ -462,6 +468,7 @@
 }
 /* }}} */
 
+
 /*
  * Local variables:
  * tab-width: 4

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to