From 6fe9d192ad446979c7a5f849b1cd620ac022f80d Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 26 Oct 2008 17:46:59 +0100 Subject: [PATCH] Hashing of base strings has to be done using unsigned characters, to be compatible with extended strings. --- src/c/hash.d | 8 +++++--- src/c/newhash.h | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/c/hash.d b/src/c/hash.d index 7cd08570f..d46bc2077 100644 --- a/src/c/hash.d +++ b/src/c/hash.d @@ -92,12 +92,14 @@ _hash_equal(int depth, cl_hashkey h, cl_object x) x = x->symbol.name; #ifdef ECL_UNICODE case t_base_string: - return hash_base_string(x->base_string.self, x->base_string.fillp, h); + return hash_base_string((unsigned char *)x->base_string.self, + x->base_string.fillp, h); case t_string: - return hash_full_string(x->base_string.self, x->base_string.fillp, h); + return hash_full_string(x->string.self, x->string.fillp, h); #else case t_base_string: - return hash_string(h, x->base_string.self, x->base_string.fillp); + return hash_string(h, (unsigned char *)x->base_string.self, + x->base_string.fillp); #endif case t_pathname: h = _hash_equal(0, h, x->pathname.directory); diff --git a/src/c/newhash.h b/src/c/newhash.h index 770d575fe..3c121be92 100644 --- a/src/c/newhash.h +++ b/src/c/newhash.h @@ -144,7 +144,7 @@ static cl_index hash_word(cl_index c, cl_index w) return c; } -static cl_index hash_base_string(const char *s, cl_index len, cl_index h) +static cl_index hash_base_string(const unsigned char *s, cl_index len, cl_index h) { cl_index a = GOLDEN_RATIO, b = GOLDEN_RATIO, i; for (i = len; i >= 3; i -= 3) { @@ -179,4 +179,3 @@ static cl_index hash_full_string(const cl_object *s, cl_index len, cl_index h) mix(a, b, h); return h; } -