Compile fix

This commit is contained in:
Jacob Dufault 2017-04-21 10:00:36 -07:00
parent 406a2ec3fd
commit 734511f562
2 changed files with 3 additions and 5 deletions

View File

@ -36,7 +36,7 @@ std::unique_ptr<IndexedFile> LoadCachedIndex(IndexerConfig* config, const std::s
optional<std::string> LoadCachedFileContents(IndexerConfig* config, const std::string& filename) {
if (!config->enableCacheRead)
return nullptr;
return nullopt;
return ReadContent(GetCachedBaseFileName(config->cacheDirectory, filename) + ".txt");
}

View File

@ -187,10 +187,6 @@ int64_t GetLastModificationTime(const std::string& absolute_path) {
// See http://stackoverflow.com/q/13198627
void CopyFileTo(const std::string& dest, const std::string& source) {
char buf[4096];
ssize_t nread;
int saved_errno;
int fd_from = open(source.c_str(), O_RDONLY);
if (fd_from < 0)
return;
@ -199,6 +195,8 @@ void CopyFileTo(const std::string& dest, const std::string& source) {
if (fd_to < 0)
goto out_error;
char buf[4096];
ssize_t nread;
while (nread = read(fd_from, buf, sizeof buf), nread > 0) {
char *out_ptr = buf;
ssize_t nwritten;