diff options
author | chai <chaifix@163.com> | 2019-03-30 11:59:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-30 11:59:35 +0800 |
commit | c270d033fa04873ee7a8925dbb00cae5edc4555c (patch) | |
tree | ee27a45c5b946b08dd7a726a925028f6ca3eabf1 /source/modules/asura-utils/io/file.cpp | |
parent | 771df5c31cd5653467fd6e76c1a3e002ca39582c (diff) |
*misc
Diffstat (limited to 'source/modules/asura-utils/io/file.cpp')
-rw-r--r-- | source/modules/asura-utils/io/file.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/modules/asura-utils/io/file.cpp b/source/modules/asura-utils/io/file.cpp index ed95436..9e89c85 100644 --- a/source/modules/asura-utils/io/file.cpp +++ b/source/modules/asura-utils/io/file.cpp @@ -122,7 +122,7 @@ namespace AsuraEngine { ASSERT(dst); - if (dst->GetSize() < length) + if (dst->GetCapacity() < length) throw Exception("Data buffer is too small compares to read length."); if (!mFileHandle || mMode != FILE_MODE_READ) @@ -149,11 +149,13 @@ namespace AsuraEngine size_t length = PHYSFS_fileLength(mFileHandle); - if (dst->GetSize() < length) + if (dst->GetCapacity() < length) throw Exception("Data buffer is too small compares to file length."); dst->Lock(); - size_t size = PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + byte* data = dst->GetData(); + size_t size = PHYSFS_readBytes(mFileHandle, data, length); + dst->Move(data, length); dst->Unlock(); return size; } |