diff options
author | Joost Peters | 2003-09-28 19:57:01 +0000 |
---|---|---|
committer | Joost Peters | 2003-09-28 19:57:01 +0000 |
commit | 84ed3e272d7a470fac35e446ad9adbbd2c374f82 (patch) | |
tree | cb14f4bda0f6c63d634dab8224b77b6a2023cf68 /queen/resource.cpp | |
parent | 07fe952eef4852f8b1429d58befe0eb529679f6d (diff) | |
download | scummvm-rg350-84ed3e272d7a470fac35e446ad9adbbd2c374f82.tar.gz scummvm-rg350-84ed3e272d7a470fac35e446ad9adbbd2c374f82.tar.bz2 scummvm-rg350-84ed3e272d7a470fac35e446ad9adbbd2c374f82.zip |
use new operator instead of malloc() and added generic file loading function
svn-id: r10470
Diffstat (limited to 'queen/resource.cpp')
-rw-r--r-- | queen/resource.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/queen/resource.cpp b/queen/resource.cpp index d87841b233..aca4fb0f2c 100644 --- a/queen/resource.cpp +++ b/queen/resource.cpp @@ -115,12 +115,13 @@ uint32 QueenResource::fileOffset(const char *filename) { return _gameVersion->resourceTable[resourceIndex(filename)].offset; } -uint8 *QueenResource::loadJAS() { - uint32 size = fileSize("QUEEN.JAS"); - uint8 *jas = (uint8 *)malloc(size); - _resourceFile->seek(fileOffset("QUEEN.JAS") + 20, SEEK_SET); - _resourceFile->read(jas, size - 20); - return jas; +uint8 *QueenResource::loadFile(const char *filename) { + uint32 size = fileSize(filename); + byte *mem = new byte[size]; + //skip 20 byte header + _resourceFile->seek(fileOffset(filename) + 20, SEEK_SET); + _resourceFile->read(mem, size - 20); + return mem; } const char *QueenResource::JASVersion() { |