Summary:
- On iOS, off_t is an int64_t, and as such std::min() doesn't compile
since the types don't match. Normalize to size_t and fail with an
error if this conversion can't be made
Test Plan:
- fbconfig -r folly && fbmake runtests
- Built on iOS
Reviewed By: tudorb@fb.com
FB internal diff:
D1142795
#ifndef FOLLY_FILEUTIL_H_
#define FOLLY_FILEUTIL_H_
+#include "folly/Conv.h"
#include "folly/Portability.h"
#include "folly/ScopeGuard.h"
constexpr size_t initialAlloc = 1024 * 4;
out.resize(
std::min(
- buf.st_size ? buf.st_size + 1 : initialAlloc,
+ buf.st_size > 0 ? folly::to<size_t>(buf.st_size + 1) : initialAlloc,
num_bytes));
while (soFar < out.size()) {