Commit Diff


commit - 26abd4a4dbcaa5d4993aa122348011c32cee77b6
commit + f34b169e54fc4d4960f06b804cabe1aeec70e07d
blob - c6481fe4c01d6cc1e445a9f0f588ec77b8003d3f
blob + e27b25b4e258ce633b60e16862f79901efaf78d5
--- lib/deltify.c
+++ lib/deltify.c
@@ -354,7 +354,7 @@ const struct got_error *
 got_deltify(struct got_delta_instruction **deltas, int *ndeltas,
     FILE *f, off_t fileoffset, off_t filesize,
     struct got_delta_table *dt, FILE *basefile,
-    off_t basefile_size)
+    off_t basefile_offset0, off_t basefile_size)
 {
 	const struct got_error *err = NULL;
 	const off_t offset0 = fileoffset;
@@ -392,7 +392,8 @@ got_deltify(struct got_delta_instruction **deltas, int
 			    &blocklen);
 			if (err)
 				break;
-			emitdelta(deltas, ndeltas, 1, block->offset, blocklen);
+			emitdelta(deltas, ndeltas, 1,
+			    block->offset - basefile_offset0, blocklen);
 		} else {
 			/*
 			 * No match.
blob - 39069a604eca508347a2f734e6fe70185a3febea
blob + 848c59979d94aa7c6bc1d69f81419df67855c141
--- lib/got_lib_deltify.h
+++ lib/got_lib_deltify.h
@@ -44,5 +44,6 @@ const struct got_error *got_deltify_init(struct got_de
     off_t fileoffset, off_t filesize);
 const struct got_error *got_deltify(struct got_delta_instruction **deltas,
     int *ndeltas, FILE *f, off_t fileoffset, off_t filesize,
-    struct got_delta_table *dt, FILE *basefile, off_t basefile_size);
+    struct got_delta_table *dt, FILE *basefile, off_t basefile_offset0,
+    off_t basefile_size);
 void got_deltify_free(struct got_delta_table *dt);
blob - 5fa89910676821b58b5c98fe4828ced3e50f3e97
blob + 872d88379087aa49d66ebbc780ae19c92d4637e9
--- regress/deltify/deltify_test.c
+++ regress/deltify/deltify_test.c
@@ -85,7 +85,8 @@ deltify_abc_axc(void)
 	}
 
 	err = got_deltify(&deltas, &ndeltas, derived_file, 0,
-	    3 * GOT_DELTIFY_MAXCHUNK, dt, base_file, 3 * GOT_DELTIFY_MAXCHUNK);
+	    3 * GOT_DELTIFY_MAXCHUNK, dt, base_file, 0,
+	    3 * GOT_DELTIFY_MAXCHUNK);
 	if (err)
 		goto done;