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
static inline unsigned long get_delta_hdr_size(const unsigned char **datap)
{
const unsigned char *data = *datap;
- unsigned char cmd = *data++;
- unsigned long size = cmd & ~0x80;
- int i = 7;
- while (cmd & 0x80) {
+ 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;
}