Browse Source

Fix gcc warning when using map (#2213)

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

* Updated per 80 character wrap.
drivehappy 8 years ago
parent
commit
d43eaf2b8f
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/google/protobuf/map.h

+ 3 - 1
src/google/protobuf/map.h

@@ -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.