From c270d033fa04873ee7a8925dbb00cae5edc4555c Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Mar 2019 11:59:35 +0800 Subject: *misc --- source/modules/asura-utils/io/file.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source/modules/asura-utils/io/file.cpp') 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; } -- cgit v1.1-26-g67d0