mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12:00
sys_fs: Fix warning C6262
This commit is contained in:
parent
28c37ab465
commit
6a95e0877b
1 changed files with 8 additions and 8 deletions
|
@ -336,16 +336,16 @@ lv2_fs_object::lv2_fs_object(utils::serial& ar, bool)
|
||||||
u64 lv2_file::op_read(const fs::file& file, vm::ptr<void> buf, u64 size)
|
u64 lv2_file::op_read(const fs::file& file, vm::ptr<void> buf, u64 size)
|
||||||
{
|
{
|
||||||
// Copy data from intermediate buffer (avoid passing vm pointer to a native API)
|
// Copy data from intermediate buffer (avoid passing vm pointer to a native API)
|
||||||
uchar local_buf[65536];
|
std::vector<uchar> local_buf(std::min<u64>(size, 65536));
|
||||||
|
|
||||||
u64 result = 0;
|
u64 result = 0;
|
||||||
|
|
||||||
while (result < size)
|
while (result < size)
|
||||||
{
|
{
|
||||||
const u64 block = std::min<u64>(size - result, sizeof(local_buf));
|
const u64 block = std::min<u64>(size - result, local_buf.size());
|
||||||
const u64 nread = file.read(+local_buf, block);
|
const u64 nread = file.read(+local_buf.data(), block);
|
||||||
|
|
||||||
std::memcpy(static_cast<uchar*>(buf.get_ptr()) + result, local_buf, nread);
|
std::memcpy(static_cast<uchar*>(buf.get_ptr()) + result, local_buf.data(), nread);
|
||||||
result += nread;
|
result += nread;
|
||||||
|
|
||||||
if (nread < block)
|
if (nread < block)
|
||||||
|
@ -360,15 +360,15 @@ u64 lv2_file::op_read(const fs::file& file, vm::ptr<void> buf, u64 size)
|
||||||
u64 lv2_file::op_write(const fs::file& file, vm::cptr<void> buf, u64 size)
|
u64 lv2_file::op_write(const fs::file& file, vm::cptr<void> buf, u64 size)
|
||||||
{
|
{
|
||||||
// Copy data to intermediate buffer (avoid passing vm pointer to a native API)
|
// Copy data to intermediate buffer (avoid passing vm pointer to a native API)
|
||||||
uchar local_buf[65536];
|
std::vector<uchar> local_buf(std::min<u64>(size, 65536));
|
||||||
|
|
||||||
u64 result = 0;
|
u64 result = 0;
|
||||||
|
|
||||||
while (result < size)
|
while (result < size)
|
||||||
{
|
{
|
||||||
const u64 block = std::min<u64>(size - result, sizeof(local_buf));
|
const u64 block = std::min<u64>(size - result, local_buf.size());
|
||||||
std::memcpy(local_buf, static_cast<const uchar*>(buf.get_ptr()) + result, block);
|
std::memcpy(local_buf.data(), static_cast<const uchar*>(buf.get_ptr()) + result, block);
|
||||||
const u64 nwrite = file.write(+local_buf, block);
|
const u64 nwrite = file.write(+local_buf.data(), block);
|
||||||
result += nwrite;
|
result += nwrite;
|
||||||
|
|
||||||
if (nwrite < block)
|
if (nwrite < block)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue