Fixes coverity issues:
CID 1254550
CID 1254603
CID 1254604
CID 1264604
CID 1254544
This commit is contained in:
Shauren
2017-01-20 22:49:44 +01:00
parent 41fc011d4e
commit 5d1f213dad
4 changed files with 20 additions and 6 deletions

View File

@@ -134,6 +134,7 @@ static bool BaseFile_Open(TFileStream * pStream, const TCHAR * szFileName, DWORD
if(fstat64(handle, &fileinfo) == -1)
{
SetLastError(errno);
close(handle);
return false;
}
@@ -192,7 +193,11 @@ static bool BaseFile_Read(
// we have to update the file position
if(ByteOffset != pStream->Base.File.FilePos)
{
lseek64((intptr_t)pStream->Base.File.hFile, (off64_t)(ByteOffset), SEEK_SET);
if(lseek64((intptr_t)pStream->Base.File.hFile, (off64_t)(ByteOffset), SEEK_SET) == (off64_t)-1)
{
SetLastError(errno);
return false;
}
pStream->Base.File.FilePos = ByteOffset;
}
@@ -263,7 +268,11 @@ static bool BaseFile_Write(TFileStream * pStream, ULONGLONG * pByteOffset, const
// we have to update the file position
if(ByteOffset != pStream->Base.File.FilePos)
{
lseek64((intptr_t)pStream->Base.File.hFile, (off64_t)(ByteOffset), SEEK_SET);
if(lseek64((intptr_t)pStream->Base.File.hFile, (off64_t)(ByteOffset), SEEK_SET) == (off64_t)-1)
{
SetLastError(errno);
return false;
}
pStream->Base.File.FilePos = ByteOffset;
}

View File

@@ -324,8 +324,11 @@ PLISTFILE_MAP ListFile_CreateMap(const TCHAR * szListFile)
break;
}
// Finish the listfile map
pListMap = ListMap_Finish(pListMap);
if(pListMap == NULL)
{
// Finish the listfile map
pListMap = ListMap_Finish(pListMap);
}
// Free the listfile
ListFile_Free(pvListFile);

View File

@@ -130,9 +130,11 @@ size_t Map_EnumObjects(PCASC_MAP pMap, void **ppvArray)
ppvArray[nIndex++] = pMap->HashTable[i];
}
}
return pMap->ItemCount;
}
return pMap->ItemCount;
return 0;
}
void * Map_FindObject(PCASC_MAP pMap, void * pvKey, PDWORD PtrIndex)

View File

@@ -58,7 +58,7 @@ recastnavigation (Recast is state of the art navigation mesh construction toolse
CascLib (An open-source implementation of library for reading CASC storage from Blizzard games since 2014)
https://github.com/ladislav-zezula/CascLib
Version: 8f606d1ae0e01338f80e108b8d1b41912d4a3d2f
Version: a03e2a397d62451ed8576b883fe32ed04add7701
rapidjson (A fast JSON parser/generator for C++ with both SAX/DOM style API http://rapidjson.org/)
https://github.com/miloyip/rapidjson