Changeset 5442:cc2334fdf126 for hash.c

Show
Ignore:
Timestamp:
2008-07-02 01:06:10 (5 months ago)
Author:
Rocco Rutte <pdmef@…>
Branch:
HEAD
Message:

Use casts to avoid triggering integer overflow detection in hash function

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • hash.c

    r4640 r5442  
    3131int hash_string (const unsigned char *s, int n) 
    3232{ 
    33   int h = 0; 
     33  unsigned int h = 0; 
    3434 
    3535#if 0 
     
    4343#endif 
    4444 
    45   return (h % n); 
     45  return (signed) (h % n); 
    4646} 
    4747