]> granicus.if.org Git - php/commitdiff
Fix compile error due to the removal of fteller on streams.
authorScott MacVicar <scottmac@php.net>
Fri, 18 Jul 2008 13:08:08 +0000 (13:08 +0000)
committerScott MacVicar <scottmac@php.net>
Fri, 18 Jul 2008 13:08:08 +0000 (13:08 +0000)
sapi/apache2filter/php_apache.h
sapi/apache2filter/sapi_apache2.c

index 53bfb9c223025302e5f8a9e79da1f9d6a2c584c0..b4f55c3edbc678a18d8aa7b36d39983d9c77baac 100644 (file)
@@ -49,7 +49,6 @@ typedef struct php_struct {
 } php_struct;
 
 typedef struct _php_apr_bucket_brigade {
-       unsigned int total_len;
        apr_bucket_brigade *bb;
 } php_apr_bucket_brigade;
 
@@ -60,8 +59,7 @@ void apply_config(void *);
 extern const command_rec php_dir_cmds[];
 
 static size_t php_apache_read_stream(void *, char *, size_t TSRMLS_DC);
-static void php_apache_close_stream(void * TSRMLS_DC);
-static long php_apache_fteller_stream(void * TSRMLS_DC);
+static size_t php_apache_fsizer_stream(void * TSRMLS_DC);
 
 #define APR_ARRAY_FOREACH_OPEN(arr, key, val)          \
 {                                                                                                      \
index f901fbc82fe5a0f2ecb1c801549967e4f1dc6be4..390b672f6848a8ecc1af13380b126bc166df622e 100644 (file)
@@ -210,7 +210,7 @@ php_apache_sapi_register_variables(zval *track_vars_array TSRMLS_DC)
        php_struct *ctx = SG(server_context);
        const apr_array_header_t *arr = apr_table_elts(ctx->r->subprocess_env);
        char *key, *val;
-       int new_val_len;
+       unsigned int new_val_len;
        
        APR_ARRAY_FOREACH_OPEN(arr, key, val)
                if (!val) {
@@ -468,7 +468,6 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
        } else {
                pbb = f->ctx = apr_palloc(f->r->pool, sizeof(*pbb));
                pbb->bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
-               pbb->total_len = 0;
        }
 
        if(ap_save_brigade(NULL, &pbb->bb, &bb, f->r->pool) != APR_SUCCESS) {
@@ -522,9 +521,9 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
        
        zfd.handle.stream.handle = pbb;
        zfd.handle.stream.reader = php_apache_read_stream;
-       zfd.handle.stream.closer = php_apache_close_stream;
-       zfd.handle.stream.fteller = php_apache_fteller_stream;
-       zfd.handle.stream.interactive = 0;
+       zfd.handle.stream.closer = NULL;
+       zfd.handle.stream.fsizer = php_apache_fsizer_stream;
+       zfd.handle.stream.isatty = 0;
        
        zfd.filename = f->r->filename;
        zfd.opened_path = NULL;
@@ -710,20 +709,20 @@ static size_t php_apache_read_stream(void *handle, char *buf, size_t wantlen TSR
        readlen = wantlen;
        apr_brigade_flatten(rbb, buf, &readlen);
        apr_brigade_cleanup(rbb);
-       pbb->total_len += readlen;
        
        return readlen;
 }
 
-static void php_apache_close_stream(void *handle TSRMLS_DC)
-{
-       return; 
-}
-
-static long php_apache_fteller_stream(void *handle TSRMLS_DC)
+static size_t php_apache_fsizer_stream(void *handle TSRMLS_DC)
 {
        php_apr_bucket_brigade *pbb = (php_apr_bucket_brigade *)handle;
-       return pbb->total_len;
+       apr_off_t actual = 0;
+
+       if (apr_brigade_length(pbb->bb, 1, &actual) == APR_SUCCESS) {
+               return actual;
+       }
+
+       return 0;
 }
 
 AP_MODULE_DECLARE_DATA module php5_module = {