commit 126ee0608bd8017ef807797e24616f07bfe7936c from: Stefan Sperling date: Sun Feb 11 15:46:49 2018 UTC remove insize arg from inflate_read() commit - 6b4a60c57f8fa6f193f2c277959a31f069fa3c07 commit + 126ee0608bd8017ef807797e24616f07bfe7936c blob - 58a2acc48d6864ff1794e447ef7614eec0fbf383 blob + 17771727f543eca5683a8c29ee19cc0995a32321 --- lib/object.c +++ lib/object.c @@ -157,7 +157,7 @@ read_object_header(struct got_object **obj, struct got i = 0; totlen = 0; do { - err = got_inflate_read(&zb, f, NULL, &outlen); + err = got_inflate_read(&zb, f, &outlen); if (err) goto done; if (strchr(zb.outbuf, '\0') == NULL) { @@ -510,7 +510,7 @@ read_commit_object(struct got_commit_object **commit, if (err) return err; - err = got_inflate_read(&zb, f, NULL, &len); + err = got_inflate_read(&zb, f, &len); if (err) return err; @@ -577,7 +577,7 @@ read_tree_object(struct got_tree_object **tree, if (err) return err; - err = got_inflate_read(&zb, f, NULL, &len); + err = got_inflate_read(&zb, f, &len); if (err) return err; @@ -673,5 +673,5 @@ got_object_blob_close(struct got_blob_object *blob) const struct got_error * got_object_blob_read_block(struct got_blob_object *blob, size_t *outlenp) { - return got_inflate_read(&blob->zb, blob->f, NULL, outlenp); + return got_inflate_read(&blob->zb, blob->f, outlenp); } blob - 6a15f3dec5ce92862619f26568e884a6758ad2cc blob + b5e809e20fd40238578c8c4f0a104cd9d376fa10 --- lib/zb.c +++ lib/zb.c @@ -63,8 +63,7 @@ done: } const struct got_error * -got_inflate_read(struct got_zstream_buf *zb, FILE *f, size_t *inlenp, - size_t *outlenp) +got_inflate_read(struct got_zstream_buf *zb, FILE *f, size_t *outlenp) { size_t last_total_out = zb->z.total_out; z_stream *z = &zb->z; @@ -74,8 +73,6 @@ got_inflate_read(struct got_zstream_buf *zb, FILE *f, z->avail_out = zb->outlen; *outlenp = 0; - if (inlenp) - *inlenp = 0; do { if (z->avail_in == 0) { size_t n = fread(zb->inbuf, 1, zb->inlen, f); @@ -86,8 +83,6 @@ got_inflate_read(struct got_zstream_buf *zb, FILE *f, } z->next_in = zb->inbuf; z->avail_in = n; - if (inlenp) - *inlenp += n; } ret = inflate(z, Z_SYNC_FLUSH); } while (ret == Z_OK && z->avail_out > 0); @@ -128,7 +123,7 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, F *outlen = 0; do { - err = got_inflate_read(&zb, f, NULL, &avail); + err = got_inflate_read(&zb, f, &avail); if (err) return err; if (avail > 0) { @@ -166,7 +161,7 @@ got_inflate_to_file(size_t *outlen, FILE *infile, FILE *outlen = 0; do { - err = got_inflate_read(&zb, infile, NULL, &avail); + err = got_inflate_read(&zb, infile, &avail); if (err) return err; if (avail > 0) { blob - e5294017e24d1cec6c532ded4529d174d7b65155 blob + 0796cc6d464990c0391e413c8aff1f8988c4796b --- lib/zb.h +++ lib/zb.h @@ -16,7 +16,7 @@ const struct got_error *got_inflate_init(struct got_zstream_buf *, size_t); const struct got_error *got_inflate_read(struct got_zstream_buf *, FILE *, - size_t *, size_t *); + size_t *); void got_inflate_end(struct got_zstream_buf *); const struct got_error *got_inflate_to_mem(uint8_t **, size_t *, FILE *); const struct got_error *got_inflate_to_file(size_t *, FILE *, FILE *);