X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=delta.h;fp=delta.h;h=a15350dabcd497d4cb21261721706eca072de034;hb=39556fbdadaacf67330bc1464e0172468e9c3a5e;hp=31d1820f80f2887d51808170fc86585ada42d42e;hpb=e7ad4a9c3c9d383d1df52410e18808174f7be667;p=git.git diff --git a/delta.h b/delta.h index 31d1820f..a15350da 100644 --- a/delta.h +++ b/delta.h @@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, unsigned long src_size, 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; }