]> granicus.if.org Git - php/commitdiff
Implement bz2 streams and bz2: wrapper.
authorWez Furlong <wez@php.net>
Thu, 21 Mar 2002 02:27:41 +0000 (02:27 +0000)
committerWez Furlong <wez@php.net>
Thu, 21 Mar 2002 02:27:41 +0000 (02:27 +0000)
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.

ext/zlib/zlib_fopen_wrapper.c

index d2acfa0e27a5e1db2044da5bf129995af9757add..a12abf19962944beb04ecccedc3c9ec64b5da384 100644 (file)
@@ -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
 };