Date: Wed, 16 Oct 2013 17:16:40 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256644 - head/lib/libz Message-ID: <201310161716.r9GHGeX2053794@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Wed Oct 16 17:16:40 2013 New Revision: 256644 URL: http://svnweb.freebsd.org/changeset/base/256644 Log: Make it possible to seek within a gzip stream. Modified: head/lib/libz/zopen.c Modified: head/lib/libz/zopen.c ============================================================================== --- head/lib/libz/zopen.c Wed Oct 16 17:03:46 2013 (r256643) +++ head/lib/libz/zopen.c Wed Oct 16 17:16:40 2013 (r256644) @@ -29,6 +29,12 @@ xgzclose(void *cookie) return gzclose(cookie); } +static fpos_t +xgzseek(void *cookie, fpos_t offset, int whence) +{ + return gzseek(cookie, (z_off_t)offset, whence); +} + FILE * zopen(const char *fname, const char *mode) { @@ -37,7 +43,7 @@ zopen(const char *fname, const char *mod return NULL; if(*mode == 'r') - return (funopen(gz, xgzread, NULL, NULL, xgzclose)); + return (funopen(gz, xgzread, NULL, xgzseek, xgzclose)); else - return (funopen(gz, NULL, xgzwrite, NULL, xgzclose)); + return (funopen(gz, NULL, xgzwrite, xgzseek, xgzclose)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310161716.r9GHGeX2053794>