aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avg.com>2013-12-12 11:15:16 +0100
committerLadislav Zezula <ladislav.zezula@avg.com>2013-12-12 11:15:16 +0100
commit6961cd51b65e8df7f807e25ab6ffc4da8c205449 (patch)
tree48bcfa6c0bb51171b3cb25330abb0e5caf051ff9 /src
parent5106d34fdaaf6378abf0fa8bb0b30d54a487e398 (diff)
+ Fixed warnings
+ Added SBaseDumpData to the makefiles
Diffstat (limited to 'src')
-rw-r--r--src/FileStream.cpp2
-rw-r--r--src/SBaseFileTable.cpp8
-rw-r--r--src/SBaseSubTypes.cpp1
-rw-r--r--src/SFileGetFileInfo.cpp3
-rw-r--r--src/SFileReadFile.cpp6
5 files changed, 9 insertions, 11 deletions
diff --git a/src/FileStream.cpp b/src/FileStream.cpp
index 03a8fea..a081bd7 100644
--- a/src/FileStream.cpp
+++ b/src/FileStream.cpp
@@ -713,7 +713,7 @@ static const TCHAR * BaseHttp_ExtractServerName(const TCHAR * szFileName, TCHAR
else
{
while(szFileName[0] != 0 && szFileName[0] != _T('/'))
- *szFileName++;
+ szFileName++;
}
// Return the remainder
diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp
index bf6be59..d4155bd 100644
--- a/src/SBaseFileTable.cpp
+++ b/src/SBaseFileTable.cpp
@@ -229,12 +229,10 @@ void SetBits(
//-----------------------------------------------------------------------------
// Support for MPQ header
-static DWORD GetMaxFileOffset32(TMPQArchive * ha, TMPQBlock * pBlockTable, DWORD dwBlockTableSize)
+static DWORD GetMaxFileOffset32(TMPQArchive * ha)
{
TMPQHeader * pHeader = ha->pHeader;
DWORD dwMaxFileOffset = ha->pHeader->dwArchiveSize;
- DWORD dwByteOffset;
- DWORD dwBlockIndex;
// We can call this only for malformed archives v 1.0
assert(ha->pHeader->wFormatVersion == MPQ_FORMAT_VERSION_1);
@@ -2230,7 +2228,7 @@ static void FixCompressedFileSize(
if(SortTable != NULL)
{
// Calculate the end of the archive
- dwMaxFileOffs = GetMaxFileOffset32(ha, pBlockTable, pHeader->dwBlockTableSize);
+ dwMaxFileOffs = GetMaxFileOffset32(ha);
// Put all blocks to a sort table
for(pBlock = pBlockTable; pBlock < pBlockTableEnd; pBlock++)
@@ -2751,7 +2749,7 @@ int RebuildFileTable(TMPQArchive * ha, DWORD dwNewHashTableSize, DWORD dwNewMaxF
}
// Move the file entry by one
- *pFileEntry++;
+ pFileEntry++;
}
}
diff --git a/src/SBaseSubTypes.cpp b/src/SBaseSubTypes.cpp
index 0aae9f5..288495f 100644
--- a/src/SBaseSubTypes.cpp
+++ b/src/SBaseSubTypes.cpp
@@ -158,7 +158,6 @@ int ConvertSqpHeaderToFormat4(
void * LoadSqpTable(TMPQArchive * ha, DWORD dwByteOffset, DWORD cbTableSize, DWORD dwKey)
{
- TMPQHeader * pHeader = ha->pHeader;
ULONGLONG ByteOffset;
LPBYTE pbSqpTable;
diff --git a/src/SFileGetFileInfo.cpp b/src/SFileGetFileInfo.cpp
index a8083dc..07b7722 100644
--- a/src/SFileGetFileInfo.cpp
+++ b/src/SFileGetFileInfo.cpp
@@ -891,6 +891,9 @@ bool WINAPI SFileFreeFileInfo(void * pvFileInfo, SFileInfoClass InfoClass)
case SFileMpqBetTable:
FreeBetTable((TMPQBetTable *)pvFileInfo);
return true;
+
+ default:
+ break;
}
SetLastError(ERROR_INVALID_PARAMETER);
diff --git a/src/SFileReadFile.cpp b/src/SFileReadFile.cpp
index cfc8d2a..ff4783c 100644
--- a/src/SFileReadFile.cpp
+++ b/src/SFileReadFile.cpp
@@ -827,10 +827,8 @@ DWORD WINAPI SFileSetFilePointer(HANDLE hFile, LONG lFilePos, LONG * plFilePosHi
MoveOffset = MAKE_OFFSET64(dwFilePosHi, lFilePos);
// Now calculate the new file pointer
- // Do not allow the file pointer to go before the begin of the file
- FilePosition += MoveOffset;
- if(FilePosition < 0)
- FilePosition = 0;
+ // Do not allow the file pointer to overflow
+ FilePosition = ((FilePosition + MoveOffset) > FilePosition) ? (FilePosition + MoveOffset) : 0;
// Now apply the file pointer to the file
if(hf->pStream != NULL)