Make it possible to seek within a gzip stream.
This commit is contained in:
parent
ec7935bfef
commit
86ccd3e00f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=256644
@ -29,6 +29,12 @@ xgzclose(void *cookie)
|
|||||||
return gzclose(cookie);
|
return gzclose(cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static fpos_t
|
||||||
|
xgzseek(void *cookie, fpos_t offset, int whence)
|
||||||
|
{
|
||||||
|
return gzseek(cookie, (z_off_t)offset, whence);
|
||||||
|
}
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
zopen(const char *fname, const char *mode)
|
zopen(const char *fname, const char *mode)
|
||||||
{
|
{
|
||||||
@ -37,7 +43,7 @@ zopen(const char *fname, const char *mode)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if(*mode == 'r')
|
if(*mode == 'r')
|
||||||
return (funopen(gz, xgzread, NULL, NULL, xgzclose));
|
return (funopen(gz, xgzread, NULL, xgzseek, xgzclose));
|
||||||
else
|
else
|
||||||
return (funopen(gz, NULL, xgzwrite, NULL, xgzclose));
|
return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user