summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Src/ChunkFile.cpp
diff options
context:
space:
mode:
authorXTra.KrazzY <XTra.KrazzY@gmail.com>2008-08-28 09:19:46 +0000
committerXTra.KrazzY <XTra.KrazzY@gmail.com>2008-08-28 09:19:46 +0000
commitf8b4311b665ce88f4d56d0cb13392bfa13e5cc56 (patch)
treea11465b76b584024a40c5ade47eee29f6bf7baac /Source/Core/Common/Src/ChunkFile.cpp
parent531230c03d2c849d1128ad40b932e6de6c2a49a1 (diff)
Final typo and error fixes and include reordering
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@372 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common/Src/ChunkFile.cpp')
-rw-r--r--Source/Core/Common/Src/ChunkFile.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/Core/Common/Src/ChunkFile.cpp b/Source/Core/Common/Src/ChunkFile.cpp
index be2dad6788..52e854d696 100644
--- a/Source/Core/Common/Src/ChunkFile.cpp
+++ b/Source/Core/Common/Src/ChunkFile.cpp
@@ -36,8 +36,8 @@ ChunkFile::ChunkFile(const char *filename, ChunkFileMode _mode)
}
fseek(f, 0, SEEK_END);
- size = ftell(f);
- eof = size;
+ fsize = ftell(f);
+ eof = fsize;
stack_ptr = 0;
}
@@ -87,7 +87,7 @@ bool ChunkFile::Do(void *ptr, int size)
}
// Do variable size array (probably heap-allocated)
-bool DoArray(void *ptr, int size, int arrSize) {
+bool ChunkFile::DoArray(void *ptr, int size, int arrSize) {
int sz;
if(ptr == NULL)
@@ -102,18 +102,19 @@ bool DoArray(void *ptr, int size, int arrSize) {
if (sz != arrSize)
return false;
- for(int i = 0; i < arrSize; i++) {
- fread(ptr[i], size, 1, f);
- fseek(f, ((size + 3) & ~3) - size, SEEK_CUR);
- }
+ fread(ptr, arrSize * size, 1, f);
+ fseek(f, (((arrSize * size) + 3) & ~3) - (arrSize * size),
+ SEEK_CUR);
+
break;
case MODE_WRITE:
WriteInt(size);
WriteInt(arrSize);
- for(int i = 0; i < arrSize; i++) {
- fwrite(ptr[i], size, 1, f);
- fseek(f, ((size + 3) & ~3) - size, SEEK_CUR);
- }
+
+ fwrite(ptr, arrSize * size, 1, f);
+ fseek(f, (((arrSize * size) + 3) & ~3) - (arrSize * size),
+ SEEK_CUR);
+
break;
case MODE_VERIFY:
sz = ReadInt();