From: Jonathan Dieter Date: Tue, 31 Jul 2018 21:08:13 +0000 (+0100) Subject: Fix intermittent problem with autochunking not being deterministic X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~149 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8680e5ef70428fef91910974aa136903791c2a7d;p=zchunk.git Fix intermittent problem with autochunking not being deterministic Signed-off-by: Jonathan Dieter --- diff --git a/src/lib/buzhash/buzhash.c b/src/lib/buzhash/buzhash.c index c1fc399..3c35f5e 100644 --- a/src/lib/buzhash/buzhash.c +++ b/src/lib/buzhash/buzhash.c @@ -108,16 +108,16 @@ uint32_t buzhash_update (buzHash *b, const char *s, size_t window) { b->window[b->window_fill] = *s; b->window_fill++; if(b->window_fill < b->window_size) { - b->h ^= rol32 (buzhash_table[(size_t) (*s)], window - b->window_fill); + b->h ^= rol32 (buzhash_table[(uint8_t) (*s)], window - b->window_fill); return 1; } else { - b->h ^= buzhash_table[(size_t) (*s)]; + b->h ^= buzhash_table[(uint8_t) (*s)]; return b->h; } } b->h = rol32 (b->h, 1) ^ - rol32 (buzhash_table[(size_t) b->window[b->window_loc]], b->window_size) ^ - buzhash_table[(size_t) *s]; + rol32 (buzhash_table[(uint8_t) b->window[b->window_loc]], b->window_size) ^ + buzhash_table[(uint8_t) *s]; b->window[b->window_loc++] = *s; b->window_loc %= b->window_size; return b->h;