mirror of
https://github.com/vivier/EMILE.git
synced 2025-01-02 21:30:29 +00:00
Uncompress a stream on-the-fly
This commit is contained in:
parent
cd28c1fb09
commit
37604400ff
22
libstream/stream_uncompress.c
Normal file
22
libstream/stream_uncompress.c
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user