mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
cleaned up code: various stuff (out-of-bounds, null-pointer, uninitialized vars,...) (by CleaningWoman)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6101 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -403,7 +403,7 @@ UINT32 LoadIndex;
|
||||
void UnloadFont(UINT32 FontIndex)
|
||||
{
|
||||
Assert(FontIndex >= 0);
|
||||
Assert(FontIndex <= MAX_FONTS);
|
||||
Assert(FontIndex < MAX_FONTS);
|
||||
Assert(FontObjs[FontIndex]!=NULL);
|
||||
|
||||
DeleteVideoObject(FontObjs[FontIndex]);
|
||||
|
||||
@@ -405,7 +405,7 @@ void MemFreeLocked( PTR ptr, UINT32 uiSize )
|
||||
if (ptr != NULL)
|
||||
{
|
||||
VirtualUnlock( ptr, uiSize );
|
||||
VirtualFree( ptr, uiSize, MEM_RELEASE );
|
||||
VirtualFree( ptr, 0, MEM_RELEASE );
|
||||
|
||||
guiMemTotal -= uiSize;
|
||||
guiMemFreed += uiSize;
|
||||
|
||||
@@ -473,6 +473,9 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
|
||||
BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
|
||||
{
|
||||
EnterCriticalSection(&gcsInputQueueLock);
|
||||
|
||||
BOOLEAN result = FALSE;
|
||||
|
||||
__try
|
||||
{
|
||||
// Is there an event to dequeue
|
||||
@@ -483,16 +486,16 @@ BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags )
|
||||
// Check if it has the masks!
|
||||
if ( ( Event->usEvent & uiMaskFlags ) )
|
||||
{
|
||||
return( DequeueEvent( Event) );
|
||||
result = DequeueEvent( Event);
|
||||
}
|
||||
}
|
||||
|
||||
return( FALSE );
|
||||
}
|
||||
__finally
|
||||
{
|
||||
LeaveCriticalSection(&gcsInputQueueLock);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOLEAN InternalDequeueEvent(InputAtom *Event)
|
||||
@@ -529,15 +532,18 @@ BOOLEAN InternalDequeueEvent(InputAtom *Event)
|
||||
|
||||
BOOLEAN DequeueEvent(InputAtom *Event)
|
||||
{
|
||||
BOOLEAN result = FALSE;
|
||||
__try
|
||||
{
|
||||
EnterCriticalSection(&gcsInputQueueLock);
|
||||
return InternalDequeueEvent(Event);
|
||||
result = InternalDequeueEvent(Event);
|
||||
}
|
||||
__finally
|
||||
{
|
||||
LeaveCriticalSection(&gcsInputQueueLock);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1871,7 +1871,7 @@ static void PopulateSectionFromCommandLine(vfs::PropertyContainer &oProps, vfs::
|
||||
wchar_t *psep = wcspbrk(arg, L":=");
|
||||
wchar_t *param = (psep ? psep+1 : NULL);
|
||||
if (psep) *psep = 0;
|
||||
if ( (param == NULL || param[0] == 0) && ( i+1<argc && ( argv[i+1][0] != L'-' || argv[i+1][0] != L'/' ) ) ) {
|
||||
if ( (param == NULL || param[0] == 0) && ( i+1<argc && ( argv[i+1][0] != L'-' && argv[i+1][0] != L'/' ) ) ) {
|
||||
param = argv[++i];
|
||||
argv[i] = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user