Commit 126ee0608bd8017ef807797e24616f07bfe7936c

Stefan Sperling 2018-02-11T16:46:49

remove insize arg from inflate_read()

diff --git a/lib/object.c b/lib/object.c
index 58a2acc..1777172 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -157,7 +157,7 @@ read_object_header(struct got_object **obj, struct got_repository *repo,
 	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);
 }
diff --git a/lib/zb.c b/lib/zb.c
index 6a15f3d..b5e809e 100644
--- a/lib/zb.c
+++ b/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, size_t *inlenp,
 	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, size_t *inlenp,
 			}
 			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, FILE *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 *outfile)
 	*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) {
diff --git a/lib/zb.h b/lib/zb.h
index e529401..0796cc6 100644
--- a/lib/zb.h
+++ b/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 *);