Skip to content

Commit

Permalink
Simplify file copy
Browse files Browse the repository at this point in the history
  • Loading branch information
alagner authored and marzojr committed Mar 21, 2021
1 parent 6d4dad9 commit 6544c02
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions files/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -840,17 +840,7 @@ void U7copy(
out.close();
throw;
}
size_t bufsize = 0x8000;
std::vector<char> buf(0x8000);
in.seekg(0, ios::end); // Get filesize.
size_t filesize = in.tellg();
in.seekg(0, ios::beg);
while (filesize > 0) { // Copy.
size_t toread = bufsize < filesize ? bufsize : filesize;
in.read(&buf[0], toread);
out.write(&buf[0], toread);
filesize -= toread;
}
out << in.rdbuf();
out.flush();
bool inok = in.good();
bool outok = out.good();
Expand Down

0 comments on commit 6544c02

Please sign in to comment.