Skip to content
Permalink
Browse files
Merge pull request #6821 from lioncash/file
FileUtil: Remove unnecessary IOFile GetHandle() call in ReadFileToString()
  • Loading branch information
leoetlino committed May 12, 2018
2 parents f0c5b76 + a85aa73 commit 85e3e61
Showing 1 changed file with 3 additions and 7 deletions.
@@ -883,16 +883,12 @@ bool WriteStringToFile(const std::string& str, const std::string& filename)
bool ReadFileToString(const std::string& filename, std::string& str)
{
File::IOFile file(filename, "rb");
auto const f = file.GetHandle();

if (!f)
if (!file)
return false;

size_t read_size;
str.resize(GetSize(f));
bool retval = file.ReadArray(&str[0], str.size(), &read_size);

return retval;
str.resize(file.GetSize());
return file.ReadArray(&str[0], str.size());
}

} // namespace File

0 comments on commit 85e3e61

Please sign in to comment.