Commit Diff


commit - 9614da0defceed78e0660d5e75d116b96feeccd6
commit + 12f2167a2e638b44a8d0c2c163448011485067b3
blob - 0ccf42c214a51c167c3c22051afc9fa855ec2c19
blob + ad8c052645bdb1fad1e36b8ca14e324f41bff53d
--- lib/got_lib_inflate.h
+++ lib/got_lib_inflate.h
@@ -46,14 +46,16 @@ const struct got_error *got_inflate_read_mmap(struct g
     uint8_t *, size_t, size_t, size_t *, size_t *);
 void got_inflate_end(struct got_inflate_buf *);
 const struct got_error *got_inflate_to_mem(uint8_t **, size_t *, size_t *,
-    FILE *);
+    struct got_inflate_checksum *, FILE *);
 const struct got_error *got_inflate_to_mem_fd(uint8_t **, size_t *, size_t *,
     struct got_inflate_checksum *, size_t, int);
 const struct got_error *got_inflate_to_mem_mmap(uint8_t **, size_t *, size_t *,
     struct got_inflate_checksum *, uint8_t *, size_t, size_t);
-const struct got_error *got_inflate_to_file(size_t *, FILE *, FILE *);
+const struct got_error *got_inflate_to_file(size_t *, FILE *,
+    struct got_inflate_checksum *, FILE *);
 const struct got_error *got_inflate_to_file_fd(size_t *, size_t *,
     struct got_inflate_checksum *, int, FILE *);
-const struct got_error *got_inflate_to_fd(size_t *, FILE *, int);
+const struct got_error *got_inflate_to_fd(size_t *, FILE *,
+    struct got_inflate_checksum *, int);
 const struct got_error *got_inflate_to_file_mmap(size_t *, size_t *,
     struct got_inflate_checksum *, uint8_t *, size_t, size_t, FILE *);
blob - 1197bbb4a3b7b764589d056de56d5e8f5542a159
blob + aa993fb6f2b096a240a470976cbe73249014215a
--- lib/inflate.c
+++ lib/inflate.c
@@ -262,7 +262,7 @@ got_inflate_end(struct got_inflate_buf *zb)
 
 const struct got_error *
 got_inflate_to_mem(uint8_t **outbuf, size_t *outlen,
-    size_t *consumed_total, FILE *f)
+    size_t *consumed_total, struct got_inflate_checksum *csum, FILE *f)
 {
 	const struct got_error *err;
 	size_t avail, consumed;
@@ -274,9 +274,9 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen,
 		*outbuf = malloc(GOT_INFLATE_BUFSIZE);
 		if (*outbuf == NULL)
 			return got_error_from_errno("malloc");
-		err = got_inflate_init(&zb, *outbuf, GOT_INFLATE_BUFSIZE, NULL);
+		err = got_inflate_init(&zb, *outbuf, GOT_INFLATE_BUFSIZE, csum);
 	} else
-		err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE, NULL);
+		err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE, csum);
 	if (err)
 		return err;
 
@@ -437,13 +437,14 @@ done:
 }
 
 const struct got_error *
-got_inflate_to_fd(size_t *outlen, FILE *infile, int outfd)
+got_inflate_to_fd(size_t *outlen, FILE *infile,
+    struct got_inflate_checksum *csum, int outfd)
 {
 	const struct got_error *err = NULL;
 	size_t avail;
 	struct got_inflate_buf zb;
 
-	err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE, NULL);
+	err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE, csum);
 	if (err)
 		goto done;
 
@@ -474,13 +475,14 @@ done:
 }
 
 const struct got_error *
-got_inflate_to_file(size_t *outlen, FILE *infile, FILE *outfile)
+got_inflate_to_file(size_t *outlen, FILE *infile,
+    struct got_inflate_checksum *csum, FILE *outfile)
 {
 	const struct got_error *err;
 	size_t avail;
 	struct got_inflate_buf zb;
 
-	err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE, NULL);
+	err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE, csum);
 	if (err)
 		goto done;
 
blob - 092a8f96cc20191276eeb1029676466039e7d80a
blob + 59f45b5cd15bd0d3e89af07aecad3d6cf6798541
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
@@ -146,11 +146,11 @@ main(int argc, char *argv[])
 
 		if (obj->size + obj->hdrlen <=
 		    GOT_PRIVSEP_INLINE_BLOB_DATA_MAX) {
-			err = got_inflate_to_mem(&buf, &size, NULL, f);
+			err = got_inflate_to_mem(&buf, &size, NULL, NULL, f);
 			if (err)
 				goto done;
 		} else {
-			err = got_inflate_to_fd(&size, f, imsg_outfd.fd);
+			err = got_inflate_to_fd(&size, f, NULL, imsg_outfd.fd);
 			if (err)
 				goto done;
 		}
blob - 41be1eaa285e55bb1d8159555c63bdfa79adee92
blob + 93245b30e1136486de36bd3eb72dc2f86f739952
--- libexec/got-read-commit/got-read-commit.c
+++ libexec/got-read-commit/got-read-commit.c
@@ -55,7 +55,7 @@ read_commit_object(struct got_commit_object **commit, 
 	size_t len;
 	uint8_t *p;
 
-	err = got_inflate_to_mem(&p, &len, NULL, f);
+	err = got_inflate_to_mem(&p, &len, NULL, NULL, f);
 	if (err)
 		return err;
 
blob - 8cb2bc37152c96e55501d1e2f7927e159f2ca29f
blob + d91d50bca13d75a6d38de4482f7e5605960b206c
--- libexec/got-read-object/got-read-object.c
+++ libexec/got-read-object/got-read-object.c
@@ -78,9 +78,9 @@ send_raw_obj(struct imsgbuf *ibuf, struct got_object *
 	}
 
 	if (obj->size + obj->hdrlen <= GOT_PRIVSEP_INLINE_OBJECT_DATA_MAX)
-		err = got_inflate_to_mem(&data, &len, &consumed, f);
+		err = got_inflate_to_mem(&data, &len, &consumed, NULL, f);
 	else
-		err = got_inflate_to_fd(&len, f, outfd);
+		err = got_inflate_to_fd(&len, f, NULL, outfd);
 	if (err)
 		goto done;
 
blob - 2ee8df0c70c373be7f85f0670e55b5684d877bc2
blob + f3ce48de8619073672d23d6c63b6e2e5208861c6
--- libexec/got-read-tag/got-read-tag.c
+++ libexec/got-read-tag/got-read-tag.c
@@ -55,7 +55,7 @@ read_tag_object(struct got_tag_object **tag, FILE *f)
 	size_t len;
 	uint8_t *p;
 
-	err = got_inflate_to_mem(&p, &len, NULL, f);
+	err = got_inflate_to_mem(&p, &len, NULL, NULL, f);
 	if (err)
 		return err;
 
blob - 03b252f3eacb482e43069dd99ef3766fbc09fc74
blob + aab6f584103a469db2e8b399113952f556555726
--- libexec/got-read-tree/got-read-tree.c
+++ libexec/got-read-tree/got-read-tree.c
@@ -56,7 +56,7 @@ read_tree_object(struct got_pathlist_head *entries, in
 	struct got_object *obj;
 	size_t len;
 
-	err = got_inflate_to_mem(p, &len, NULL, f);
+	err = got_inflate_to_mem(p, &len, NULL, NULL, f);
 	if (err)
 		return err;