aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-19 11:01:05 -0400
committerLioncash <mathew1800@gmail.com>2018-07-19 11:01:07 -0400
commit6fff93da5ff36be2b3ba1da5dad8bb9fa331e8e6 (patch)
tree63998475a888bfdfb0a0c1f1aabcc903fd8b6f95 /src
parent45e747beaaafc5490bddb69196830f723c45d917 (diff)
fsp_srv: Remove unnecessary vector construction in IFile's Write() function
We can avoid constructing a std::vector here by simply passing a pointer to the original data and the size of the copy we wish to perform to the backend's Write() function instead, avoiding copying the data where it's otherwise not needed.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index 673eaabf0d..e7ffb6bd16 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -149,8 +149,9 @@ private:
length, data.size());
// Write the data to the Storage backend
- std::vector<u8> actual_data(data.begin(), data.begin() + length);
- const std::size_t written = backend->WriteBytes(std::move(actual_data), offset);
+ const auto write_size =
+ static_cast<std::size_t>(std::distance(data.begin(), data.begin() + length));
+ const std::size_t written = backend->Write(data.data(), write_size, offset);
ASSERT_MSG(static_cast<s64>(written) == length,
"Could not write all bytes to file (requested={:016X}, actual={:016X}).", length,