unsigned char cast in hash functions

This commit is contained in:
Stefan Frederik 2021-12-09 00:34:43 +01:00
parent e45e3caa84
commit 6458fdc5bd
2 changed files with 3 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
}