From 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 02:43:29 +0100 Subject: i am in hell --- src/T2DLL/LArray.cpp | 145 +++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 75 deletions(-) (limited to 'src/T2DLL/LArray.cpp') diff --git a/src/T2DLL/LArray.cpp b/src/T2DLL/LArray.cpp index da569e0..53c44ce 100644 --- a/src/T2DLL/LArray.cpp +++ b/src/T2DLL/LArray.cpp @@ -4,8 +4,7 @@ // unknown/assumed name -- not in T2DLL exports! class LDefaultComparator : public LComparator { public: - LDefaultComparator(); - virtual ~LDefaultComparator(); + virtual ~LDefaultComparator() {} virtual int Compare(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; virtual BOOL IsEqualTo(const void* inItemOne, const void* inItemTwo, unsigned int inSizeOne, unsigned int inSizeTwo) const; static LDefaultComparator* GetComparator(); @@ -188,65 +187,67 @@ void LArray::SetComparator(LComparator* comparator) { } /*virtual*/ void LArray::ReadAsWord(T2Archive& archive) { + unsigned char flagValue; int itemSize; - int count; - int i; - unsigned char zero; - int totalSize; - unsigned short item; + int itemCount; + int handleSize; + int n; archive >> itemSize; - archive >> count; - archive >> i; - archive >> i; - archive >> zero; - archive >> zero; - archive >> totalSize; + archive >> itemCount; + archive >> n; + archive >> n; + archive >> flagValue; + archive >> flagValue; + archive >> handleSize; if (mItemCount > 0) RemoveItemsAt(mItemCount, 1); - for (i = 0; i < count; i++) { - archive >> item; - unsigned int v = item; + unsigned short theItem; + unsigned int v; + for (n = 0; n < itemCount; n++) { + archive >> theItem; + v = theItem; Add(&v); } - for (; i < totalSize / itemSize; i++) { - archive >> item; + for (; n < handleSize / itemSize; n++) { + archive >> theItem; } } /*virtual*/ void LArray::WriteAsWord(T2Archive& archive) { - int boop = 2; - archive << boop; + int renameThisVarPleaseM = 2; + archive << renameThisVarPleaseM; - boop = mItemCount; - archive << boop; + renameThisVarPleaseM = mItemCount; + archive << renameThisVarPleaseM; - int byteCount = boop * 2; - archive << byteCount; - archive << byteCount; + int dataStored = renameThisVarPleaseM * 2; + archive << dataStored; + archive << dataStored; - unsigned char zero = 0; - archive << zero; + unsigned char flagValue = 0; + archive << flagValue; - zero = 0; - archive << zero; + flagValue = 0; + archive << flagValue; - int totalSize = mItemCount * 2; - archive << totalSize; + int handleSize = mItemCount * 2; + archive << handleSize; LArrayIterator iter(*this); - unsigned int item; - while (iter.Next(&item)) { - unsigned short v = item; - archive << v; + unsigned int v; + unsigned short item; + while (iter.Next(&v)) { + item = v; + archive << item; } } /*virtual*/ void LArray::ReadAsDWord(T2Archive& archive) { - unsigned long code; + DWORD code; archive >> code; #line 261 _ASSERT(code == 'Darr'); @@ -254,11 +255,11 @@ void LArray::SetComparator(LComparator* comparator) { if (mItemCount > 0) RemoveItemsAt(mItemCount, 1); - int count; - archive >> count; + int itemCount; + archive >> itemCount; unsigned int item; - for (int i = 0; i < count; i++) { + for (int i = 0; i < itemCount; i++) { archive >> item; Add(&item); } @@ -268,31 +269,31 @@ void LArray::SetComparator(LComparator* comparator) { if (mItemCount > 0) RemoveItemsAt(mItemCount, 1); + unsigned char v; int i; - int elemSize; - int elemCount; - int byteCount; - int byteCount2; - int totalSize; - unsigned char buf; - - archive >> elemSize; - archive >> elemCount; - archive >> byteCount; - archive >> byteCount2; - archive >> totalSize; - - for (i = 0; i < elemCount; i++) { - archive >> buf; - Add(&buf); + int itemSize; + int itemCount; + int dataStored; + int dataAllocated; + int handleSize; + + archive >> itemSize; + archive >> itemCount; + archive >> dataStored; + archive >> dataAllocated; + archive >> handleSize; + + for (i = 0; i < itemCount; i++) { + archive >> v; + Add(&v); } - for (; i < totalSize; i++) { - archive >> buf; + for (; i < handleSize; i++) { + archive >> v; } } /*virtual*/ void LArray::WriteAsDWord(T2Archive& archive) { - unsigned long code = 'Darr'; + DWORD code = 'Darr'; archive << code; archive << mItemCount; @@ -304,21 +305,21 @@ void LArray::SetComparator(LComparator* comparator) { } /*virtual*/ void LArray::WriteAsChar(T2Archive& archive) { - int elemSize = 1; - int byteCount = mItemCount; - int byteCount2 = byteCount; - int totalSize = byteCount; + unsigned char v; + int itemSize = 1; + int handleSize = mItemCount; + int dataAllocated = handleSize; + int dataStored = dataAllocated; - archive << elemSize; + archive << itemSize; archive << mItemCount; - archive << byteCount; - archive << byteCount2; - archive << totalSize; + archive << dataStored; + archive << dataAllocated; + archive << handleSize; LArrayIterator iter(*this); - unsigned char item; - while (iter.Next(&item)) { - archive << item; + while (iter.Next(&v)) { + archive << v; } } @@ -398,9 +399,3 @@ LDefaultComparator* LDefaultComparator::GetComparator() { sDefaultComparator = new LDefaultComparator; return sDefaultComparator; } - -LDefaultComparator::LDefaultComparator() { -} - -/*virtual*/ LDefaultComparator::~LDefaultComparator() { -} -- cgit v1.2.3