Fix gcc warning when using map (#2213)

* Issue #2211: Addressing GCC warning on enumeral/non-enumeral in conditional expression.

* Updated per 80 character wrap.
This commit is contained in:
drivehappy 2017-03-28 16:57:19 -07:00 committed by Feng Xiao
parent 585993201a
commit d43eaf2b8f

View File

@ -1290,7 +1290,9 @@ class Map {
// Return a power of two no less than max(kMinTableSize, n). // Return a power of two no less than max(kMinTableSize, n).
// Assumes either n < kMinTableSize or n is a power of two. // Assumes either n < kMinTableSize or n is a power of two.
size_type TableSize(size_type n) { size_type TableSize(size_type n) {
return n < kMinTableSize ? kMinTableSize : n; return n < static_cast<size_type>(kMinTableSize)
? static_cast<size_type>(kMinTableSize)
: n;
} }
// Use alloc_ to allocate an array of n objects of type U. // Use alloc_ to allocate an array of n objects of type U.