1diff --git a/base/third_party/cityhash/city.cc b/base/third_party/cityhash/city.cc 2index 2ab3db20f4fa1..913d91f4c9a1b 100644 3--- a/base/third_party/cityhash/city.cc 4+++ b/base/third_party/cityhash/city.cc 5@@ -181,7 +181,7 @@ static uint32 Hash32Len13to24(const char* s, size_t len) { 6 uint32 d = Fetch32(s + (len >> 1)); 7 uint32 e = Fetch32(s); 8 uint32 f = Fetch32(s + len - 4); 9- uint32 h = len; 10+ uint32 h = static_cast<uint32>(len); 11 12 return fmix(Mur(f, Mur(e, Mur(d, Mur(c, Mur(b, Mur(a, h))))))); 13 } 14@@ -191,14 +191,14 @@ static uint32 Hash32Len0to4(const char* s, size_t len) { 15 uint32 c = 9; 16 for (size_t i = 0; i < len; i++) { 17 signed char v = s[i]; 18- b = b * c1 + v; 19+ b = b * c1 + static_cast<uint32>(v); 20 c ^= b; 21 } 22- return fmix(Mur(b, Mur(len, c))); 23+ return fmix(Mur(b, Mur(static_cast<uint32>(len), c))); 24 } 25 26 static uint32 Hash32Len5to12(const char* s, size_t len) { 27- uint32 a = len, b = len * 5, c = 9, d = b; 28+ uint32 a = static_cast<uint32>(len), b = a * 5, c = 9, d = b; 29 a += Fetch32(s); 30 b += Fetch32(s + len - 4); 31 c += Fetch32(s + ((len >> 1) & 4)); 32@@ -213,7 +213,7 @@ uint32 CityHash32(const char* s, size_t len) { 33 } 34 35 // len > 24 36- uint32 h = len, g = c1 * len, f = g; 37+ uint32 h = static_cast<uint32>(len), g = c1 * h, f = g; 38 uint32 a0 = Rotate32(Fetch32(s + len - 4) * c1, 17) * c2; 39 uint32 a1 = Rotate32(Fetch32(s + len - 8) * c1, 17) * c2; 40 uint32 a2 = Rotate32(Fetch32(s + len - 16) * c1, 17) * c2; 41@@ -314,11 +314,11 @@ static uint64 HashLen0to16(const char* s, size_t len) { 42 return HashLen16(len + (a << 3), Fetch32(s + len - 4), mul); 43 } 44 if (len > 0) { 45- uint8 a = s[0]; 46- uint8 b = s[len >> 1]; 47- uint8 c = s[len - 1]; 48+ uint8 a = static_cast<uint8>(s[0]); 49+ uint8 b = static_cast<uint8>(s[len >> 1]); 50+ uint8 c = static_cast<uint8>(s[len - 1]); 51 uint32 y = static_cast<uint32>(a) + (static_cast<uint32>(b) << 8); 52- uint32 z = len + (static_cast<uint32>(c) << 2); 53+ uint32 z = static_cast<uint32>(len) + (static_cast<uint32>(c) << 2); 54 return ShiftMix(y * k2 ^ z * k0) * k2; 55 } 56 return k2; 57@@ -439,15 +439,15 @@ static uint128 CityMurmur(const char* s, size_t len, uint128 seed) { 58 uint64 b = Uint128High64(seed); 59 uint64 c = 0; 60 uint64 d = 0; 61- signed long l = len - 16; 62- if (l <= 0) { // len <= 16 63+ if (len <= 16) { 64 a = ShiftMix(a * k1) * k1; 65 c = b * k1 + HashLen0to16(s, len); 66 d = ShiftMix(a + (len >= 8 ? Fetch64(s) : c)); 67- } else { // len > 16 68+ } else { 69 c = HashLen16(Fetch64(s + len - 8) + k1, a); 70 d = HashLen16(b + len, c + Fetch64(s + len - 16)); 71 a += d; 72+ // len > 16 here, so do...while is safe 73 do { 74 a ^= ShiftMix(Fetch64(s) * k1) * k1; 75 a *= k1; 76@@ -456,8 +456,8 @@ static uint128 CityMurmur(const char* s, size_t len, uint128 seed) { 77 c *= k1; 78 d ^= c; 79 s += 16; 80- l -= 16; 81- } while (l > 0); 82+ len -= 16; 83+ } while (len > 16); 84 } 85 a = HashLen16(a, c); 86 b = HashLen16(d, b); 87