summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2Archive.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-07-01 23:04:04 +0100
committerAsh Wolf <ninji@wuffs.org>2023-07-01 23:04:04 +0100
commitc2efba6907fab934a04959b9bb644cf7141cc955 (patch)
treec047244f99870e44a7a5d7e733c2857434c03765 /src/T2DLL/T2Archive.cpp
parent1eb8da84d77d0c865623421069ec38bfc7b0d461 (diff)
downloadt2win-c2efba6907fab934a04959b9bb644cf7141cc955.tar.gz
t2win-c2efba6907fab934a04959b9bb644cf7141cc955.zip
matched T2DLL as well as i can
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2Archive.cpp40
1 files changed, 20 insertions, 20 deletions
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;
}