Blame


1 4ca7b755 2018-01-26 stsp /*
2 4ca7b755 2018-01-26 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 4ca7b755 2018-01-26 stsp *
4 4ca7b755 2018-01-26 stsp * Permission to use, copy, modify, and distribute this software for any
5 4ca7b755 2018-01-26 stsp * purpose with or without fee is hereby granted, provided that the above
6 4ca7b755 2018-01-26 stsp * copyright notice and this permission notice appear in all copies.
7 4ca7b755 2018-01-26 stsp *
8 4ca7b755 2018-01-26 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 4ca7b755 2018-01-26 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 4ca7b755 2018-01-26 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 4ca7b755 2018-01-26 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 4ca7b755 2018-01-26 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 4ca7b755 2018-01-26 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 4ca7b755 2018-01-26 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 4ca7b755 2018-01-26 stsp */
16 4ca7b755 2018-01-26 stsp
17 908b0194 2018-02-12 stsp struct got_zstream_buf {
18 908b0194 2018-02-12 stsp z_stream z;
19 908b0194 2018-02-12 stsp char *inbuf;
20 908b0194 2018-02-12 stsp size_t inlen;
21 908b0194 2018-02-12 stsp char *outbuf;
22 908b0194 2018-02-12 stsp size_t outlen;
23 908b0194 2018-02-12 stsp int flags;
24 908b0194 2018-02-12 stsp #define GOT_ZSTREAM_F_HAVE_MORE 0x01
25 908b0194 2018-02-12 stsp };
26 908b0194 2018-02-12 stsp
27 4ca7b755 2018-01-26 stsp const struct got_error *got_inflate_init(struct got_zstream_buf *, size_t);
28 4ca7b755 2018-01-26 stsp const struct got_error *got_inflate_read(struct got_zstream_buf *, FILE *,
29 126ee060 2018-02-11 stsp size_t *);
30 4ca7b755 2018-01-26 stsp void got_inflate_end(struct got_zstream_buf *);
31 61d262a8 2018-02-11 stsp const struct got_error *got_inflate_to_mem(uint8_t **, size_t *, FILE *);
32 3606d7fc 2018-02-11 stsp const struct got_error *got_inflate_to_file(size_t *, FILE *, FILE *);