Revert "diff-delta.c: allow delta with empty blob."
authorJunio C Hamano <junkio@cox.net>
Tue, 13 Dec 2005 00:42:38 +0000 (16:42 -0800)
committerJunio C Hamano <junkio@cox.net>
Tue, 13 Dec 2005 00:42:38 +0000 (16:42 -0800)
This reverts 962537a3eb03a118cf27d9d0da365a3216ed1caa commit to
play safe.

delta.h
diff-delta.c
diff --git a/delta.h b/delta.h
index c6a476353f7122884cb4769685089d63c886631c..31d1820f80f2887d51808170fc86585ada42d42e 100644 (file)
--- a/delta.h
+++ b/delta.h
@@ -9,8 +9,8 @@ extern void *patch_delta(void *src_buf, unsigned long src_size,
                         void *delta_buf, unsigned long delta_size,
                         unsigned long *dst_size);
 
-/* the smallest possible delta size is 2 bytes (empty to empty) */
-#define DELTA_SIZE_MIN 2
+/* the smallest possible delta size is 4 bytes */
+#define DELTA_SIZE_MIN 4
 
 /*
  * This must be called twice on the delta data buffer, first to get the
index cf5013896f6ea5efc35c9d7e90d076e4bf6328a5..b2ae7b5e6c3b4aa409ccfa60f67d5c8eb1690504 100644 (file)
@@ -213,7 +213,7 @@ void *diff_delta(void *from_buf, unsigned long from_size,
        bdrecord_t *brec;
        bdfile_t bdf;
 
-       if (delta_prepare(from_buf, from_size, &bdf))
+       if (!from_size || !to_size || delta_prepare(from_buf, from_size, &bdf))
                return NULL;
        
        outpos = 0;