2005-11-22 23:14:27 +00:00
|
|
|
#include <zlib.h>
|
|
|
|
|
|
|
|
#include "libstream.h"
|
|
|
|
|
2008-04-20 16:07:24 +00:00
|
|
|
extern gzFile gzopen (stream_t *stream);
|
|
|
|
|
2005-11-22 23:14:27 +00:00
|
|
|
int stream_uncompress(stream_t *stream)
|
|
|
|
{
|
|
|
|
gzFile *gz;
|
|
|
|
|
2008-04-20 16:07:24 +00:00
|
|
|
gz = gzopen(stream);
|
2005-11-22 23:14:27 +00:00
|
|
|
if (gz == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2008-04-20 16:07:24 +00:00
|
|
|
stream->volume = NULL;
|
|
|
|
stream->file = gz;
|
2005-11-22 23:14:27 +00:00
|
|
|
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;
|
|
|
|
}
|