From c2efba6907fab934a04959b9bb644cf7141cc955 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 23:04:04 +0100 Subject: matched T2DLL as well as i can --- src/T2DLL/T2Archive.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'src/T2DLL/T2Archive.cpp') diff --git a/src/T2DLL/T2Archive.cpp b/src/T2DLL/T2Archive.cpp index 8aac959..2431a27 100644 --- a/src/T2DLL/T2Archive.cpp +++ b/src/T2DLL/T2Archive.cpp @@ -238,22 +238,22 @@ BOOL T2Archive::operator<<(RECT v) { } BOOL T2Archive::operator>>(CString& v) { - int maxSize = 16; + int maxLen = 16; char buf[17]; v = ""; - int sz = Read(buf, maxSize); - while (strlen(buf) == sz) { - buf[sz] = 0; + int amountRead = Read(buf, maxLen); + while (strlen(buf) == amountRead) { + buf[amountRead] = 0; v += buf; - if (sz < maxSize) + if (amountRead < maxLen) return false; - sz = Read(buf, maxSize); + amountRead = Read(buf, maxLen); } int len = strlen(buf); - mFile->Seek(len - sz + 1, CFile::current); + mFile->Seek(len - amountRead + 1, CFile::current); v += buf; return true; @@ -267,22 +267,22 @@ BOOL T2Archive::operator<<(CString& v) { } BOOL T2Archive::operator>>(char* v) { - int maxSize = 16; + int maxLen = 16; char buf[17]; v = ""; // BUG!! - int sz = Read(buf, maxSize); - while (strlen(buf) == sz) { - buf[sz] = 0; + int amountRead = Read(buf, maxLen); + while (strlen(buf) == amountRead) { + buf[amountRead] = 0; strcat(v, buf); - if (sz < maxSize) + if (amountRead < maxLen) return false; - sz = Read(buf, maxSize); + amountRead = Read(buf, maxLen); } int len = strlen(buf); - mFile->Seek(len - sz + 1, CFile::current); + mFile->Seek(len - amountRead + 1, CFile::current); strcat(v, buf); return true; @@ -329,20 +329,20 @@ BOOL T2Archive::WritePStr(const char* v) { } /*virtual*/ BOOL T2Archive::Skip(unsigned long v) { - int size; + int bufSize; BOOL result = true; if (v > 1000) - size = 1000; + bufSize = 1000; else - size = v; + bufSize = v; - void *buf = malloc(size); + void *buf = malloc(bufSize); while (v > 0) { - int howMuch = Read(buf, size); + int howMuch = Read(buf, bufSize); v -= howMuch; - if (howMuch < size && v > 0) { + if (howMuch < bufSize && v > 0) { result = false; break; } -- cgit v1.2.3