diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 1b003bd843..e3f237c5c7 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -3,6 +3,8 @@ // Refer to the license.txt file included. #include +#include + #include "common/logging/log.h" #include "common/string_util.h" #include "core/core.h" @@ -133,17 +135,16 @@ private: return; } - std::vector data = ctx.ReadBuffer(); - std::vector actual_data(length); + const std::vector data = ctx.ReadBuffer(); ASSERT_MSG( data.size() <= length, "Attempting to write more data than requested (requested={:016X}, actual={:016X}).", length, data.size()); - std::copy(data.begin(), data.end(), actual_data.begin()); // Write the data to the Storage backend - auto written = backend->WriteBytes(data, offset); + std::vector actual_data(data.begin(), data.begin() + length); + const auto written = backend->WriteBytes(std::move(actual_data), offset); ASSERT_MSG(written == length, "Could not write all bytes to file (requested={:016X}, actual={:016X}).", length,