Make sure there is no signed int overflow
authorAnton Korobeynikov <anton@korobeynikov.info>
Sat, 13 Oct 2012 21:39:24 +0000 (01:39 +0400)
committerJordan DeLong <jdelong@fb.com>
Sat, 19 Jan 2013 00:37:12 +0000 (16:37 -0800)
Summary: use proper type for index.

Test Plan: .

Reviewed By: tudorb@fb.com

FB internal diff: D660142

folly/small_vector.h

index cf9caa6e5ac87eb290bcd5d9b77e9e8832df7c54..45697b865aff6b3df00606f6b632d8e99b7a208f 100644 (file)
@@ -205,7 +205,7 @@ namespace detail {
   void populateMemForward(T* mem, std::size_t n, Function const& op) {
     std::size_t idx = 0;
     try {
-      for (int i = 0; i < n; ++i) {
+      for (size_t i = 0; i < n; ++i) {
         op(&mem[idx]);
         ++idx;
       }