From: Ken Raeburn Date: Sun, 8 Jun 2008 05:19:50 +0000 (+0000) Subject: Do hash stuff with unsigned math X-Git-Tag: krb5-1.7-alpha1~659 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=368f66f47ab734681d108cb3ee071991b367f447;p=krb5.git Do hash stuff with unsigned math git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20370 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index d3f9aa846..63b923823 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -64,12 +64,13 @@ static int rc_store(context, krb5_rcache id, krb5_donot_replay *rep) * dfl_recover. */ -static int -hash(krb5_donot_replay *rep, int hsize) +static unsigned int +hash(krb5_donot_replay *rep, unsigned int hsize) { - return (int) ((((rep->cusec + rep->ctime + *rep->server + *rep->client) - % hsize) + hsize) % hsize); - /* We take this opportunity to once again complain about C's idiotic %. */ + unsigned int h = rep->cusec + rep->ctime; + h += *rep->server; + h += *rep->client; + return h % hsize; } #define CMP_MALLOC -3 @@ -104,7 +105,7 @@ struct dfl_data { char *name; krb5_deltat lifespan; - int hsize; + unsigned int hsize; int numhits; int nummisses; struct authlist **h; @@ -130,7 +131,7 @@ rc_store(krb5_context context, krb5_rcache id, krb5_donot_replay *rep, krb5_int32 now) { struct dfl_data *t = (struct dfl_data *)id->data; - int rephash; + unsigned int rephash; struct authlist *ta; rephash = hash(rep, t->hsize); @@ -614,7 +615,7 @@ krb5_rc_dfl_expunge_locked(krb5_context context, krb5_rcache id) { struct dfl_data *t = (struct dfl_data *)id->data; #ifdef NOIOSTUFF - int i; + unsigned int i; struct authlist **q; struct authlist **qt; struct authlist *r;