From 31a8ef2e7fd276e8b78f61bbc7bd013abd2e784a Mon Sep 17 00:00:00 2001 From: Joost Peters Date: Tue, 28 Oct 2003 13:27:37 +0000 Subject: cleanup svn-id: r10989 --- queen/resource.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'queen') diff --git a/queen/resource.cpp b/queen/resource.cpp index ed3ef1071d..8c29c35456 100644 --- a/queen/resource.cpp +++ b/queen/resource.cpp @@ -142,23 +142,17 @@ uint32 Resource::fileOffset(const char *filename) { } uint8 *Resource::loadFile(const char *filename, uint32 skipBytes, byte *dstBuf) { - uint32 size = fileSize(filename); + uint32 size = fileSize(filename) - skipBytes; if (dstBuf == NULL) dstBuf = new byte[size]; // skip 'skipBytes' bytes (useful for headers) _resourceFile->seek(fileOffset(filename) + skipBytes, SEEK_SET); - _resourceFile->read(dstBuf, size - skipBytes); + _resourceFile->read(dstBuf, size); return dstBuf; } uint8 *Resource::loadFileMalloc(const char *filename, uint32 skipBytes, byte *dstBuf) { - uint32 size = fileSize(filename); - if (dstBuf == NULL) - dstBuf = (byte *)malloc(size); - // skip 'skipBytes' bytes (useful for headers) - _resourceFile->seek(fileOffset(filename) + skipBytes, SEEK_SET); - _resourceFile->read(dstBuf, size - skipBytes); - return dstBuf; + return loadFile(filename, skipBytes, (byte *)malloc(fileSize(filename) - skipBytes)); } bool Resource::exists(const char *filename) { -- cgit v1.2.3