From 6458fdc5bd2a3e527feda76c834c44de498d68e1 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Thu, 9 Dec 2021 00:34:43 +0100 Subject: [PATCH] unsigned char cast in hash functions --- src/hilight.c | 4 ++-- src/token.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hilight.c b/src/hilight.c index c551aaa0..60708811 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -30,13 +30,13 @@ static unsigned int hi_hash(const char *tok) if(xctx->sch_path_hash[xctx->currsch] == 0) { str=xctx->sch_path[xctx->currsch]; - while ( (c = *str++) ) + while ( (c = (unsigned char)*str++) ) hash += (hash << 5) + c; xctx->sch_path_hash[xctx->currsch] = hash; } else { hash = xctx->sch_path_hash[xctx->currsch]; } - while ( (c = *tok++) ) + while ( (c = (unsigned char)*tok++) ) hash += (hash << 5) + c; return hash; } diff --git a/src/token.c b/src/token.c index 095b981d..838ad082 100644 --- a/src/token.c +++ b/src/token.c @@ -30,7 +30,7 @@ unsigned int str_hash(const char *tok) register unsigned int hash = 5381; register unsigned int c; - while ( (c = *tok++) ) + while ( (c = (unsigned char)*tok++) ) hash += (hash << 5) + c; return hash; }