From 3d78c020d22023d35d27b48817d73ff31a361ac7 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Tue, 28 Aug 2012 06:48:28 +0000 Subject: Fix comparisons of enumerated types which may cause warnings for some compilers. Signed-off-by: Sun Rui Reviewed-by: Gao Liming git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13686 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Mem/Page.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/Mem/Page.c') diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c index b4a62b9f0c..6d5a259eb6 100644 --- a/MdeModulePkg/Core/Dxe/Mem/Page.c +++ b/MdeModulePkg/Core/Dxe/Mem/Page.c @@ -557,7 +557,7 @@ CoreAddMemoryDescriptor ( // Make sure the memory type in the gMemoryTypeInformation[] array is valid // Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type); - if (Type < 0 || Type > EfiMaxMemoryType) { + if ((UINT32)Type > EfiMaxMemoryType) { continue; } if (gMemoryTypeInformation[Index].NumberOfPages != 0) { @@ -581,7 +581,7 @@ CoreAddMemoryDescriptor ( // Make sure the memory type in the gMemoryTypeInformation[] array is valid // Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[FreeIndex].Type); - if (Type < 0 || Type > EfiMaxMemoryType) { + if ((UINT32)Type > EfiMaxMemoryType) { continue; } @@ -624,7 +624,7 @@ CoreAddMemoryDescriptor ( // Make sure the memory type in the gMemoryTypeInformation[] array is valid // Type = (EFI_MEMORY_TYPE) (gMemoryTypeInformation[Index].Type); - if (Type < 0 || Type > EfiMaxMemoryType) { + if ((UINT32)Type > EfiMaxMemoryType) { continue; } if (gMemoryTypeInformation[Index].NumberOfPages != 0) { @@ -747,7 +747,7 @@ CoreConvertPages ( // // Update counters for the number of pages allocated to each memory type // - if (Entry->Type >= 0 && Entry->Type < EfiMaxMemoryType) { + if ((UINT32)Entry->Type < EfiMaxMemoryType) { if ((Start >= mMemoryTypeStatistics[Entry->Type].BaseAddress && Start <= mMemoryTypeStatistics[Entry->Type].MaximumAddress) || (Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) { if (NumberOfPages > mMemoryTypeStatistics[Entry->Type].CurrentNumberOfPages) { @@ -758,7 +758,7 @@ CoreConvertPages ( } } - if (NewType >= 0 && NewType < EfiMaxMemoryType) { + if ((UINT32)NewType < EfiMaxMemoryType) { if ((Start >= mMemoryTypeStatistics[NewType].BaseAddress && Start <= mMemoryTypeStatistics[NewType].MaximumAddress) || (Start >= mDefaultBaseAddress && Start <= mDefaultMaximumAddress) ) { mMemoryTypeStatistics[NewType].CurrentNumberOfPages += NumberOfPages; @@ -1011,7 +1011,7 @@ FindFreePages ( // // Attempt to find free pages in the preferred bin based on the requested memory type // - if (NewType >= 0 && NewType < EfiMaxMemoryType && MaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) { + if ((UINT32)NewType < EfiMaxMemoryType && MaxAddress >= mMemoryTypeStatistics[NewType].MaximumAddress) { Start = CoreFindFreePagesI ( mMemoryTypeStatistics[NewType].MaximumAddress, mMemoryTypeStatistics[NewType].BaseAddress, @@ -1094,7 +1094,7 @@ CoreAllocatePages ( UINT64 MaxAddress; UINTN Alignment; - if (Type < AllocateAnyPages || Type >= (UINTN) MaxAllocateType) { + if ((UINT32)Type >= MaxAllocateType) { return EFI_INVALID_PARAMETER; } -- cgit v1.2.3