From: Wez Furlong Date: Thu, 21 Mar 2002 02:27:41 +0000 (+0000) Subject: Implement bz2 streams and bz2: wrapper. X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1170 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0e39dfa9c061de3db311698dda8aca7a8bef0ef;p=php Implement bz2 streams and bz2: wrapper. You can now do this: copy("zlib:src.gz", "bz2:dest.bz2"); As with zlib, most of the functions with counterparts in file.c are now aliases to those functions. --- diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c index d2acfa0e27..a12abf1996 100644 --- a/ext/zlib/zlib_fopen_wrapper.c +++ b/ext/zlib/zlib_fopen_wrapper.c @@ -78,10 +78,16 @@ static int php_gziop_close(php_stream *stream, int close_handle TSRMLS_DC) return ret; } +static int php_gziop_flush(php_stream *stream TSRMLS_DC) +{ + struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *)stream->abstract; + return gzflush(self->gz_file, Z_SYNC_FLUSH); +} + php_stream_ops php_stream_gzio_ops = { php_gziop_write, php_gziop_read, - php_gziop_close, NULL, + php_gziop_close, php_gziop_flush, php_gziop_seek, php_gziop_gets, NULL, "ZLIB" }; @@ -122,6 +128,7 @@ php_stream *php_stream_gzopen(char *path, char *mode, int options, char **opened php_stream_wrapper php_stream_gzip_wrapper = { php_stream_gzopen, + NULL, NULL };