# HG changeset patch # User Markus F.X.J. Oberhumer # Date 1300844003 -3600 # Node ID 5d0cdf4ec3384a5519799f4f6a0f5074e1bfa1ca # Parent df978f28a259385fff9af115e961784e406c5707 bdiff.c: use unsigned arithmetic for hash computation Signed integer overflow is undefined in C. diff -r df978f28a259 -r 5d0cdf4ec338 mercurial/bdiff.c --- a/mercurial/bdiff.c Wed Mar 23 02:33:22 2011 +0100 +++ b/mercurial/bdiff.c Wed Mar 23 02:33:23 2011 +0100 @@ -65,7 +65,8 @@ static int splitlines(const char *a, int len, struct line **lr) { - int h, i; + unsigned h; + int i; const char *p, *b = a; const char * const plast = a + len - 1; struct line *l; @@ -98,7 +99,8 @@ } /* set up a sentinel */ - l->h = l->len = 0; + l->h = 0; + l->len = 0; l->l = a + len; return i - 1; }