mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-01 10:20:33 +00:00
FileUtil: Remove unnecessary IOFile GetHandle() call in ReadFileToString()
We can just use IOFile's GetSize() function to do the same thing. While we're at it, get rid of unnecessary variables.
This commit is contained in:
parent
f0c5b76186
commit
a85aa73c4d
@ -883,16 +883,12 @@ bool WriteStringToFile(const std::string& str, const std::string& filename)
|
|||||||
bool ReadFileToString(const std::string& filename, std::string& str)
|
bool ReadFileToString(const std::string& filename, std::string& str)
|
||||||
{
|
{
|
||||||
File::IOFile file(filename, "rb");
|
File::IOFile file(filename, "rb");
|
||||||
auto const f = file.GetHandle();
|
|
||||||
|
|
||||||
if (!f)
|
if (!file)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
size_t read_size;
|
str.resize(file.GetSize());
|
||||||
str.resize(GetSize(f));
|
return file.ReadArray(&str[0], str.size());
|
||||||
bool retval = file.ReadArray(&str[0], str.size(), &read_size);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace File
|
} // namespace File
|
||||||
|
Loading…
x
Reference in New Issue
Block a user