aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLadislav Zezula <zezula@volny.cz>2023-11-13 10:36:02 +0100
committerGitHub <noreply@github.com>2023-11-13 10:36:02 +0100
commitaaa011852dcbbf92cc2475720291198d6f5597ca (patch)
tree8c4932ebb113cda8001381c00c36a9f91276dc2b
parentbf6a10b5e54c541ba5b17562ab139e58eac6393c (diff)
parent5d938c500a6c37b97c80d7cb3f7435114090e291 (diff)
Merge pull request #309 from ladislav-zezula/LZ_TabsToSpaces
Tabs -> Spaces
-rw-r--r--src/SBaseCommon.cpp58
-rw-r--r--src/SBaseFileTable.cpp14
-rw-r--r--src/SCompression.cpp40
-rw-r--r--src/SFileVerify.cpp2
-rw-r--r--src/StormPort.h2
5 files changed, 58 insertions, 58 deletions
diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp
index de6c58f..4fc473a 100644
--- a/src/SBaseCommon.cpp
+++ b/src/SBaseCommon.cpp
@@ -1896,10 +1896,10 @@ void ConvertUInt16Buffer(void * ptr, size_t length)
uint32_t nElements = (uint32_t)(length / sizeof(uint16_t));
while(nElements-- > 0)
- {
- *buffer = SwapUInt16(*buffer);
- buffer++;
- }
+ {
+ *buffer = SwapUInt16(*buffer);
+ buffer++;
+ }
}
// Swaps array of unsigned 32-bit integers
@@ -1908,11 +1908,11 @@ void ConvertUInt32Buffer(void * ptr, size_t length)
uint32_t * buffer = (uint32_t *)ptr;
uint32_t nElements = (uint32_t)(length / sizeof(uint32_t));
- while(nElements-- > 0)
- {
- *buffer = SwapUInt32(*buffer);
- buffer++;
- }
+ while(nElements-- > 0)
+ {
+ *buffer = SwapUInt32(*buffer);
+ buffer++;
+ }
}
// Swaps array of unsigned 64-bit integers
@@ -1921,37 +1921,37 @@ void ConvertUInt64Buffer(void * ptr, size_t length)
uint64_t * buffer = (uint64_t *)ptr;
uint32_t nElements = (uint32_t)(length / sizeof(uint64_t));
- while(nElements-- > 0)
- {
- *buffer = SwapUInt64(*buffer);
- buffer++;
- }
+ while(nElements-- > 0)
+ {
+ *buffer = SwapUInt64(*buffer);
+ buffer++;
+ }
}
// Swaps the TMPQHeader structure
void ConvertTMPQHeader(void *header, uint16_t version)
{
- TMPQHeader * theHeader = (TMPQHeader *)header;
+ TMPQHeader * theHeader = (TMPQHeader *)header;
// Swap header part version 1
if(version >= MPQ_FORMAT_VERSION_1)
{
- theHeader->dwID = SwapUInt32(theHeader->dwID);
- theHeader->dwHeaderSize = SwapUInt32(theHeader->dwHeaderSize);
- theHeader->dwArchiveSize = SwapUInt32(theHeader->dwArchiveSize);
- theHeader->wFormatVersion = SwapUInt16(theHeader->wFormatVersion);
- theHeader->wSectorSize = SwapUInt16(theHeader->wSectorSize);
- theHeader->dwHashTablePos = SwapUInt32(theHeader->dwHashTablePos);
- theHeader->dwBlockTablePos = SwapUInt32(theHeader->dwBlockTablePos);
- theHeader->dwHashTableSize = SwapUInt32(theHeader->dwHashTableSize);
- theHeader->dwBlockTableSize = SwapUInt32(theHeader->dwBlockTableSize);
+ theHeader->dwID = SwapUInt32(theHeader->dwID);
+ theHeader->dwHeaderSize = SwapUInt32(theHeader->dwHeaderSize);
+ theHeader->dwArchiveSize = SwapUInt32(theHeader->dwArchiveSize);
+ theHeader->wFormatVersion = SwapUInt16(theHeader->wFormatVersion);
+ theHeader->wSectorSize = SwapUInt16(theHeader->wSectorSize);
+ theHeader->dwHashTablePos = SwapUInt32(theHeader->dwHashTablePos);
+ theHeader->dwBlockTablePos = SwapUInt32(theHeader->dwBlockTablePos);
+ theHeader->dwHashTableSize = SwapUInt32(theHeader->dwHashTableSize);
+ theHeader->dwBlockTableSize = SwapUInt32(theHeader->dwBlockTableSize);
}
- if(version >= MPQ_FORMAT_VERSION_2)
- {
- theHeader->HiBlockTablePos64 = SwapUInt64(theHeader->HiBlockTablePos64);
+ if(version >= MPQ_FORMAT_VERSION_2)
+ {
+ theHeader->HiBlockTablePos64 = SwapUInt64(theHeader->HiBlockTablePos64);
theHeader->wHashTablePosHi = SwapUInt16(theHeader->wHashTablePosHi);
- theHeader->wBlockTablePosHi = SwapUInt16(theHeader->wBlockTablePosHi);
+ theHeader->wBlockTablePosHi = SwapUInt16(theHeader->wBlockTablePosHi);
}
if(version >= MPQ_FORMAT_VERSION_3)
@@ -1962,7 +1962,7 @@ void ConvertTMPQHeader(void *header, uint16_t version)
}
if(version >= MPQ_FORMAT_VERSION_4)
- {
+ {
theHeader->HashTableSize64 = SwapUInt64(theHeader->HashTableSize64);
theHeader->BlockTableSize64 = SwapUInt64(theHeader->BlockTableSize64);
theHeader->HiBlockTableSize64 = SwapUInt64(theHeader->HiBlockTableSize64);
diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp
index befe40f..a53d6a6 100644
--- a/src/SBaseFileTable.cpp
+++ b/src/SBaseFileTable.cpp
@@ -2800,17 +2800,17 @@ DWORD DefragmentFileTable(TMPQArchive * ha)
{
TMPQHash * pHashTableEnd = ha->pHashTable + ha->pHeader->dwHashTableSize;
TMPQHash * pHash;
- DWORD dwNewBlockIndex;
+ DWORD dwNewBlockIndex;
for(pHash = ha->pHashTable; pHash < pHashTableEnd; pHash++)
{
if(MPQ_BLOCK_INDEX(pHash) < ha->dwFileTableSize)
- {
- // If that block entry is there, set it to the hash entry
- // If not, set it as DELETED
- dwNewBlockIndex = DefragmentTable[MPQ_BLOCK_INDEX(pHash)];
- pHash->dwBlockIndex = (dwNewBlockIndex != HASH_ENTRY_FREE) ? dwNewBlockIndex : HASH_ENTRY_DELETED;
- }
+ {
+ // If that block entry is there, set it to the hash entry
+ // If not, set it as DELETED
+ dwNewBlockIndex = DefragmentTable[MPQ_BLOCK_INDEX(pHash)];
+ pHash->dwBlockIndex = (dwNewBlockIndex != HASH_ENTRY_FREE) ? dwNewBlockIndex : HASH_ENTRY_DELETED;
+ }
}
}
}
diff --git a/src/SCompression.cpp b/src/SCompression.cpp
index d6d2e27..086c623 100644
--- a/src/SCompression.cpp
+++ b/src/SCompression.cpp
@@ -176,7 +176,7 @@ int Decompress_ZLIB(void * pvOutBuffer, int * pcbOutBuffer, void * pvInBuffer, i
inflateEnd(&z);
}
- return (nResult >= Z_OK);
+ return (nResult >= Z_OK);
}
/******************************************************************************/
@@ -279,27 +279,27 @@ static void Compress_PKLIB(void * pvOutBuffer, int * pcbOutBuffer, void * pvInBu
static int Decompress_PKLIB(void * pvOutBuffer, int * pcbOutBuffer, void * pvInBuffer, int cbInBuffer)
{
TDataInfo Info; // Data information
- char * work_buf;
- int nResult = 0;
+ char * work_buf;
+ int nResult = 0;
// Allocate Pklib's work buffer
if((work_buf = STORM_ALLOC(char, EXP_BUFFER_SIZE)) != NULL)
- {
- // Fill data information structure
- memset(work_buf, 0, EXP_BUFFER_SIZE);
- Info.pbInBuff = (unsigned char *)pvInBuffer;
- Info.pbInBuffEnd = (unsigned char *)pvInBuffer + cbInBuffer;
- Info.pbOutBuff = (unsigned char *)pvOutBuffer;
- Info.pbOutBuffEnd = (unsigned char *)pvOutBuffer + *pcbOutBuffer;
-
- // Do the decompression
- if(explode(ReadInputData, WriteOutputData, work_buf, &Info) == CMP_NO_ERROR)
- nResult = 1;
-
- // Give away the number of decompressed bytes
- *pcbOutBuffer = (int)(Info.pbOutBuff - (unsigned char *)pvOutBuffer);
- STORM_FREE(work_buf);
- }
+ {
+ // Fill data information structure
+ memset(work_buf, 0, EXP_BUFFER_SIZE);
+ Info.pbInBuff = (unsigned char *)pvInBuffer;
+ Info.pbInBuffEnd = (unsigned char *)pvInBuffer + cbInBuffer;
+ Info.pbOutBuff = (unsigned char *)pvOutBuffer;
+ Info.pbOutBuffEnd = (unsigned char *)pvOutBuffer + *pcbOutBuffer;
+
+ // Do the decompression
+ if(explode(ReadInputData, WriteOutputData, work_buf, &Info) == CMP_NO_ERROR)
+ nResult = 1;
+
+ // Give away the number of decompressed bytes
+ *pcbOutBuffer = (int)(Info.pbOutBuff - (unsigned char *)pvOutBuffer);
+ STORM_FREE(work_buf);
+ }
return nResult;
}
@@ -374,7 +374,7 @@ static int Decompress_BZIP2(void * pvOutBuffer, int * pcbOutBuffer, void * pvInB
BZ2_bzDecompressEnd(&strm);
}
- return (nResult >= BZ_OK);
+ return (nResult >= BZ_OK);
}
/******************************************************************************/
diff --git a/src/SFileVerify.cpp b/src/SFileVerify.cpp
index 3748918..9bbbb6b 100644
--- a/src/SFileVerify.cpp
+++ b/src/SFileVerify.cpp
@@ -863,7 +863,7 @@ DWORD SSignFileFinish(TMPQArchive * ha)
// Sign the hash
memset(WeakSignature, 0, sizeof(WeakSignature));
rsa_sign_hash_ex(Md5Digest, sizeof(Md5Digest), WeakSignature + 8, &signature_len, LTC_LTC_PKCS_1_V1_5, 0, 0, hash_idx, 0, &key);
- memrev(WeakSignature + 8, MPQ_WEAK_SIGNATURE_SIZE);
+ memrev(WeakSignature + 8, MPQ_WEAK_SIGNATURE_SIZE);
rsa_free(&key);
// Write the signature to the MPQ. Don't use SFile* functions, but write the hash directly
diff --git a/src/StormPort.h b/src/StormPort.h
index aa2c9f5..48a5e1f 100644
--- a/src/StormPort.h
+++ b/src/StormPort.h
@@ -20,7 +20,7 @@
/* 12.11.03 1.02 Dan Macintosh compatibility */
/* 24.07.04 1.03 Sam Mac OS X compatibility */
/* 22.11.06 1.04 Sam Mac OS X compatibility (for StormLib 6.0) */
-/* 31.12.06 1.05 XPinguin Full GNU/Linux compatibility */
+/* 31.12.06 1.05 XPinguin Full GNU/Linux compatibility */
/* 17.10.12 1.05 Lad Moved error codes so they don't overlap with errno.h */
/*****************************************************************************/