Permalink
Browse files

FileUtil: Remove unnecessary IOFile GetHandle() call in ReadFileToStr…

…ing()

We can just use IOFile's GetSize() function to do the same thing. While
we're at it, get rid of unnecessary variables.
  • Loading branch information...
lioncash committed May 11, 2018
1 parent f0c5b76 commit a85aa73c4d5e7b37856912925bf5dc9a8bcb38b4
Showing with 3 additions and 7 deletions.
  1. +3 −7 Source/Core/Common/FileUtil.cpp
@@ -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 a85aa73

Please sign in to comment.