diff options
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; } |