diff-delta.c: allow delta with empty blob.
Delta computation with an empty blob used to punt and returned NULL. This commit allows creation with empty blob; all combination of empty->empty, empty->something, and something->empty are allowed. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Dec 12, 2005 at 12:01 UTC
962537a3eb03a118cf27d9d0da365a3216ed1caa
2 files changed
+3
-3
delta.h
+2
-2
@@ -9,8 +9,8 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
9
void *delta_buf, unsigned long delta_size,
10
unsigned long *dst_size);
11
12
-/* the smallest possible delta size is 4 bytes */
13
-#define DELTA_SIZE_MIN 4
12
+/* the smallest possible delta size is 2 bytes (empty to empty) */
13
+#define DELTA_SIZE_MIN 2
14
15
/*
16
* This must be called twice on the delta data buffer, first to get the
diff-delta.c
+1
-1
@@ -213,7 +213,7 @@ void *diff_delta(void *from_buf, unsigned long from_size,
213
bdrecord_t *brec;
214
bdfile_t bdf;
215
216
- if (!from_size || !to_size || delta_prepare(from_buf, from_size, &bdf))
216
+ if (delta_prepare(from_buf, from_size, &bdf))
217
return NULL;
218
219
outpos = 0;