index ccc0c9ecebfa160f1f33ce3285deaa3557814941..a15350dabcd497d4cb21261721706eca072de034 100644 (file)
--- a/delta.h
+++ b/delta.h
void *delta_buf, unsigned long delta_size,
unsigned long *dst_size);
void *delta_buf, unsigned long delta_size,
unsigned long *dst_size);
-/* handling of delta objects */
-struct delta;
-struct object_list;
-extern struct delta *lookup_delta(const unsigned char *sha1);
-extern int parse_delta_buffer(struct delta *item, void *buffer, unsigned long size);
-extern int parse_delta(struct delta *item, unsigned char sha1);
-extern int process_deltas(void *src, unsigned long src_size,
- const char *src_type, struct object_list *delta);
+/* 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
+ * expected reference buffer size, and again to get the result buffer size.
+ */
+static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
+{
+ const unsigned char *data = *datap;
+ unsigned char cmd;
+ unsigned long size = 0;
+ int i = 0;
+ do {
+ cmd = *data++;
+ size |= (cmd & ~0x80) << i;
+ i += 7;
+ } while (cmd & 0x80);
+ *datap = data;
+ return size;
+}
#endif
#endif