From 71f68914fa2e7c0b661fcf11a09362b7f9564eb9 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Fri, 9 May 2008 07:52:58 +0000 Subject: Fix the prediction warnings in DxeMain. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5190 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Event/event.c | 6 +++--- MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 2 +- MdeModulePkg/Core/Dxe/Gcd/gcd.c | 18 +++++++++--------- MdeModulePkg/Core/Dxe/Image/Image.c | 8 ++++---- MdeModulePkg/Core/Dxe/Image/ImageFile.c | 2 +- MdeModulePkg/Core/Dxe/Mem/Page.c | 10 +++++----- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Dxe/Event/event.c b/MdeModulePkg/Core/Dxe/Event/event.c index f5ffbb7..834ace5 100644 --- a/MdeModulePkg/Core/Dxe/Event/event.c +++ b/MdeModulePkg/Core/Dxe/Event/event.c @@ -358,7 +358,7 @@ CoreCreateEventEx ( // // If it's a notify type of event, check its parameters // - if ((Type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL))) { + if ((Type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL)) != 0) { // // Check for an invalid NotifyFunction or NotifyTpl // @@ -381,7 +381,7 @@ CoreCreateEventEx ( // Allcoate and initialize a new event structure. // Status = CoreAllocatePool ( - (Type & EVT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData, + ((Type & EVT_RUNTIME) != 0) ? EfiRuntimeServicesData: EfiBootServicesData, sizeof (IEVENT), (VOID **)&IEvent ); @@ -404,7 +404,7 @@ CoreCreateEventEx ( *Event = IEvent; - if (Type & EVT_RUNTIME) { + if ((Type & EVT_RUNTIME) != 0) { // // Keep a list of all RT events so we can tell the RT AP. // diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c index bdf8773..ed81cd4 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c @@ -272,7 +272,7 @@ FvCheck ( // // Scan to check the free space & File list // - if (FvbAttributes & EFI_FVB2_ERASE_POLARITY) { + if ((FvbAttributes & EFI_FVB2_ERASE_POLARITY) != 0) { FvDevice->ErasePolarity = 1; } else { FvDevice->ErasePolarity = 0; diff --git a/MdeModulePkg/Core/Dxe/Gcd/gcd.c b/MdeModulePkg/Core/Dxe/Gcd/gcd.c index b6a0f1b..bff13b3 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/gcd.c @@ -586,11 +586,11 @@ CoreConvertSpace ( } Map = NULL; - if (Operation & GCD_MEMORY_SPACE_OPERATION) { + if ((Operation & GCD_MEMORY_SPACE_OPERATION) != 0) { CoreAcquireGcdMemoryLock (); Map = &mGcdMemorySpaceMap; } - if (Operation & GCD_IO_SPACE_OPERATION) { + if ((Operation & GCD_IO_SPACE_OPERATION) != 0) { CoreAcquireGcdIoLock (); Map = &mGcdIoSpaceMap; } @@ -666,7 +666,7 @@ CoreConvertSpace ( // Set attribute operations // case GCD_SET_ATTRIBUTES_MEMORY_OPERATION: - if (Attributes & EFI_MEMORY_RUNTIME) { + if ((Attributes & EFI_MEMORY_RUNTIME) != 0) { if ((BaseAddress & EFI_PAGE_MASK) != 0 || (Length & EFI_PAGE_MASK) != 0) { Status = EFI_INVALID_PARAMETER; @@ -775,10 +775,10 @@ CoreConvertSpace ( Status = CoreCleanupGcdMapEntry (TopEntry, BottomEntry, StartLink, EndLink, Map); Done: - if (Operation & GCD_MEMORY_SPACE_OPERATION) { + if ((Operation & GCD_MEMORY_SPACE_OPERATION) != 0) { CoreReleaseGcdMemoryLock (); } - if (Operation & GCD_IO_SPACE_OPERATION) { + if ((Operation & GCD_IO_SPACE_OPERATION) != 0) { CoreReleaseGcdIoLock (); } @@ -902,11 +902,11 @@ CoreAllocateSpace ( } Map = NULL; - if (Operation & GCD_MEMORY_SPACE_OPERATION) { + if ((Operation & GCD_MEMORY_SPACE_OPERATION) != 0) { CoreAcquireGcdMemoryLock (); Map = &mGcdMemorySpaceMap; } - if (Operation & GCD_IO_SPACE_OPERATION) { + if ((Operation & GCD_IO_SPACE_OPERATION) != 0) { CoreAcquireGcdIoLock (); Map = &mGcdIoSpaceMap; } @@ -1073,10 +1073,10 @@ CoreAllocateSpace ( Status = CoreCleanupGcdMapEntry (TopEntry, BottomEntry, StartLink, EndLink, Map); Done: - if (Operation & GCD_MEMORY_SPACE_OPERATION) { + if ((Operation & GCD_MEMORY_SPACE_OPERATION) != 0) { CoreReleaseGcdMemoryLock (); } - if (Operation & GCD_IO_SPACE_OPERATION) { + if ((Operation & GCD_IO_SPACE_OPERATION) !=0) { CoreReleaseGcdIoLock (); } diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 7c66f07..0770399 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -332,7 +332,7 @@ CoreLoadPeImage ( // is used to relocate the image when SetVirtualAddressMap() is called. The // relocation is done by the Runtime AP. // - if (Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) { + if ((Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) != 0) { if (Image->ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) { Image->ImageContext.FixupData = CoreAllocateRuntimePool ((UINTN)(Image->ImageContext.FixupDataSize)); if (Image->ImageContext.FixupData == NULL) { @@ -432,7 +432,7 @@ CoreLoadPeImage ( Image->Info.ImageSize = Image->ImageContext.ImageSize; Image->Info.ImageCodeType = (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType); Image->Info.ImageDataType = (EFI_MEMORY_TYPE) (Image->ImageContext.ImageDataMemoryType); - if (Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) { + if ((Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION) != 0) { if (Image->ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) { // // Make a list off all the RT images so we can let the RT AP know about them. @@ -754,7 +754,7 @@ CoreLoadImageCommon ( // // Register the image in the Debug Image Info Table if the attribute is set // - if (Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION) { + if ((Attribute & EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION) != 0) { CoreNewDebugImageInfoEntry (EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL, &Image->Info, Image->Handle); } @@ -1014,7 +1014,7 @@ CoreStartImage ( // The initial call to SetJump() must always return 0. // Subsequent calls to LongJump() cause a non-zero value to be returned by SetJump(). // - if (!SetJumpFlag) { + if (SetJumpFlag == 0) { // // Call the image's entry point // diff --git a/MdeModulePkg/Core/Dxe/Image/ImageFile.c b/MdeModulePkg/Core/Dxe/Image/ImageFile.c index 7cb2576..d3f28e2 100644 --- a/MdeModulePkg/Core/Dxe/Image/ImageFile.c +++ b/MdeModulePkg/Core/Dxe/Image/ImageFile.c @@ -467,7 +467,7 @@ CoreGrowBuffer ( // // If there's an error, free the buffer // - if ((!TryAgain) && (EFI_ERROR (*Status)) && (*Buffer)) { + if ((!TryAgain) && (EFI_ERROR (*Status)) && (*Buffer != NULL)) { CoreFreePool (*Buffer); *Buffer = NULL; } diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index 9ec8314..190715e 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -557,7 +557,7 @@ CoreFreeMemoryMapStack ( // // If already freeing the map stack, then return // - if (mFreeMapStack) { + if (mFreeMapStack != 0) { return ; } @@ -566,7 +566,7 @@ CoreFreeMemoryMapStack ( // mFreeMapStack += 1; - while (mMapDepth) { + while (mMapDepth != 0) { // // Deque an memory map entry from mFreeMemoryMapEntryList // @@ -730,7 +730,7 @@ CoreConvertPages ( ASSERT (End > Start) ; ASSERT_LOCKED (&gMemoryLock); - if (NumberOfPages == 0 || (Start & EFI_PAGE_MASK ) || (Start > (Start + NumberOfBytes))) { + if (NumberOfPages == 0 || ((Start & EFI_PAGE_MASK) != 0) || (Start > (Start + NumberOfBytes))) { return EFI_INVALID_PARAMETER; } @@ -1042,9 +1042,9 @@ FindFreePages ( } Start = CoreFindFreePagesI (NewMaxAddress, NoPages, NewType, Alignment); - if (!Start) { + if (Start == 0) { Start = CoreFindFreePagesI (MaxAddress, NoPages, NewType, Alignment); - if (!Start) { + if (Start == 0) { // // Here means there may be no enough memory to use, so try to go through // all the memory descript to promote the untested memory directly -- cgit v1.1