Fix comparisons of enumerated types which may cause warnings for some compilers.
Signed-off-by: Sun Rui <rui.sun@intel.com> Reviewed-by: Gao Liming <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13686 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -261,7 +261,7 @@ CoreSetTimer (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Type < 0 || Type > TimerRelative || (Event->Type & EVT_TIMER) == 0) {
|
||||
if ((UINT32)Type > TimerRelative || (Event->Type & EVT_TIMER) == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
The GCD services are used to manage the memory and I/O regions that
|
||||
are accessible to the CPU that is executing the DXE core.
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -1012,15 +1012,15 @@ CoreAllocateSpace (
|
||||
//
|
||||
// Make sure parameters are valid
|
||||
//
|
||||
if (GcdAllocateType < 0 || GcdAllocateType >= EfiGcdMaxAllocateType) {
|
||||
if ((UINT32)GcdAllocateType >= EfiGcdMaxAllocateType) {
|
||||
DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (GcdMemoryType < 0 || GcdMemoryType >= EfiGcdMemoryTypeMaximum) {
|
||||
if ((UINT32)GcdMemoryType >= EfiGcdMemoryTypeMaximum) {
|
||||
DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (GcdIoType < 0 || GcdIoType >= EfiGcdIoTypeMaximum) {
|
||||
if ((UINT32)GcdIoType >= EfiGcdIoTypeMaximum) {
|
||||
DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -120,7 +120,7 @@ LookupPoolHead (
|
||||
POOL *Pool;
|
||||
UINTN Index;
|
||||
|
||||
if (MemoryType >= 0 && MemoryType < EfiMaxMemoryType) {
|
||||
if ((UINT32)MemoryType < EfiMaxMemoryType) {
|
||||
return &mPoolHead[MemoryType];
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ CoreFreePoolI (
|
||||
// portion of that memory type has been freed. If it has, then free the
|
||||
// list entry for that memory type
|
||||
//
|
||||
if (Pool->MemoryType < 0 && Pool->Used == 0) {
|
||||
if ((INT32)Pool->MemoryType < 0 && Pool->Used == 0) {
|
||||
RemoveEntryList (&Pool->Link);
|
||||
CoreFreePoolI (Pool);
|
||||
}
|
||||
|
Reference in New Issue
Block a user