Uncompress a stream on-the-fly

This commit is contained in:
Laurent Vivier 2005-11-22 23:14:27 +00:00
parent cd28c1fb09
commit 37604400ff

View File

@ -0,0 +1,22 @@
#include <zlib.h>
#include "libstream.h"
extern gzFile gzopen (filesystem_io_t *fs);
int stream_uncompress(stream_t *stream)
{
gzFile *gz;
gz = gzopen(&stream->fs);
if (gz == NULL)
return -1;
stream->fs.volume = NULL;
stream->fs.file = gz;
stream->fs.read = (stream_read_t)gzread;
stream->fs.lseek = (stream_lseek_t)gzseek;
stream->fs.close = (stream_close_t)gzclose;
stream->fs.umount = NULL;
return 0;
}