Commit ffc409c4 authored by Andrew Krieger's avatar Andrew Krieger Committed by Facebook Github Bot

Remove dependency on Conv.h from FileUtil.h

Summary: So we can use writeFile in projects which compile with -fno-rtti

Reviewed By: mzlee

Differential Revision: D5341469

fbshipit-source-id: bb77baf9576604ff862d54d59bf382862bd0dd58
parent 30d05890
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#pragma once #pragma once
#include <folly/Conv.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/Range.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/SysUio.h> #include <folly/portability/SysUio.h>
...@@ -139,8 +139,7 @@ bool readFile( ...@@ -139,8 +139,7 @@ bool readFile(
constexpr size_t initialAlloc = 1024 * 4; constexpr size_t initialAlloc = 1024 * 4;
out.resize( out.resize(
std::min( std::min(
buf.st_size > 0 ? folly::to<size_t>(buf.st_size + 1) : initialAlloc, buf.st_size > 0 ? (size_t(buf.st_size) + 1) : initialAlloc, num_bytes));
num_bytes));
while (soFar < out.size()) { while (soFar < out.size()) {
const auto actual = readFull(fd, &out[soFar], out.size() - soFar); const auto actual = readFull(fd, &out[soFar], out.size() - soFar);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment