Mercurial > hg
changeset 13731:5d0cdf4ec338
bdiff.c: use unsigned arithmetic for hash computation
Signed integer overflow is undefined in C.
author | Markus F.X.J. Oberhumer <markus@oberhumer.com> |
---|---|
date | Wed, 23 Mar 2011 02:33:23 +0100 |
parents | df978f28a259 |
children | afe9269dccec |
files | mercurial/bdiff.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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; }