[PATCH] bdiff.c: cast to unsigned char when computing hash value
Markus F.X.J. Oberhumer
markus at oberhumer.com
Tue Mar 22 20:38:21 CDT 2011
# HG changeset patch
# User Markus F.X.J. Oberhumer <markus at oberhumer.com>
# Date 1300844002 -3600
# Node ID 5828a08f0eb3155e40f6838fa2e557b7fa3cccc5
# Parent 7b393d249459095bde15da8183ee0c53043e4ea9
bdiff.c: cast to unsigned char when computing hash value
diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c
--- a/mercurial/bdiff.c
+++ b/mercurial/bdiff.c
@@ -84,7 +84,7 @@
h = 0;
for (p = a; p < a + len; p++) {
/* Leonid Yuriev's hash */
- h = (h * 1664525) + *p + 1013904223;
+ h = (h * 1664525) + (unsigned char)*p + 1013904223;
if (*p == '\n' || p == plast) {
l->h = h;
More information about the Mercurial-devel
mailing list