Fossil SCM
Fix a harmless UBSAN warning in makeheaders.c
Commit
a456dcbbac25366ccb02696505ea04e99dace78ceb81056f7fc91537d3b14cc4
Parent
39262f69b28492b…
1 file changed
+2
-2
+2
-2
| --- tools/makeheaders.c | ||
| +++ tools/makeheaders.c | ||
| @@ -486,18 +486,18 @@ | ||
| 486 | 486 | /* |
| 487 | 487 | ** Compute a hash on a string. The number returned is a non-negative |
| 488 | 488 | ** value between 0 and 2**31 - 1 |
| 489 | 489 | */ |
| 490 | 490 | static int Hash(const char *z, int n){ |
| 491 | - int h = 0; | |
| 491 | + unsigned int h = 0; | |
| 492 | 492 | if( n<=0 ){ |
| 493 | 493 | n = strlen(z); |
| 494 | 494 | } |
| 495 | 495 | while( n-- ){ |
| 496 | 496 | h = h ^ (h<<5) ^ *z++; |
| 497 | 497 | } |
| 498 | - return h & 0x7fffffff; | |
| 498 | + return (int)(h & 0x7fffffff); | |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | /* |
| 502 | 502 | ** Given an identifier name, try to find a declaration for that |
| 503 | 503 | ** identifier in the hash table. If found, return a pointer to |
| 504 | 504 |
| --- tools/makeheaders.c | |
| +++ tools/makeheaders.c | |
| @@ -486,18 +486,18 @@ | |
| 486 | /* |
| 487 | ** Compute a hash on a string. The number returned is a non-negative |
| 488 | ** value between 0 and 2**31 - 1 |
| 489 | */ |
| 490 | static int Hash(const char *z, int n){ |
| 491 | int h = 0; |
| 492 | if( n<=0 ){ |
| 493 | n = strlen(z); |
| 494 | } |
| 495 | while( n-- ){ |
| 496 | h = h ^ (h<<5) ^ *z++; |
| 497 | } |
| 498 | return h & 0x7fffffff; |
| 499 | } |
| 500 | |
| 501 | /* |
| 502 | ** Given an identifier name, try to find a declaration for that |
| 503 | ** identifier in the hash table. If found, return a pointer to |
| 504 |
| --- tools/makeheaders.c | |
| +++ tools/makeheaders.c | |
| @@ -486,18 +486,18 @@ | |
| 486 | /* |
| 487 | ** Compute a hash on a string. The number returned is a non-negative |
| 488 | ** value between 0 and 2**31 - 1 |
| 489 | */ |
| 490 | static int Hash(const char *z, int n){ |
| 491 | unsigned int h = 0; |
| 492 | if( n<=0 ){ |
| 493 | n = strlen(z); |
| 494 | } |
| 495 | while( n-- ){ |
| 496 | h = h ^ (h<<5) ^ *z++; |
| 497 | } |
| 498 | return (int)(h & 0x7fffffff); |
| 499 | } |
| 500 | |
| 501 | /* |
| 502 | ** Given an identifier name, try to find a declaration for that |
| 503 | ** identifier in the hash table. If found, return a pointer to |
| 504 |