diff options
author | Ladislav Zezula <zezula@volny.cz> | 2020-11-23 12:56:00 +0100 |
---|---|---|
committer | Ladislav Zezula <zezula@volny.cz> | 2020-11-23 12:56:00 +0100 |
commit | b6102b2600f792f159320439686a872a72d20c70 (patch) | |
tree | a9cfacadc0c28b3cfde908d2a4511b6605a648a0 /src/SFileAddFile.cpp | |
parent | 809005c7f025bcc55bfa4ede78cb4cc45d3c0e6c (diff) |
Removed trailing whitespace
Diffstat (limited to 'src/SFileAddFile.cpp')
-rw-r--r-- | src/SFileAddFile.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/SFileAddFile.cpp b/src/SFileAddFile.cpp index e756781..31f052a 100644 --- a/src/SFileAddFile.cpp +++ b/src/SFileAddFile.cpp @@ -36,8 +36,8 @@ typedef struct _WAVE_FILE_HEADER DWORD dwChunkId; // 0x52494646 ("RIFF")
DWORD dwChunkSize; // Size of that chunk, in bytes
DWORD dwFormat; // Must be 0x57415645 ("WAVE")
-
- // Format sub-chunk
+
+ // Format sub-chunk
DWORD dwSubChunk1Id; // 0x666d7420 ("fmt ")
DWORD dwSubChunk1Size; // 0x16 for PCM
USHORT wAudioFormat; // 1 = PCM. Other value means some sort of compression
@@ -150,11 +150,11 @@ static int WriteDataToMpqFile( DWORD dwSectorIndex = hf->dwFilePos / hf->dwSectorSize;
DWORD dwBytesToCopy;
- // Process all data.
+ // Process all data.
while(dwDataSize != 0)
{
dwBytesToCopy = dwDataSize;
-
+
// Check for sector overflow
if(dwBytesToCopy > (hf->dwSectorSize - dwBytesInSector))
dwBytesToCopy = (hf->dwSectorSize - dwBytesInSector);
@@ -214,7 +214,7 @@ static int WriteDataToMpqFile( // by the first sector compression. This is because the entire sector must
// be compressed by the same compression.
//
- // Test case:
+ // Test case:
//
// WRITE_FILE(hFile, pvBuffer, 0x10, MPQ_COMPRESSION_PKWARE) // Write 0x10 bytes (sector 0)
// WRITE_FILE(hFile, pvBuffer, 0x10, MPQ_COMPRESSION_ADPCM_MONO) // Write 0x10 bytes (still sector 0)
@@ -370,7 +370,7 @@ static int RecryptFileData( }
// If necessary, re-encrypt the sector
- // Note: Recompression is not necessary here. Unlike encryption,
+ // Note: Recompression is not necessary here. Unlike encryption,
// the compression does not depend on the position of the file in MPQ.
BSWAP_ARRAY32_UNSIGNED(hf->pbFileSector, dwRawDataInSector);
DecryptMpqBlock(hf->pbFileSector, dwRawDataInSector, dwOldKey + dwSector);
@@ -422,7 +422,7 @@ int SFileAddFile_Init( // Sector CRC is not allowed if the file is not compressed
if(!(dwFlags & MPQ_FILE_COMPRESS_MASK))
dwFlags &= ~MPQ_FILE_SECTOR_CRC;
-
+
// Fix Key is not allowed if the file is not enrypted
if(!(dwFlags & MPQ_FILE_ENCRYPTED))
dwFlags &= ~MPQ_FILE_FIX_KEY;
@@ -456,7 +456,7 @@ int SFileAddFile_Init( if(pFileEntry != NULL)
InvalidateInternalFiles(ha);
else
- nError = ERROR_DISK_FULL;
+ nError = ERROR_DISK_FULL;
}
// Set the file entry to the file structure
@@ -621,7 +621,7 @@ int SFileAddFile_Write(TMPQFile * hf, const void * pvData, DWORD dwSize, DWORD d {
if(!FileStream_Write(ha->pStream, &RawFilePos, hf->pPatchInfo, hf->pPatchInfo->dwLength))
nError = GetLastError();
-
+
pFileEntry->dwCmpSize += hf->pPatchInfo->dwLength;
RawFilePos += hf->pPatchInfo->dwLength;
}
@@ -754,7 +754,7 @@ int SFileAddFile_Finish(TMPQFile * hf) }
//-----------------------------------------------------------------------------
-// Adds data as file to the archive
+// Adds data as file to the archive
bool WINAPI SFileCreateFile(
HANDLE hMpq,
@@ -775,7 +775,7 @@ bool WINAPI SFileCreateFile( nError = ERROR_INVALID_PARAMETER;
if(phFile == NULL)
nError = ERROR_INVALID_PARAMETER;
-
+
// Don't allow to add file if the MPQ is open for read only
if(nError == ERROR_SUCCESS)
{
@@ -841,7 +841,7 @@ bool WINAPI SFileWriteFile( //
// if(dwFlags & MPQ_FILE_ENCRYPTED)
// nError = ERROR_INVALID_PARAMETER;
-
+
// Lossy compression is not allowed on single unit files
if(dwCompression & MPQ_LOSSY_COMPRESSION_MASK)
nError = ERROR_INVALID_PARAMETER;
@@ -851,7 +851,7 @@ bool WINAPI SFileWriteFile( // Write the data to the file
if(nError == ERROR_SUCCESS)
nError = SFileAddFile_Write(hf, pvData, dwSize, dwCompression);
-
+
// Deal with errors
if(nError != ERROR_SUCCESS)
SetLastError(nError);
@@ -872,7 +872,7 @@ bool WINAPI SFileFinishFile(HANDLE hFile) // Finish the file
if(nError == ERROR_SUCCESS)
nError = SFileAddFile_Finish(hf);
-
+
// Deal with errors
if(nError != ERROR_SUCCESS)
SetLastError(nError);
@@ -880,7 +880,7 @@ bool WINAPI SFileFinishFile(HANDLE hFile) }
//-----------------------------------------------------------------------------
-// Adds a file to the archive
+// Adds a file to the archive
bool WINAPI SFileAddFileEx(
HANDLE hMpq,
@@ -937,7 +937,7 @@ bool WINAPI SFileAddFileEx( // we will copy the compression for the first sector
if(dwCompressionNext == MPQ_COMPRESSION_NEXT_SAME)
dwCompressionNext = dwCompression;
-
+
// If the caller wants ADPCM compression, we make sure
// that the first sector is not compressed with lossy compression
if(dwCompressionNext & (MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO))
@@ -946,7 +946,7 @@ bool WINAPI SFileAddFileEx( // in order not to corrupt the headers
if(dwCompression & (MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO))
dwCompression = MPQ_COMPRESSION_PKWARE;
-
+
// Remove both flag mono and stereo flags.
// They will be re-added according to WAVE type
dwCompressionNext &= ~(MPQ_COMPRESSION_ADPCM_MONO | MPQ_COMPRESSION_ADPCM_STEREO);
@@ -1020,7 +1020,7 @@ bool WINAPI SFileAddFileEx( SetLastError(nError);
return (nError == ERROR_SUCCESS);
}
-
+
// Adds a data file into the archive
bool WINAPI SFileAddFile(HANDLE hMpq, const TCHAR * szFileName, const char * szArchivedName, DWORD dwFlags)
{
@@ -1047,7 +1047,7 @@ bool WINAPI SFileAddWave(HANDLE hMpq, const TCHAR * szFileName, const char * szA // Starcraft files are packed as Mono (0x41) on medium quality.
// Because this compression is not used anymore, our compression functions
// will default to WaveCompressionLevel = 4 when using ADPCM compression
- //
+ //
// Convert quality to data compression
switch(dwQuality)
@@ -1190,7 +1190,7 @@ bool WINAPI SFileRenameFile(HANDLE hMpq, const char * szFileName, const char * s {
// Recrypt the file data in the MPQ
nError = RecryptFileData(ha, hf, szFileName, szNewFileName);
-
+
// Update the MD5 of the raw block
if(nError == ERROR_SUCCESS && ha->pHeader->dwRawChunkSize != 0)
{
|