Merge pull request #309 from ladislav-zezula/LZ_TabsToSpaces

Tabs -> Spaces
This commit is contained in:
Ladislav Zezula
2023-11-13 10:36:02 +01:00
committed by GitHub
5 changed files with 58 additions and 58 deletions

View File

@@ -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);

View File

@@ -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;
}
}
}
}

View File

@@ -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);
}
/******************************************************************************/

View File

@@ -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

View File

@@ -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 */
/*****************************************************************************/